From 14cfcb9610fa9804cfe98c31c5b4828c2a60326e Mon Sep 17 00:00:00 2001 From: tmont Date: Sat, 18 Oct 2008 09:02:23 +0000 Subject: [PATCH] slight controller/view/architecture refactor (incomplete) --- src/bootstrap.php | 2 +- src/ci.php | 0 src/index.php | 2 +- src/lib/PanaceaControllerFactory.php | 15 +++++++- src/lib/PanaceaViewFactory.php | 20 +++++++++- src/lib/views/PanaceaMenuView.php | 14 +++---- src/media/css/global.css | 55 +++++++++++++++++----------- src/repo.php | 0 src/reviewer.php | 0 src/tracker.php | 0 src/wiki.php | 0 11 files changed, 74 insertions(+), 34 deletions(-) delete mode 100644 src/ci.php delete mode 100644 src/repo.php delete mode 100644 src/reviewer.php delete mode 100644 src/tracker.php delete mode 100644 src/wiki.php diff --git a/src/bootstrap.php b/src/bootstrap.php index 428704d..e957fd5 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -30,7 +30,7 @@ break; case 'PanaceaView': - case 'PanaceaPageView': + case 'PanaceaHomeView': case 'PanaceaTemplateView': case 'PanaceaHeaderView': case 'PanaceaLogoView': diff --git a/src/ci.php b/src/ci.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/index.php b/src/index.php index 3a825f5..5cf5445 100644 --- a/src/index.php +++ b/src/index.php @@ -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) diff --git a/src/lib/PanaceaControllerFactory.php b/src/lib/PanaceaControllerFactory.php index 608ac2f..0b31175 100644 --- a/src/lib/PanaceaControllerFactory.php +++ b/src/lib/PanaceaControllerFactory.php @@ -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]); diff --git a/src/lib/PanaceaViewFactory.php b/src/lib/PanaceaViewFactory.php index 6fba135..5edb04a 100644 --- a/src/lib/PanaceaViewFactory.php +++ b/src/lib/PanaceaViewFactory.php @@ -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); diff --git a/src/lib/views/PanaceaMenuView.php b/src/lib/views/PanaceaMenuView.php index 9de358c..848833b 100644 --- a/src/lib/views/PanaceaMenuView.php +++ b/src/lib/views/PanaceaMenuView.php @@ -32,13 +32,13 @@ diff --git a/src/media/css/global.css b/src/media/css/global.css index f2d9a63..c55f988 100644 --- a/src/media/css/global.css +++ b/src/media/css/global.css @@ -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; } \ No newline at end of file diff --git a/src/repo.php b/src/repo.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/reviewer.php b/src/reviewer.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/tracker.php b/src/tracker.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/wiki.php b/src/wiki.php deleted file mode 100644 index e69de29..0000000