from html_streaming to xynt_streaming object name
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Tue, 13 Nov 2012 06:13:46 +0000 (07:13 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Tue, 13 Nov 2012 06:22:23 +0000 (07:22 +0100)
13 files changed:
INSTALL.sh
web/Obj/brisk.phh
web/Obj/user.phh
web/briskin5/Obj/briskin5.phh
web/briskin5/index.php
web/briskin5/index_rd.php
web/index.php
web/index_rd.php
web/index_wr.php
web/xynt-http-streaming-ifra.js [deleted file]
web/xynt-http-streaming.js [deleted file]
web/xynt-streaming-ifra.js [new file with mode: 0644]
web/xynt-streaming.js [new file with mode: 0644]

index 3195e3a..bffa041 100755 (executable)
@@ -334,7 +334,7 @@ sed -i "s@define *( *'BRISK_AUTH_CONF',[^)]*)@define('BRISK_AUTH_CONF', \"$brisk
 
 sed -i "s@var \+cookiepath \+= \+\"[^\"]*\";@var cookiepath = \"$prefix_path\";@g" ${web_path}__/commons.js
 
-sed -i "s@\( \+cookiepath *: *\)\"[^\"]*\" *,@\1 \"$prefix_path\",@g" ${web_path}__/xynt-http-streaming.js
+sed -i "s@\( \+cookiepath *: *\)\"[^\"]*\" *,@\1 \"$prefix_path\",@g" ${web_path}__/xynt-streaming.js
 
 document_root="$(grep DocumentRoot "${apache_conf}"  | grep -v '^#' | awk '{ print $2 }')"
 sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph*
index 586f0d9..a94412e 100644 (file)
@@ -984,7 +984,7 @@ class Room {
 
       $ret = "gst.st = ".($user_cur->step+1)."; ".($remove_wagon ? sprintf("tra.rem(%d);",$table_idx) : "");
       if ($from_table && ($user_cur->table == $table_idx || $user->idx_get() == $i)) {
-       $ret .= 'gst.st_loc++; hstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("index.php");|';
+       $ret .= 'gst.st_loc++; xstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("index.php");|';
        // $ret .= 'gst.st_loc++; document.location.assign("index.php");|';
        log_main("DOCUMENT.index.php: from table");
       }
index cc4d211..d094055 100644 (file)
@@ -591,7 +591,7 @@ class User {
       
       $is_page_streaming = TRUE;
       log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
-      return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'));
+      return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'));
   }
   
   // FIXME TO SUPPORT iframe
@@ -605,7 +605,7 @@ class User {
       
       log_rd2("PAGE_SYNC");
       printf("xXx USER::PAGE_SYNC [%s]\n", get_class($this));
-      return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); hstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page));
+      return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); xstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page));
   }
 
 
@@ -760,11 +760,11 @@ class User {
     $body .= sprintf("<html>
 <head>
 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
-<script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
+<script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
 <script type=\"text/javascript\">
-var http_streaming = \"ready\";", self::base_get(), self::base_get());
+var xynt_streaming = \"ready\";", self::base_get(), self::base_get());
     $body .= sprintf("
-window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
+window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
 </script>
 </head>
 <body>");
@@ -819,13 +819,13 @@ function stream_init($init_string, $enc, &$header_out, &$body, $get, $post, $coo
     $body .= sprintf("<html>
 <head>
 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
-<script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
+<script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
 <script type=\"text/javascript\">
-var http_streaming = \"ready\";", self::base_get(), self::base_get());
+var xynt_streaming = \"ready\";", self::base_get(), self::base_get());
     if ($this->rd_scristp > 0)
         $body .= sprintf("last_clean = %d;\n", ($this->rd_scristp-1));
     $body .= sprintf("
-window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
+window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
 </script> 
 </head>
 <body>");
index 22b75d1..c16d14c 100644 (file)
@@ -729,11 +729,11 @@ class Bin5_user extends User {
     $body .= sprintf("<html>
 <head>
 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
-<script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
+<script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
 <script type=\"text/javascript\">
-var http_streaming = \"ready\";", self::base_get(), self::base_get());
+var xynt_streaming = \"ready\";", self::base_get(), self::base_get());
     $body .= sprintf("
-window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
+window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
 </script>
 </head>
 <body>");
@@ -754,7 +754,7 @@ push(\"%s\");
         
         $is_page_streaming = TRUE;
         log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
-        return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
+        return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
     }
     
     protected function page_sync($sess, $page)
@@ -764,7 +764,7 @@ push(\"%s\");
         $is_page_streaming = TRUE;
         log_rd2("PAGE_SYNC");
         printf("xXx BIN5_USER::PAGE_SYNC\n");
-        return (sprintf('hstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
+        return (sprintf('xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
     }
 
     protected function maincheck($cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $splashdate, $table_idx, $table_token)
@@ -1355,7 +1355,7 @@ class Bin5 {
             $user_cur->laccwr = $curtime;
 
             $ret = "gst.st = ".($user_cur->step+1)."; ";
-            $ret .= 'gst.st_loc++; hstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");|';
+            $ret .= 'gst.st_loc++; xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");|';
 
             log_wr($user_cur->sess." BIN5_WAKEUP: ".$ret);
             $user_cur->comm[$user_cur->step % COMM_N] = $ret;
index 1e0ba3b..7142f46 100644 (file)
@@ -64,7 +64,7 @@ function bin5_index_main(&$header_out, $addr, $get, $post, $cookie)
 <link rel="shortcut icon" href="../img/brisk_ico.png">
 <script type="text/javascript" src="../commons.js"></script> 
 <script type="text/javascript" src="../heartbit.js"></script>
-<script type="text/javascript" src="../xynt-http-streaming.js"></script>
+<script type="text/javascript" src="../xynt-streaming.js"></script>
 <script type="text/javascript" src="dnd.js"></script>
 <script type="text/javascript" src="dom-drag.js"></script>
 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
@@ -76,7 +76,7 @@ function bin5_index_main(&$header_out, $addr, $get, $post, $cookie)
 <body>
 <SCRIPT type="text/javascript">
    var sess = "not_connected";
-   var hstm = null;
+   var xstm = null;
    var g_lang = "<?php echo "$G_lang"; ?>";
    var stat = "table";
    var subst = "none";
@@ -110,13 +110,13 @@ window.onload = function() {
   preferences_update();
 
   sess = "<?php echo "$sess"; ?>";
-  hstm = new http_streaming(window, null /* console */, gst, 'table_php', 'sess', sess, $('sandbox'), 'index_rd_ifra.php', function(com){eval(com);});
-  hstm.hbit_set(heartbit);
+  xstm = new xynt_streaming(window, null /* console */, gst, 'table_php', 'sess', sess, $('sandbox'), 'index_rd_ifra.php', function(com){eval(com);});
+  xstm.hbit_set(heartbit);
   
   window.onbeforeunload = onbeforeunload_cb;  
   window.onunload = onunload_cb;  
 
-  hstm.start(); 
+  xstm.start();
   // FIXME: add this setTimeout(preload_images into data stream to avoid
   // race on opened socket
   // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct);
index dab09f3..0a66fc8 100644 (file)
@@ -64,7 +64,7 @@ function blocking_error($is_unrecoverable)
 
   $is_page_streaming = TRUE;
   log_rd2("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
-  return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
+  return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
 }
 
 function page_sync($sess, $page)
@@ -73,7 +73,7 @@ function page_sync($sess, $page)
 
   $is_page_streaming = TRUE;
   log_rd2("PAGE_SYNC");
-  return (sprintf('hstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
+  return (sprintf('xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
 }
 
 function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $table_idx, $table_token)
@@ -100,7 +100,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su
     if (($sem = Bin5::lock_data(FALSE, $table_idx)) == FALSE) { 
         // wait 20 secs, then restart the xhr 
         ignore_user_abort(FALSE);
-        return ("sleep(gst,20000);|hstm.xhr_abort();");
+        return ("sleep(gst,20000);|xstm.xhr_abort();");
     }
 
     if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) {
@@ -119,7 +119,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su
         if (($sem = Bin5::lock_data(TRUE, $table_idx)) == FALSE) { 
             // wait 20 secs, then restart the xhr 
             ignore_user_abort(FALSE);
-            return ("sleep(gst,20000);|hstm.xhr_abort();");
+            return ("sleep(gst,20000);|xstm.xhr_abort();");
         }
         $S_load_stat['lL_laccgarb']++;
 
@@ -196,7 +196,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su
 //         else {
 //             ignore_user_abort(FALSE);
             
-//             return ("sleep(gst,20000);|hstm.xhr_abort();");
+//             return ("sleep(gst,20000);|xstm.xhr_abort();");
 //         }
         
 //         $first_loop = FALSE;
index 390bc78..72658ba 100644 (file)
@@ -865,7 +865,7 @@ supported by:<br>
 <!--<script type="text/javascript" src="myconsole.js"></script> -->
 <script type="text/javascript" src="menu.js"></script>
 <script type="text/javascript" src="heartbit.js"></script>
-<script type="text/javascript" src="xynt-http-streaming.js"></script>
+<script type="text/javascript" src="xynt-streaming.js"></script>
 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
 <script type="text/javascript" src="AC_OETags.js"></script>
 <script type="text/javascript" src="room.js"></script>
@@ -886,7 +886,7 @@ supported by:<br>
    var gst  = new globst();
    var topbanner_sfx, topbanner_dx;
    var g_brow = null;
-   var hstm = null;
+   var xstm = null;
    var sess = "not_connected";
    var spo_slide, sup_slide;
 
@@ -1001,7 +1001,7 @@ echo "$body"; ?>
 <script type="text/javascript" src="menu.js"></script>
 <script type="text/javascript" src="ticker.js"></script>
 <script type="text/javascript" src="heartbit.js"></script>
-<script type="text/javascript" src="xynt-http-streaming.js"></script>
+<script type="text/javascript" src="xynt-streaming.js"></script>
 <script type="text/javascript" src="room.js"></script>
 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
 <script type="text/javascript" src="AC_OETags.js"></script>
@@ -1057,8 +1057,8 @@ else {
 
 ?>
      sess = "<?php echo "$sess"; ?>";
-hstm = new http_streaming(window, null /* console*/ , gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd_ifra.php', function(com){eval(com);});
-     hstm.hbit_set(heartbit);
+xstm = new xynt_streaming(window, null /* console*/ , gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd_ifra.php', function(com){eval(com);});
+     xstm.hbit_set(heartbit);
      tra = new train($('room_tit'));
      window.onunload = onunload_cb;
      window.onbeforeunload = onbeforeunload_cb;
@@ -1070,7 +1070,7 @@ hstm = new http_streaming(window, null /* console*/ , gst, 'index_php', 'sess',
        $("proflashext").innerHTML = "";
 
      // console.log("session from main: "+sess);
-     hstm.start();
+     xstm.start();
      // alert("ARR LENGTH "+g_preload_img_arr.length);
      // FIXME: preload image will be fired by stream instead here
      // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
index d2b5898..31c9058 100644 (file)
@@ -70,7 +70,7 @@ function blocking_error($is_unrecoverable)
 
   $is_page_streaming = TRUE;
   log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
-  return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'));
+  return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'));
 }
 
 function page_sync($sess, $page, $table_idx, $table_token)
@@ -82,7 +82,7 @@ function page_sync($sess, $page, $table_idx, $table_token)
   $is_page_streaming = TRUE;
 
   log_rd2("PAGE_SYNC");
-  return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); hstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page));
+  return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); xstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page));
 }
 
 
@@ -123,7 +123,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su
     if (($sem = Room::lock_data(FALSE)) == FALSE) { 
         // wait 20 secs, then restart the xhr 
         ignore_user_abort(FALSE);
-        return ("sleep(gst,20000);|hstm.xhr_abort();");
+        return ("sleep(gst,20000);|xstm.xhr_abort();");
     }
     
     // Verifica l'expire time lato server
@@ -140,7 +140,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su
         if (($sem = Room::lock_data(TRUE)) == FALSE) { 
             // wait 20 secs, then restart the xhr 
             ignore_user_abort(FALSE);
-            return ("sleep(gst,20000);|hstm.xhr_abort();");
+            return ("sleep(gst,20000);|xstm.xhr_abort();");
         }
         $S_load_stat['lL_laccgarb']++;
 
@@ -216,7 +216,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su
 //             // wait 20 secs, then restart the xhr 
 //             ignore_user_abort(FALSE);
             
-//             return ("sleep(gst,20000);|hstm.xhr_abort();");
+//             return ("sleep(gst,20000);|xstm.xhr_abort();");
 //         }
 //         $first_loop = FALSE;
 //     } // if  ($first_loop == TRUE) {
index 7746051..310e4f2 100644 (file)
@@ -642,7 +642,7 @@ function index_wr_main(&$room, $remote_addr, $get, $post, $cookie)
                         while (array_pop($user_cur->comm) != NULL);
           
                         $ret = "";
-                        $ret .= sprintf('gst.st_loc++; gst.st=%d; createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); createCookie("lang", "%s", 24*365, cookiepath); hstm.stop(); window.onunload = null ; window.onbeforeunload = null ; document.location.assign("briskin5/index.php");|', $user_cur->step+1, $table_idx, $table_token, $G_lang);
+                        $ret .= sprintf('gst.st_loc++; gst.st=%d; createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); createCookie("lang", "%s", 24*365, cookiepath); xstm.stop(); window.onunload = null ; window.onbeforeunload = null ; document.location.assign("briskin5/index.php");|', $user_cur->step+1, $table_idx, $table_token, $G_lang);
                         
                         $user_cur->comm[$user_cur->step % COMM_N] = $ret;
                         $user_cur->trans_step = $user_cur->step + 1;
diff --git a/web/xynt-http-streaming-ifra.js b/web/xynt-http-streaming-ifra.js
deleted file mode 100644 (file)
index d037f10..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-var ctx_new      = "";
-var ctx_old_len  = 0;
-var last_clean   = 0;
-var script_clean = -1;
-
-function push(s) {
-    var i;
-
-    // window.parent.console.log('push('+s+');');
-    for (i = last_clean ; i < script_clean ; i++) {
-        if (typeof($('hs'+i)) != 'undefined' && $('hs'+i) != null) {
-            document.body.removeChild($('hs'+i));
-            // if (typeof(CollectGarbage) == "function") {
-            // CollectGarbage();
-            // }
-
-            last_clean = i;
-        }
-        else {
-            // window.parent.console.log('ifra: hs'+i+" NOT FOUND");
-        }
-    }
-    // FIXME: remove this barbarian log
-    // window.parent.console.log("ifra: ctx_new.length: "+ctx_new.length+"  ctx_old_len: "+ctx_old_len);
-    if (ctx_new.length == ctx_old_len && ctx_old_len > 0) {
-        // FIXME: remove this barbarian log
-        // window.parent.console.log("ifra: NOW clean");
-        // alert("cleanna");
-        ctx_new = "";
-        ctx_old_len = 0;
-    }
-    if (s != null) {
-        ctx_new = ctx_new + "@BEGIN@" + s + "@END@";
-        // FIXME: remove this barbarian log
-        // window.parent.console.log("ifra: CTX_NEW: ["+ctx_new+"]");
-        
-    }
-    else {
-        ctx_new = ctx_new + "_";
-    }
-    return;
-}
diff --git a/web/xynt-http-streaming.js b/web/xynt-http-streaming.js
deleted file mode 100644 (file)
index fe325be..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-// old targetpage == page and moved into start method
-
-function http_streaming(win, console, gst, from, cookiename, sess, sandbox, page, cmdproc)
-{
-    this.win = win;
-    this.console = console;
-    this.gst = gst;
-    this.from = from;
-    this.cookiename = cookiename;
-    this.sess = sess;
-    this.sandbox = sandbox;
-    this.page = page;
-    this.cmdproc = cmdproc;
-    // this.cmdproc = function(com){/* console.log("COM: "+com); */ eval(com);}
-
-    this.doc = win.document;
-    this.keepalive_old = -1;
-    this.keepalive_new = -1;
-}
-
-http_streaming.prototype = {
-    win:               null,
-    console:           null,
-    gst:               null,
-    from:              null,
-    cookiename:        null,
-    sess:              null,
-    sandbox:           null,
-    page:              null,
-    cmdproc:           null,
-
-    doc:               null,
-    ifra:              null,
-    cookiepath: "/brisk/",
-    watchdog_hdl:      null,
-    hbit:              null,
-    keepalive_old:    -1,
-    keepalive_new:    -1,
-    keepalives_equal:  0,
-    /* NOTE: right watch_timeout value to 100, for devel reasons use 1000 or more */
-    // FIXME watchdog_timeout:  200,
-    /* restart after  3 * 40 * 100 millisec if server ping is missing => 12secs */
-    keepalives_eq_max: 3,
-    watchdog_checktm:  40,
-    watchdog_timeout:  100,
-    watchdog_ct:       0,
-    watchable:         false,
-    restart_n:         0,
-    comm_match:        /_*@BEGIN@(.*?)@END@/g, 
-    comm_clean:        /_*@BEGIN@(.*?)@END@/,
-    stream:            "",
-    the_end:           false,
-
-    start: function() { /* public */
-        if (this.the_end) 
-            return;
-
-        createCookie(this.cookiename, sess, 24*365, this.cookiepath);
-        // alert("start");
-        this.log("http_streaming:start restart: "+this.restart_n);
-        this.keepalives_equal = 0;
-        this.ifra = this.doc.createElement("iframe");
-        this.ifra.style.visibility = "hidden";
-        this.doc.body.appendChild(this.ifra);
-        this.page = url_complete(this.win.location.href, this.page);
-        // stat, subst, this.gst.st
-
-        this.page = url_append_args(this.page, "sess", this.sess, "stat", stat, "subst", subst, "step", this.gst.st, "from", this.from);
-        // alert(this.page);
-        this.log(this.page);
-
-        // this.log(this.ifra);
-        this.ifra.contentWindow.location.href = this.page;
-        // this.ifra.src = this.page;
-        this.watchdog_ct  = 0;
-        if (!this.the_end) {
-            this.watchdog_hdl = setTimeout(function(obj) { obj.log("tout1"); obj.watchdog(); }, this.watchdog_timeout, this);
-        }
-    },
-
-    stop: function() {
-        this.the_end = true;
-        this.abort();
-    },
-
-    hbit_set: function (hbit) {
-        this.hbit = hbit;
-    },
-
-    watchdog: function () {
-        // alert("watchdog");
-        var i, again;
-        var comm_newpart, comm_len, comm_arr;
-        var ctx_new_len;
-
-        if (this.sandbox != null) {
-            // from old: var zug = "POLL sess = "+sess+" stat = "+stat+" subst = "+subst+" step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new+" STOP: "+this.stopped;
-            var zug = "WATCHDOG  sess = ["+this.sess+"]  step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new;          
-            if (zug != this.sandbox.innerHTML)
-               this.sandbox.innerHTML = zug;
-        }
-
-        // WATCHDOGING THE CONNECTION
-        this.log("hs::watchdog: start, cur equal times: "+this.keepalives_equal);
-        if (!this.watchable) {
-            do {
-                try{
-                    if (typeof(this.ifra.contentWindow.http_streaming) == 'undefined')
-                        break;
-                }
-                catch(b) {
-                   break;
-                }
-
-                /*
-                  on IE7 the the window frame scope is cleaned after the href is set, so we wait 
-                  for a well know variable value before assign this object value to it (OO is a passion)
-                */
-                if (this.ifra.contentWindow.http_streaming == "ready") {
-                    this.ifra.contentWindow.http_streaming = this;
-                    this.watchable = true;
-                    this.watchdog_ct = 0;
-                    this.log("hs::watchdog: watchable = yes");
-                }
-            } while (false);
-        }
-        if ( (this.watchdog_ct % this.watchdog_checktm) == 0) {
-            this.log("hs::watchdog: this.keepalive_old: "+this.keepalive_old+" this.keepalive_new: "+this.keepalive_new);
-            if (this.keepalive_old == this.keepalive_new) {
-                this.keepalives_equal++;
-            }
-            else {
-                this.keepalive_old = this.keepalive_new;
-                this.keepalives_equal = 0;
-            }
-            
-            if (this.keepalives_equal > this.keepalives_eq_max) {
-                this.log("hs::watchdog: MAX ACHIEVED "+this.keepalives_equal);
-                this.reload();
-                // alert("watchdog return reload");
-                return;
-            }
-        }
-
-        // PICK COMMANDS FROM STREAM
-        do {
-            // alert("do--while begin ["+again+"]");
-           // CHECK: maybe again here isn't needed 
-            again = 0;
-            try {
-                if (typeof(this.ifra.contentWindow.ctx_new)     == 'undefined' ||
-                    typeof(this.ifra.contentWindow.ctx_old_len) == 'undefined')
-                    break;
-            }
-            catch(b) {
-               break;
-            }
-            
-            ctx_new_len = this.ifra.contentWindow.ctx_new.length;
-            if (ctx_new_len <= this.ifra.contentWindow.ctx_old_len) {
-                break;
-            }
-            this.log("new: "+ ctx_new_len + "  old: "+this.ifra.contentWindow.ctx_old_len);
-            this.keepalive_new++;
-            // alert("pre-loop 1");
-            for (i = this.ifra.contentWindow.ctx_old_len ; i < ctx_new_len ; i++) {
-               if (this.ifra.contentWindow.ctx_new.charAt(i) != '_') {
-                    // this.log("ctx_new.char(i) != '_' ["+this.ifra.contentWindow.ctx_new.charAt(i)+"]");
-                   break;
-                }
-                // else {
-                //     this.log("ctx_new.charAt(i) == '_'");
-                // }
-           }
-           this.ifra.contentWindow.ctx_old_len = i;
-           if (i == ctx_new_len) {
-                this.log("old_len == i");
-               break;
-           }
-            else {
-                this.log("old_len != i: "+i);
-            }
-            // alert("do--while middle ["+this.ifra.contentWindow.ctx_old_len+"]");
-
-            comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ifra.contentWindow.ctx_old_len);    
-            this.log("COM_NEWPART: ["+comm_newpart+"]");
-            comm_len = 0;
-           comm_arr = comm_newpart.match(this.comm_match);
-
-            // alert("do--while middle2 ["+again+"]");
-           if (comm_arr) {
-                var comm_arr_len = comm_arr.length;
-               for (i = 0 ; i < comm_arr_len ; i++) {
-                   var temp = comm_arr[i].replace(this.comm_clean,"$1").split("|");
-                   this.gst.comms = this.gst.comms.concat(temp);
-                   comm_len += comm_arr[i].length;
-               }
-               again = 1;
-           }
-            this.ifra.contentWindow.ctx_old_len += comm_len;
-            this.ifra.contentWindow.script_clean = this.gst.st;
-            // alert("do--while end ["+again+"]");
-        } while (again);
-
-        // alert("post while");
-        // EXECUTION OF STREAM COMMANDS
-        do {
-           again = 0;
-           //MOP ?? xhrrestart = 0;
-           if (this.gst.st_loc < this.gst.st_loc_new) {
-               // there is some slow actions running
-               break;
-           }
-           else if (this.gst.comms.length > 0) {
-               var singlecomm;
-                
-               singlecomm = this.gst.comms.shift();
-               // alert("EXE"+gugu);
-               // $("xhrdeltalog").innerHTML = "EVALL: "+singlecomm.replace("<", "&lt;", "g"); +"<br>";
-               //xx this.hbit("+");
-
-                // alert("SINGLE: ["+singlecomm+"]");
-               this.cmdproc(singlecomm);
-               again = 1;
-           }
-        } while (again);
-        this.watchdog_ct++;
-        if (!this.the_end) {
-            this.watchdog_hdl = setTimeout(function(obj) { /* obj.log("tout2"); */ obj.watchdog(); }, this.watchdog_timeout, this);
-        }
-        // alert("watchdog return normal");
-
-        return;
-    },
-
-    //
-    // moved to xynt-http-streaming-ifra as push()
-    //
-    // keepalive: function (s) {
-    //     this.log("hs::keepalive");
-    //     if (s != null) {
-    //         this.log(s);
-    //         this.ifra.contentWindow.ctx_new += "@BEGIN@"+s+"@END@";
-    //     }
-    //     else {
-    //         this.ifra.contentWindow.ctx_new += "_";
-    //     }
-    //     // this.keepalive_new++;
-    // },
-
-    abort: function () { /* public */
-        // this.log("PATH: "+this.ifra.contentWindow.location.protocol + "://" + this.ifra.contentWindow.location.host + "/" + this.ifra.contentWindow.location.pathname);
-
-        this.gst.abort();
-        if (this.watchdog_hdl != null) {
-            clearTimeout(this.watchdog_hdl);
-            this.watchdog_hdl = null;
-        }
-
-        this.restart_n++;
-        this.log("hs::reload");
-        this.watchable = false;
-        if (this.ifra != null) {
-            this.doc.body.removeChild(this.ifra);
-            delete this.ifra;
-            this.ifra = null;
-        }
-    },
-
-    reload: function () {
-        this.abort();
-        this.start(null);
-    },
-
-    log: function (s) {
-        if (this.console != null) {
-            return (this.console.log(s));
-        }
-    }
-}
diff --git a/web/xynt-streaming-ifra.js b/web/xynt-streaming-ifra.js
new file mode 100644 (file)
index 0000000..d037f10
--- /dev/null
@@ -0,0 +1,42 @@
+var ctx_new      = "";
+var ctx_old_len  = 0;
+var last_clean   = 0;
+var script_clean = -1;
+
+function push(s) {
+    var i;
+
+    // window.parent.console.log('push('+s+');');
+    for (i = last_clean ; i < script_clean ; i++) {
+        if (typeof($('hs'+i)) != 'undefined' && $('hs'+i) != null) {
+            document.body.removeChild($('hs'+i));
+            // if (typeof(CollectGarbage) == "function") {
+            // CollectGarbage();
+            // }
+
+            last_clean = i;
+        }
+        else {
+            // window.parent.console.log('ifra: hs'+i+" NOT FOUND");
+        }
+    }
+    // FIXME: remove this barbarian log
+    // window.parent.console.log("ifra: ctx_new.length: "+ctx_new.length+"  ctx_old_len: "+ctx_old_len);
+    if (ctx_new.length == ctx_old_len && ctx_old_len > 0) {
+        // FIXME: remove this barbarian log
+        // window.parent.console.log("ifra: NOW clean");
+        // alert("cleanna");
+        ctx_new = "";
+        ctx_old_len = 0;
+    }
+    if (s != null) {
+        ctx_new = ctx_new + "@BEGIN@" + s + "@END@";
+        // FIXME: remove this barbarian log
+        // window.parent.console.log("ifra: CTX_NEW: ["+ctx_new+"]");
+        
+    }
+    else {
+        ctx_new = ctx_new + "_";
+    }
+    return;
+}
diff --git a/web/xynt-streaming.js b/web/xynt-streaming.js
new file mode 100644 (file)
index 0000000..f716d8c
--- /dev/null
@@ -0,0 +1,280 @@
+// old targetpage == page and moved into start method
+
+function xynt_streaming(win, console, gst, from, cookiename, sess, sandbox, page, cmdproc)
+{
+    this.win = win;
+    this.console = console;
+    this.gst = gst;
+    this.from = from;
+    this.cookiename = cookiename;
+    this.sess = sess;
+    this.sandbox = sandbox;
+    this.page = page;
+    this.cmdproc = cmdproc;
+    // this.cmdproc = function(com){/* console.log("COM: "+com); */ eval(com);}
+
+    this.doc = win.document;
+    this.keepalive_old = -1;
+    this.keepalive_new = -1;
+}
+
+xynt_streaming.prototype = {
+    win:               null,
+    console:           null,
+    gst:               null,
+    from:              null,
+    cookiename:        null,
+    sess:              null,
+    sandbox:           null,
+    page:              null,
+    cmdproc:           null,
+
+    doc:               null,
+    ifra:              null,
+    cookiepath: "/brisk/",
+    watchdog_hdl:      null,
+    hbit:              null,
+    keepalive_old:    -1,
+    keepalive_new:    -1,
+    keepalives_equal:  0,
+    /* NOTE: right watch_timeout value to 100, for devel reasons use 1000 or more */
+    // FIXME watchdog_timeout:  200,
+    /* restart after  3 * 40 * 100 millisec if server ping is missing => 12secs */
+    keepalives_eq_max: 3,
+    watchdog_checktm:  40,
+    watchdog_timeout:  100,
+    watchdog_ct:       0,
+    watchable:         false,
+    restart_n:         0,
+    comm_match:        /_*@BEGIN@(.*?)@END@/g, 
+    comm_clean:        /_*@BEGIN@(.*?)@END@/,
+    stream:            "",
+    the_end:           false,
+
+    start: function() { /* public */
+        if (this.the_end) 
+            return;
+
+        createCookie(this.cookiename, sess, 24*365, this.cookiepath);
+        // alert("start");
+        this.log("xynt_streaming:start restart: "+this.restart_n);
+        this.keepalives_equal = 0;
+        this.ifra = this.doc.createElement("iframe");
+        this.ifra.style.visibility = "hidden";
+        this.doc.body.appendChild(this.ifra);
+        this.page = url_complete(this.win.location.href, this.page);
+        // stat, subst, this.gst.st
+
+        this.page = url_append_args(this.page, "sess", this.sess, "stat", stat, "subst", subst, "step", this.gst.st, "from", this.from);
+        // alert(this.page);
+        this.log(this.page);
+
+        // this.log(this.ifra);
+        this.ifra.contentWindow.location.href = this.page;
+        // this.ifra.src = this.page;
+        this.watchdog_ct  = 0;
+        if (!this.the_end) {
+            this.watchdog_hdl = setTimeout(function(obj) { obj.log("tout1"); obj.watchdog(); }, this.watchdog_timeout, this);
+        }
+    },
+
+    stop: function() {
+        this.the_end = true;
+        this.abort();
+    },
+
+    hbit_set: function (hbit) {
+        this.hbit = hbit;
+    },
+
+    watchdog: function () {
+        // alert("watchdog");
+        var i, again;
+        var comm_newpart, comm_len, comm_arr;
+        var ctx_new_len;
+
+        if (this.sandbox != null) {
+            // from old: var zug = "POLL sess = "+sess+" stat = "+stat+" subst = "+subst+" step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new+" STOP: "+this.stopped;
+            var zug = "WATCHDOG  sess = ["+this.sess+"]  step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new;          
+            if (zug != this.sandbox.innerHTML)
+               this.sandbox.innerHTML = zug;
+        }
+
+        // WATCHDOGING THE CONNECTION
+        this.log("hs::watchdog: start, cur equal times: "+this.keepalives_equal);
+        if (!this.watchable) {
+            do {
+                try{
+                    if (typeof(this.ifra.contentWindow.xynt_streaming) == 'undefined')
+                        break;
+                }
+                catch(b) {
+                   break;
+                }
+
+                /*
+                  on IE7 the the window frame scope is cleaned after the href is set, so we wait 
+                  for a well know variable value before assign this object value to it (OO is a passion)
+                */
+                if (this.ifra.contentWindow.xynt_streaming == "ready") {
+                    this.ifra.contentWindow.xynt_streaming = this;
+                    this.watchable = true;
+                    this.watchdog_ct = 0;
+                    this.log("hs::watchdog: watchable = yes");
+                }
+            } while (false);
+        }
+        if ( (this.watchdog_ct % this.watchdog_checktm) == 0) {
+            this.log("hs::watchdog: this.keepalive_old: "+this.keepalive_old+" this.keepalive_new: "+this.keepalive_new);
+            if (this.keepalive_old == this.keepalive_new) {
+                this.keepalives_equal++;
+            }
+            else {
+                this.keepalive_old = this.keepalive_new;
+                this.keepalives_equal = 0;
+            }
+            
+            if (this.keepalives_equal > this.keepalives_eq_max) {
+                this.log("hs::watchdog: MAX ACHIEVED "+this.keepalives_equal);
+                this.reload();
+                // alert("watchdog return reload");
+                return;
+            }
+        }
+
+        // PICK COMMANDS FROM STREAM
+        do {
+            // alert("do--while begin ["+again+"]");
+           // CHECK: maybe again here isn't needed 
+            again = 0;
+            try {
+                if (typeof(this.ifra.contentWindow.ctx_new)     == 'undefined' ||
+                    typeof(this.ifra.contentWindow.ctx_old_len) == 'undefined')
+                    break;
+            }
+            catch(b) {
+               break;
+            }
+            
+            ctx_new_len = this.ifra.contentWindow.ctx_new.length;
+            if (ctx_new_len <= this.ifra.contentWindow.ctx_old_len) {
+                break;
+            }
+            this.log("new: "+ ctx_new_len + "  old: "+this.ifra.contentWindow.ctx_old_len);
+            this.keepalive_new++;
+            // alert("pre-loop 1");
+            for (i = this.ifra.contentWindow.ctx_old_len ; i < ctx_new_len ; i++) {
+               if (this.ifra.contentWindow.ctx_new.charAt(i) != '_') {
+                    // this.log("ctx_new.char(i) != '_' ["+this.ifra.contentWindow.ctx_new.charAt(i)+"]");
+                   break;
+                }
+                // else {
+                //     this.log("ctx_new.charAt(i) == '_'");
+                // }
+           }
+           this.ifra.contentWindow.ctx_old_len = i;
+           if (i == ctx_new_len) {
+                this.log("old_len == i");
+               break;
+           }
+            else {
+                this.log("old_len != i: "+i);
+            }
+            // alert("do--while middle ["+this.ifra.contentWindow.ctx_old_len+"]");
+
+            comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ifra.contentWindow.ctx_old_len);    
+            this.log("COM_NEWPART: ["+comm_newpart+"]");
+            comm_len = 0;
+           comm_arr = comm_newpart.match(this.comm_match);
+
+            // alert("do--while middle2 ["+again+"]");
+           if (comm_arr) {
+                var comm_arr_len = comm_arr.length;
+               for (i = 0 ; i < comm_arr_len ; i++) {
+                   var temp = comm_arr[i].replace(this.comm_clean,"$1").split("|");
+                   this.gst.comms = this.gst.comms.concat(temp);
+                   comm_len += comm_arr[i].length;
+               }
+               again = 1;
+           }
+            this.ifra.contentWindow.ctx_old_len += comm_len;
+            this.ifra.contentWindow.script_clean = this.gst.st;
+            // alert("do--while end ["+again+"]");
+        } while (again);
+
+        // alert("post while");
+        // EXECUTION OF STREAM COMMANDS
+        do {
+           again = 0;
+           //MOP ?? xhrrestart = 0;
+           if (this.gst.st_loc < this.gst.st_loc_new) {
+               // there is some slow actions running
+               break;
+           }
+           else if (this.gst.comms.length > 0) {
+               var singlecomm;
+                
+               singlecomm = this.gst.comms.shift();
+               // alert("EXE"+gugu);
+               // $("xhrdeltalog").innerHTML = "EVALL: "+singlecomm.replace("<", "&lt;", "g"); +"<br>";
+               //xx this.hbit("+");
+
+                // alert("SINGLE: ["+singlecomm+"]");
+               this.cmdproc(singlecomm);
+               again = 1;
+           }
+        } while (again);
+        this.watchdog_ct++;
+        if (!this.the_end) {
+            this.watchdog_hdl = setTimeout(function(obj) { /* obj.log("tout2"); */ obj.watchdog(); }, this.watchdog_timeout, this);
+        }
+        // alert("watchdog return normal");
+
+        return;
+    },
+
+    //
+    // moved to xynt-streaming-ifra as push()
+    //
+    // keepalive: function (s) {
+    //     this.log("hs::keepalive");
+    //     if (s != null) {
+    //         this.log(s);
+    //         this.ifra.contentWindow.ctx_new += "@BEGIN@"+s+"@END@";
+    //     }
+    //     else {
+    //         this.ifra.contentWindow.ctx_new += "_";
+    //     }
+    //     // this.keepalive_new++;
+    // },
+
+    abort: function () { /* public */
+        // this.log("PATH: "+this.ifra.contentWindow.location.protocol + "://" + this.ifra.contentWindow.location.host + "/" + this.ifra.contentWindow.location.pathname);
+
+        this.gst.abort();
+        if (this.watchdog_hdl != null) {
+            clearTimeout(this.watchdog_hdl);
+            this.watchdog_hdl = null;
+        }
+
+        this.restart_n++;
+        this.log("hs::reload");
+        this.watchable = false;
+        if (this.ifra != null) {
+            this.doc.body.removeChild(this.ifra);
+            delete this.ifra;
+            this.ifra = null;
+        }
+    },
+
+    reload: function () {
+        this.abort();
+        this.start(null);
+    },
+
+    log: function (s) {
+        if (this.console != null) {
+            return (this.console.log(s));
+        }
+    }
+}