X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Fxhr.js;h=c3816a64104d5ea0eaebd9b31e9ac8fad5008d64;hb=a561ac838b0deefca6bc6aee83ea52200c968b02;hp=30819dc22a4be902c5175ce383723ea4bdb9c46a;hpb=f18bac8374119fa1f3c826e82cfc74ce2ce52dd7;p=brisk.git
diff --git a/web/xhr.js b/web/xhr.js
index 30819dc..c3816a6 100644
--- a/web/xhr.js
+++ b/web/xhr.js
@@ -1,7 +1,10 @@
/*
* brisk - xhr.js
*
- * Copyright (C) 2006 matteo.nastasi@milug.org
+ * Copyright (C) 2006-2008 Matteo Nastasi
+ * mailto: nastasi@alternativeoutput.it
+ * matteo.nastasi@milug.org
+ * web: http://www.alternativeoutput.it
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,13 +19,15 @@
* 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;
@@ -31,6 +36,14 @@ var the_end = false;
var ct = 0;
var watchdog = 0;
+function hbit(symb)
+{
+ if ($("heartbit").innerHTML.length >= 40)
+ $("heartbit").innerHTML = symb;
+ else
+ $("heartbit").innerHTML += symb;
+}
+
function xhr_rd_cb(xhr_rd)
{
var ret;
@@ -51,10 +64,15 @@ 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");
+ // if (g_is_spawn == 1)
+ // alert("di qui3: "+(g_is_spawn == 1 ? "&table_idx="+g_table_idx : ""));
xhr_rd.open('GET', 'index_rd.php?sess='+sess+"&stat="+stat+"&subst="+subst+"&step="+step+"&onlyone="+(document.uniqueID ? "TRUE" : "FALSE")+"&myfrom="+myfrom, true);
// try {
xhr_rd.onreadystatechange = function() { xhr_rd_cb(xhr_rd); }
@@ -79,17 +97,13 @@ 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 */
+ hbit("_");
do {
again = 0;
@@ -104,13 +118,18 @@ function xhr_rd_poll(sess)
singlecomm = gst.comms.shift();
// alert("EXE"+gugu);
// $("xhrdeltalog").innerHTML = "EVALL: "+singlecomm.replace("<", "<", "g"); +"
";
+ hbit("+");
+
eval(singlecomm);
again = 1;
}
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 +143,9 @@ 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 = "-";
+
+ // hbit(".");
+
}
return;
}
@@ -150,6 +169,8 @@ function xhr_rd_poll(sess)
var delta = 0;
var match_lines = /^_*$/;
+ hbit("/\\");
+
// check for the same command group
if (xhr_rd_old_n != xhr_rd_cur_n) {
xhr_rd_old_n = xhr_rd_cur_n;
@@ -213,9 +234,9 @@ function xhr_rd_poll(sess)
// $("sandbox").innerHTML += "return 3
";
if (the_end != true) {
setTimeout(xhr_rd_poll, tout, sess);
- $("sandbox2").innerHTML += "-";
- if ($("sandbox2").innerHTML.length == 20)
- $("sandbox2").innerHTML = "-";
+
+ // hbit(".");
+
}
return;
};