From 6e77afdc4d237f78495ca70fdc82d1059d94643f Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sat, 17 Dec 2011 21:01:53 +0100 Subject: [PATCH] http_streaming: parametric hunk process instead of hard cabled eval function --- web/briskin5/index.php | 2 +- web/http_streaming.js | 8 +++++--- web/index.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/briskin5/index.php b/web/briskin5/index.php index 2e5c5a0..7b3e6d2 100644 --- a/web/briskin5/index.php +++ b/web/briskin5/index.php @@ -100,7 +100,7 @@ window.onload = function() { preferences_update(); 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; diff --git a/web/http_streaming.js b/web/http_streaming.js index 8029812..4fa069f 100644 --- a/web/http_streaming.js +++ b/web/http_streaming.js @@ -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("<", "<", "g"); +"
"; this.hbit("+"); - eval(singlecomm); + this.cmdproc(singlecomm); again = 1; } else { diff --git a/web/index.php b/web/index.php index a2f7bf8..1908a12 100644 --- a/web/index.php +++ b/web/index.php @@ -1063,7 +1063,7 @@ else { ?> 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; -- 2.17.1