aboutsummaryrefslogtreecommitdiffstats
path: root/config/nut
diff options
context:
space:
mode:
authorAndrew Nikitin <andrey.b.nikitin@gmail.com>2015-10-24 23:29:16 +0500
committerAndrew Nikitin <andrey.b.nikitin@gmail.com>2015-10-24 23:29:16 +0500
commita75d28b2c102d42a8323e4ac10d17c49a22c3c99 (patch)
tree62ed3422e166d28606a21858a2fcc4a21e79ba6d /config/nut
parent803374f514759fa795a9e21eb5b2610385ff7b95 (diff)
parent5757a6d0b3ae5da610c986776c622bd50f131c59 (diff)
downloadpfsense-packages-a75d28b2c102d42a8323e4ac10d17c49a22c3c99.tar.gz
pfsense-packages-a75d28b2c102d42a8323e4ac10d17c49a22c3c99.tar.bz2
pfsense-packages-a75d28b2c102d42a8323e4ac10d17c49a22c3c99.zip
Merge pull request #1 from doktornotor/patch-5
nut package widget fixes
Diffstat (limited to 'config/nut')
-rw-r--r--config/nut/nut.xml14
-rw-r--r--config/nut/ups_status.inc10
-rw-r--r--config/nut/ups_status.js14
-rw-r--r--config/nut/ups_status.widget.php31
4 files changed, 33 insertions, 36 deletions
diff --git a/config/nut/nut.xml b/config/nut/nut.xml
index ca7ca956..e066bc83 100644
--- a/config/nut/nut.xml
+++ b/config/nut/nut.xml
@@ -41,7 +41,7 @@
]]>
</copyright>
<name>nut</name>
- <version>2.0.5</version>
+ <version>2.1.1</version>
<title>Services: NUT</title>
<savetext>Change</savetext>
<aftersaveredirect>/status_nut.php</aftersaveredirect>
@@ -77,6 +77,18 @@
<prefix>/usr/local/www/</prefix>
<item>https://packages.pfsense.org/packages/config/nut/status_nut.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/widgets/widgets/</prefix>
+ <item>https://packages.pfsense.org/packages/config/nut/ups_status.widget.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/widgets/javascript/</prefix>
+ <item>https://packages.pfsense.org/packages/config/nut/ups_status.js</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/widgets/include/</prefix>
+ <item>https://packages.pfsense.org/packages/config/nut/ups_status.inc</item>
+ </additional_files_needed>
<advanced_options>enabled</advanced_options>
<fields>
<field>
diff --git a/config/nut/ups_status.inc b/config/nut/ups_status.inc
index ee6280f9..8953ff94 100644
--- a/config/nut/ups_status.inc
+++ b/config/nut/ups_status.inc
@@ -1,14 +1,6 @@
<?php
-/*
- $Id: ups_status.inc
- File location:
- \usr\local\www\widgets\include\
- Used by:
- \usr\local\www\widgets\widgets\ups_status.widget.php
-*/
-
-//set variable for custom title
+// set variable for custom title
$ups_status_title = "UPS Status";
$ups_status_title_link = "status_nut.php";
diff --git a/config/nut/ups_status.js b/config/nut/ups_status.js
index 98a27a9e..4c64498f 100644
--- a/config/nut/ups_status.js
+++ b/config/nut/ups_status.js
@@ -1,10 +1,9 @@
/*
- $Id: ups_status.js
-
- File location:
- \usr\local\www\widgets\javascript\
- Used by:
- \usr\local\www\widgets\widgets\ups_status.widget.php
+ ups_status.js
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2015 SunStroke <andrey.b.nikitin@gmail.com>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -27,7 +26,6 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
//should be called from "ups_status.widget.php"
function showUPSData() {
@@ -46,7 +44,7 @@ function showUPSData() {
updateUPSWidgetContent("Error getting data from [ups_status.widget.php]");
}
});
-
+
//call itself in 11 seconds
window.setTimeout(showUPSData, 11000);
}
diff --git a/config/nut/ups_status.widget.php b/config/nut/ups_status.widget.php
index dade23d6..f2a766e1 100644
--- a/config/nut/ups_status.widget.php
+++ b/config/nut/ups_status.widget.php
@@ -1,24 +1,20 @@
<?php
/*
- $Id: ups_status.widget.php
-
+ ups_status.widget.php
+ part of pfSense (https://www.pfsense.org/)
Copyright (C) 2015 SunStroke <andrey.b.nikitin@gmail.com>
-
- File location:
- \usr\local\www\widgets\widgets\
- Depends on:
- \usr\local\www\widgets\javascript\ups_status.js
- \usr\local\www\widgets\include\ups_status.inc
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -30,16 +26,15 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
- */
-
+*/
require_once("guiconfig.inc"); // NOTE: maybe not needed (no GUI settings)? Remove if so.
require_once("/usr/local/www/widgets/include/ups_status.inc");
//called by showUPSData() (jQuery Ajax call) in ups_status.js
if (isset($_GET["getUPSData"])) {
- //get UPS data and return it in ajax response
- echo getUPSData();
- return;
+ //get UPS data and return it in ajax response
+ echo getUPSData();
+ return;
}
function getUPSData() {
@@ -142,8 +137,8 @@ function getUPSData() {
if ($secs < 0 || $secs == "") {
$data .= ":" . gettext("n/a");
} else {
- $m = (int)($secs / 60);
- $h = (int)($m / 60) % 24;
+ $m = (int)($secs / 60);
+ $h = (int)($m / 60) % 24;
$m = $m % 60;
$s = $secs % 60;
$data .= ":" . $h."h " . $m."m " . $s."s";