]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
added init_system button to testgui, fixed scrolling issue
authorMichael Wiebusch <m.wiebusch@gsi.de>
Fri, 19 Dec 2014 13:50:37 +0000 (14:50 +0100)
committerMichael Wiebusch <m.wiebusch@gsi.de>
Fri, 19 Dec 2014 13:50:37 +0000 (14:50 +0100)
tools/init_system.pl
tools/testgui.js
tools/testgui.pl

index 2bb3c434b38a1c56265fe98b33855e0e83f4b44b..05bc119dd7662f2e575275695049a8cc97288d30 100755 (executable)
@@ -3,7 +3,9 @@
 use warnings;
 use File::chdir;
 use XML::LibXML;
-use Getopt::Long;
+# use Getopt::Long;
+use CGI ':standard';
+use CGI::Carp qw(fatalsToBrowser);
 use Data::Dumper;
 use FileHandle;
 use Pod::Usage;
@@ -14,7 +16,6 @@ use FindBin;
 use lib "$FindBin::Bin/..";
 use Environment;
 use HADES::TrbNet;
-trb_init_ports() or die trb_strerror();
 
 sub trb_write {
   my($a,$r,$v) = @_;
@@ -24,11 +25,22 @@ sub trb_write {
 sub run {
   my($c) = @_;
   print $c."\n";
-  system("DAQOPSERVER=".DAQOPSERVER." ".$c);
+#   system("DAQOPSERVER=".DAQOPSERVER." ".$c);
+  system($c);
   }
 
 
-my $system = $ARGV[0];
+my $isHttpReq = $ENV{HTTP_USER_AGENT};
+print header('text/plain') if $isHttpReq;
+print "<pre>" if $isHttpReq;
+my $q = CGI->new;
+my $system=$q->param('system');
+
+# only for backwards compatibility
+unless(defined($system)){
+  $system = $ARGV[0];
+}
+
 unless (defined $system) {die "No system name given\n";}
 my $systemFile = SYSTEMDIR."/".$system.".xml";
 unless(-e $systemFile) {die "System file $systemFile not found\n";}
@@ -46,11 +58,17 @@ for my $n ($db->findnodes("//gbe")) {
 for my $n ($db->findnodes("//roc")) {
   push(@roc,hex($n->findvalue("./\@address")));
   }  
+my $daqopserver = $db->findvalue("//daqopserver");
+$ENV{'DAQOPSERVER'} = $daqopserver if (defined($daqopserver));
+
+print "DAQOPSERVER:\t$daqopserver\n";
 printf("CCU:\t%04x\n",$ccu);
 print("ROC:\t".join(", ", map {sprintf("%04x",$_)} @roc)."\n");
 print("HUB:\t".join(", ", map {sprintf("%04x",$_)} @hub)."\n");
 print("GBE:\t".join(", ", map {sprintf("%04x",$_)} @gbe)."\n");
+
+trb_init_ports() or die trb_strerror();
+
 run("trbcmd reset");
 
 sleep 2;
@@ -79,3 +97,5 @@ if($system eq 'ELab') {
 
 #Send arbiter start signal
 trb_write($ccu,0xa000,0x00000001);
+
+print "</pre>" if $isHttpReq;
index ebf56bf4c7f5dcb68d963159210dc29909638de0..8f63ab4f09fc016a287ec91ac1b18cc0f28b97b2 100644 (file)
@@ -38,15 +38,25 @@ function run(time) {
 
 
 function startupOnly(){
-
-
-  
   var setupFile_ = encodeURIComponent(setupFile);
   getdata("run.pl?startupOnly=true&runtime=0&setupFile="+setupFile_,"theConsole",false);
-  
+}
 
-  
-  
+
+
+function exec_init_system(){
+     $.ajax({
+        url:       "init_system.pl",
+        cache:     false,
+        async:     false,
+        dataType:  "text",
+        data:      {
+          system       : systemName
+        },
+        success:   function(result) {
+          $("#theConsole").html(result);
+        }
+     }); 
 }
 
 function delete_file(){
@@ -158,16 +168,25 @@ $(document).ready(function(){
   $("#advoptbtn").click(function(){
 //     toggleVis("advancedOptionsContainer");
     $("#advancedOptionsContainer").fadeToggle();
-    var $target = $('html,body'); 
+    $('html, body').animate({
+        scrollTop: $("#advancedOptionsContainer").offset().top
+    }, 2000);
+//     var $target = $('html,body'); 
 //     $target.animate({scrollTop: $target.height()}, 1000);
   });
   $("#debugbtn").click(function(){
 //     toggleVis("theConsoleContainer");
     $("#theConsoleContainer").fadeToggle();
-    var $target = $('html,body'); 
+    $('html, body').animate({
+        scrollTop: $("#theConsoleContainer").offset().top
+    }, 2000);
+//     var $target = $('html,body'); 
 //     $target.animate({scrollTop: $target.height()}, 1000);
   });
   
+  $("#button_init_system").click(function(){
+    exec_init_system();
+  });
   
   timer = $.timer(function() {
     clear_report();
index deaa28b132c48e5bc5c68206d639057597c377e6..9ff43897e8b23d43d0c64f4e7f3fed1d7e4bd1a1 100755 (executable)
@@ -200,6 +200,7 @@ sub init_html{
   # so the javascript knows which placeholders to fill with actual plots
   print "<script language='javascript'>\n";
   print q%var setupFile = '%.$setupFile.q%';%."\n";
+  print q%var systemName = '%.$systemName.q%';%."\n";
   print q%var systemFile = '%.SYSTEMDIR."/".$systemName.".xml".q%';%."\n";
   print q%var setupDir = '%.SETUPDIR.q%';%."\n";
   print "var previewAreaIdHash = new Object();\n";
@@ -225,6 +226,8 @@ sub init_html{
   print q%<input type='button' onClick='startupOnly();' value='startup only'
   title="only program JTAG settings and start the sensors, take no data">%;
 #   print "</td><td>";
+  print q%<input type='button' id='button_init_system' value='init system'
+  title="initialize the readout system (resets the TRB3)">%;
   print "</td></tr></table>";