91 lines
2.2 KiB
JavaScript
91 lines
2.2 KiB
JavaScript
var projInfo = {
|
|
name: "XbotWps",
|
|
type: "et",
|
|
};
|
|
|
|
var invokeParam = {
|
|
flag: "openOfficeFile",
|
|
filepath: null,
|
|
};
|
|
|
|
function GetVersion(callBack) {
|
|
var url = GetUrlBase() + "/version";
|
|
startWps({
|
|
url: url,
|
|
data: "",
|
|
callBack: function (res) {
|
|
callBack && callBack(res);
|
|
if (res.status !== 0 && res.message !== "Subserver not available.") {
|
|
serverVersion = "wait";
|
|
return;
|
|
}
|
|
if (res.response && serverVersion == "wait") {
|
|
serverVersion = res.response;
|
|
sessionStorage.setItem("serverVersion", serverVersion);
|
|
}
|
|
},
|
|
tryCount: 4,
|
|
bPop: true,
|
|
timeout: 5000,
|
|
});
|
|
}
|
|
|
|
function createXHR() {
|
|
if (typeof XMLHttpRequest != 'undefined') {
|
|
return new XMLHttpRequest();
|
|
}
|
|
}
|
|
|
|
function getHttpObj() {
|
|
var httpobj = null;
|
|
httpobj = new createXHR();
|
|
return httpobj;
|
|
}
|
|
|
|
function WpsStartWrapVersion(clientType, name, func, param, callBack, showToFront, jsPluginsXml, silentMode, timeout, startparam) {
|
|
var paramEx = {
|
|
jsPluginsXml: jsPluginsXml ? jsPluginsXml : "",
|
|
showToFront: typeof (showToFront) == 'boolean' ? showToFront : true,
|
|
param: (typeof (param) == 'object' ? param : JSON.parse(param))
|
|
}
|
|
var options = {
|
|
clientType: clientType,
|
|
name: name,
|
|
func: func,
|
|
param: paramEx,
|
|
urlBase: GetUrlBase(),
|
|
callBack: callBack,
|
|
wpsclient: undefined,
|
|
concurrent: true,
|
|
silentMode: silentMode,
|
|
timeout: timeout,
|
|
startparam: startparam,
|
|
}
|
|
WpsStartWrapVersionInner(options);
|
|
}
|
|
|
|
|
|
var WpsInvoke = {
|
|
InvokeAsHttp: WpsStartWrapVersion,
|
|
InvokeAsHttps: WpsStartWrapVersion,
|
|
RegWebNotify: RegWebNotify,
|
|
ClientType: {
|
|
wps: "wps",
|
|
et: "et",
|
|
wpp: "wpp",
|
|
pdf: "pdf",
|
|
},
|
|
CreateXHR: getHttpObj,
|
|
IsClientRunning: IsClientRunning,
|
|
GetVersion: GetVersion,
|
|
RegWebNotifyEnable: true,
|
|
};
|
|
|
|
WpsInvoke.InvokeAsHttp(
|
|
projInfo.type,
|
|
projInfo.name,
|
|
"openOfficeFileFromSystemDemo",
|
|
JSON.stringify(invokeParam),
|
|
callbackFunc,
|
|
);
|