// where are we?
this.currentStart = 0;
+ // currentNum can be overwritten in show
this.currentNum = 20;
// last full record retrieved
this.currRecOffset = null;
//timers
+ this.pingTimer = null;
this.statTime = paramArray.stattime || 1000;
this.statTimer = null;
this.termTime = paramArray.termtime || 1000;
this.sessionID = null;
this.initStatusOK = false;
this.pingStatusOK = false;
+ clearTimeout(this.pingTimer);
}
this.searchStatusOK = false;
this.stop();
context.sessionID =
data.getElementsByTagName("session")[0]
.childNodes[0].nodeValue;
- setTimeout(
- function () {
- context.ping();
- },
- context.keepAlive
- );
+ context.pingTimer =
+ setTimeout(
+ function () {
+ context.ping();
+ },
+ context.keepAlive
+ );
if ( context.initCallback )
context.initCallback();
}
'Pz2.js: Ping not allowed (proxy mode) or session not initialized.'
);
var context = this;
+
+ clearTimeout(context.pingTimer);
+
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
request.safeGet(
{ "command": "ping", "session": this.sessionID, "windowid" : window.name },
if ( data.getElementsByTagName("status")[0]
.childNodes[0].nodeValue == "OK" ) {
context.pingStatusOK = true;
- setTimeout(
- function () {
- context.ping();
- },
- context.keepAlive
- );
+ context.pingTimer =
+ setTimeout(
+ function () {
+ context.ping();
+ },
+ context.keepAlive
+ );
}
else
context.throwError('Ping failed. Malformed WS resonse.',
}
);
},
- show: function(start, num, sort)
+ show: function(start, num, sort, query_state)
{
if( !this.searchStatusOK && this.useSessions )
throw new Error(
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.safeGet(
+ var requestParameters =
{
"command": "show",
"session": this.sessionID,
"block": 1,
"type": this.showResponseType,
"windowid" : window.name
- },
+ };
+ if (query_state)
+ requestParameters["query-state"] = query_state;
+ request.safeGet(
+ requestParameters,
function(data, type) {
var show = null;
var activeClients = 0;
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
request.safeGet(
- { "command": "bytarget", "session": this.sessionID, "windowid" : window.name},
+ {
+ "command": "bytarget",
+ "session": this.sessionID,
+ "block": 1,
+ "windowid" : window.name
+ },
function(data) {
if ( data.getElementsByTagName("status")[0]
.childNodes[0].nodeValue == "OK" ) {
== Node.ELEMENT_NODE ) {
var nodeName =
targetNodes[i].childNodes[j].nodeName;
- var nodeText =
- targetNodes[i].childNodes[j]
- .firstChild.nodeValue;
- bytarget[i][nodeName] = nodeText;
+ if (targetNodes[i].childNodes[j].firstChild != null)
+ {
+ var nodeText = targetNodes[i].childNodes[j]
+ .firstChild.nodeValue;
+ bytarget[i][nodeName] = nodeText;
+ }
+ else {
+ bytarget[i][nodeName] = "";
+ }
+
+
}
}
if (bytarget[i]["state"]=="Client_Disconnected") {
} else if (bytarget[i].diagnostic == "2") {
bytarget[i].diagnostic = "Temporary system error";
}
+ var targetsSuggestions = targetNodes[i].getElementsByTagName("suggestions");
+ if (targetsSuggestions != undefined && targetsSuggestions.length>0) {
+ var suggestions = targetsSuggestions[0];
+ bytarget[i]["suggestions"] = Element_parseChildNodes(suggestions);
+ }
}
context.bytargetCounter++;