Index: trunk/FACT++/www/viewer/index.php
===================================================================
--- trunk/FACT++/www/viewer/index.php	(revision 17727)
+++ 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));
-
 ?>
