]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
few pieces of information in status gui
authorJan Michel <j.michel@gsi.de>
Sat, 10 Aug 2013 14:52:14 +0000 (16:52 +0200)
committerJan Michel <j.michel@gsi.de>
Sat, 10 Aug 2013 14:52:14 +0000 (16:52 +0200)
layout/jtageditor_blue.css
scripts/scripts.js
tools/getdata.js
tools/statusgui.pl

index f0706af657248738a61eddf00a6fc420ef61de72..036fe47f31e2d3901d52110d36519a7387da5084 100644 (file)
@@ -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;
     }
 
index 5fb6966d71126935dea8b6f0f3c8af9b1a7f3e9f..dfdf5a461a53a6c5787c60cdb7b446ed63240f1f 100644 (file)
@@ -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) {
index 7a33b4c6f033674fb16c7709d0e84734fe4be61a..4578c8518e4a4c4cf1d7812ff8e4c3cd0da6707b 100644 (file)
@@ -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!
index a09ead63a7afcd3a29b5874d4bb76da175922115..5c88111a0b1bff6b04697b282c5dd584e89347f3 100755 (executable)
@@ -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("<li>Controller %i ($ctrlname) 0x%s\n",$ctrlid,$ctrladdr) if $write;
     print("<ul>") if $write;
     foreach my $curchain ($curctrl->findnodes('chain')) {
       my $chainid   = $curchain->getAttribute('id');
       my $chainname = $curchain->getAttribute('name');
+      $setup->{$ctrlname}->{chains}->{$chainname}->{addr} = $chainid;
       printf("<li>Chain %i ($chainname)",$chainid) if $write;
       print("<ul>") if $write;
       foreach my $cursensor ($curchain->findnodes('sensor')) {
@@ -57,6 +60,7 @@ sub readConfig {
         my $sensname = $cursensor->getAttribute('name');
         my $sensfile = $cursensor->getAttribute('config');
         my $sensena  = $cursensor->getAttribute('enabled');
+        $setup->{$ctrlname}->{chains}->{$chainname}->{sensors}->{$sensname} = $sensid;
         printf("<li>Sensor $sensid ($sensname) $sensfile %s",($sensena?"active":"disabled")) if $write;
         }
       print("</ul>") if $write;
@@ -67,6 +71,15 @@ sub readConfig {
   }
 
 
+sub getStatus {
+print <<EOF;
+  <input type="button" class="stdbutton" onClick="getdataprint('../../daqtools/xml-db/get.pl?JtagController-0xf308-JtagStatus','content',false);" value="Refresh">
+  <div id="content"></div>
+EOF
+  
+  }
+  
+  
 
 sub initPage {
   
@@ -88,11 +101,19 @@ EOF
   <span class=").($isStatus?"selected":"inactive").qq("><a href="?status">Status</a></span>
   <span class=").($isErrors?"selected":"inactive").qq("><a href="?errors">Errors</a></span>
 </div>
-<div class="content">
+
 );
-readConfig($configFile,($command eq "setup"?1:0));
+if($isSetup) {
+  print '<div class="content">';
+  readConfig($configFile,1);
+  print '</div>';
+  }
+if ($isStatus) {
+  readConfig($configFile,0);
+  getStatus();
+  }
 print <<EOF ;
-</div>
+
 </div>
 <div id="debugpane">
 <div class="header">Debug Output</div>
@@ -113,6 +134,7 @@ sub printJavaScripts {
 ####### javascript function land ################
 
   print <<EOF;
+<script language="javascript" src="../scripts/scripts.js"></script>
 
 <script language="javascript">