From 6791074027e9825c935ad44926c74b41360ea4d0 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sat, 15 Feb 2014 11:27:24 +0100 Subject: [PATCH] delete Stylesheet- and CssAgent and use static CSS-file instead --- agents/intermediate/CssAgent.inc | 35 --------- agents/toplevel/StylesheetAgent.inc | 35 --------- controllers/CssController.inc | 103 --------------------------- controllers/StylesheetController.inc | 37 ---------- views/html/html.tpl | 2 +- views/stylesheet/css/desktop.tpl | 0 views/stylesheet/error/index.tpl | 1 - views/stylesheet/stylesheet.tpl | 4 -- www/css/desktop.css | 1 + 9 files changed, 2 insertions(+), 216 deletions(-) delete mode 100644 agents/intermediate/CssAgent.inc delete mode 100644 agents/toplevel/StylesheetAgent.inc delete mode 100644 controllers/CssController.inc delete mode 100644 controllers/StylesheetController.inc delete mode 100644 views/stylesheet/css/desktop.tpl delete mode 100644 views/stylesheet/error/index.tpl delete mode 100644 views/stylesheet/stylesheet.tpl create mode 100644 www/css/desktop.css diff --git a/agents/intermediate/CssAgent.inc b/agents/intermediate/CssAgent.inc deleted file mode 100644 index 860a75a5..00000000 --- a/agents/intermediate/CssAgent.inc +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2014 Heinrich-Heine-Universität Düsseldorf - * @license http://www.gnu.org/licenses/gpl.html - * @link https://bitbucket.org/coderkun/the-legend-of-z - */ - - namespace hhu\z\agents\intermediate; - - - /** - * Agent to show CSS-stylesheets. - * - * @author Oliver Hanraths - */ - class CssAgent extends \nre\agents\IntermediateAgent - { - - - - - /** - * Action: index. - */ - public function index(\nre\core\Request $request, \nre\core\Response $response) - { - } - - } - -?> diff --git a/agents/toplevel/StylesheetAgent.inc b/agents/toplevel/StylesheetAgent.inc deleted file mode 100644 index 6231b066..00000000 --- a/agents/toplevel/StylesheetAgent.inc +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2014 Heinrich-Heine-Universität Düsseldorf - * @license http://www.gnu.org/licenses/gpl.html - * @link https://bitbucket.org/coderkun/the-legend-of-z - */ - - namespace hhu\z\agents\toplevel; - - - /** - * Agent to display stylesheets. - * - * @author Oliver Hanraths - */ - class StylesheetAgent extends \nre\agents\ToplevelAgent - { - - - - - /** - * Action: index. - */ - public function index(\nre\core\Request $request, \nre\core\Response $response) - { - } - - } - -?> diff --git a/controllers/CssController.inc b/controllers/CssController.inc deleted file mode 100644 index 38e4a474..00000000 --- a/controllers/CssController.inc +++ /dev/null @@ -1,103 +0,0 @@ - - * @copyright 2014 Heinrich-Heine-Universität Düsseldorf - * @license http://www.gnu.org/licenses/gpl.html - * @link https://bitbucket.org/coderkun/the-legend-of-z - */ - - namespace hhu\z\controllers; - - - /** - * Controller of the CssAgent to show CSS-stylesheets. - * - * @author Oliver Hanraths - */ - class CssController extends \hhu\z\Controller - { - - - - /** - * Prefilter that is executed before running the Controller. - * - * @param Request $request Current request - * @param Response $response Current response - */ - public function preFilter(\nre\core\Request $request, \nre\core\Response $response) - { - parent::preFilter($request, $response); - - // Set content-type for CSS-stylesheets - $response->addHeader('Content-type: text/css'); - - // Set expires-header for caching - $response->addHeader("Pragma: public"); - $response->addHeader("Expires: ".gmdate('r', time()+(60*60*24))); - $response->addHeader("Date: ".gmdate(\DateTime::RFC822)); - } - - - /** - * Action: desktop. - * - * Show CSS for desktops. - */ - public function desktop() - { - // Set HTTP-header - $this->setHeader(); - } - - - /** - * Action: adds. - * - * Show additional CSS for desktops. - */ - public function desktop_adds() - { - // Set HTTP-header - $this->setHeader(); - } - - - - - /** - * Set HTTP-header for caching. - */ - private function setHeader() - { - // Determine filename of template - $templateFilename = $this->getView()->getTemplateFilename(); - - // Determine date of last change - $templateLastModified = gmdate('r', filemtime($templateFilename)); - - // Create E-tag - $templateEtag = hash('sha256', $templateLastModified.$templateFilename); - - - // Set header - $this->response->addHeader("Last-Modified: ".$templateLastModified); - $this->response->addHeader("Etag: ".$templateEtag); - // HTTP-status - $headerModifiedSince = $this->request->getServerParam('HTTP_IF_MODIFIED_SINCE'); - $headerNoneMatch = $this->request->getServerParam('HTTP_IF_NONE_MATCH'); - if( - !is_null($headerModifiedSince) && $templateLastModified < strtotime($headerModifiedSince) && - !is_null($headerNoneMatch) && $headerNoneMatch == $templateEtag - ) { - $this->response->setExit(true); - $this->response->addHeader(\nre\core\WebUtils::getHttpHeader(304)); - } - } - - } - -?> diff --git a/controllers/StylesheetController.inc b/controllers/StylesheetController.inc deleted file mode 100644 index d9bbfc3d..00000000 --- a/controllers/StylesheetController.inc +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright 2014 Heinrich-Heine-Universität Düsseldorf - * @license http://www.gnu.org/licenses/gpl.html - * @link https://bitbucket.org/coderkun/the-legend-of-z - */ - - namespace hhu\z\controllers; - - - /** - * Controller of the StylesheetAgent to display stylesheets. - * - * @author Oliver Hanraths - */ - class StylesheetController extends \nre\core\Controller - { - - - - - /** - * Action: index. - * - * Show the stylesheet-structure - */ - public function index() - { - } - - } - -?> diff --git a/views/html/html.tpl b/views/html/html.tpl index a9f5c842..0eadc348 100644 --- a/views/html/html.tpl +++ b/views/html/html.tpl @@ -5,7 +5,7 @@ The Legend of Z - + diff --git a/views/stylesheet/css/desktop.tpl b/views/stylesheet/css/desktop.tpl deleted file mode 100644 index e69de29b..00000000 diff --git a/views/stylesheet/error/index.tpl b/views/stylesheet/error/index.tpl deleted file mode 100644 index f6ceec9b..00000000 --- a/views/stylesheet/error/index.tpl +++ /dev/null @@ -1 +0,0 @@ -Fehler: diff --git a/views/stylesheet/stylesheet.tpl b/views/stylesheet/stylesheet.tpl deleted file mode 100644 index c796c127..00000000 --- a/views/stylesheet/stylesheet.tpl +++ /dev/null @@ -1,4 +0,0 @@ -@charset "UTF-8"; - - - diff --git a/www/css/desktop.css b/www/css/desktop.css new file mode 100644 index 00000000..9f44090c --- /dev/null +++ b/www/css/desktop.css @@ -0,0 +1 @@ +@charset "UTF-8";