Enable the dompdf float support and fix our list's layout

This commit is contained in:
Johannes Meyer 2014-12-15 13:56:19 +01:00
parent bca28a5ae2
commit 3fde78f2b3
8 changed files with 16 additions and 14 deletions

View File

@ -31,7 +31,7 @@ if ( isset($pdf) )
} }
</script> </script>
<?= $this->img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '150')) ?> <?= $this->img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '75')) ?>
<!--<div id="page-header"> <!--<div id="page-header">
<table> <table>
<tr> <tr>

View File

@ -387,7 +387,7 @@ EOD;
try { try {
$png = $pie->toPng($this->width, $this->height); $png = $pie->toPng($this->width, $this->height);
return '<img src="data:image/png;base64,' . base64_encode($png) . '" />'; return '<img class="inlinepie" src="data:image/png;base64,' . base64_encode($png) . '" />';
} catch (IcingaException $_) { } catch (IcingaException $_) {
return ''; return '';
} }

View File

@ -637,7 +637,7 @@ class FilterEditor extends AbstractWidget
public function renderSearch() public function renderSearch()
{ {
$html = ' <form method="post" class="inline" action="' $html = ' <form method="post" class="inline dontprint" action="'
. $this->url() . $this->url()
. '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="' . '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="'
. t('Search...') . t('Search...')

View File

@ -11,7 +11,7 @@
//define("DOMPDF_DPI", 72); //define("DOMPDF_DPI", 72);
//define("DOMPDF_ENABLE_PHP", true); //define("DOMPDF_ENABLE_PHP", true);
//define("DOMPDF_ENABLE_REMOTE", true); //define("DOMPDF_ENABLE_REMOTE", true);
//define("DOMPDF_ENABLE_CSS_FLOAT", true); define("DOMPDF_ENABLE_CSS_FLOAT", true);
//define("DOMPDF_ENABLE_JAVASCRIPT", false); //define("DOMPDF_ENABLE_JAVASCRIPT", false);
//define("DEBUGPNG", true); //define("DEBUGPNG", true);
//define("DEBUGKEEPTEMP", true); //define("DEBUGKEEPTEMP", true);

View File

@ -9,7 +9,7 @@ use Icinga\Module\Monitoring\Plugin\PerfdataSet;
class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
{ {
public function perfdata($perfdataStr, $compact = false, $float = false) public function perfdata($perfdataStr, $compact = false)
{ {
$pset = PerfdataSet::fromString($perfdataStr)->asArray(); $pset = PerfdataSet::fromString($perfdataStr)->asArray();
$onlyPieChartData = array_filter($pset, function ($e) { return $e->getPercentage() > 0; }); $onlyPieChartData = array_filter($pset, function ($e) { return $e->getPercentage() > 0; });
@ -24,11 +24,7 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
foreach ($onlyPieChartData as $perfdata) { foreach ($onlyPieChartData as $perfdata) {
$pieChart = $this->createInlinePie($perfdata); $pieChart = $this->createInlinePie($perfdata);
if ($compact) { if ($compact) {
if (! $float) { $result .= $pieChart->render();
$result .= $pieChart->render();
} else {
$result .= '<div style="float: right;">' . $pieChart->render() . '</div>';
}
} else { } else {
if (! $perfdata->isPercentage()) { if (! $perfdata->isPercentage()) {
// TODO: Should we trust sprintf-style placeholders in perfdata titles? // TODO: Should we trust sprintf-style placeholders in perfdata titles?

View File

@ -67,7 +67,7 @@ foreach ($services as $service):
</td> </td>
<td> <td>
<?= $this->perfdata($service->service_perfdata, true, true) ?> <?= $this->perfdata($service->service_perfdata, true) ?>
<?php if (!$service->service_handled && $service->service_state > 0): ?> <?php if (!$service->service_handled && $service->service_state > 0): ?>
<?= $this->icon('attention-alt', $this->translate('Unhandled')) ?> <?= $this->icon('attention-alt', $this->translate('Unhandled')) ?>

View File

@ -65,11 +65,12 @@ table.action td a:hover {
text-decoration: underline; text-decoration: underline;
} }
table.action div.inlinepie { table.action span.sparkline, table.action img.inlinepie {
margin: 0.5em 0.25em 0.5em 0.25em; margin: 0.5em 0.25em 0.5em 0.25em;
float:right;
} }
.dashboard table.action div.inlinepie { .dashboard table.action span.sparkline, .dashboard table.action img.inlinepie {
margin: 0em 0.25em 0em 0.25em; margin: 0em 0.25em 0em 0.25em;
} }

View File

@ -1,10 +1,15 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
.controls form, .controls .pagination, .controls > .tabs, .dontprint, .inlinepie { .controls form, .controls .pagination, .controls .widgetLimiter, .controls > .tabs, .dontprint {
display: none !important; display: none !important;
} }
table.action img.inlinepie {
width: 50%;
height: 50%;
}
@page { @page {
margin: 2cm; margin: 2cm;
} }