wiki menu, and created a wiki view base class

This commit is contained in:
tmont 2008-10-19 04:43:45 +00:00
parent 6d01fe82c7
commit 0ffdd23172
7 changed files with 166 additions and 6 deletions

View File

@ -32,6 +32,9 @@
break;
case 'WikiPageView':
case 'WikiPageMenuView':
case 'WikiPageContentView':
case 'PanaceaWikiView':
$file = "$path/lib/views/wiki/$className.php";
break;

View File

@ -21,6 +21,7 @@
* @since 2008-10-16
*
* @property-read string $root The relative root
* @property-read string $wikiPath The path to the wiki directory
* @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
@ -52,6 +53,7 @@
$this->config = array(
'root' => '/panacea/src',
'wikiPath' => '/panacea/src/wiki',
'mediaPath' => '/panacea/src/media',
'cssPath' => '/panacea/src/media/css',
'jsPath' => '/panacea/src/media/js',

View File

@ -0,0 +1,49 @@
<?php
/**
* WikiPageContentView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-18
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for wiki content
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-18
*/
class PanaceaWikiView extends PanaceaView {
/**
* The wiki page to display
*
* @var WikiPageObject
*/
protected $page;
/**
* Creates a new {@link WikiPageView}
*
* @author Tommy Montgomery
* @since 2008-10-18
*
* @param WikiPageObject $page The wiki page to display
* @param int $priority The priority of the view
*/
public function __construct(WikiPageObject $page, $priority = 0) {
parent::__construct($priority);
$this->page = $page;
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
/**
* WikiPageContentView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-18
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for wiki content
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-18
*/
class WikiPageContentView extends PanaceaWikiView {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-18
*/
public function send() {
echo "\t\t" . $this->page;
}
}
?>

View File

@ -0,0 +1,46 @@
<?php
/**
* WikiPageMenuView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-18
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for wiki page menus
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-18
*/
class WikiPageMenuView extends PanaceaWikiView {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-18
*/
public function send() { ?>
<div class="wikimenu">
<ul class="menu">
<li><a href="<?php echo $this->wikiPath; ?>/<?php echo $this->page->page->page_name; ?>?stats">Statistics</a></li>
<li><a href="<?php echo $this->wikiPath; ?>/<?php echo $this->page->page->page_name; ?>?history">History</a></li>
<li><a href="<?php echo $this->wikiPath; ?>/<?php echo $this->page->page->page_name; ?>?source">Source</a></li>
<li><a href="<?php echo $this->wikiPath; ?>/<?php echo $this->page->page->page_name; ?>?edit">Edit</a></li>
</ul>
<div style="clear:right"></div>
</div>
<?php }
}
?>

View File

@ -20,13 +20,23 @@
* @author Tommy Montgomery
* @since 2008-10-18
*/
class WikiPageView extends PanaceaView {
protected $page;
class WikiPageView extends PanaceaWikiView {
/**
* Creates a new {@link WikiPageView}
*
* @author Tommy Montgomery
* @since 2008-10-18
*
* @param WikiPageObject $page The wiki page to display
* @param int $priority The priority of the view
*/
public function __construct(WikiPageObject $page, $priority = 0) {
parent::__construct($priority);
$this->page = $page;
parent::__construct($page, $priority);
$this->addView(new WikiPageMenuView($page, 1));
$this->addView(new WikiPageContentView($page, 2));
$this->addView(new WikiPageMenuView($page, 3));
}
/**
@ -36,7 +46,7 @@
* @since 2008-10-18
*/
public function send() {
echo $this->page;
parent::send();
}
}

View File

@ -10,6 +10,11 @@ body {
a {
text-decoration: none;
}
ul.menu {
list-style-type: none;
margin: 0;
padding: 0;
}
#wrapper {
width: 95%;
@ -129,4 +134,12 @@ a {
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
background-color: #DDDD77;
}
.wikimenu {
position: relative;
}
.wikimenu ul li {
float: right;
margin-left: 10px;
}