From: Michael Wiebusch
Date: Mon, 2 Dec 2013 19:47:30 +0000 (+0100)
Subject: added a setupFile selector to testgui.pl. the setup file is passed to startup.pl...
X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=96cb35c3dbda4c3b1ffd31db197691ae2d592041;p=mvdsensorcontrol.git
added a setupFile selector to testgui.pl. the setup file is passed to startup.pl via run.pl by pressing on the run button
---
diff --git a/tools/run.pl b/tools/run.pl
index 2dfb8d3..bd30244 100755
--- a/tools/run.pl
+++ b/tools/run.pl
@@ -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";
diff --git a/tools/testgui.js b/tools/testgui.js
index 01b6ca9..6400a59 100644
--- a/tools/testgui.js
+++ b/tools/testgui.js
@@ -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);
diff --git a/tools/testgui.pl b/tools/testgui.pl
index eee8e85..0ad9fc1 100755
--- a/tools/testgui.pl
+++ b/tools/testgui.pl
@@ -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 "";
-print "
";
-print "";
-print "run for [s] ";
-print " ";
-print "";
-print q% %;
-print " ";
-print q% %;
-print " ";
-
-
-
-# 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 "";
-# 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 "";
+ print "chose setup: ";
+ print " ";
+ $setup_selector->print_html();
+ print "
";
+
+ print_setupStructure();
-print " ";
+ print "";
+ print "
";
+ print " ";
+ print "
";
-print "
";
-print "[the \"console\"]
";
+ print "";
+ print "[the \"console\"]
";
-print end_html;
+ print end_html;
}