mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
allow multiple icons to be defined per OS, let user select one in the device settings
git-svn-id: http://www.observium.org/svn/observer/trunk@3146 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -12,6 +12,12 @@ if ($_SESSION['userlevel'] < '7')
|
||||
$panes['device'] = 'Device Settings';
|
||||
$panes['snmp'] = 'SNMP';
|
||||
$panes['ports'] = 'Port Settings';
|
||||
|
||||
if (count($config['os'][$device['os']]['icons']))
|
||||
{
|
||||
$panes['icon'] = 'Icon';
|
||||
}
|
||||
|
||||
$panes['apps'] = 'Applications';
|
||||
$panes['alerts'] = 'Alerts';
|
||||
$panes['modules'] = 'Modules';
|
||||
|
@@ -6,11 +6,6 @@ if ($_POST['editing'])
|
||||
{
|
||||
$updated = 0;
|
||||
|
||||
$descr = mres($_POST['descr']);
|
||||
$ignore = mres($_POST['ignore']);
|
||||
$type = mres($_POST['type']);
|
||||
$disabled = mres($_POST['disabled']);
|
||||
|
||||
$override_sysLocation_bool = mres($_POST['override_sysLocation']);
|
||||
if (isset($_POST['sysLocation'])) { $override_sysLocation_string = mres($_POST['sysLocation']); }
|
||||
|
||||
|
84
html/pages/device/edit/icon.inc.php
Normal file
84
html/pages/device/edit/icon.inc.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
if ($_POST['editing'])
|
||||
{
|
||||
if ($_SESSION['userlevel'] > "7")
|
||||
{
|
||||
$param = array('icon' => $_POST['icon']);
|
||||
|
||||
$rows_updated = dbUpdate($param, 'devices', '`device_id` = ?', array($device['device_id']));
|
||||
|
||||
if ($rows_updated > 0 || $updated)
|
||||
{
|
||||
$update_message = "Device icon updated.";
|
||||
$updated = 1;
|
||||
$device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id']));
|
||||
} elseif ($rows_updated = '-1') {
|
||||
$update_message = "Device icon unchanged. No update necessary.";
|
||||
$updated = -1;
|
||||
} else {
|
||||
$update_message = "Device icon update error.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
include("includes/error-no-perm.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($updated && $update_message)
|
||||
{
|
||||
print_message($update_message);
|
||||
} elseif ($update_message) {
|
||||
print_error($update_message);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h3>Device icon</h3>
|
||||
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<form id="edit" name="edit" method="post" action="">
|
||||
<input type="hidden" name="editing" value="yes">
|
||||
<table border="0">
|
||||
<?php
|
||||
|
||||
$numicons = 1;
|
||||
echo(" <tr>\n");
|
||||
|
||||
# Default icon
|
||||
$icon = $config['os'][$device['os']]['icon'];
|
||||
echo(' <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />');
|
||||
echo('<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == '' || $device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n");
|
||||
|
||||
for ($i = 0;$i < count($config['os'][$device['os']]['icons']);$i++)
|
||||
{
|
||||
$icon = $config['os'][$device['os']]['icons'][$i];
|
||||
echo(' <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />');
|
||||
echo('<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n");
|
||||
}
|
||||
|
||||
|
||||
if ($numicons %10 == 0)
|
||||
{
|
||||
echo(" </tr>\n");
|
||||
echo(" <tr>\n");
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="10">
|
||||
<br />
|
||||
<input type="submit" name="Submit" value="Save" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
</form>
|
||||
</td>
|
||||
<td width="50"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $debug;
|
||||
|
||||
if ($config['enable_printers'])
|
||||
{
|
||||
$valid_toner = array();
|
||||
|
@@ -671,6 +671,7 @@ $config['os'][$os]['over'][0]['text'] = "Temperature";
|
||||
$config['os'][$os]['over'][1]['graph'] = "device_humidity";
|
||||
$config['os'][$os]['over'][1]['text'] = "Humidity";
|
||||
$config['os'][$os]['icon'] = "carel";
|
||||
$config['os'][$os]['icons'][] = "uniflair";
|
||||
|
||||
$os = "netvision";
|
||||
$config['os'][$os]['text'] = "Socomec Net Vision";
|
||||
|
Reference in New Issue
Block a user