mirror of
https://github.com/unraid/webgui.git
synced 2026-02-07 01:19:08 -06:00
Allow images and font-awesome icons in titles and panels
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Title="Add {$_GET['template']} VM"
|
||||
Png="addvm.png"
|
||||
Tag="clipboard"
|
||||
Cond="(pgrep('libvirtd')!==false)"
|
||||
Markdown="false"
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Menu="NetworkSettings:100"
|
||||
Title="Interface eth0"
|
||||
Png="ethernet.png"
|
||||
Tag="tag"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Menu="parentname:nnn"
|
||||
Title="Interface ethX"
|
||||
Png="ethernet.png"
|
||||
Tag="tag"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
Menu="SMB:2"
|
||||
Title="SMB Extras"
|
||||
Cond="($var['shareSMBEnabled']!='no')"
|
||||
Png="smbsettings.png"
|
||||
Tag="share-alt-square"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2016, Lime Technology
|
||||
* Copyright 2016, Bergware International.
|
||||
/* Copyright 2017, Lime Technology
|
||||
* Copyright 2017, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
|
||||
@@ -339,13 +339,13 @@ foreach ($pages as $page) {
|
||||
eval("\$title=\"".htmlspecialchars($page['Title'])."\";");
|
||||
if ($tabbed) {
|
||||
echo "<div class='tab'><input type='radio' id='tab{$tab}' name='tabs' onclick='settab(this.id)'><label for='tab{$tab}'>";
|
||||
echo tab_title($title,$page['root'],isset($page['Png'])?$page['Png']:false);
|
||||
echo tab_title($title,$page['root'],$page['Tag']??false);
|
||||
echo "</label><div class='content'>";
|
||||
$close = true;
|
||||
} else {
|
||||
if ($tab==1) echo "<div class='tab'><input type='radio' id='tab{$tab}' name='tabs'><div class='content shift'>";
|
||||
echo "<div id='title'><span class='left'>";
|
||||
echo tab_title($title,$page['root'],isset($page['Png'])?$page['Png']:false);
|
||||
echo tab_title($title,$page['root'],$page['Tag']??false);
|
||||
echo "</span></div>";
|
||||
}
|
||||
$tab++;
|
||||
@@ -355,12 +355,19 @@ foreach ($pages as $page) {
|
||||
foreach ($pgs as $pg) {
|
||||
@eval("\$title=\"".htmlspecialchars($pg['Title'])."\";");
|
||||
$link = "$path/{$pg['name']}";
|
||||
if ($icon = isset($pg['Icon'])) {
|
||||
$icon = "{$pg['root']}/images/{$pg['Icon']}";
|
||||
if (!file_exists($icon)) { $icon = "{$pg['root']}/{$pg['Icon']}"; if (!file_exists($icon)) $icon = false; }
|
||||
$icon = $pg['Icon'] ?? false;
|
||||
if ($icon) {
|
||||
if (substr($icon,-4)=='.png') {
|
||||
$icon = "{$pg['root']}/images/$icon";
|
||||
if (!file_exists($icon)) {$icon = "{$pg['root']}/$icon"; if (!file_exists($icon)) $icon = '/webGui/images/default.png';}
|
||||
$icon = "<img class=\"PanelImg\" src=\"$icon\">";
|
||||
} else {
|
||||
$icon = "<i class='PanelIcon fa fa-$icon'></i>";
|
||||
}
|
||||
} else {
|
||||
$icon = "<img class=\"PanelImg\" src=\"/webGui/images/default.png\">";
|
||||
}
|
||||
if (!$icon) $icon = "/webGui/images/default.png";
|
||||
echo "<div class=\"Panel\"><a href=\"$link\" onclick=\"$.cookie('one','tab1',{path:'/'})\"><img class=\"PanelImg\" src=\"$icon\"><br><div class=\"PanelText\">$title</div></a></div>";
|
||||
echo "<div class=\"Panel\"><a href=\"$link\" onclick=\"$.cookie('one','tab1',{path:'/'})\">$icon<div class=\"PanelText\">$title</div></a></div>";
|
||||
}
|
||||
}
|
||||
$text = $page['text'];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2012-2017, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -66,11 +66,15 @@ function find_pages($item) {
|
||||
return $pages;
|
||||
}
|
||||
|
||||
function tab_title($text,$path,$png) {
|
||||
function tab_title($name,$path,$tag) {
|
||||
global $docroot;
|
||||
$file = "$path/icons/".($png ? $png : strtolower(str_replace(' ','',$text)).".png");
|
||||
if (!file_exists("$docroot/$file")) $file = "webGui/icons/default.png";
|
||||
return "<img src='/$file' class='icon'>".htmlspecialchars(my_disk($text));
|
||||
if (!$tag || substr($tag,-4)=='.png') {
|
||||
$file = "$path/icons/".($tag ?: strtolower(str_replace(' ','',$name)).".png");
|
||||
if (!file_exists("$docroot/$file")) $file = 'webGui/icons/default.png';
|
||||
return "<img src='/$file' class='icon'>".htmlspecialchars(my_disk($name));
|
||||
} else {
|
||||
return "<i class='title fa fa-$tag'></i>".htmlspecialchars(my_disk($name));
|
||||
}
|
||||
}
|
||||
|
||||
// hack to embed function output in a quoted string (e.g., in a page Title)
|
||||
|
||||
Reference in New Issue
Block a user