\n";
- return $htm;
+
+ $html = str_replace("{URL}", $url->getAbsoluteUrl(), $this->template);
+ $html = str_replace("{REMOVE_URL}", $removeUrl, $html);
+ $html = str_replace("{STYLE}", $this->getBoxSizeAsCSS(), $html);
+ $html = str_replace("{TITLE}", $view->escape($this->getTitle()), $html);
+ return $html;
+ }
+
+ private function getBoxSizeAsCSS()
+ {
+ $style = "";
+ if ($this->height) {
+ $style .= 'height:'.(string) $this->height.';';
+ }
+ if ($this->width) {
+ $style .= 'width:'.(string) $this->width.';';
+ }
+ }
+
+ public static function fromIni($title, Zend_Config $config, Pane $pane)
+ {
+ $height = null;
+ $width = null;
+ $url = $config->get('url');
+ $parameters = $config->toArray();
+ unset($parameters["url"]); // otherwise there's an url = parameter in the Url
+
+ if (isset($parameters["height"])) {
+ $height = Dimension::fromString($parameters["height"]);
+ unset($parameters["height"]);
+ }
+
+ if (isset($parameters["width"])) {
+ $width = Dimension::fromString($parameters["width"]);
+ unset($parameters["width"]);
+ }
+
+ $cmp = new Component($title, Url::fromPath($url, $parameters), $pane);
+ $cmp->setHeight($height);
+ $cmp->setWidth($width);
+ return $cmp;
}
}
diff --git a/library/Icinga/Web/Widget/Dashboard/Pane.php b/library/Icinga/Web/Widget/Dashboard/Pane.php
index c57aaf5d2..6749da12a 100644
--- a/library/Icinga/Web/Widget/Dashboard/Pane.php
+++ b/library/Icinga/Web/Widget/Dashboard/Pane.php
@@ -4,8 +4,10 @@ namespace Icinga\Web\Widget\Dashboard;
use Icinga\Web\Url;
use Icinga\Exception\ConfigurationError;
+use Icinga\Web\Widget\Widget;
+use Zend_Config;
-class Pane
+class Pane implements Widget
{
protected $name;
protected $title;
@@ -61,13 +63,22 @@ class Pane
{
return $this->components;
}
-
+
+ public function render(\Zend_View_Abstract $view)
+ {
+ $html = PHP_EOL;
+ foreach ($this->getComponents() as $component) {
+ $html .= PHP_EOL.$component->render($view);
+ }
+ return $html;
+ }
+
public function addComponent($component, $url = null)
{
if ($component instanceof Component) {
- $this->components[$component->title] = $component;
+ $this->components[$component->getTitle()] = $component;
} elseif (is_string($component) && $url !== null) {
- $this->components[$component] = new Component($component, $url);
+ $this->components[$component] = new Component($component, $url, $this);
} else{
throw new ConfigurationError('You messed up your dashboard');
}
@@ -81,24 +92,28 @@ class Pane
public function toIni()
{
- $ini = sprintf(
- "[%s]\ntitle = %s\n",
- $this->getName(),
- $this->quoteIni($this->getTitle())
- ) . "\n";
+ if (empty($this->components))
+ {
+ return "";
+ }
+ $ini = '['.$this->getName().']'.PHP_EOL.
+ 'title = '.$this->quoteIni($this->getTitle()).PHP_EOL;
foreach ($this->components as $title => $component) {
- $ini .= sprintf(
- "[%s.%s]\n",
- $this->getName(),
- $title
- ) . $component->toIni() . "\n";
+ // component header
+ $ini .= '['.$this->getName().'.'.$title.']'.PHP_EOL;
+ // component content
+ $ini .= $component->toIni().PHP_EOL;
}
return $ini;
}
- public function __toString()
+ public static function fromIni($title, Zend_Config $config)
{
- return implode('', $this->components);
+ $pane = new Pane($title);
+ if ($config->get('title', false)) {
+ $pane->setTitle($config->get('title'));
+ }
+ return $pane;
}
}
diff --git a/library/Icinga/Web/Widget/Form.php b/library/Icinga/Web/Widget/Form.php
deleted file mode 100644
index 9ee4bb827..000000000
--- a/library/Icinga/Web/Widget/Form.php
+++ /dev/null
@@ -1,78 +0,0 @@
-
- * @author Icinga-Web Team
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
- */
-class Form
-{
- protected $form;
- protected $properties = array(
- 'name' => null,
- 'options' => null
- );
-
- public function __call($func, $args)
- {
- return call_user_func_array(array($this->form, $func), $args);
- }
-
- protected function init()
- {
- // Load form by name given in props:
- $file = null;
- $fparts = array();
- $cparts = array();
- foreach (preg_split('~/~', $this->name, -1, PREG_SPLIT_NO_EMPTY) as $part) {
- $fparts[] = $part;
- $cparts[] = ucfirst($part);
- }
- array_push($fparts, ucfirst(array_pop($fparts)));
-
- $app = Icinga::app();
- $module_name = $this->view()->module_name;
- if ($module_name === 'default') {
- $module_name = null;
- }
- if ($module_name !== null) {
- $fname = $app->getModuleManager()->getModule($module_name)->getBaseDir()
- . '/application/forms/'
- . implode('/', $fparts)
- . 'Form.php';
- if (file_exists($fname)) {
- $file = $fname;
- array_unshift($cparts, ucfirst($module_name));
- }
- }
-
- if ($file === null) {
- $fname = $app->getApplicationDir('forms/')
- . implode('/', $fparts)
- . 'Form.php';
- if (file_exists($fname)) {
- $file = $fname;
- } else {
- throw new ProgrammingError(sprintf(
- 'Unable to load your form: %s',
- $this->name
- ));
- }
- }
- $class = 'Icinga\\Web\\Form\\' . implode('_', $cparts) . 'Form';
- require_once($file);
- $this->form = new $class($this->options);
- }
-
- public function render()
- {
- return (string) $this->form;
- }
-}
diff --git a/library/Icinga/Web/Widget/Tab.php b/library/Icinga/Web/Widget/Tab.php
index 501e358de..0e1fc0f76 100644
--- a/library/Icinga/Web/Widget/Tab.php
+++ b/library/Icinga/Web/Widget/Tab.php
@@ -41,6 +41,7 @@ class Tab implements Widget
private $url = null;
private $urlParams = array();
private $icon = null;
+ private $iconCls = null;
/**
@@ -59,6 +60,16 @@ class Tab implements Widget
return $this->icon;
}
+ public function setIconCls($iconCls)
+ {
+ $this->iconCls = $iconCls;
+ }
+
+ public function getIconCls()
+ {
+ return $this->iconCls;
+ }
+
/**
* @param mixed $name
*/
@@ -107,6 +118,22 @@ class Tab implements Widget
return $this->url;
}
+ /**
+ * @param mixed $url
+ */
+ public function setUrlParams(array $urlParams)
+ {
+ $this->urlParams = $urlParams;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getUrlParams()
+ {
+ return $this->urlParams;
+ }
+
public function __construct(array $properties = array())
{
foreach ($properties as $name=>$value) {
@@ -115,18 +142,6 @@ class Tab implements Widget
$this->$setter($value);
}
}
-
- }
-
- /**
- * Health check at initialization time
- *
- * @throws Icinga\Exception\ProgrammingError if tab name is missing
- *
- * @return void
- */
- protected function init()
- {
if ($this->name === null) {
throw new ProgrammingError('Cannot create a nameless tab');
}
@@ -172,6 +187,8 @@ class Tab implements Widget
'width' => 16,
'height' => 16
)) . ' ' . $caption;
+ } else if ($this->iconCls !== null) {
+ $caption = ' ' . $caption;
}
if ($this->url !== null) {
$tab = $view->qlink(
diff --git a/library/Icinga/Web/Widget/Tabs.php b/library/Icinga/Web/Widget/Tabs.php
index af3fa1f21..69b1b2065 100644
--- a/library/Icinga/Web/Widget/Tabs.php
+++ b/library/Icinga/Web/Widget/Tabs.php
@@ -197,6 +197,7 @@ class Tabs implements Countable, Widget
$html .= $tab->render($view);
}
+ // @TODO: Remove special part from tabs (Bug #4512)
$special = array();
$special[] = $view->qlink(
$view->img('img/classic/application-pdf.png') . ' PDF',
diff --git a/library/vendor/tcpdf/examples/example_059.php b/library/vendor/tcpdf/examples/example_059.php
index 6e458d5b7..57870bd3f 100755
--- a/library/vendor/tcpdf/examples/example_059.php
+++ b/library/vendor/tcpdf/examples/example_059.php
@@ -5,7 +5,7 @@
// Last Update : 2011-04-15
//
// Description : Example 059 for TCPDF class
-// Table Of Content using HTML templates.
+// Table Of Content using HTML Templates.
//
// Author: Nicola Asuni
//
@@ -19,7 +19,7 @@
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
- * @abstract TCPDF - Example: Table Of Content using HTML templates.
+ * @abstract TCPDF - Example: Table Of Content using HTML Templates.
* @author Nicola Asuni
* @since 2010-05-06
*/
@@ -153,7 +153,7 @@ $bookmark_templates = array();
/*
* The key of the $bookmark_templates array represent the bookmark level (from 0 to n).
- * The following templates will be replaced with proper content:
+ * The following Templates will be replaced with proper content:
* #TOC_DESCRIPTION# this will be replaced with the bookmark description;
* #TOC_PAGE_NUMBER# this will be replaced with page number.
*
@@ -166,7 +166,7 @@ $bookmark_templates = array();
$bookmark_templates[0] = '
#TOC_DESCRIPTION#
#TOC_PAGE_NUMBER#
';
$bookmark_templates[1] = '
#TOC_DESCRIPTION#
#TOC_PAGE_NUMBER#
';
$bookmark_templates[2] = '
#TOC_DESCRIPTION#
#TOC_PAGE_NUMBER#
';
-// add other bookmark level templates here ...
+// add other bookmark level Templates here ...
// add table of content at page 1
// (check the example n. 45 for a text-only TOC
diff --git a/library/vendor/tcpdf/tcpdf.php b/library/vendor/tcpdf/tcpdf.php
index fccf6b117..c113071a5 100644
--- a/library/vendor/tcpdf/tcpdf.php
+++ b/library/vendor/tcpdf/tcpdf.php
@@ -76,7 +76,7 @@
// dullus for text Justification.
// Bob Vincent (pillarsdotnet@users.sourceforge.net) for
value attribute.
// Patrick Benny for text stretch suggestion on Cell().
-// Johannes Güntert for JavaScript support.
+// Johannes G�ntert for JavaScript support.
// Denis Van Nuffelen for Dynamic Form.
// Jacek Czekaj for multibyte justification
// Anthony Ferrara for the reintroduction of legacy image methods.
@@ -87,7 +87,7 @@
// Mohamad Ali Golkar, Saleh AlMatrafe, Charles Abbott for Arabic and Persian support.
// Moritz Wagner and Andreas Wurmser for graphic functions.
// Andrew Whitehead for core fonts support.
-// Esteban Joël Marín for OpenType font conversion.
+// Esteban Jo�l Mar�n for OpenType font conversion.
// Teus Hagen for several suggestions and fixes.
// Yukihiro Nakadaira for CID-0 CJK fonts fixes.
// Kosmas Papachristos for some CSS improvements.
@@ -647,7 +647,7 @@ class TCPDF {
protected $footer_font;
/**
- * Language templates.
+ * Language Templates.
* @protected
*/
protected $l;
@@ -6123,7 +6123,7 @@ class TCPDF {
* @param $cellpadding (float) Internal cell padding, if empty uses default cell padding.
* @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
0: no border (default)
1: frame
or a string containing some or all of the following characters (in any order):
L: left
T: top
R: right
B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
* @return float Return the minimal height needed for multicell method for printing the $txt param.
- * @author Alexander Escalona Fernández, Nicola Asuni
+ * @author Alexander Escalona Fern�ndez, Nicola Asuni
* @public
* @since 4.5.011
*/
@@ -6230,7 +6230,7 @@ class TCPDF {
* @param $cellpadding (float) Internal cell padding, if empty uses default cell padding.
* @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
0: no border (default)
1: frame
or a string containing some or all of the following characters (in any order):
L: left
T: top
R: right
B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
* @return float Return the minimal height needed for multicell method for printing the $txt param.
- * @author Nicola Asuni, Alexander Escalona Fernández
+ * @author Nicola Asuni, Alexander Escalona Fern�ndez
* @public
*/
public function getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellpadding='', $border=0) {
@@ -11442,7 +11442,7 @@ class TCPDF {
}
/**
- * Append a cubic Bézier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bézier control points.
+ * Append a cubic B�zier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the B�zier control points.
* The new current point shall be (x3, y3).
* @param $x1 (float) Abscissa of control point 1.
* @param $y1 (float) Ordinate of control point 1.
@@ -11460,7 +11460,7 @@ class TCPDF {
}
/**
- * Append a cubic Bézier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bézier control points.
+ * Append a cubic B�zier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the B�zier control points.
* The new current point shall be (x3, y3).
* @param $x2 (float) Abscissa of control point 2.
* @param $y2 (float) Ordinate of control point 2.
@@ -11476,7 +11476,7 @@ class TCPDF {
}
/**
- * Append a cubic Bézier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bézier control points.
+ * Append a cubic B�zier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the B�zier control points.
* The new current point shall be (x3, y3).
* @param $x1 (float) Abscissa of control point 1.
* @param $y1 (float) Ordinate of control point 1.
@@ -12271,7 +12271,7 @@ class TCPDF {
/**
* Insert Named Destinations.
* @protected
- * @author Johannes Güntert, Nicola Asuni
+ * @author Johannes G�ntert, Nicola Asuni
* @since 5.9.098 (2011-06-23)
*/
protected function _putdests() {
@@ -12499,7 +12499,7 @@ class TCPDF {
* Adds a javascript
* @param $script (string) Javascript code
* @public
- * @author Johannes Güntert, Nicola Asuni
+ * @author Johannes G�ntert, Nicola Asuni
* @since 2.1.002 (2008-02-12)
*/
public function IncludeJS($script) {
@@ -12528,7 +12528,7 @@ class TCPDF {
/**
* Create a javascript PDF string.
* @protected
- * @author Johannes Güntert, Nicola Asuni
+ * @author Johannes G�ntert, Nicola Asuni
* @since 2.1.002 (2008-02-12)
*/
protected function _putjavascript() {
@@ -13414,7 +13414,7 @@ class TCPDF {
* @param $private_key (mixed) private key (string or filename prefixed with 'file://')
* @param $private_key_password (string) password
* @param $extracerts (string) specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.
- * @param $cert_type (int) The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature.
+ * @param $cert_type (int) The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page Templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature.
* @param $info (array) array of option information: Name, Location, Reason, ContactInfo.
* @public
* @author Nicola Asuni
@@ -14174,7 +14174,7 @@ class TCPDF {
* @param $col1 (array) first color (Grayscale, RGB or CMYK components).
* @param $col2 (array) second color (Grayscale, RGB or CMYK components).
* @param $coords (array) array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
- * @author Andreas Würmser, Nicola Asuni
+ * @author Andreas W�rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09)
* @public
*/
@@ -14192,7 +14192,7 @@ class TCPDF {
* @param $col1 (array) first color (Grayscale, RGB or CMYK components).
* @param $col2 (array) second color (Grayscale, RGB or CMYK components).
* @param $coords (array) array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined.
- * @author Andreas Würmser, Nicola Asuni
+ * @author Andreas W�rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09)
* @public
*/
@@ -14215,7 +14215,7 @@ class TCPDF {
* @param $coords_min (array) minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0
* @param $coords_max (array) maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1
* @param $antialias (boolean) A flag indicating whether to filter the shading function to prevent aliasing artifacts.
- * @author Andreas Würmser, Nicola Asuni
+ * @author Andreas W�rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09)
* @public
*/
@@ -14307,7 +14307,7 @@ class TCPDF {
* @param $y (float) ordinate of the top left corner of the rectangle.
* @param $w (float) width of the rectangle.
* @param $h (float) height of the rectangle.
- * @author Andreas Würmser, Nicola Asuni
+ * @author Andreas W�rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09)
* @protected
*/
@@ -21301,13 +21301,13 @@ if (! $size) $size = 10;
}
/**
- * Output a Table Of Content Index (TOC) using HTML templates.
+ * Output a Table Of Content Index (TOC) using HTML Templates.
* This method must be called after all Bookmarks were set.
* Before calling this method you have to open the page using the addTOCPage() method.
* After calling this method you have to call endTOCPage() to close the TOC page.
* @param $page (int) page number where this TOC should be inserted (leave empty for current page).
* @param $toc_name (string) name to use for TOC bookmark.
- * @param $templates (array) array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number.
+ * @param $templates (array) array of html Templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number.
* @param $correct_align (boolean) if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL)
* @param $style (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic.
* @param $color (array) RGB color array for title (values from 0 to 255).
@@ -21352,7 +21352,7 @@ if (! $size) $size = 10;
}
$maxpage = max($maxpage, $outline['p']);
}
- // replace templates with current values
+ // replace Templates with current values
$row = str_replace('#TOC_DESCRIPTION#', $outline['t'], $row);
$row = str_replace('#TOC_PAGE_NUMBER#', $pagenum, $row);
// add link to page
@@ -23300,7 +23300,7 @@ if (! $size) $size = 10;
}
break;
}
- case 'Q': { // quadratic Bézier curveto
+ case 'Q': { // quadratic B�zier curveto
foreach ($params as $ck => $cp) {
$params[$ck] = $cp;
if ((($ck + 1) % 4) == 0) {
@@ -23326,7 +23326,7 @@ if (! $size) $size = 10;
}
break;
}
- case 'T': { // shorthand/smooth quadratic Bézier curveto
+ case 'T': { // shorthand/smooth quadratic B�zier curveto
foreach ($params as $ck => $cp) {
$params[$ck] = $cp;
if (($ck % 2) != 0) {
diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php
index 6996fc7eb..46d5cd6ac 100644
--- a/modules/monitoring/application/controllers/ListController.php
+++ b/modules/monitoring/application/controllers/ListController.php
@@ -10,6 +10,7 @@ use Icinga\Web\Widget\Tabs;
class Monitoring_ListController extends ModuleActionController
{
protected $backend;
+ private $compactView = null;
public function init()
{
@@ -23,6 +24,7 @@ class Monitoring_ListController extends ModuleActionController
public function hostsAction()
{
Benchmark::measure("hostsAction::query()");
+ $this->compactView = "hosts-compact";
$this->view->hosts = $this->query(
'status',
array(
@@ -192,6 +194,10 @@ class Monitoring_ListController extends ModuleActionController
protected function handleFormatRequest($query)
{
+ if ($this->compactView !== null && $this->_getParam("view", false) === "compact") {
+ $this->_helper->viewRenderer($this->compactView);
+ }
+
if ($this->_getParam('format') === 'sql') {
echo '
diff --git a/modules/monitoring/test/php/testlib/datasource/strategies/StatusdatInsertionStrategy.php b/modules/monitoring/test/php/testlib/datasource/strategies/StatusdatInsertionStrategy.php
index 840e83ed1..2d1d1ec6f 100644
--- a/modules/monitoring/test/php/testlib/datasource/strategies/StatusdatInsertionStrategy.php
+++ b/modules/monitoring/test/php/testlib/datasource/strategies/StatusdatInsertionStrategy.php
@@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/../schemes/StatusdatTemplates.php');
* to according objects.cache and status.dat files which then can be read
* by the Statusdat parser and used in tests.
*
- * The templates for insertion can be found under schemes/objectsCacheTemplates.php
+ * The Templates for insertion can be found under schemes/objectsCacheTemplates.php
* and schemes/StatusdatTempaltes.php
*
*/
diff --git a/public/js/icinga/container.js b/public/js/icinga/container.js
index ce9c4031b..ec1dc21bf 100755
--- a/public/js/icinga/container.js
+++ b/public/js/icinga/container.js
@@ -71,12 +71,13 @@
};
this.loadAsyncContainers = function(root) {
- $('.icinga-container[icinga-url]',root).each(function() {
+ $('.icinga-container[icingaurl]',root).each(function() {
var el = $(this);
- var url = el.attr('icinga-url');
+ var url = el.attr('icingaurl');
el.attr('loaded',true);
async.loadToTarget(el,url);
});
+ log.debug("Loading async");
};
this.initializeContainers = function(root) {