--- /dev/null
+&htsponse(200, "OK");
+print "Content-type: text/html\r\n\r\n";
+
+
+
+use HADES::TrbNet;
+use Data::Dumper;
+
+ if (!defined &trb_init_ports()) {
+ die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
+ }
+
+my ($board,$addr,$amount) = split('-',$ENV{'QUERY_STRING'});
+
+$board = hex($board);
+$addr = hex($addr);
+$amount = 1 unless $amount;
+
+if($amount != 1) {
+ my $hits = trb_register_read_mem($board,$addr,0,$amount);
+ foreach my $b (sort keys %$hits) {
+ printf ("%04x",$b);
+ for(my $c =0; $c < $amount; $c++) {
+ printf(" %d",$hits->{$b}->[$c]);
+ }
+ print "&";
+ }
+ }
+else {
+ my $hits = trb_register_read($board,$addr);
+ foreach my $b (sort keys %$hits) {
+ printf ("%04x",$b);
+ printf(" %d",$hits->{$b});
+ print "&";
+ }
+
+ }
+
+exit 1;
\ No newline at end of file
--- /dev/null
+&htsponse(200, "OK");
+print "Content-type: text/html\r\n\r\n";
+
+
+use HADES::TrbNet;
+use Data::Dumper;
+
+my $header = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<!--<meta http-equiv="refresh" content="$.$delay.qq$"/> -->
+<link href="styles.css" rel="stylesheet" type="text/css"/>
+<script src="scripts.js" type="text/javascript"></script>
+<title>Hmon $.$ENV{'QUERY_STRING'}.qq$</title>
+</head>
+<body>
+$;
+print $header;
+
+
+ if (!defined &trb_init_ports()) {
+ die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
+ }
+
+
+my $board = 0xffff;
+my $e = <<EOD;
+<h4>Hit Counters</h4>
+<form acion="">
+<table><tr><td>Board:<td><input type="text" id="form_board" name="board" maxlength="4" value="ffff">
+<tr><td>Update Interval (ms)<td><input type="text" id="form_rate" name="rate" maxlength="5" value="1000">
+<tr><td>Differences<td><input type="checkbox" id="form_diff" name="diff" value="1">
+<tr><td><td><input type="button" onClick="setValues()" value="OK">
+</table>
+</form>
+
+EOD
+
+print $e;
+
+
+print "<table id=\"content\"><tr><th>Channel<th>Value\n";
+for(my $c =0; $c < 64; $c++) {
+ print "<tr><td>$c<td id=\"content".($c+1)."\">";
+ }
+
+print "</table>";
+
+
+$e = <<EOD;
+<script language="javascript">
+var updaterate = document.getElementById("form_rate").value;
+var board = document.getElementById("form_board").value;
+var updateTask = setInterval("getdata('get.pl?"+board+"-4000-64',update)",updaterate);
+var differences= document.getElementById("form_diff").checked;
+var oldvalues = {};
+
+
+function update(data) {
+ if(!document.getElementById("content").innerHTML) return;
+ var b = data.split("&");
+ var c = {};
+ o = "<tr><th>Channel";
+
+ for(j=0;j<b.length-1;j++) {
+ c[j] = b[j].split(" ");
+ if(!oldvalues[j]) oldvalues[j] = c[j];
+ o += "<th>"+c[j][0];
+ }
+
+ for(i = 1; i <= 64; i++) {
+ o += "<tr><th>"+(i-1);
+ for(j=0;j<b.length-1;j++) {
+ if(differences) {
+ val = c[j][i]- (oldvalues[j][i]||0);
+ }
+ else {
+ val = c[j][i];
+ }
+ o += "<td>"+val;
+ }
+ }
+ oldvalues = c;
+ document.getElementById("content").innerHTML = o;
+ }
+
+function setValues() {
+ updaterate = document.getElementById("form_rate").value;
+ board = document.getElementById("form_board").value;
+ differences= document.getElementById("form_diff").checked;
+ clearInterval(updateTask);
+ updateTask = setInterval("getdata('get.pl?"+board+"-4000-64',update)",updaterate);
+ }
+
+</script>
+
+EOD
+
+print $e;
+print "</body></html>";
+exit 1;
+
--- /dev/null
+&htsponse(200, "OK");
+print "Content-type: text/html\r\n\r\n";
+
+
+
+use HADES::TrbNet;
+use Data::Dumper;
+
+ if (!defined &trb_init_ports()) {
+ die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
+ }
+
+my ($board,$addr,@values) = split('-',$ENV{'QUERY_STRING'});
+
+if(!defined $board || !defined $addr || !defined $values[0]) {exit -1;}
+$board = hex($board);
+$addr = hex($addr);
+
+for(my $x = 0; $x < scalar @values; $x++) {
+ $values[$x] = hex($values[$x]);
+ }
+
+
+my $hits = trb_register_write_mem($board,$addr,0,\@values,scalar @values);
+
+exit 1;
\ No newline at end of file
--- /dev/null
+
+
+function getdata(command,callback) {
+ xmlhttp=new XMLHttpRequest();
+ xmlhttp.onreadystatechange = function() {
+ if(xmlhttp.readyState == 4) {
+ if(callback)
+ callback(xmlhttp.responseText);
+ }
+ }
+ xmlhttp.open("GET",command,true);
+ xmlhttp.send(null);
+ }
+
+
+
+// function reload() {
+// xmlhttp=new XMLHttpRequest();
+// xmlhttp.onreadystatechange = function() {
+// if(xmlhttp.readyState == 4) {
+// document.getElementById("content").innerHTML=xmlhttp.responseText;
+// if(document.getElementById('logbox')) {
+// if(saveScrollTop) {
+// document.getElementById('logbox').scrollTop = saveScrollTop;
+// }
+// }
+//
+// document.getElementById("stop").style.background="#444";
+// reloadevery = setTimeout('reload()',$.($delay*1000).qq$);
+// }
+// };
+// if(document.getElementById('logbox')) {
+// saveScrollTop = document.getElementById('logbox').scrollTop;
+// if (saveScrollTop == 0) {saveScrollTop = 0.1;}
+// }
+// xmlhttp.open("GET","get.cgi?$.$ENV{'QUERY_STRING'}.qq$",true);
+// xmlhttp.send(null);
+// document.getElementById("stop").style.background="#111";
+// }
\ No newline at end of file
--- /dev/null
+body {
+ background:#def;
+}
+
+
+table#content {
+ border:1px solid #aaa;
+ border-collapse:collapse;
+}
+
+
+table#content td, table#content th {
+ border:1px solid #aaa;
+ width:100px;
+ text-align:right;
+ padding-right:15px;
+}
+
+table#content {
+ border:1px solid #aaa;
+}
+
+
+div#bar1 {
+ width:900px;
+ overflow-x:scroll;
+ }
+
+div#bar1 div {
+ width:66000px;
+ height:0px;
+}
+
+div#bar2 {
+ width:900px;
+ overflow-x:scroll;
+ }
+
+div#bar2 div {
+ width:65536px;
+ height:0px;
+}
+
+
+#total {
+ text-align:center;
+ font-weight:bold;
+ }
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<link href="styles.css" rel="stylesheet" type="text/css"/>
+<script src="scripts.js" type="text/javascript"></script>
+<title>Threshold settings</title>
+</head>
+<body>
+
+<h4>Threshold Settings</h4>
+<form acion="">
+<table><tr><td>Board:<td><input type="text" id="form_board" name="board" maxlength="4" value="fccc">
+<tr><td>DAC-Chain:<td><select id="form_chain" name="chain"><option>0<option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10<option>11<option>12<option>13<option>14<option>15</select>
+<tr><td>Channel<td><select id="form_channel" name="channel"><option>0<option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10<option>11<option>12<option>13<option>14<option>15</select>
+<tr><td>Update Interval (ms)<td><input type="text" id="form_rate" name="rate" maxlength="5" value="500">
+<tr><td><td><input type="button" onClick="setValues()" value="OK">
+</table>
+</form>
+
+<table><tr><td>
+<div id="bar1" onScroll="update(1,1)">
+<div> </div>
+</div>
+<td id="bar1value">
+<tr><td><div id="bar2" onScroll="update(2,256)">
+<div> </div>
+</div>
+<td id="bar2value">
+<tr><td id="total"> <td>
+<tr><td id="cmd"> <td>
+<tr><td id="err"> <td>
+</table>
+
+<script language="javascript">
+
+var value = {};
+var dataWaiting = 0;
+var updateDelay = 0;
+var command = 0;
+var updaterate = document.getElementById("form_rate").value;
+var board = document.getElementById("form_board").value;
+var chain = 1<<document.getElementById("form_chain").value;
+var chan = document.getElementById("form_channel").value;
+
+
+function update(bar,scale) {
+ value[bar-1] = Math.round(document.getElementById("bar"+bar).scrollLeft/scale);
+ document.getElementById("bar"+bar+"value").innerHTML = value[bar-1];
+ document.getElementById("total").innerHTML = value[0]+value[1];
+ command = 0x00300000 + (chan << 16) + ((value[0]+value[1]) & 0xFFFF);
+ command = command.toString(16);
+ dataWaiting = 1;
+ if(!updateTask) {
+ updateTask = setInterval("doUpdate()",updaterate);
+ }
+ }
+
+
+function doUpdate() {
+ if(dataWaiting) {
+ cmdstring = "put.pl?"+board+"-d400-"+command+"-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-"+chain+"-1";
+ getdata(cmdstring,showret);
+ dataWaiting = 0;
+ }
+ else {
+ clearInterval(updateTask);
+ }
+ }
+
+function showret(d) {
+// document.getElementById("err").innerHTML = d;
+ }
+
+
+function setValues() {
+ updaterate = document.getElementById("form_rate").value;
+ board = document.getElementById("form_board").value;
+ chain = 1<<document.getElementById("form_chain").value;
+ chan = document.getElementById("form_channel").value;
+ clearInterval(updateTask);
+ updateTask = setInterval("doUpdate()",updaterate);
+ }
+
+var updateTask = setInterval("doUpdate()",updaterate);
+
+
+</script>
+
+</body></html>
+
+