From 1275405ab1410ce0cc9fde0b8e3276ae0a2c9752 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Mon, 14 Sep 2015 16:31:17 +0200 Subject: [PATCH] adding comment box to sensors --- sensors/style.css | 6 ++++++ sensors/update.pl | 26 ++++++++++++++++---------- sensors/writeconfig.pl | 4 ++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/sensors/style.css b/sensors/style.css index 9d891b2..d03c16f 100644 --- a/sensors/style.css +++ b/sensors/style.css @@ -106,3 +106,9 @@ input { top:10px; right:50px; } + +.sensor .comment { + width:200px; + background:#fff; + box-shadow:none; + } diff --git a/sensors/update.pl b/sensors/update.pl index 75e5dfb..722f942 100755 --- a/sensors/update.pl +++ b/sensors/update.pl @@ -4,6 +4,7 @@ print "Content-Type: text/html; charset=utf-8\r\n\r\n"; use warnings; use strict; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +use URI::Escape; use CGI; use utf8; use POSIX; @@ -119,18 +120,23 @@ my $cfile = "config/default.conf"; open(my $cdata, '<', $cfile) or die "Could not open '$cfile' $!\n"; while (my $line = <$cdata>) { $line =~ s/#.*//; - my @f = split(" " , $line); + my @f = split(" " , $line,5); if(defined $f[3]) { $f[4] = $f[4] || ''; - my $val = '--.--'; - $val = sprintf('%02.2f',$values->[$f[0]*8+$f[1]]) if defined $values->[$f[0]*8+$f[1]]; - print " -
[$f[0]*8+$f[1]],$min,$max)."\"> -
$val
-
$f[0].$f[1]
-
$f[4]
-
- ";##/($count->[$f[0]*8+$f[1]]||0) + if($f[0] != 99) { + my $val = '--.--'; + $val = sprintf('%02.2f',$values->[$f[0]*8+$f[1]]) if defined $values->[$f[0]*8+$f[1]]; + print " +
[$f[0]*8+$f[1]],$min,$max)."\"> +
$val
+
$f[0].$f[1]
+
".uri_unescape($f[4])."
+
+ ";##/($count->[$f[0]*8+$f[1]]||0) + } + else { + print "
".uri_unescape($f[4])."
"; + } } } diff --git a/sensors/writeconfig.pl b/sensors/writeconfig.pl index b99e9d4..4a3ca06 100755 --- a/sensors/writeconfig.pl +++ b/sensors/writeconfig.pl @@ -11,7 +11,7 @@ use Data::Dumper; my $str = $ENV{'QUERY_STRING'}; my @new = split(',', $str); $str =~ s/,/\t\t\t\t/g; - +print join('-', @new); my $out = ""; my $cfile = "config/default.conf"; @@ -36,4 +36,4 @@ close($cdata); open($cdata, '>', $cfile) or die "Could not open '$cfile' $!\n"; print $cdata $out; close($cdata); - \ No newline at end of file + -- 2.43.0