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

View File

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

View File

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