diff --git a/src/.htaccess b/src/.htaccess index 8168030..70b18f0 100644 --- a/src/.htaccess +++ b/src/.htaccess @@ -1,5 +1,10 @@ RewriteEngine On -RewriteCond %{REQUEST_URI} !.*index\.php$ -RewriteCond %{REQUEST_URI} !.*/media/.* -RewriteRule .* /panacea/src/index.php [L] \ No newline at end of file +RewriteRule ^wiki$ /panacea/src/wiki.php [L] +RewriteRule ^tracker$ /panacea/src/tracker.php [L] +RewriteRule ^ci$ /panacea/src/ci.php [L] +RewriteRule ^repo$ /panacea/src/repo.php [L] + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_URI} !.*/media/.* +RewriteRule .* /panacea/src/index.php [L] \ No newline at end of file diff --git a/src/bootstrap.php b/src/bootstrap.php index bff6a5f..428704d 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -29,6 +29,7 @@ $file = "$path/lib/$className.php"; break; + case 'PanaceaView': case 'PanaceaPageView': case 'PanaceaTemplateView': case 'PanaceaHeaderView': diff --git a/src/ci.php b/src/ci.php new file mode 100644 index 0000000..e69de29 diff --git a/src/lib/views/PanaceaHeaderView.php b/src/lib/views/PanaceaHeaderView.php index 4b020fd..6f88f6d 100644 --- a/src/lib/views/PanaceaHeaderView.php +++ b/src/lib/views/PanaceaHeaderView.php @@ -20,7 +20,7 @@ * @author Tommy Montgomery * @since 2008-10-16 */ - class PanaceaHeaderView extends View { + class PanaceaHeaderView extends PanaceaView { /** * Creates a view for the header diff --git a/src/lib/views/PanaceaLogoView.php b/src/lib/views/PanaceaLogoView.php index 1b7f8a2..0793791 100644 --- a/src/lib/views/PanaceaLogoView.php +++ b/src/lib/views/PanaceaLogoView.php @@ -20,7 +20,7 @@ * @author Tommy Montgomery * @since 2008-10-16 */ - class PanaceaLogoView extends View { + class PanaceaLogoView extends PanaceaView { /** * Renders the view diff --git a/src/lib/views/PanaceaMenuView.php b/src/lib/views/PanaceaMenuView.php index 1de0fc6..9de358c 100644 --- a/src/lib/views/PanaceaMenuView.php +++ b/src/lib/views/PanaceaMenuView.php @@ -20,7 +20,7 @@ * @author Tommy Montgomery * @since 2008-10-16 */ - class PanaceaMenuView extends View { + class PanaceaMenuView extends PanaceaView { /** * Renders the view @@ -32,11 +32,13 @@
diff --git a/src/lib/views/PanaceaPageView.php b/src/lib/views/PanaceaPageView.php index dd59960..3607683 100644 --- a/src/lib/views/PanaceaPageView.php +++ b/src/lib/views/PanaceaPageView.php @@ -20,7 +20,7 @@ * @author Tommy Montgomery * @since 2008-10-05 */ - class PanaceaPageView extends View { + class PanaceaPageView extends PanaceaView { /** * Renders the view diff --git a/src/lib/views/PanaceaTemplateView.php b/src/lib/views/PanaceaTemplateView.php index c98a4b0..3a7d1d4 100644 --- a/src/lib/views/PanaceaTemplateView.php +++ b/src/lib/views/PanaceaTemplateView.php @@ -20,7 +20,24 @@ * @author Tommy Montgomery * @since 2008-10-14 */ - class PanaceaTemplateView extends TemplateView { + class PanaceaTemplateView extends PanaceaView { + + /**#@+ @var string */ + /** + * The title of the web page + */ + protected $title; + + /** + * The default title of the web page + */ + protected $defaultTitle; + + /** + * The title separator + */ + protected $separator; + /**#@-*/ /** * Creates a new {@link TemplateView} @@ -35,50 +52,127 @@ throw new InvalidTypeException(1, 'string', $title); } - parent::__construct(); + parent::__construct(0); $this->defaultTitle = 'Panacea'; $this->title = (!empty($title)) ? $title : 'It doesn\'t suck'; + $this->separator = ' - '; $this->addView(new PanaceaHeaderView(1)); } /** - * Gets all meta data associated with this view + * The meta data for this view * * @author Tommy Montgomery - * @since 2008-10-14 - * @todo Get rid of the hardcoded CSS path + * @since 2008-07-03 + * @uses ViewMetaData::generate() + * @uses ViewMetaData::addMeta() * * @return ViewMetaData */ public function getMetaData() { - return parent::getMetaData()->addCss('/panacea/src/media/css/global.css'); + //latest revision time + $revised = 0; + foreach (get_included_files() as $file) { + if (($mtime = filemtime($file)) > $revised) { + $revised = $mtime; + } + } + + return ViewMetaData::generate()->addMeta('revised', date('c', $revised)) + ->addCss($this->cssPath . '/global.css'); } /** - * Gets the next default priority + * Allows read access to certain class properties * * @author Tommy Montgomery - * @since 2008-10-16 + * @since 2008-07-03 + * + * @param string $var The property to get + * @throws {@link UnknownPropertyException} if the property is invalid or inaccessible + * @return mixed + * @ignore */ - public function getNextPriority() { - $priority = 1; - foreach ($this->views as $view) { - $priority = max($priority, $view->priority); + public function __get($var) { + switch ($var) { + case 'title': + case 'defaultTitle': + case 'separator': + return $this->$var; + default: + return parent::__get($var); + } + } + + /** + * Allows write access to certain class properties + * + * @author Tommy Montgomery + * @since 2008-07-03 + * + * @param string $var The property to set + * @param string $val The value to set the property to + * @throws {@link InvalidTypeException} if the datatypes don't match + * @throws {@link UnknownPropertyException} if the property is invalid or inaccessible + * @ignore + */ + public function __set($var, $val) { + switch ($var) { + case 'title': + case 'defaultTitle': + case 'separator': + if (!is_string($val)) { + throw new InvalidTypeException(2, 'string', $val); + } + $this->$var = $val; + break; + default: + parent::__set($var, $val); } - - return $priority + 1; } /** * Renders the view * * @author Tommy Montgomery - * @since 2008-10-14 + * @since 2008-07-03 + * @uses getMetaData() + * @uses ViewMetaData::merge() + * @uses View::send() */ public function send() { - parent::send(); + $metadata = $this->getMetaData(); + foreach ($this->views as $view) { + $metadata->merge($view->getMetaData()); + } + + ?> + + + + +