aboutsummaryrefslogtreecommitdiffstats
path: root/packages/nut
diff options
context:
space:
mode:
authorRyan Wagoner <rsw686@pfsense.org>2007-02-16 16:27:37 +0000
committerRyan Wagoner <rsw686@pfsense.org>2007-02-16 16:27:37 +0000
commit936e4e2958efef52d4ebb77f7ca78726d70b43ef (patch)
tree4fbcdf97331e6f6f4bd7e3926cd3d3b6f42a957f /packages/nut
parenta00c9bef6c042f15c59b29c55d7cd537c9f032ae (diff)
downloadpfsense-packages-936e4e2958efef52d4ebb77f7ca78726d70b43ef.tar.gz
pfsense-packages-936e4e2958efef52d4ebb77f7ca78726d70b43ef.tar.bz2
pfsense-packages-936e4e2958efef52d4ebb77f7ca78726d70b43ef.zip
-use strong tags in xml for required fields, this was done purposely instead of using the required tag as depending on the monitoring mode local/remote these fields may not be required, however on head you can't save package changes if all required fields are not filled out
-add support for more ups status conditions
Diffstat (limited to 'packages/nut')
-rw-r--r--packages/nut/nut.xml24
-rw-r--r--packages/nut/status_nut.php46
2 files changed, 43 insertions, 27 deletions
diff --git a/packages/nut/nut.xml b/packages/nut/nut.xml
index 9cdbec04..d775cec8 100644
--- a/packages/nut/nut.xml
+++ b/packages/nut/nut.xml
@@ -60,12 +60,12 @@
</options>
</field>
<field>
- <fielddescr>Local UPS Name</fielddescr>
+ <fielddescr>&lt;strong&gt;Local UPS Name&lt;/strong&gt;</fielddescr>
<fieldname>name</fieldname>
<type>input</type>
</field>
<field>
- <fielddescr>Local UPS Model</fielddescr>
+ <fielddescr>&lt;strong&gt;Local UPS Model&lt;/strong&gt;</fielddescr>
<fieldname>driver</fieldname>
<type>select</type>
<description>If generic or cable specified in parenthesis you need
@@ -350,7 +350,7 @@
</options>
</field>
<field>
- <fielddescr>Local UPS Port</fielddescr>
+ <fielddescr>&lt;strong&gt;Local UPS Port&lt;/strong&gt;</fielddescr>
<fieldname>port</fieldname>
<type>select</type>
<options>
@@ -361,7 +361,7 @@
</options>
</field>
<field>
- <fielddescr>Local UPS Generic Type (optional)</fielddescr>
+ <fielddescr>Local UPS Generic Type</fielddescr>
<fieldname>upstype</fieldname>
<type>select</type>
<options>
@@ -400,7 +400,7 @@
</options>
</field>
<field>
- <fielddescr>Local UPS Cable Type (optional)</fielddescr>
+ <fielddescr>Local UPS Cable Type</fielddescr>
<fieldname>cable</fieldname>
<type>select</type>
<options>
@@ -419,37 +419,37 @@
</options>
</field>
<field>
- <fielddescr>Local Remote Access Address &lt;br&gt;(ex: 192.168.1.0/24) (optional)</fielddescr>
+ <fielddescr>Local Remote Access Address &lt;br&gt;(ex: 192.168.1.0/24)</fielddescr>
<fieldname>allowaddr</fieldname>
<type>input</type>
</field>
<field>
- <fielddescr>Local Remote Access User (optional)</fielddescr>
+ <fielddescr>Local Remote Access User</fielddescr>
<fieldname>allowuser</fieldname>
<type>input</type>
</field>
<field>
- <fielddescr>Local Remote Acces Password (optional)</fielddescr>
+ <fielddescr>Local Remote Acces Password</fielddescr>
<fieldname>allowpass</fieldname>
<type>password</type>
</field>
<field>
- <fielddescr>Remote UPS Name</fielddescr>
+ <fielddescr>&lt;strong&gt;Remote UPS Name&lt;/strong&gt;</fielddescr>
<fieldname>remotename</fieldname>
<type>input</type>
</field>
<field>
- <fielddescr>Remote UPS Address &lt;br&gt;(ex: 192.168.1.10)</fielddescr>
+ <fielddescr>&lt;strong&gt;Remote UPS Address&lt;/strong&gt; &lt;br&gt;(ex: 192.168.1.10)</fielddescr>
<fieldname>remoteaddr</fieldname>
<type>input</type>
</field>
<field>
- <fielddescr>Remote UPS User</fielddescr>
+ <fielddescr>&lt;strong&gt;Remote UPS User&lt;/strong&gt;</fielddescr>
<fieldname>remoteuser</fieldname>
<type>input</type>
</field>
<field>
- <fielddescr>Remote UPS Password</fielddescr>
+ <fielddescr>&lt;strong&gt;Remote UPS Password&lt;/strong&gt;</fielddescr>
<fieldname>remotepass</fieldname>
<type>password</type>
</field>
diff --git a/packages/nut/status_nut.php b/packages/nut/status_nut.php
index 42d5979e..2d16c0ec 100644
--- a/packages/nut/status_nut.php
+++ b/packages/nut/status_nut.php
@@ -38,13 +38,13 @@ function tblrow ($name, $value) {
print(<<<EOD
<tr>
<td class="vncellreq" width="100px">{$name}</td>
- <td class="vtable">{$value}</td>
+ <td class="vtable">{$value}{$symbol}</td>
<tr>
EOD
."\n");
}
-function tblrowbar ($name, $value, $red, $yellow, $green) {
+function tblrowbar ($name, $value, $symbol, $red, $yellow, $green) {
$red = explode('-',$red);
$yellow = explode('-',$yellow);
$green = explode('-',$green);
@@ -71,8 +71,8 @@ function tblrowbar ($name, $value, $red, $yellow, $green) {
<td class="vncellreq" width="100px">{$name}</td>
<td class="vtable">
<div style="width: 125px; height: 12px; border-top: thin solid gray; border-bottom: thin solid gray;">
- <div style="width: {$value}%; height: 12px; background-color: {$bgcolor};">
- <div style="text-align: center; color: {$color}">{$value}%</div>
+ <div style="width: {$value}{$symbol}; height: 12px; background-color: {$bgcolor};">
+ <div style="text-align: center; color: {$color}">{$value}{$symbol}</div>
</div>
</div>
</td>
@@ -136,28 +136,44 @@ include("head.inc");
$status = explode(' ',$ups['ups.status']);
foreach($status as $condition) {
+ if($disp_status) $disp_status .= ', ';
switch ($condition) {
- case WAIT:
- $disp_status .= 'Waiting... ';
+ case 'WAIT':
+ $disp_status .= 'Waiting';
break;
- case OL:
- $disp_status .= 'On Line ';
+ case 'OL':
+ $disp_status .= 'On Line';
break;
- case OB:
- $disp_status .= 'On Battery ';
+ case 'OB':
+ $disp_status .= 'On Battery';
break;
- case LB:
- $disp_status .= 'Battery Low ';
+ case 'TRIM':
+ $disp_status .= 'SmartTrim';
break;
+ case 'BOOST':
+ $disp_status .= 'SmartBoost';
+ break;
+ case 'OVER':
+ $disp_status .= 'Overload';
+ break;
+ case 'LB':
+ $disp_status .= 'Battery Low';
+ break;
+ case 'RB':
+ $disp_status .= 'Replace Battery';
+ break;
+ case 'CAL':
+ $disp_status .= 'Calibration';
+ break;
default:
- $disp_status .= $condition.' ';
+ $disp_status .= $condition;
break;
}
}
tblrow('Status:',$disp_status);
- tblrowbar('Load:',$ups['ups.load'],'100-80','79-60','59-0');
- tblrowbar('Battery Charge:',$ups['battery.charge'],'0-29','30-79','80-100');
+ tblrowbar('Load:',$ups['ups.load'],'%','100-80','79-60','59-0');
+ tblrowbar('Battery Charge:',$ups['battery.charge'],'%','0-29','30-79','80-100');
tblrow('Battery Voltage:',$ups['battery.voltage'].'V');
tblrow('Input Voltage:',$ups['input.voltage'].'V');
tblrow('Output Voltage:',$ups['output.voltage'].'V');