Merge remote-tracking branch 'origin/master' into feature/livestatus-playground-4787

This commit is contained in:
Thomas Gelf 2014-11-16 18:07:18 +01:00
commit c0343a0dae
3 changed files with 15 additions and 9 deletions

View File

@ -85,7 +85,7 @@ class Tab extends AbstractWidget
*/ */
public function setIcon($icon) public function setIcon($icon)
{ {
if (is_string($icon)) { if (is_string($icon) && strpos($icon, '.') !== false) {
$icon = Url::fromPath($icon); $icon = Url::fromPath($icon);
} }
$this->icon = $icon; $this->icon = $icon;
@ -202,24 +202,30 @@ class Tab extends AbstractWidget
$classes[] = 'active'; $classes[] = 'active';
} }
$caption = $view->escape($this->title); $caption = $view->escape($this->title);
$tagParams = $this->tagParams;
if ($this->icon !== null) { if ($this->icon !== null) {
if (strpos($this->icon, '.') === false) { if (strpos($this->icon, '.') === false) {
$classes[] = 'icon-' . $this->icon; if (array_key_exists('class', $tagParams)) {
$tagParams['class'] .= ' icon-' . $this->icon;
} else {
$tagParams['class'] = 'icon-' . $this->icon;
}
} else { } else {
$caption = $view->img($this->icon, array('class' => 'icon')) . $caption; $caption = $view->img($this->icon, array('class' => 'icon')) . $caption;
} }
} }
if ($this->url !== null) { if ($this->url !== null) {
$this->url->overwriteParams($this->urlParams); $this->url->overwriteParams($this->urlParams);
$tagParams = ''; if ($tagParams !== null) {
if ($this->tagParams !== null) { $params = $view->propertiesToString($tagParams);
$tagParams = $view->propertiesToString($this->tagParams); } else {
$params = '';
} }
$tab = sprintf( $tab = sprintf(
'<a href="%s"%s>%s</a>', '<a href="%s"%s>%s</a>',
$this->url, $this->url,
$tagParams, $params,
$caption $caption
); );
} else { } else {

View File

@ -24,7 +24,7 @@ class DashboardAction implements Tabextension
$tabs->addAsDropdown( $tabs->addAsDropdown(
'dashboard', 'dashboard',
array( array(
'icon' => 'img/icons/dashboard.png', 'icon' => 'dashboard',
'title' => 'Add To Dashboard', 'title' => 'Add To Dashboard',
'url' => Url::fromPath('dashboard/addurl'), 'url' => Url::fromPath('dashboard/addurl'),
'urlParams' => array( 'urlParams' => array(

View File

@ -40,13 +40,13 @@ class OutputFormat implements Tabextension
self::TYPE_PDF => array( self::TYPE_PDF => array(
'name' => 'pdf', 'name' => 'pdf',
'title' => 'PDF', 'title' => 'PDF',
'icon' => 'img/icons/pdf.png', 'icon' => 'file-pdf',
'urlParams' => array('format' => 'pdf'), 'urlParams' => array('format' => 'pdf'),
), ),
self::TYPE_CSV => array( self::TYPE_CSV => array(
'name' => 'csv', 'name' => 'csv',
'title' => 'CSV', 'title' => 'CSV',
'icon' => 'img/icons/csv.png', 'icon' => 'file-excel',
'urlParams' => array('format' => 'csv') 'urlParams' => array('format' => 'csv')
), ),
self::TYPE_JSON => array( self::TYPE_JSON => array(