made things a little prettier, modified the view structure
This commit is contained in:
parent
27ceeca9a8
commit
4631ff1374
@ -1,5 +1,10 @@
|
|||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !.*index\.php$
|
RewriteRule ^wiki$ /panacea/src/wiki.php [L]
|
||||||
RewriteCond %{REQUEST_URI} !.*/media/.*
|
RewriteRule ^tracker$ /panacea/src/tracker.php [L]
|
||||||
RewriteRule .* /panacea/src/index.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]
|
@ -29,6 +29,7 @@
|
|||||||
$file = "$path/lib/$className.php";
|
$file = "$path/lib/$className.php";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'PanaceaView':
|
||||||
case 'PanaceaPageView':
|
case 'PanaceaPageView':
|
||||||
case 'PanaceaTemplateView':
|
case 'PanaceaTemplateView':
|
||||||
case 'PanaceaHeaderView':
|
case 'PanaceaHeaderView':
|
||||||
|
0
src/ci.php
Normal file
0
src/ci.php
Normal file
@ -20,7 +20,7 @@
|
|||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-16
|
* @since 2008-10-16
|
||||||
*/
|
*/
|
||||||
class PanaceaHeaderView extends View {
|
class PanaceaHeaderView extends PanaceaView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a view for the header
|
* Creates a view for the header
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-16
|
* @since 2008-10-16
|
||||||
*/
|
*/
|
||||||
class PanaceaLogoView extends View {
|
class PanaceaLogoView extends PanaceaView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the view
|
* Renders the view
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-16
|
* @since 2008-10-16
|
||||||
*/
|
*/
|
||||||
class PanaceaMenuView extends View {
|
class PanaceaMenuView extends PanaceaView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the view
|
* Renders the view
|
||||||
@ -32,11 +32,13 @@
|
|||||||
|
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#">Item #1</a></li>
|
<li><a href="<?php echo $this->root; ?>/">Home</a></li>
|
||||||
<li><a href="#">Item #2</a></li>
|
<li><a href="<?php echo $this->root; ?>/repo">SVN Repo</a></li>
|
||||||
<li><a href="#">Item #3</a></li>
|
<li><a href="<?php echo $this->root; ?>/ci">Continuous Integration</a></li>
|
||||||
<li><a href="#">Item #4</a></li>
|
<li><a href="<?php echo $this->root; ?>/wiki">Wiki</a></li>
|
||||||
<li><a href="#">Item #5</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>
|
||||||
</ul>
|
</ul>
|
||||||
<div style="clear:left"></div>
|
<div style="clear:left"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-05
|
* @since 2008-10-05
|
||||||
*/
|
*/
|
||||||
class PanaceaPageView extends View {
|
class PanaceaPageView extends PanaceaView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the view
|
* Renders the view
|
||||||
|
@ -20,7 +20,24 @@
|
|||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-14
|
* @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}
|
* Creates a new {@link TemplateView}
|
||||||
@ -35,50 +52,127 @@
|
|||||||
throw new InvalidTypeException(1, 'string', $title);
|
throw new InvalidTypeException(1, 'string', $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct(0);
|
||||||
|
|
||||||
$this->defaultTitle = 'Panacea';
|
$this->defaultTitle = 'Panacea';
|
||||||
$this->title = (!empty($title)) ? $title : 'It doesn\'t suck';
|
$this->title = (!empty($title)) ? $title : 'It doesn\'t suck';
|
||||||
|
$this->separator = ' - ';
|
||||||
|
|
||||||
$this->addView(new PanaceaHeaderView(1));
|
$this->addView(new PanaceaHeaderView(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all meta data associated with this view
|
* The meta data for this view
|
||||||
*
|
*
|
||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-14
|
* @since 2008-07-03
|
||||||
* @todo Get rid of the hardcoded CSS path
|
* @uses ViewMetaData::generate()
|
||||||
|
* @uses ViewMetaData::addMeta()
|
||||||
*
|
*
|
||||||
* @return ViewMetaData
|
* @return ViewMetaData
|
||||||
*/
|
*/
|
||||||
public function getMetaData() {
|
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
|
* @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() {
|
public function __get($var) {
|
||||||
$priority = 1;
|
switch ($var) {
|
||||||
foreach ($this->views as $view) {
|
case 'title':
|
||||||
$priority = max($priority, $view->priority);
|
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
|
* Renders the view
|
||||||
*
|
*
|
||||||
* @author Tommy Montgomery
|
* @author Tommy Montgomery
|
||||||
* @since 2008-10-14
|
* @since 2008-07-03
|
||||||
|
* @uses getMetaData()
|
||||||
|
* @uses ViewMetaData::merge()
|
||||||
|
* @uses View::send()
|
||||||
*/
|
*/
|
||||||
public function send() {
|
public function send() {
|
||||||
parent::send();
|
$metadata = $this->getMetaData();
|
||||||
|
foreach ($this->views as $view) {
|
||||||
|
$metadata->merge($view->getMetaData());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
|
||||||
|
<head>
|
||||||
|
<title><?php echo $this->defaultTitle . $this->separator . $this->title; ?></title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||||
|
<?php echo $metadata; ?>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
|
||||||
|
<?php parent::send(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
unset($metadata);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
83
src/lib/views/PanaceaView.php
Normal file
83
src/lib/views/PanaceaView.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PanaceaView
|
||||||
|
*
|
||||||
|
* @package Panacea
|
||||||
|
* @subpackage Views
|
||||||
|
* @author Tommy Montgomery
|
||||||
|
* @since 2008-10-16
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Bootstraps the NowhereConcave framework */
|
||||||
|
require_once 'NowhereConcave/bootstrap.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base view of <i>Panacea</i>
|
||||||
|
*
|
||||||
|
* @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 <i>Panacea</i>
|
||||||
|
*
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -2,14 +2,18 @@ html {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
background-color: #999999;
|
background-color: #363636;
|
||||||
font-family: Verdana, Arial, sans-serif;
|
font-family: Verdana, Arial, sans-serif;
|
||||||
font-size: 8pt;
|
font-size: 8pt;
|
||||||
color: #000000;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wrapper {
|
#wrapper {
|
||||||
|
width: 95%;
|
||||||
|
margin: auto;
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
color: #000000;
|
||||||
|
border: 2px solid #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#head {
|
#head {
|
||||||
@ -33,14 +37,27 @@ body {
|
|||||||
}
|
}
|
||||||
#menu ul li {
|
#menu ul li {
|
||||||
float: left;
|
float: left;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
#menu ul li a {
|
#menu ul li a {
|
||||||
display: block;
|
display: block;
|
||||||
width: 10em;
|
color: #000000;
|
||||||
height: 2em;
|
height: 1.5em;
|
||||||
font-size: 1.5em;
|
|
||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
|
padding: .5em;
|
||||||
|
font-size: 1em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-right: 1px;
|
margin-right: 1px;
|
||||||
text-decoration: none;
|
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;
|
||||||
}
|
}
|
0
src/repo.php
Normal file
0
src/repo.php
Normal file
0
src/reviewer.php
Normal file
0
src/reviewer.php
Normal file
0
src/tracker.php
Normal file
0
src/tracker.php
Normal file
0
src/wiki.php
Normal file
0
src/wiki.php
Normal file
Loading…
Reference in New Issue
Block a user