http_streaming: parametric hunk process instead of hard cabled eval function pre-sac
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Sat, 17 Dec 2011 20:01:53 +0000 (21:01 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Sat, 17 Dec 2011 20:01:53 +0000 (21:01 +0100)
web/briskin5/index.php
web/http_streaming.js
web/index.php

index 2e5c5a0..7b3e6d2 100644 (file)
@@ -100,7 +100,7 @@ window.onload = function() {
   preferences_update();
 
   sess = "<?php echo "$sess"; ?>";
-  hstm = new http_streaming(gst, 'table_php', 'sess', $('sandbox'), 'index_rd.php');
+  hstm = new http_streaming(gst, 'table_php', 'sess', $('sandbox'), 'index_rd.php', function(com){eval(com);});
   hstm.hbit_set(heartbit);
   
   window.onbeforeunload = onbeforeunload_cb;  
index 8029812..4fa069f 100644 (file)
@@ -26,8 +26,8 @@
  *   NOT MANDATORY
  *   - type of streaming into the constructor
  *   - all iframe related streaming add
- *   - substitute fixed "eval" with a generic command hunks processor
  *
+ *   DONE - substitute fixed "eval" with a generic command hunks processor
  *   DONE - myfrom (now from) into the constructor
  *   DONE - target page into the constructor
  *   DONE - gst management
@@ -37,7 +37,7 @@
  *
  */
 
-function http_streaming(gst, from, cookiename, sandbox, targetpage)
+function http_streaming(gst, from, cookiename, sandbox, targetpage, cmdproc)
 {
     this.xhr = createXMLHttpRequest();
     // this.xhr.setRequestHeader("Content-type", "text/html; charset=utf-8");
@@ -47,6 +47,7 @@ function http_streaming(gst, from, cookiename, sandbox, targetpage)
     this.cookiename = cookiename;
     this.sandbox = sandbox;
     this.targetpage = targetpage;
+    this.cmdproc = cmdproc;
 }
 
 http_streaming.prototype = {
@@ -55,6 +56,7 @@ http_streaming.prototype = {
     cookiename: null,
     sandbox: null,
     targetpage: null,
+    cmdproc: null,
 
     /* cookiepath is automatically customized in installation phase */
     cookiepath: "/brisk/",
@@ -201,7 +203,7 @@ http_streaming.prototype = {
                // $("xhrdeltalog").innerHTML = "EVALL: "+singlecomm.replace("<", "&lt;", "g"); +"<br>";
                this.hbit("+");
                 
-               eval(singlecomm);
+               this.cmdproc(singlecomm);
                again = 1;
            }
            else {
index a2f7bf8..1908a12 100644 (file)
@@ -1063,7 +1063,7 @@ else {
 
 ?>
      sess = "<?php echo "$sess"; ?>";
-     hstm = new http_streaming(gst, 'index_php', 'sess', $('sandbox'), 'index_rd.php');
+     hstm = new http_streaming(gst, 'index_php', 'sess', $('sandbox'), 'index_rd.php', function(com){eval(com);});
      hstm.hbit_set(heartbit);
      tra = new train($('room_tit'));
      window.onunload = onunload_cb;