From 0c0d32834b53e87485f90d9f4a9b6764d2404cfd Mon Sep 17 00:00:00 2001 From: tmont Date: Mon, 27 Oct 2008 08:52:33 +0000 Subject: [PATCH] initial bug tracking factories; created pages for contact, credits and about pages --- src/bootstrap.php | 16 +++- .../controllers/PanaceaDefaultController.php | 2 +- .../controllers/PanaceaTrackerController.php | 77 ++++++++++++++++ src/lib/views/TrackerViewFactory.php | 61 ++++++++++++ src/lib/views/default/PanaceaAboutView.php | 43 +++++++++ src/lib/views/default/PanaceaContactView.php | 50 ++++++++++ src/lib/views/default/PanaceaCreditsView.php | 92 +++++++++++++++++++ src/lib/views/default/PanaceaWelcomeView.php | 13 +-- src/lib/views/system/PanaceaFooterView.php | 3 +- src/lib/views/tracker/TrackerView.php | 39 ++++++++ 10 files changed, 382 insertions(+), 14 deletions(-) create mode 100644 src/lib/controllers/PanaceaTrackerController.php create mode 100644 src/lib/views/TrackerViewFactory.php create mode 100644 src/lib/views/default/PanaceaAboutView.php create mode 100644 src/lib/views/default/PanaceaContactView.php create mode 100644 src/lib/views/default/PanaceaCreditsView.php create mode 100644 src/lib/views/tracker/TrackerView.php diff --git a/src/bootstrap.php b/src/bootstrap.php index 8474106..c395df6 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -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)) { diff --git a/src/lib/controllers/PanaceaDefaultController.php b/src/lib/controllers/PanaceaDefaultController.php index 3582195..73b0cce 100644 --- a/src/lib/controllers/PanaceaDefaultController.php +++ b/src/lib/controllers/PanaceaDefaultController.php @@ -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; diff --git a/src/lib/controllers/PanaceaTrackerController.php b/src/lib/controllers/PanaceaTrackerController.php new file mode 100644 index 0000000..fcb9c25 --- /dev/null +++ b/src/lib/controllers/PanaceaTrackerController.php @@ -0,0 +1,77 @@ +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); + } + } + + } + +?> \ No newline at end of file diff --git a/src/lib/views/TrackerViewFactory.php b/src/lib/views/TrackerViewFactory.php new file mode 100644 index 0000000..469c430 --- /dev/null +++ b/src/lib/views/TrackerViewFactory.php @@ -0,0 +1,61 @@ + \ No newline at end of file diff --git a/src/lib/views/default/PanaceaAboutView.php b/src/lib/views/default/PanaceaAboutView.php new file mode 100644 index 0000000..1ed8eb0 --- /dev/null +++ b/src/lib/views/default/PanaceaAboutView.php @@ -0,0 +1,43 @@ + + +

About

+
+ Hello world. +
+ \ No newline at end of file diff --git a/src/lib/views/default/PanaceaContactView.php b/src/lib/views/default/PanaceaContactView.php new file mode 100644 index 0000000..ea05705 --- /dev/null +++ b/src/lib/views/default/PanaceaContactView.php @@ -0,0 +1,50 @@ + + +

Contact

+
+
+
Email
+
somewhere@somewhere.com
+
Submit a bug
+
Bug tracker
+
+
+ + + \ No newline at end of file diff --git a/src/lib/views/default/PanaceaCreditsView.php b/src/lib/views/default/PanaceaCreditsView.php new file mode 100644 index 0000000..5fbf575 --- /dev/null +++ b/src/lib/views/default/PanaceaCreditsView.php @@ -0,0 +1,92 @@ + + +

Credits

+
+

Internals

+
+

+ This application was built entirely by + Tommy Montgomery. He wrote it + using PHP. Obviously, + Trac was a big inspiration. +

+
+ +

Development Tools

+
+

+ Yes, this entire thing was developed on gasp! Windows. + Macs are for suckers and Linux is for sadists. Of course, I relied + heavily on the use of Cygwin… +

+ + +
+ +

References

+
+

+ These are mentioned because I sometimes referred to them while + developing Panacea. +

+ +
+
+ + + \ No newline at end of file diff --git a/src/lib/views/default/PanaceaWelcomeView.php b/src/lib/views/default/PanaceaWelcomeView.php index d171afa..daf5cd3 100644 --- a/src/lib/views/default/PanaceaWelcomeView.php +++ b/src/lib/views/default/PanaceaWelcomeView.php @@ -34,10 +34,7 @@

Welcome to Panacea, a web-based application that - doesn't suck. It's aimed at software developers, - software development managers, QA professionals, - and people who like using wikis - (which should be everybody, unless you're a robot). + doesn't suck.

@@ -46,16 +43,12 @@

Panacea is modeled after Trac, which is a fantastic application very similar to this one. Panacea - aims to ease integration, configuration and installation. That is not to say - that Panacea is simple; it is in fact just the opposite. Panacea is - infintely complex and extensible; it is well documented and well-written; it - is a panacea to all your software development troubles; it's also a lot of - fun, in the sense that there's a lot of crap to mess around with. + aims to ease integration, configuration and installation.

More information about the technology and reason for Panacea can be - viewed at the about page. + viewed at the about page.

diff --git a/src/lib/views/system/PanaceaFooterView.php b/src/lib/views/system/PanaceaFooterView.php index 51f66cf..71e8200 100644 --- a/src/lib/views/system/PanaceaFooterView.php +++ b/src/lib/views/system/PanaceaFooterView.php @@ -13,7 +13,7 @@ require_once 'NowhereConcave/bootstrap.php'; /** - * View for standard Panacea pages + * Footer view * * @package Panacea * @subpackage Views @@ -36,7 +36,6 @@
diff --git a/src/lib/views/tracker/TrackerView.php b/src/lib/views/tracker/TrackerView.php new file mode 100644 index 0000000..53907f9 --- /dev/null +++ b/src/lib/views/tracker/TrackerView.php @@ -0,0 +1,39 @@ + \ No newline at end of file