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()); + } + + ?> + + + + + <?php echo $this->defaultTitle . $this->separator . $this->title; ?> + + + + + + + +
+ + + +
+ + + +Panacea + * + * @package Panacea + * @subpackage Views + * @author Tommy Montgomery + * @since 2008-10-16 + * + * @property-read string $root The relative root + * @property-read string $mediaPath The path to the media directory + * @property-read string $cssPath The path to the CSS directory + * @property-read string $jsPath The path to the JavaScript directory + * @property-read string $imagesPath The path to the images directory + * @property-read string $audioPath The path to the audio directory + * @property-read string $videoPath The path to the video directory + */ + class PanaceaView extends View { + + /** + * Configuration data for Panacea + * + * @var array + * @ignore + */ + private $config; + + /** + * Creates a new {@link PanaceaView} + * + * @author Tommy Montgomery + * @since 2008-10-16 + * @todo The config values should be loaded from a config file + * + * @param int $priority The priority of the view + */ + public function __construct($priority = 0) { + parent::__construct($priority); + + $this->config = array( + 'root' => '/panacea/src', + 'mediaPath' => '/panacea/src/media', + 'cssPath' => '/panacea/src/media/css', + 'jsPath' => '/panacea/src/media/js', + 'imagesPath' => '/panacea/src/media/images', + 'audioPath' => '/panacea/src/media/audio', + 'videoPath' => '/panacea/src/media/video'); + } + + /** + * Allows read access to certain class properties + * + * @author Tommy Montgomery + * @since 2008-10-16 + * + * @param string $var The property to get + * @return mixed + * @ignore + */ + public function __get($var) { + if (isset($this->config[$var])) { + return $this->config[$var]; + } + + return parent::__get($var); + } + + } + +?> \ No newline at end of file diff --git a/src/media/css/global.css b/src/media/css/global.css index 7131538..f2d9a63 100644 --- a/src/media/css/global.css +++ b/src/media/css/global.css @@ -2,14 +2,18 @@ html { overflow: auto; } body { - background-color: #999999; + background-color: #363636; font-family: Verdana, Arial, sans-serif; font-size: 8pt; - color: #000000; + color: #FFFFFF; } #wrapper { - + width: 95%; + margin: auto; + background-color: #EEEEEE; + color: #000000; + border: 2px solid #000000; } #head { @@ -33,14 +37,27 @@ body { } #menu ul li { float: left; + position: relative; } #menu ul li a { display: block; - width: 10em; - height: 2em; - font-size: 1.5em; + 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; } \ No newline at end of file diff --git a/src/repo.php b/src/repo.php new file mode 100644 index 0000000..e69de29 diff --git a/src/reviewer.php b/src/reviewer.php new file mode 100644 index 0000000..e69de29 diff --git a/src/tracker.php b/src/tracker.php new file mode 100644 index 0000000..e69de29 diff --git a/src/wiki.php b/src/wiki.php new file mode 100644 index 0000000..e69de29