slight controller/view/architecture refactor (incomplete)
This commit is contained in:
parent
4631ff1374
commit
14cfcb9610
@ -30,7 +30,7 @@
|
||||
break;
|
||||
|
||||
case 'PanaceaView':
|
||||
case 'PanaceaPageView':
|
||||
case 'PanaceaHomeView':
|
||||
case 'PanaceaTemplateView':
|
||||
case 'PanaceaHeaderView':
|
||||
case 'PanaceaLogoView':
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
$uriRegex = str_replace(str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT']), '', dirname(__FILE__));
|
||||
$uriRegex = str_replace('\\', '/', $uriRegex);
|
||||
$uriRegex = '^' . $uriRegex . '/(.*)';
|
||||
$uriRegex = '^' . $uriRegex . '/([^/]*)(?:/(.+))?';
|
||||
|
||||
Dispatcher::getInstance()->setUriRegex($uriRegex)
|
||||
->setThrowExceptions(true)
|
||||
|
@ -47,6 +47,9 @@
|
||||
* Parses the URI fragments and determines which
|
||||
* {@link Controller} to instantiate
|
||||
*
|
||||
* {@internal $section will be wiki, repo, tracker, etc.
|
||||
* $page will be empty or the name of the page}}
|
||||
*
|
||||
* @author Tommy Montgomery
|
||||
* @since 2008-10-05
|
||||
*
|
||||
@ -55,8 +58,16 @@
|
||||
* @return PanaceaPageController
|
||||
*/
|
||||
public function getController(array $uriFragments) {
|
||||
if (count($uriFragments) !== 1) {
|
||||
throw new InvalidTypeException(1, 'array of size 1', $uriFragments);
|
||||
if (count($uriFragments) < 2) {
|
||||
throw new InvalidTypeException(1, 'array with at least two elements', $uriFragments);
|
||||
}
|
||||
|
||||
$section = '';
|
||||
$page = $uriFragments[0];
|
||||
|
||||
if (isset($uriFragments[1])) {
|
||||
$section = $uriFragments[0];
|
||||
$page = $uriFragments[1];
|
||||
}
|
||||
|
||||
return new PanaceaPageController($uriFragments[0]);
|
||||
|
@ -20,8 +20,21 @@
|
||||
*/
|
||||
class PanaceaViewFactory extends ViewFactory {
|
||||
|
||||
/**
|
||||
* The singleton instance
|
||||
*
|
||||
* @var PanaceaViewFactory
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Gets the singleton instance
|
||||
*
|
||||
* @author Tommy Montgomery
|
||||
* @since 2008-10-17
|
||||
*
|
||||
* @return PanaceaViewFactory
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if (static::$instance === null) {
|
||||
static::$instance = new static();
|
||||
@ -48,8 +61,11 @@
|
||||
throw new InvalidTypeException(1, 'string', $page);
|
||||
}
|
||||
|
||||
//parse out special pages here
|
||||
$viewName = 'PanaceaPageView';
|
||||
if (empty($page)) {
|
||||
$page = 'home';
|
||||
}
|
||||
|
||||
$viewName = 'Panacea' . ucfirst($page) . 'View';
|
||||
|
||||
try {
|
||||
$refclass = new ReflectionClass($viewName);
|
||||
|
@ -32,13 +32,13 @@
|
||||
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li><a href="<?php echo $this->root; ?>/">Home</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/repo">SVN Repo</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/ci">Continuous Integration</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/wiki">Wiki</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/tracker">Tracker</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/reviewer">Code Review</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/manager">Project Management</a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/"><b>Home</b></a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/repo/"><b>SVN Repo</b></a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/ci/"><b>CI</b></a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/wiki/"><b>Wiki</b></a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/tracker/"><b>Tracker</b></a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/reviewer/"><b>Reviews</b></a></li>
|
||||
<li><a href="<?php echo $this->root; ?>/manager/"><b>Projects</b></a></li>
|
||||
</ul>
|
||||
<div style="clear:left"></div>
|
||||
</div>
|
||||
|
@ -29,6 +29,7 @@ body {
|
||||
#menu {
|
||||
border-top: 2px solid #000000;
|
||||
border-bottom: 2px solid #000000;
|
||||
background-color: #DDDD77;
|
||||
}
|
||||
#menu ul {
|
||||
list-style-type: none;
|
||||
@ -36,28 +37,40 @@ body {
|
||||
padding: 0;
|
||||
}
|
||||
#menu ul li {
|
||||
float: left;
|
||||
position: relative;
|
||||
float:left;
|
||||
display:block;
|
||||
margin-right:5px;
|
||||
width:100px;
|
||||
height:25px;
|
||||
}
|
||||
#menu ul li a {
|
||||
display: block;
|
||||
color: #000000;
|
||||
height: 1.5em;
|
||||
line-height: 1.5em;
|
||||
padding: .5em;
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
margin-right: 1px;
|
||||
text-decoration: none;
|
||||
background-color: #CCCCCC;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
#menu ul li a:hover {
|
||||
display: inline;
|
||||
background-color: #009999;
|
||||
color: #FFFFFF;
|
||||
border: 1px solid #000000;
|
||||
border-top-width: 2px;
|
||||
padding-bottom: 14px;
|
||||
line-height: 1.9em;
|
||||
float: left;
|
||||
width: 100px;
|
||||
height: 25px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
#menu ul li a b {
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 25px;
|
||||
line-height: 24px;
|
||||
color: #000000;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
#menu ul li a:hover b {
|
||||
width: 110px;
|
||||
height: 37px;
|
||||
top: -6px;
|
||||
left: -5px;
|
||||
z-index: 2;
|
||||
background-color: #999966;
|
||||
font-size: 1.3em;
|
||||
color: #FFFFFF;
|
||||
line-height: 35px;
|
||||
border: 1px solid #FFFFFF;
|
||||
}
|
Loading…
Reference in New Issue
Block a user