diff --git a/application/controllers/helpers/DataFormatSwitch.php b/application/controllers/helpers/DataFormatSwitch.php deleted file mode 100644 index a9a2b4549..000000000 --- a/application/controllers/helpers/DataFormatSwitch.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ -// {{{ICINGA_LICENSE_HEADER}}} - -class Zend_Controller_Action_Helper_DataFormatSwitch extends Zend_Controller_Action_Helper_ContextSwitch { - - protected $autoSerialization = true; - - public function setAutoJsonSerialization($value) - { - $this->autoSerialization = $value; - $this->setAutoJsonSerialization($value); - } - - public function __construct() - { - $this->setContexts( - array( - 'pdf' => array( - 'suffix' => 'pdf', - 'headers' => array('Content-Type' => 'application/pdf'), - 'callbacks' => array( - 'init' => 'removeStyles', - 'post' => 'postPdfContext' - ) - ), - 'json' => array( - 'suffix' => 'json', - 'headers' => array('Content-Type' => 'application/json'), - 'callbacks' => array( - 'init' => 'removeStyles', - 'post' => 'postJsonContext' - ) - ), - 'xml' => array( - 'suffix' => 'xml', - 'headers' => array('Content-Type' => 'application/xml'), - 'callbacks' => array( - 'init' => 'removeStyles', - 'post' => 'postXmlContext' - ) - ) - ) - ); - } - - private function postXmlContext() - { - if (!$this->autoSerialization) { - return; - } - } - - private function postPdfContext() - { - if (!$this->autoSerialization) { - return; - } - $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); - $helper = new Zend_View_Helper_Pdf(); - $this->getResponse()->setBody( - $helper->pdf($viewRenderer->render()) - ); - } - - private function removeStyles() - { - if (!$this->getAutoJsonSerialization()) { - return; - } - $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); - $view = $viewRenderer->view; - if ($view instanceof Zend_View_Interface) { - $viewRenderer->setNoRender(true); - } - } -} \ No newline at end of file diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 9cef30dbe..7fdbed55f 100755 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -254,11 +254,9 @@ class ActionController extends Zend_Controller_Action if (!headers_sent()) { $css = $this->view->getHelper('action')->action('stylesheet', 'static', 'application'); - // fix css for pdf - require_once 'vendor/lessphp/lessc.inc.php'; - $lessc = new \lessc(); + // load css fixes for pdf formatting mode $publicDir = realpath(dirname($_SERVER['SCRIPT_FILENAME'])); - $css .= $lessc->compile($publicDir . '/css/icinga/pdf.less'); + $css .= file_get_contents($publicDir . '/css/pdf/pdf.css'); $pdf = new PDF(); if ($this->_request->getControllerName() === 'list') { diff --git a/public/css/icinga/pdf.less b/public/css/pdf/pdf.css old mode 100644 new mode 100755 similarity index 88% rename from public/css/icinga/pdf.less rename to public/css/pdf/pdf.css index c735ec95b..1005eb44f --- a/public/css/icinga/pdf.less +++ b/public/css/pdf/pdf.css @@ -24,7 +24,8 @@ * @author Icinga Development Team * */ -// {{{ICINGA_LICENSE_HEADER}}} +/* {{{ICINGA_LICENSE_HEADER}}} */ + *, html { font-size: 100%; @@ -34,7 +35,6 @@ form { display: none; } -// Insert page breaks div.pdf-page { page-break-before: always; } @@ -46,24 +46,20 @@ div.selection-toolbar > a { display: none; } -// Dont show any link outline a { outline: 0; } -// Fix badge positioning span.badge { float: right; max-width: 5px; } -// prevent table rows from growing too big on page breaks tr { max-height: 30px; height: 30px; } -// Hide buttons *.button { display: none; } @@ -74,7 +70,6 @@ button > i { display: none; } -// Hide navigation *.nav { display: none; } @@ -85,7 +80,6 @@ button > i { display: none; } -// Hide pagination *.pagination { display: none; } @@ -97,4 +91,4 @@ button > i { } *.pagination > li > span { display: none; -} \ No newline at end of file +}