delete Stylesheet- and CssAgent and use static CSS-file instead
This commit is contained in:
parent
0a09700828
commit
6791074027
9 changed files with 2 additions and 216 deletions
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @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 <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CssAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @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 <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StylesheetAgent extends \nre\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @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 <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @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 <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StylesheetController extends \nre\core\Controller
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* Show the stylesheet-structure
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<title>The Legend of Z</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="<?=$linker->link(array('css','desktop'))?>" media="all" />
|
||||
<link rel="stylesheet" type="text/css" href="<?=$linker->link(array('css','desktop.css'))?>" media="all" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Fehler: <?=$code?> <?=$string?>
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
@charset "UTF-8";
|
||||
|
||||
|
||||
<?=$intermediate?>
|
||||
1
www/css/desktop.css
Normal file
1
www/css/desktop.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
@charset "UTF-8";
|
||||
Loading…
Add table
Add a link
Reference in a new issue