From ca4a6c35848b8c44b849cb3bd45994362996c938 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Sat, 10 Aug 2013 16:52:14 +0200 Subject: [PATCH] few pieces of information in status gui --- layout/jtageditor_blue.css | 5 ++--- scripts/scripts.js | 29 +++++++++++++++++++++++++++++ tools/getdata.js | 3 +++ tools/statusgui.pl | 36 +++++++++++++++++++++++++++++------- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/layout/jtageditor_blue.css b/layout/jtageditor_blue.css index f0706af..036fe47 100644 --- a/layout/jtageditor_blue.css +++ b/layout/jtageditor_blue.css @@ -70,8 +70,7 @@ input:hover, input:active, input:focus, select:hover, select:active { background:#eed; } -.stdbutton -{ +.stdbutton, input.stdbutton:active, input.stdbutton:focus { width:100px; height:25px; background:#dde; @@ -82,7 +81,7 @@ background:#eed; transition: background .4s; } -.stdbutton:hover { +input.stdbutton:hover { background:#eed; } diff --git a/scripts/scripts.js b/scripts/scripts.js index 5fb6966..dfdf5a4 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -15,6 +15,35 @@ function getdata(command,callback) { xmlhttp.open("GET",command,true); xmlhttp.send(null); } + + +function getdataprint(command,dId,async) { + //async==true : do what you can when you can do it :D + //async==false : do the task after you finished the previous task! + + // super duper debug line! +// alert("caller is " + arguments.callee.caller.toString()); + + var xmlhttp = null; + //var cb = null; + xmlhttp=new XMLHttpRequest(); + //cb = callback; + var destId = dId; + + xmlhttp.onreadystatechange = function() { + if(xmlhttp.readyState == 4 && xmlhttp.status==200) { + //if(cb) + if(document.getElementById(destId)){ + document.getElementById(destId).innerHTML = xmlhttp.responseText; + } + //cb(xmlhttp.responseText); + //document.getElementById(destId).innerHTML = xmlhttp.responseText; + } + } + + xmlhttp.open("GET",command,async); + xmlhttp.send(null); + } function SciNotation(v) { diff --git a/tools/getdata.js b/tools/getdata.js index 7a33b4c..4578c85 100644 --- a/tools/getdata.js +++ b/tools/getdata.js @@ -1,3 +1,6 @@ +//copied this function to ../scripts/scripts.js to keep everything in one place. Use it if you like. Jan 10.08.2013 + + function getdata(command,dId,async) { //async==true : do what you can when you can do it :D //async==false : do the task after you finished the previous task! diff --git a/tools/statusgui.pl b/tools/statusgui.pl index a09ead6..5c88111 100755 --- a/tools/statusgui.pl +++ b/tools/statusgui.pl @@ -13,7 +13,7 @@ use Environment; my $configFile = SETUPFILE; - +my $setup; my ($command,$style) = split("-",$ENV{'QUERY_STRING'}); @@ -26,8 +26,10 @@ $style = "" unless defined $style; my $isErrors = $command eq "errors"; -if($isSetup && $style eq "only") {readConfig($configFile,1);} -else {initPage();} +if($isSetup && $style eq "only") {readConfig($configFile,1);} +elsif($isStatus && $style eq "only") {readConfig($configFile,0); + getStatus();} +else {initPage();} @@ -44,12 +46,13 @@ sub readConfig { my $ctrlname = $curctrl->getAttribute('name'); my $ctrlid = $curctrl->getAttribute('id'); my $ctrladdr = $curctrl->getAttribute('address'); - + $setup->{$ctrlname}->{addr} = $ctrladdr; printf("
  • Controller %i ($ctrlname) 0x%s\n",$ctrlid,$ctrladdr) if $write; print("