Index: trunk/FACT++/www/viewer/index.html
===================================================================
--- trunk/FACT++/www/viewer/index.html	(revision 17728)
+++ trunk/FACT++/www/viewer/index.html	(revision 17732)
@@ -47,4 +47,6 @@
 <body>
 
+<div id='tooltip' style="position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div>
+
 <div class="myaccordion" id="accordion5">
    <h3><a href="#">Editor 1 (proc)</a></h3>
@@ -129,5 +131,5 @@
 
 <div class="ui-widget-content" style="background:#eee;margin-top:-10px">
-   <input id="submit" type="button" onclick="onSubmit();" value="Submit"></input>
+   <input id="submit"  type="button" onclick="onSubmit();" value="Submit"></input>
    <span style="float:right;white-space:nowrap;">
       Run file: 
@@ -276,5 +278,14 @@
 </div>
 
-<div id='tooltip' style="position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div>
+<div class="myaccordion" id="accordion6">
+   <h3><a href="#">Additional controls</a></h3>
+</div>
+<div id="ctrlcontainer" class="ui-widget-content">
+   <form id="controls" method="POST" style="margin-bottom:0">
+      <input id="getcamera"   type="button" onclick="onGetCameras();" value="Get camera data"></input>
+      <input id="getwaveform" type="button" onclick="onGetWaveforms();" value="Get waveforms"></input>
+      <input id="data" name="data" type="hidden"></input>
+   </form>
+</div>
 
 <div class="myaccordion" id="accordion4">
Index: trunk/FACT++/www/viewer/index.js
===================================================================
--- trunk/FACT++/www/viewer/index.js	(revision 17728)
+++ trunk/FACT++/www/viewer/index.js	(revision 17732)
@@ -171,4 +171,6 @@
 {
     $('#submit').prop('disabled', disabled);
+    $('#getcamera').prop('disabled', disabled);
+    $('#getwaveforms').prop('disabled', disabled);
     $('#event').prop('disabled', disabled);
     $('#pixel').prop('disabled', disabled);
@@ -181,4 +183,28 @@
 }
 
+function onGetCameras()
+{
+    var arr =
+    [
+     document.getElementById("camera1").dataAbs,
+     document.getElementById("camera2").dataAbs,
+     document.getElementById("camera3").dataAbs,
+     document.getElementById("camera4").dataAbs,
+     ];
+
+    $('#controls > input[name=data]').val(JSON.stringify(arr));
+    $('#controls').attr('action','index.php');
+    $('#controls').submit();
+}
+
+function onGetWaveforms()
+{
+    var arr = document.getElementById("waveform").data;
+
+    $('#controls > input[name=data]').val(JSON.stringify(arr));
+    $('#controls').attr('action','index.php');
+    $('#controls').submit();
+}
+
 function onReady()
 {
@@ -224,4 +250,5 @@
     setupAccordion('#accordion3', '#waveformcontainer');
     setupAccordion('#accordion4', '#helpcontainer', true);
+    setupAccordion('#accordion6', '#ctrlcontainer', true);
 
     $("#selectfile1").on('change', onFile);
@@ -247,9 +274,9 @@
 function onFilelistReceived(result)
 {
-    var dbg = document.getElementById("debug");
-
-    var pre = document.createElement("pre");
-    pre.appendChild(document.createTextNode(rc));
-    dbg.appendChild(pre);
+    //var dbg = document.getElementById("debug");
+
+    //var pre = document.createElement("pre");
+    //pre.appendChild(document.createTextNode(rc));
+    //dbg.appendChild(pre);
 
     var rc;
@@ -329,7 +356,7 @@
     var con = document.getElementById("console");
 
-    var pre = document.createElement("pre");
-    pre.appendChild(document.createTextNode(rc));
-    dbg.appendChild(pre);
+    //var pre = document.createElement("pre");
+    //pre.appendChild(document.createTextNode(rc));
+    //dbg.appendChild(pre);
 
     try
@@ -392,7 +419,7 @@
         con.appendChild(document.createTextNode(rc.debug));
 
-        debug("return "+JSON.stringify(rc.ret));
-        debug("");
-        debug("Execution times:");
+        //debug("return "+JSON.stringify(rc.ret));
+        //debug("");
+        debug("PHP execution:");
         debug("Time Javascripts = "+(rc.timeJs[0]*1000).toFixed(2)+","+(rc.timeJs[1]*1000).toFixed(2)+","+(rc.timeJs[2]*1000).toFixed(2)+ " [ms]");
     }
@@ -430,4 +457,5 @@
     {
         var waveform = document.getElementById("waveform");
+        waveform.data = [ ];
 
         var data = [[],[],[],[]];
@@ -442,4 +470,6 @@
             for (var i=0; i<evt.numRoi; i++)
                 data[0][i] = [ i, rc.waveform[i] ];
+
+            waveform.data[0] = rc.waveform;
         }
 
@@ -456,4 +486,5 @@
                     data[j][i] = [ i, ref[i] ];
 
+                waveform.data[j] = ref;
             }
         }
Index: trunk/FACT++/www/viewer/index.php
===================================================================
--- trunk/FACT++/www/viewer/index.php	(revision 17728)
+++ trunk/FACT++/www/viewer/index.php	(revision 17732)
@@ -15,9 +15,39 @@
 
     header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
-    header("Cache-Control: public"); // needed for i.e.
-    header("Content-Type: text/plain");
-    header("Content-Transfer-Encoding: Text");
-    header("Content-Disposition: attachment; filename=\"".$name."\"");
+    header('Cache-Control: public'); // needed for i.e.
+    header('Content-Type: text/plain');
+    header('Content-Transfer-Encoding: Text');
+    header('Content-Disposition: attachment; filename="'.$name.'"');
     print($source);
+    return;
+}
+
+// This is a pretty weird hack because it does first convert
+// all data to ascii (json) to print it...
+if (isset($_POST['data']))
+{
+    header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
+    header('Cache-Control: public'); // needed for i.e.
+    header('Content-Type: text/plain');
+    header('Content-Transfer-Encoding: Text');
+    header('Content-Disposition: attachment; filename="data.txt"');
+
+    $json = json_decode($_POST['data']);
+
+    $n   = count($json[0]);
+    $cnt = count($json);
+
+    for ($i=0; $i<$n; $i++)
+    {
+        print($i." ".$json[0][$i]);
+
+        if ($cnt>1)
+            print(" ".$json[1][$i]);
+        if ($cnt>2)
+            print(" ".$json[2][$i]);
+        if ($cnt>3)
+            print(" ".$json[3][$i]);
+        print("\n");
+    }
     return;
 }
@@ -347,4 +377,3 @@
 // Output result as JSON object
 print(json_encode($rc));
-
 ?>
