var leapconfig = {
server : "http://192.168.0.174:8080/LEAPClient",
_rpcurl : null,
loginHTML : null,
rpcurl : function() {
return this._rpcurl;
},
resurl : function() {
return this.server;
},
rpcservice : "leap",
defaultCallService : "leap",
ReturnJSON : true
};
var PublishServerConfig = {
URL : "http://192.168.0.174:8080/LEAPClient",
ImagesPath : this.URL + "Images",
UploadURL : this.URL + "Upload.jsp"
};
var leapscripttype = {
js : 0,
css : 1,
template : 2
};
var ___logout = function() {
var A = document.URL;
A = A.substring(0, A.indexOf("/HTML/")) + "/HTML/Login.html";
if (leapconfig.loginHTML == null) {
window.location.replace(A);
} else {
window.location.replace(leapconfig.server + leapconfig.loginHTML);
}
};
var leaprpcclient = function() {
this.URL = leapconfig.rpcurl();
this.Service = leapconfig.rpcservice;
this.CallService = leapconfig.defaultCallService;
this.IsReturnJSON = leapconfig.ReturnJSON;
var C;
var A;
this.isSuccess = null;
this.lastError = null;
this.lastErrorCode = null;
this.lastWarring = null;
this.extendResult = null;
this.ID = "";
this.sid = null;
this.getLastWarring = function() {
return this.lastWarring;
};
this.getLastExtendResult = function() {
return this.extendResult;
};
this.setLastExtendResult = function(D) {
this.extendResult = D;
};
this.getLastError = function() {
var F = this.lastError;
var D = this.lastErrorCode;
var G = this.isSuccess;
this.isSuccess = 1;
this.lastError = null;
this.lastErrorCode = null;
if (F == null && D == null && G == 1) {
return;
}
var E = {
error : F,
code : D,
success : G
};
return E;
};
this.___buildResult = function(J, I) {
this.isSuccess = 1;
this.lastError = null;
this.lastErrorCode = null;
if (J == null || J == "" || J == "null") {
this.isSuccess = 0;
this.lastError = "request result is null";
this.lastErrorCode = "-9999";
return null;
}
if (I == null) {
I = true;
} else {
var D = null;
try {
D = JSON.parse(J);
if (D != null && D.javaClass) {
this.isSuccess = D.isSuccess;
this.lastError = D.lastError;
this.lastErrorCode = D.lastErrorCode;
this.lastWarring = D.lastWarring;
this.extendResult = D.extendResult;
if (this.isSuccess == 0) {
if (this.lastErrorCode == "88888"
|| this.lastErrorCode == "-1") {
setTimeout(___logout, 1000);
}
return null;
}
var E = D.result;
if (E == null || E == "" || E == "null") {
return null;
}
if (D.dataType != null && D.dataType == 12) {
I = false;
}
if (I) {
var H = null;
try {
H = JSON.parse(E);
} catch (F) {
}
if (H != null) {
return H;
}
return E;
} else {
return E;
}
}
} catch (G) {
this.isSuccess = 0;
this.lastError = "deserialize server return result error";
this.lastErrorCode = "-9998";
}
}
};
this.getsid = function() {
if (this.sid == null) {
if (document.cookie.indexOf("JSESSIONID=") > -1) {
var E = document.cookie.substring(document.cookie
.indexOf("JSESSIONID="));
E = E.split(";")[0];
this.sid = E.substring(11);
return this.sid;
} else {
var D = XmlHttpHelper.GetTextByPost(leapconfig.rpcurl(),
"type=997");
this.sid = D;
return this.sid;
}
} else {
return this.sid;
}
};
this.request = function(T, O, V, I, P, G, D, N, R, M) {
var U = null;
var E = null;
if (P == null) {
U = this.Service;
} else {
U = P;
}
if (G == null) {
E = this.CallService;
} else {
E = G;
}
var Q = this.IsReturnJSON;
if (N != null && N != Q) {
Q = N;
}
var K = "service=" + U + "&method=" + T + "&callService=" + E
+ "&returnJSON=" + Q + "&clientID=" + this.ID + "&sid="
+ this.getsid();
if (V != null) {
K += "&extend=" + encodeURIComponent(encodeURIComponent(escape(V)));
}
if (D != null) {
K += "&type=" + D;
}
var F = null;
if (O != null && typeof(O) == "object" && O != "") {
try {
var L = [];
var J = 0;
for (var W in O) {
if (typeof(O[W]) != "function") {
if (typeof(O[W]) != "string") {
L[J] = JSON.stringify(O[W]);
} else {
L[J] = O[W];
}
J++;
}
}
K += "&requestData="
+ encodeURIComponent(encodeURIComponent(escape(JSON
.stringify(L))));
} catch (H) {
parexp = null;
}
}
try {
if (K != null && K != "") {
K += "&";
}
K += "requestURL=" + document.URL;
if (I == null) {
var S = null;
if (R == true) {
S = XmlHttpHelper.GetTextByGet(T);
} else {
S = XmlHttpHelper.GetTextByPost(leapconfig.rpcurl(), K);
}
if (Q) {
return this.___buildResult(S, true);
} else {
return S;
}
} else {
if (R == true) {
XmlHttpHelper.GetTextByGet(T, this.callbackfunction, this,
{
callback : I,
domain : M
});
} else {
XmlHttpHelper.GetTextByPost(leapconfig.rpcurl(), K,
this.callbackfunction, this, {
callback : I,
domain : M
});
}
}
} catch (H) {
if (I != null) {
return null;
}
}
};
this.asynrequest = function(F, G, H, E, D) {
return this.request(F, G, H, E, null, null, null, null, null, D);
};
this.callbackfunction = function(H, E) {
try {
var D = this.___buildResult(H, true);
if (E.callback != null) {
var G = function() {
try {
var I = E.domain;
if (I == null) {
I = this;
}
E.callback.call(I, D);
I = callobject = null;
} finally {
I = E = null;
}
};
setTimeout(G, 1);
}
} catch (F) {
}
};
this.load = function(D) {
return this.request(leapconfig.resurl() + D, null, null, null, null,
null, 2, false, true);
};
this.loadjs = function(F, D, E) {
return this.loadscript(F, leapscripttype.js, D, E);
};
this.loadcss = function(E, D) {
return this.loadscript(E, leapscripttype.css, D);
};
this.loadtl = function(E, D) {
return this.loadscript(E, leapscripttype.template, D);
};
this._s = null;
this._c = null;
this.loadscript = function(G, M, K, D) {
if (K == null) {
K = document;
}
if (this._s == null) {
this._s = [];
var N = K.getElementsByTagName("SCRIPT");
if (N != null) {
for (var H = 0; H < N.length; H++) {
var E = N[H].getAttribute("path");
if (E != null) {
this._s.push(E.toLowerCase());
}
E = null;
}
}
}
if (this._c == null) {
this._c = [];
var J = K.getElementsByTagName("LINK");
if (J != null) {
for (var H = 0; H < J.length; H++) {
var E = J[H].getAttribute("path");
if (E != null) {
this._c.push(E.toLowerCase());
}
E = null;
}
}
}
if (M == null) {
M = leapscripttype.js;
}
if (M == leapscripttype.js) {
var F = this._s.length;
var I = G.toLowerCase();
for (var H = 0; H < F; H++) {
if (I == this._s[H]) {
return;
}
}
this._s.push(I);
} else {
if (M == leapscripttype.css) {
var F = this._c.length;
var I = G.toLowerCase();
for (var H = 0; H < F; H++) {
if (I == this._c[H]) {
return;
}
}
this._c.push(I);
}
}
var L = this.load(G);
if (L == null) {
return;
}
if (M == leapscripttype.js || M == leapscripttype.css) {
B(L, K, M, D, G);
} else {
try {
return L;
} finally {
L = null;
}
}
};
var B = function(I, F, D, K, J) {
try {
if (I != null) {
var H = F.getElementsByTagName("HEAD").item(0);
var G;
if (D == leapscripttype.js) {
G = F.createElement("script");
G.language = "javascript";
G.type = "text/javascript";
G.charset = "UTF-8";
G.defer = "defer";
G.text = I;
G.path = J;
} else {
if (D == leapscripttype.css) {
var G = document.createElement("link");
G.setAttribute("rel", "stylesheet");
G.setAttribute("type", "text/css");
G.setAttribute("href", leapconfig.server + J);
G.path = J;
}
}
H.appendChild(G);
I = F = D = K = H = G = null;
return true;
}
} catch (E) {
}
};
this.init = function() {
var F = window.location.href;
var E = document.getElementsByTagName("HEAD").item(0).childNodes;
for (var G = 0; G < E.length; G++) {
if (E[G].tagName == "SCRIPT"
&& E[G].src != null
&& (E[G].src.indexOf("Base.js") > -1 || E[G].src
.indexOf("Net.js") > -1)) {
var H = E[G].src;
if (H.charAt(0) == "/") {
while (F.indexOf("//") > -1) {
F = F.replace("//", "_");
}
F = F.replace("http:_", "http://").replace("https:_",
"https://");
while (F.lastIndexOf("/") > -1
&& F.charAt(F.lastIndexOf("/") - 1) != "/") {
F = F.substring(0, F.lastIndexOf("/"));
}
if (E[G].src.indexOf("Base.js") > -1) {
F += H.replace("LEAP/Resource/JavaScript/Base.js", "");
} else {
F += H.replace("LEAP/Resource/JavaScript/Base/Net.js",
"");
}
} else {
if (H.indexOf("http://") > -1 || H.indexOf("https://") > -1) {
if (E[G].src.indexOf("Base.js") > -1) {
F = H.replace("LEAP/Resource/JavaScript/Base.js",
"");
} else {
F = H.replace(
"LEAP/Resource/JavaScript/Base/Net.js", "");
}
} else {
var I = 0;
while (H.indexOf("../") > -1) {
I += 1;
H = H.replace("../", "");
}
while (F.indexOf("//") > -1) {
F = F.replace("//", "_");
}
F = F.replace("http:_", "http://").replace("https:_",
"https://").substring(0, F.lastIndexOf("/"));
if (I > 0) {
while (I > 0) {
I--;
F = F.substring(0, F.lastIndexOf("/"));
}
}
F = F + "/" + H;
if (E[G].src.indexOf("Base.js") > -1) {
F = F.replace("LEAP/Resource/JavaScript/Base.js",
"");
} else {
F = F.replace(
"LEAP/Resource/JavaScript/Base/Net.js", "");
}
}
}
break;
}
}
var D = F;
leapconfig.server = D;
leapconfig._rpcurl = D + "LEAP/Service/RPC/RPC.DO";
PublishServerConfig.URL = D;
PublishServerConfig.ImagesPath = PublishServerConfig.URL + "Images";
PublishServerConfig.UploadURL = PublishServerConfig.URL + "Upload.jsp";
};
};
var leapclient = new leaprpcclient();
function XmlHttpHelper() {
}
var arr_t = new Array("MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0",
"MSXML2.XMLHTTP.2.6", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP",
"MSXML.XMLHTTP");
var arr_t_indx = -1;
XmlHttpHelper._getXmlHttpObj = function() {
var D = null;
if (window.ActiveXObject) {
if (arr_t_indx == -1) {
for (var B = 0; B < arr_t.length; B++) {
try {
D = new ActiveXObject(arr_t[B]);
arr_t_indx = B;
} catch (C) {
}
if (D != null) {
break;
}
}
} else {
D = new ActiveXObject(arr_t[arr_t_indx]);
}
} else {
if (window.XMLHttpRequest) {
try {
D = new XMLHttpRequest();
if (D.overrideMimeType) {
D.overrideMimeType("text/xml");
}
} catch (A) {
}
}
}
if (D == null) {
alert("con not create XMLHTTP object");
throw (new Error(-1, "con not create XMLHTTP object"));
}
return D;
};
XmlHttpHelper.GetTextByPost = function(D, C, F, B, A) {
var E = null;
try {
if (arguments.length > 2) {
if (arguments.length > 3) {
E = arguments[3];
}
return XmlHttpHelper.transmit(arguments[0], "POST", arguments[1],
"text", true, arguments[2], E, A);
} else {
return XmlHttpHelper.transmit(arguments[0], "POST", arguments[1],
"text", false, null);
}
} finally {
E = null;
}
};
XmlHttpHelper.GetTextByGet = function(C, E, B, A) {
var D = null;
try {
if (arguments.length > 1) {
if (arguments.length > 3) {
D = arguments[2];
}
return XmlHttpHelper.transmit(arguments[0], "GET", null, "text",
true, arguments[1], D, A);
} else {
return XmlHttpHelper.transmit(arguments[0], "GET", null, "text",
false, null);
}
} finally {
D = null;
}
};
XmlHttpHelper.transmit = function(A, B, D, G, F, L, H, E) {
var C = this._getXmlHttpObj();
try {
C.open(B, A, F);
C.setRequestHeader("connection", "keep-alive");
if (B.toLowerCase() == "post") {
var J = 0;
if (D != null) {
J = D.length;
}
C.setRequestHeader("Content-Length", '"' + J + '"');
C.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
}
if (F) {
C.onreadystatechange = function() {
if (C.readyState == 4) {
try {
if (G != null) {
if (G.toLowerCase() == "text") {
if (L != null) {
if (H != null) {
L.call(H, C.responseText, E);
} else {
L.call(C.responseText);
}
}
} else {
if (G.toLowerCase() == "xml") {
if (H != null) {
L.call(H, C.responseXML, E);
} else {
L.call(C.responseXML);
}
}
}
} else {
if (H != null) {
if (E != null) {
L.call(H, null, E);
} else {
L.call(H);
}
} else {
L.call();
}
}
} finally {
}
}
};
if (D == null) {
D = "";
}
C.send(D);
} else {
if (D == null) {
D = "";
}
C.send(D);
if (C.status == 200) {
if (G != null) {
if (G.toLowerCase() == "text") {
return C.responseText;
} else {
if (G.toLowerCase() == "xml") {
return C.responseXML;
}
}
} else {
return null;
}
}
return null;
}
} catch (I) {
} finally {
if (C != null) {
try {
} catch (K) {
}
}
}
};
RegExp.prototype.toJSON = function() {
return this.toString();
};
if (!this.JSON) {
this.JSON = {};
}
(function() {
function f(n) {
return n < 10 ? "0" + n : n;
}
if (typeof Date.prototype.toJSON !== "function") {
Date.prototype.toJSON = function(key) {
return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-"
+ f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate())
+ "T" + f(this.getUTCHours()) + ":"
+ f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds())
+ "Z" : null;
};
String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function(
key) {
return this.valueOf();
};
}
var cx = /[/u0000/u00ad/u0600-/u0604/u070f/u17b4/u17b5/u200c-/u200f/u2028-/u202f/u2060-/u206f/ufeff/ufff0-/uffff]/g, escapable = /[///"/x00-/x1f/x7f-/x9f/u00ad/u0600-/u0604/u070f/u17b4/u17b5/u200c-/u200f/u2028-/u202f/u2060-/u206f/ufeff/ufff0-/uffff]/g, gap, indent, meta = {
"/b" : "//b",
"/t" : "//t",
"/n" : "//n",
"/f" : "//f",
"/r" : "//r",
'"' : '//"',
"//" : ""
}, rep;
function quote(string) {
escapable.lastIndex = 0;
return escapable.test(string) ? '"'
+ string.replace(escapable, function(a) {
var c = meta[a];
return typeof c === "string" ? c : "//u"
+ ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"'
: '"' + string + '"';
}
function str(key, holder) {
var i, k, v, length, mind = gap, partial, value = holder[key];
if (value && typeof value === "object"
&& typeof value.toJSON === "function") {
value = value.toJSON(key);
}
if (typeof rep === "function") {
value = rep.call(holder, key, value);
}
switch (typeof value) {
case "string" :
return quote(value);
case "number" :
return isFinite(value) ? String(value) : "null";
case "boolean" :
case "null" :
return String(value);
case "object" :
if (!value) {
return "null";
}
gap += indent;
partial = [];
if (Object.prototype.toString.apply(value) === "[object Array]") {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || "null";
}
v = partial.length === 0 ? "[]" : gap
? "[/n" + gap + partial.join(",/n" + gap) + "/n"
+ mind + "]"
: "[" + partial.join(",") + "]";
gap = mind;
return v;
}
if (rep && typeof rep === "object") {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === "string") {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ": " : ":") + v);
}
}
}
} else {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ": " : ":") + v);
}
}
}
}
v = partial.length === 0 ? "{}" : gap ? "{/n" + gap
+ partial.join(",/n" + gap) + "/n" + mind + "}" : "{"
+ partial.join(",") + "}";
gap = mind;
return v;
}
}
if (typeof JSON.stringify !== "function") {
JSON.stringify = function(value, replacer, space) {
var i;
gap = "";
indent = "";
if (typeof space === "number") {
for (i = 0; i < space; i += 1) {
indent += " ";
}
} else {
if (typeof space === "string") {
indent = space;
}
}
rep = replacer;
if (replacer
&& typeof replacer !== "function"
&& (typeof replacer !== "object" || typeof replacer.length !== "number")) {
throw new Error("JSON.stringify");
}
return str("", {
"" : value
});
};
}
if (typeof JSON.parse !== "function") {
JSON.parse = function(text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === "object") {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function(a) {
return "//u"
+ ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
});
}
if (/^[/],:{}/s]*$/
.test(text
.replace(///(?:["bfnrt]|u[0-9a-fA-F]{4})/g, "@")
.replace(
/"[^"///n/r]*"|true|false|null|-?/d+(?:/./d*)?(?:[eE][+/-]?/d+)?/g,
"]").replace(/(?:^|:|,)(?:/s*/[)+/g, ""))) {
j = eval("(" + text + ")");
return typeof reviver === "function" ? walk({
"" : j
}, "") : j;
}
throw new SyntaxError("JSON.parse");
};
}
}());
var json_parse = (function() {
var D, B, A = {
'"' : '"',
"//" : "//",
"/" : "/",
b : "/b",
f : "/f",
n : "/n",
r : "/r",
t : "/t"
}, M, K = function(N) {
throw {
name : "SyntaxError",
message : N,
at : D,
text : M
};
}, G = function(N) {
if (N && N !== B) {
K("Expected '" + N + "' instead of '" + B + "'");
}
B = M.charAt(D);
D += 1;
return B;
}, F = function() {
var O, N = "";
if (B === "-") {
N = "-";
G("-");
}
while (B >= "0" && B <= "9") {
N += B;
G();
}
if (B === ".") {
N += ".";
while (G() && B >= "0" && B <= "9") {
N += B;
}
}
if (B === "e" || B === "E") {
N += B;
G();
if (B === "-" || B === "+") {
N += B;
G();
}
while (B >= "0" && B <= "9") {
N += B;
G();
}
}
O = +N;
if (isNaN(O)) {
K("Bad number");
} else {
return O;
}
}, H = function() {
var Q, P, O = "", N;
if (B === '"') {
while (G()) {
if (B === '"') {
G();
return O;
} else {
if (B === "//") {
G();
if (B === "u") {
N = 0;
for (P = 0; P < 4; P += 1) {
Q = parseInt(G(), 16);
if (!isFinite(Q)) {
break;
}
N = N * 16 + Q;
}
O += String.fromCharCode(N);
} else {
if (typeof A[B] === "string") {
O += A[B];
} else {
break;
}
}
} else {
O += B;
}
}
}
}
K("Bad string");
}, J = function() {
while (B && B <= " ") {
G();
}
}, C = function() {
switch (B) {
case "t" :
G("t");
G("r");
G("u");
G("e");
return true;
case "f" :
G("f");
G("a");
G("l");
G("s");
G("e");
return false;
case "n" :
G("n");
G("u");
G("l");
G("l");
return null;
}
K("Unexpected '" + B + "'");
}, L, I = function() {
var N = [];
if (B === "[") {
G("[");
J();
if (B === "]") {
G("]");
return N;
}
while (B) {
N.push(L());
J();
if (B === "]") {
G("]");
return N;
}
G(",");
J();
}
}
K("Bad array");
}, E = function() {
var O, N = {};
if (B === "{") {
G("{");
J();
if (B === "}") {
G("}");
return N;
}
while (B) {
O = H();
J();
G(":");
if (Object.hasOwnProperty.call(N, O)) {
K('Duplicate key "' + O + '"');
}
N[O] = L();
J();
if (B === "}") {
G("}");
return N;
}
G(",");
J();
}
}
K("Bad object");
};
L = function() {
J();
switch (B) {
case "{" :
return E();
case "[" :
return I();
case '"' :
return H();
case "-" :
return F();
default :
return B >= "0" && B <= "9" ? F() : C();
}
};
return function(Q, O) {
var N;
M = Q;
D = 0;
B = " ";
N = L();
J();
if (B) {
K("Syntax error");
}
return typeof O === "function" ? (function P(U, T) {
var S, R, V = U[T];
if (V && typeof V === "object") {
for (S in V) {
if (Object.hasOwnProperty.call(V, S)) {
R = P(V, S);
if (R !== undefined) {
V[S] = R;
} else {
delete V[S];
}
}
}
}
return O.call(U, T, V);
}({
"" : N
}, "")) : N;
};
}());
if (this.JSON && !window.ActiveXObject) {
if (this.JSON.parse && this.json_parse) {
this.JSON.innerParse = this.JSON.parse;
this.JSON.parse = function(B, A) {
if (B != null) {
if (B.length >= 327680) {
return json_parse(B, A);
} else {
return JSON.innerParse(B, A);
}
}
};
}
}
var UUID = {
S4 : function() {
return (((1 + Math.random()) * 65536) | 0).toString(16).substring(1);
},
randomUUID : function() {
return (UUID.S4() + UUID.S4() + "-" + UUID.S4() + "-" + UUID.S4() + "-"
+ UUID.S4() + "-" + UUID.S4() + UUID.S4() + UUID.S4());
},
d : new Date().getTime() + "_" + Math.random().toString().replace(".", "_")
+ "_",
c : 0,
cID : function() {
++UUID.c;
return "cid_" + UUID.d + UUID.c;
}
};
function leap_common_init() {
leapclient.init();
}
leap_common_init();
leapclient.ID = UUID.randomUUID();
JS 后台服务调用
最新推荐文章于 2024-01-24 09:43:36 发布