spostata la chiusura finestra in fondo alla pagina
[brisk.git] / web / xhr.js
index 30819dc..ca1a2a0 100644 (file)
  * not, write to the Free Software Foundation, Inc, 59 Temple Place -
  * Suite 330, Boston, MA 02111-1307, USA.
  *
+ * $Id$
+ *
  */
 
 var xhr_rd_cookiepath = "/brisk/";
 var xhr_rd = false;
 var xhr_rd_stopped = true;
 var xhr_rd_oldctx = "";
-var xhr_rd_newctx;
+var xhr_rd_newctx = "";
 
 var xhr_rd_cur_n = -1;
 var xhr_rd_old_n = -1;
@@ -51,7 +53,11 @@ function xhr_rd_start(sess,stat,subst,step)
 {
     if (the_end)
        return;
-    createCookie("sess",sess,1,xhr_rd_cookiepath);
+    createCookie("sess", sess, 24*365, xhr_rd_cookiepath);
+
+    // NOTE: *ctx = "" to prevent konqueror stream commands duplication.
+    xhr_rd_oldctx = "";
+    xhr_rd_newctx = "";
 
     /* NOTE document.uniqueID exists only under IE  */
     // alert("di qui3");
@@ -79,17 +85,15 @@ function xhr_rd_poll(sess)
        xhr_rd.abort(); 
     }
     */
-
     var zug = "XHR_RD_POLL sess = "+sess+" stat = "+stat+" subst = "+subst+" step = "+gst.st+" step_loc = "+gst.st_loc+" step_loc_new = "+gst.st_loc_new+" STOP: "+xhr_rd_stopped;
 
     if (zug != $("sandbox").innerHTML)
        $("sandbox").innerHTML = zug;
-    
 
-    /* heartbeat log */
-    $("sandbox2").innerHTML += "_";
-    if ($("sandbox2").innerHTML.length == 20)
-       $("sandbox2").innerHTML = "_";
+    /* heartbit log */
+    $("heartbit").innerHTML += "_";
+    if ($("heartbit").innerHTML.length == 20)
+       $("heartbit").innerHTML = "_";
     
     do {
        again = 0;
@@ -110,7 +114,10 @@ function xhr_rd_poll(sess)
        else {
            xhrrestart = 1;
            try { 
-               xhr_rd_newctx = xhr_rd.responseText;
+               if (xhr_rd == null)
+                       throw "restart";
+               if (xhr_rd.responseText != null)
+                       xhr_rd_newctx = xhr_rd.responseText;
            }
            catch (e) {
                if (xhr_rd_stopped == true) {
@@ -124,9 +131,11 @@ function xhr_rd_poll(sess)
                if (the_end != true) {
                    watchdog = 0;
                    setTimeout(xhr_rd_poll, tout, sess);
-                   $("sandbox2").innerHTML += "-";
-                   if ($("sandbox2").innerHTML.length == 20)
-                       $("sandbox2").innerHTML = "-";
+                   
+                   $("heartbit").innerHTML += "-";
+                   if ($("heartbit").innerHTML.length == 20)
+                       $("heartbit").innerHTML = "-";
+                   
                }
                return;
            }
@@ -213,9 +222,11 @@ function xhr_rd_poll(sess)
     // $("sandbox").innerHTML += "return 3<br>";
     if (the_end != true) {
        setTimeout(xhr_rd_poll, tout, sess);
-       $("sandbox2").innerHTML += "-";
-       if ($("sandbox2").innerHTML.length == 20)
-           $("sandbox2").innerHTML = "-";
+       
+       $("heartbit").innerHTML += "-";
+       if ($("heartbit").innerHTML.length == 20)
+           $("heartbit").innerHTML = "-";
+       
     }
     return;
 };