From: Michael Wiebusch <stratomaster@gmx.net> Date: Thu, 1 Aug 2013 16:08:52 +0000 (+0200) Subject: added a nice error picture, testgui should now be able to actualize all sensors at... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=3cafb23eca40ae88d0d2d4cc77762ce4673595ac;p=mvdsensorcontrol.git added a nice error picture, testgui should now be able to actualize all sensors at once --- diff --git a/tools/preview/error.jpg b/tools/preview/error.jpg new file mode 100644 index 0000000..333b554 Binary files /dev/null and b/tools/preview/error.jpg differ diff --git a/tools/testgui.js b/tools/testgui.js index a6d530d..55f0ba7 100644 --- a/tools/testgui.js +++ b/tools/testgui.js @@ -1,8 +1,9 @@ - - - - +// var sensorIdHash = new Object(); + + + + function reloadQuickEditArea(configFile,destId) { var configFile_ = encodeURIComponent(configFile); @@ -10,4 +11,18 @@ function reloadQuickEditArea(configFile,destId) { getdata("testgui.pl?action=print_quickEditArea&configFile="+configFile_+"&destId="+destId_,destId,"false"); } - \ No newline at end of file + + + +function run(time) { +// sensorIdHash["hugo"]="hugo"; +// sensorIdHash["hugo2"]="hugonaut"; + + getdata("run.pl","","false"); + var sensorId; + for( sensorId in previewAreaIdHash){ +// alert(laufid+" => "+previewAreaIdHash[laufid]); + var sensorId_ = encodeURIComponent(sensorId); + getdata("testgui.pl?action=showPlot&sensorId="+sensorId_,previewAreaIdHash[sensorId],"false"); + } +} \ No newline at end of file diff --git a/tools/testgui.pl b/tools/testgui.pl index ba2f248..f3c38e9 100755 --- a/tools/testgui.pl +++ b/tools/testgui.pl @@ -37,6 +37,8 @@ my $setupTree; my $sensorAreaId; my $quickEditAreaId; +my %previewAreaIdHash; + ####################### @@ -59,6 +61,15 @@ unless($q->param()) { my $destId = $q->param('destId'); $quickEditAreaId = $destId; print_quickEditArea($configFileName); + } elsif ($q->param('action') eq "showPlot") { + + my $sensorId = $q->param('sensorId'); + my $imgSrc = './preview/image_recalibrated_'.$sensorId.'.png'; + if (-e $imgSrc) { + print img{src=>$imgSrc."?".rand(),title=>$sensorId}; + } else { + print img{src=>"./preview/error.jpg",title=>$sensorId}; + } } else { print start_html( @@ -137,6 +148,19 @@ print h2("testgui"); # print_quickEditArea("0.xml"); # print "</div>"; print_setupStructure(); +print q%<input type='button' onClick='run(0.2)' value='run'>%; + + + + +print "<script language='javascript'>\n"; + +print "var previewAreaIdHash = new Object();\n"; +for my $sensorId (keys %previewAreaIdHash){ + print "previewAreaIdHash[\"$sensorId\"]=\"".$previewAreaIdHash{$sensorId}."\";\n"; +} +print "</script>"; + print end_html; @@ -231,6 +255,7 @@ sub print_sensorArea { my $sensorPosition = $sensor->findnodes("./position")->shift(); my $sensorDescription = $sensor->findvalue("./description"); + $sensorAreaId = $sensorId; print "<div class='sensorAreaDiv' id='".$sensorAreaId."'>"; print "<table class='sensorAreaTable'>"; @@ -239,22 +264,22 @@ sub print_sensorArea { print "</tr>"; print "<tr>"; my $previewAreaId = "preview_".$sensorId; - print "<td id='".$previewAreaId."' class='previewArea' > [not run yet!] </td>"; + print "<td id='".$previewAreaId."' class='previewArea'> [not run yet!] </td>"; $quickEditAreaId = "quickEdit_".$sensorId; print "<td id='".$quickEditAreaId."' class='quickEditArea'>"; print_quickEditArea($sensorConfig); print "</td>"; print "</tr>"; - print "<tr>"; - print "<td colspan=2 align='right'>"; - my $command = "./prevImg.pl"; - print q%<input type='button' onClick='getdata("%.$command.q%","%.$previewAreaId.q%","true")' value='run'>%; - print "</td>"; - print "</tr>"; - print "<table>"; +# print "<tr>"; +# print "<td colspan=2 align='right'>"; +# my $command = "./prevImg.pl"; +# print q%<input type='button' onClick='getdata("%.$command.q%","%.$previewAreaId.q%","true")' value='run'>%; +# print "</td>"; +# print "</tr>"; + print "</table>"; print "</div>"; - + $previewAreaIdHash{$sensorId}=$previewAreaId; } # description the block that is printed for each sensor, # containing the preview plot and the quick edit area