]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
added a setupFile selector to testgui.pl. the setup file is passed to startup.pl...
authorMichael Wiebusch <stratomaster@gmx.net>
Mon, 2 Dec 2013 19:47:30 +0000 (20:47 +0100)
committerMichael Wiebusch <stratomaster@gmx.net>
Mon, 2 Dec 2013 19:47:30 +0000 (20:47 +0100)
tools/run.pl
tools/testgui.js
tools/testgui.pl

index 2dfb8d33984355a4d9d1562d8763f9dde51ee180..bd30244ca9f8ac21b105c21ff178be596da3ac2d 100755 (executable)
@@ -17,7 +17,6 @@ use FindBin;
 use lib "$FindBin::Bin/..";
 use Environment;
 
-
 my $here = getcwd();
 
 my $runtime = 0.2;
@@ -38,6 +37,7 @@ if( $q->param('runtime') ) {
   $runtime = $q->param('runtime');
 }
 
+my $setupFile = $q->param('setupFile');
 # print escapeHTML("hallo<<<>>>&&&!!"),br;
 # print escapeHTML($here);
 # $ENV{'PATH'}=$ENV{'PATH'}.":/home/hadaq/bin";
@@ -54,11 +54,12 @@ unless(-e $picPath or mkdir $picPath) {
   die "Unable to create $picPath\n";
 }
 
-system("./startup.pl ".SETUPFILE);
+system("./startup.pl ".SETUPFILE);
 
 my $dummy;
 
-$dummy=qx"rm $dumpPath/te1*.hld 2>&1";
+$dummy =qx"./startup.pl $setupFile";
+$dummy.=qx"rm $dumpPath/te1*.hld 2>&1";
 $dummy.=qx"./preview/exec_evtbuild_t.pl -t $runtime -p $dumpPath 2>&1";
 $dummy.=qx"rm $dumpPath/temp.hld 2>&1";
 $dummy.=qx"mv $dumpPath/te1* $dumpPath/temp.hld 2>&1";
index 01b6ca9cf8c5c5571dee94dcb13efa0704917ab6..6400a59365ad026e0be83bffab679dfa86139fbb 100644 (file)
@@ -1,5 +1,8 @@
 
-
+function reloadSetup(setup) {
+  var setup_ = encodeURIComponent(setup);
+  window.location = 'testgui.pl?setup='+setup_;
+}
 
 
 function reloadQuickEditArea(configFile,destId) {
@@ -22,7 +25,8 @@ function run(time) {
   }
   
   var time_= encodeURIComponent(time);
-  getdata("run.pl?runtime="+time_,"theConsole",false);
+  var setupFile_ = encodeURIComponent(setupFile);
+  getdata("run.pl?runtime="+time_+"&setupFile="+setupFile_,"theConsole",false);
   
   for( var sensorId in previewAreaIdHash){
     var sensorId_ = encodeURIComponent(sensorId);
index eee8e857dcf8b89b750427b76859936bb6ce3c06..0ad9fc1f1d4c980c5a0b05c0453cf38a545b30c0 100755 (executable)
@@ -1,6 +1,9 @@
 #!/usr/bin/perl -w
 #print "Content-type: text/html\n\n";
-
+#TODO
+# TypeError: t is undefined
+# http://127.0.0.1/mvdsensorcontrol/tools/hideAndShow.js
+# Line 14
 
 my $me = "testgui.pl";
 
@@ -11,6 +14,7 @@ use POSIX;
 use CGI ':standard';
 use CGI::Carp qw(fatalsToBrowser);
 use HTML::Entities;
+use Widgets;
 require Common;
 require xmlOperations;
 require xmlRendering;
@@ -26,7 +30,9 @@ our $confDir  = CONFDIR;
 our $specDir  = SPECDIR;
 my $picPath= PICTUREPATHREL;
 # my $picPath   = PICTUREPATH;
-my $setupFile = SETUPFILE;
+# my $setupFile = SETUPFILE;
+my $setupFile;
+my $setupFileName;
 
 # the file that tells me what fields should be printed in the quick edit area
 # for each sensor
@@ -51,8 +57,10 @@ my $q = CGI->new;
 
 
 
-unless($q->param()) {
-  #if called without arguments, 
+if( not(defined($q->param())) or $q->param('setup') ) {
+  #if called without arguments, or given a definitive setup file
+  $setupFileName = $q->param('setup'); 
+  $setupFile = $setupDir."/".$setupFileName;
   init_html();
 } else {
 #####################################
@@ -116,56 +124,73 @@ sub parse_setupFile {
 
 sub init_html{
 
-print header;
-print start_html(
--title=>'testgui',
--style=>[{'src'=>'../layout/styles.css'},
-{'src'=>'../layout/jtageditor_blue.css'},
-{'src'=>'../layout/testgui.css'}
-],
--script=>[
-{ -type => 'text/javascript', -src => './testgui.js'},
-{ -type => 'text/javascript', -src => './hideAndShow.js'},
-{ -type => 'text/javascript', -src => './getdata.js'},
-{ -type => 'text/javascript', -src => './xmlOperations.js'}
-]
-);
-
-print_setupStructure();
-
-print "<p>";
-print "<table>";
-print "<tr>";
-print "<td>run for [s]</td>";
-print "</tr><tr>";
-print "<td>";
-print q%<input type='text' id='runtime' value='0.2'>%;
-print "</td><td>";
-print q%<input type='button' onClick='run(document.getElementById("runtime").value)' value='run'>%;
-print "</td><td>";
-
-
-
-# pass a list of sensor Ids to the javascript side
-# more precisely: a hash consisting of $sensorId=>$previewAreaId
-# so the javascript knows which placeholders to fill with actual plots
-print "<script language='javascript'>\n";
-print "var previewAreaIdHash = new Object();\n";
-for my $sensorId (keys %previewAreaIdHash){
-  print "previewAreaIdHash[\"$sensorId\"]=\"".$previewAreaIdHash{$sensorId}."\";\n";
-}
-print "</script>";
-# end of that story
+  print header;
+  print start_html(
+  -title=>'testgui',
+  -style=>[{'src'=>'../layout/styles.css'},
+  {'src'=>'../layout/jtageditor_blue.css'},
+  {'src'=>'../layout/testgui.css'}
+  ],
+  -script=>[
+  { -type => 'text/javascript', -src => './testgui.js'},
+  { -type => 'text/javascript', -src => './hideAndShow.js'},
+  { -type => 'text/javascript', -src => './getdata.js'},
+  { -type => 'text/javascript', -src => './xmlOperations.js'}
+  ]
+  );
+
+
+  my $setup_selector = fileSelector->new(
+      selected=>$setupFileName,
+      id=>"setupSelector",
+      name=>"setupSelectionDropdown",
+      onchange=>"reloadSetup(this.options[this.selectedIndex].text)"
+    );
+  $setup_selector->add_item(value=>'...');
+  $setup_selector->add_items_from_dir(dir=>$setupDir,ext=>"xml");
+  
+  print "<table><tr><td>";
+  print "chose setup: ";
+  print "</td><td>";
+  $setup_selector->print_html();
+  print "</td></tr></table>";
+  
+  print_setupStructure();
 
-print "<input type='button' value='show/hide debug output' onclick='toggleVis(\"theConsole\")'>";
+  print "<p>";
+  print "<table>";
+  print "<tr>";
+  print "<td>run for [s]</td>";
+  print "</tr><tr>";
+  print "<td>";
+  print q%<input type='text' id='runtime' value='0.2'>%;
+  print "</td><td>";
+  print q%<input type='button' onClick='run(document.getElementById("runtime").value)' value='run'>%;
+  print "</td><td>";
+
+
+
+  # pass a list of sensor Ids to the javascript side
+  # more precisely: a hash consisting of $sensorId=>$previewAreaId
+  # so the javascript knows which placeholders to fill with actual plots
+  print "<script language='javascript'>\n";
+  print q%var setupFile = '%.$setupFile.q%';%."\n";
+  print "var previewAreaIdHash = new Object();\n";
+  for my $sensorId (keys %previewAreaIdHash){
+    print "previewAreaIdHash[\"$sensorId\"]=\"".$previewAreaIdHash{$sensorId}."\";\n";
+  }
+  print "</script>";
+  # end of that story
+
+  print "<input type='button' value='show/hide debug output' onclick='toggleVis(\"theConsole\")'>";
 
-print "</td></tr>";
-print "</table>";
+  print "</td></tr>";
+  print "</table>";
 
-print "</p>";
-print "<div id='theConsole'>[the \"console\"]</div>";
+  print "</p>";
+  print "<div id='theConsole'>[the \"console\"]</div>";
 
-print end_html;
+  print end_html;
 
 }