initial bug tracking factories; created pages for contact, credits and about pages

This commit is contained in:
tmont 2008-10-27 08:52:33 +00:00
parent 90f5420fac
commit 0c0d32834b
10 changed files with 382 additions and 14 deletions

View File

@ -33,6 +33,7 @@
case 'PanaceaControllerFactory':
case 'PanaceaWikiController':
case 'PanaceaDefaultController':
case 'PanaceaTrackerController':
$file = "$path/lib/controllers/$className.php";
break;
@ -46,6 +47,7 @@
//views
case 'WikiViewFactory':
case 'PanaceaViewFactory':
case 'TrackerViewFactory':
$file = "$path/lib/views/$className.php";
break;
@ -63,6 +65,11 @@
$file = "$path/lib/views/wiki/$className.php";
break;
//tracker views
case 'TrackerView':
$file = "$path/lib/views/tracker/$className.php";
break;
//system views
case 'PanaceaView':
case 'PanaceaHomeView':
@ -72,9 +79,16 @@
case 'PanaceaLogoView':
case 'PanaceaMenuView':
case 'PanaceaFooterView':
case 'PanaceaWelcomeView':
$file = "$path/lib/views/system/$className.php";
break;
//default views
case 'PanaceaContactView':
case 'PanaceaWelcomeView':
case 'PanaceaCreditsView':
case 'PanaceaAboutView':
$file = "$path/lib/views/default/$className.php";
break;
}
if (!empty($file) && is_file($file)) {

View File

@ -69,7 +69,7 @@
}
try {
$title = (empty($this->page) || $this->page === 'Home') ? 'It doesn\'t suck' : $this->page;
$title = (empty($this->page) || $this->page === 'Home') ? 'It doesn\'t suck' : ucfirst($this->page);
$templateView = new PanaceaTemplateView($title);
$templateView->mainView->addView($this->viewFactory->getView($this->page));
return $templateView;

View File

@ -0,0 +1,77 @@
<?php
/**
* PanaceaTrackerController
*
* @package Panacea
* @author Tommy Montgomery
* @since 2008-10-26
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* Bug tracker controller
*
* @package Panacea
* @author Tommy Montgomery
* @since 2008-10-26
*/
class PanaceaTrackerController extends PanaceaDefaultController {
public function __construct($page) {
parent::__construct($page, View::VIEWTYPE_HTML);
$this->viewFactory = TrackerViewFactory::getInstance();
}
/**
* {@inheritdoc}
*
* @author Tommy Montgomery
* @since 2008-10-26
*
* @return string
*/
public static function getDefaultPageName() {
return 'Hello Bug Tracker';
}
/**
* {@inheritdoc}
*
* @author Tommy Montgomery
* @since 2008-10-26
* @uses Request::create()
* @uses HttpUtil::getRequestMethod()
* @todo Remove the hardcoded database connection
*
* @throws {@link InvalidRequestException} if a {@link View} cannot be created
* @return PanaceaTemplateView
*/
public function handleRequest(Request $request = null) {
if (!($request instanceof Request)) {
$request = Request::create(HttpUtil::getRequestMethod());
}
//handle request metadata
if ($request->method === HttpUtil::HTTP_METHOD_POST) {
$postHandler = PanaceaPostHandlerFactory::getInstance()->getPostHandler($request->body);
$lastInsertId = $postHandler->execute($mysql);
}
try {
$templateView = new PanaceaTemplateView('Bug Tracker :: ' . $this->page);
$templateView->mainView->addView($this->viewFactory->getView($this->page));
return $templateView;
}
catch (ClassNotFoundException $e) {
throw new InvalidRequestException($request);
}
}
}
?>

View File

@ -0,0 +1,61 @@
<?php
/**
* TrackerViewFactory
*
* @package Panacea
* @author Tommy Montgomery
* @since 2008-10-26
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* Factory for generating bug tacking {@link View}s
*
* @package Panacea
* @author Tommy Montgomery
* @since 2008-10-26
*/
class TrackerViewFactory extends ViewFactory {
/**
* The singleton instance
*
* @var WikiViewFactory
*/
protected static $instance = null;
/**
* Gets the singleton instance
*
* @author Tommy Montgomery
* @since 2008-10-26
*
* @return TrackerViewFactory
*/
public static function getInstance() {
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
/**
* {@inheritdoc}
*
* @author Tommy Montgomery
* @since 2008-10-18
*
* @param string $page The name of the page
* @return string
*/
protected function getViewName($page) {
return 'TrackerView';
}
}
?>

View File

@ -0,0 +1,43 @@
<?php
/**
* PanaceaAboutView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for the about page
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
class PanaceaAboutView extends PanaceaView {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-26
*/
public function send() { ?>
<h2>About</h2>
<div class="inset">
Hello world.
</div>
<?php
}
}
?>

View File

@ -0,0 +1,50 @@
<?php
/**
* PanaceaContactView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for the contact page
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
class PanaceaContactView extends PanaceaView {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-26
*/
public function send() { ?>
<h2>Contact</h2>
<div class="inset">
<dl>
<dt>Email</dt>
<dd>somewhere@somewhere.com</dd>
<dt>Submit a bug</dt>
<dd><a href="<?php echo $this->root; ?>/tracker/">Bug tracker</a></dd>
</dl>
</div>
<?php
}
}
?>

View File

@ -0,0 +1,92 @@
<?php
/**
* PanaceaCreditsView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for the credits page
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
class PanaceaCreditsView extends PanaceaView {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-26
*/
public function send() { ?>
<h2>Credits</h2>
<div class="inset">
<h3>Internals</h3>
<div class="inset">
<p>
This application was built entirely by
<a href="http://tommymontgomery.com/">Tommy Montgomery</a>. He wrote it
using <a href="http://php.net/">PHP</a>. Obviously,
<a href="http://trac.edgewall.org/">Trac</a> was a big inspiration.
</p>
</div>
<h3>Development Tools</h3>
<div class="inset">
<p>
Yes, this entire thing was developed on <i>gasp!</i> Windows.
Macs are for suckers and Linux is for sadists. Of course, I relied
heavily on the use of Cygwin&hellip;
</p>
<ul>
<li><a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a></li>
<li><a href="http://webyog.com/en/downloads.php#sqlyog">SQLyog</a></li>
<li><a href="http://subversion.tigris.org/">Subversion</a></li>
<li><a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a></li>
<li><a href="http://www.cygwin.com/">Cygwin</a></li>
<li><a href="http://mysql.com/">MySQL</a></li>
<li><a href="http://httpd.apache.com/">Apache web server</a></li>
<li><a href="http://phpunit.de/">PHPUnit</a></li>
<li><a href="http://phpundercontrol.org/">phpUnderControl</a> / <a href="http://cruisecontrol.sourceforge.net/">CruiseControl</a></li>
<li><a href="http://pear.php.net/package/PHP_CodeSniffer/">PHP_CodeSniffer</a></li>
<li><a href="http://xdebug.org/">XDebug</a></li>
<li><a href="http://www.gimp.org/">gimp</a></li>
</ul>
</div>
<h3>References</h3>
<div class="inset">
<p>
These are mentioned because I sometimes referred to them while
developing Panacea.
</p>
<ul>
<li><a href="http://trac.edgewall.org/">Trac</a></li>
<li><a href="http://ezcomponents.org">ezComponents</a></li>
<li><a href="http://framework.zend.com/">Zend Framework</a></li>
<li><a href="http://en.wikipedia.org/">Wikipedia</a> (reference for wiki syntax)</li>
<li><a href="http://cssplay.co.uk/">CSSplay</a></li>
</ul>
</div>
</div>
<?php
}
}
?>

View File

@ -34,10 +34,7 @@
<div class="inset">
<p>
Welcome to <i>Panacea</i>, a web-based application that
doesn&#039;t suck. It&#039;s aimed at software developers,
software development managers, <acronym>QA</acronym> professionals,
and people who like using <a href="http://en.wikipedia.org/wiki/Wiki">wikis</a>
(which should be everybody, unless you&#039;re a robot).
doesn&#039;t suck.
</p>
</div>
@ -46,16 +43,12 @@
<p>
<i>Panacea</i> is modeled after <a href="http://trac.edgewall.org/">Trac</a>,
which is a fantastic application very similar to this one. <i>Panacea</i>
aims to ease integration, configuration and installation. That is not to say
that <i>Panacea</i> is simple; it is in fact just the opposite. <i>Panacea</i> is
infintely complex and extensible; it is well documented and well-written; it
is a panacea to all your software development troubles; it&#039;s also a lot of
fun, in the sense that there&#039;s a lot of crap to mess around with.
aims to ease integration, configuration and installation.
</p>
<p>
More information about the technology and reason for <i>Panacea</i> can be
viewed at the <a href="<?php echo $this->root; ?>/wiki/About">about</a> page.
viewed at the <a href="<?php echo $this->root; ?>/about">about</a> page.
</p>
</div>

View File

@ -13,7 +13,7 @@
require_once 'NowhereConcave/bootstrap.php';
/**
* View for standard Panacea pages
* Footer view
*
* @package Panacea
* @subpackage Views
@ -36,7 +36,6 @@
<ul>
<li><a href="<?php echo $this->root; ?>/about">About</a></li>
<li><a href="<?php echo $this->root; ?>/credits">Credits</a></li>
<li><a href="<?php echo $this->root; ?>/copyright">Copyright</a></li>
<li><a href="<?php echo $this->root; ?>/contact">Contact</a></li>
</ul>
<div style="clear:right"></div>

View File

@ -0,0 +1,39 @@
<?php
/**
* TrackerView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* View for bug tracking pages
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-26
*/
class TrackerView extends PanaceaView {
/**
* Creates a new {@link WikiPageView}
*
* @author Tommy Montgomery
* @since 2008-10-26
*
* @param int $priority The priority of the view
*/
public function __construct($priority = 0) {
parent::__construct($priority);
}
}
?>