UpdateProcess.js
资源名称:WorkFlow.rar [点击查看]
上传用户:ahit0551
上传日期:2009-04-15
资源大小:2345k
文件大小:3k
源码类别:
xml/soap/webservice
开发平台:
Java
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) xio.name 2006</p>
- * @author xio
- */ function UpdateProcess(wrapper, toolbar) { this.base = Ajax; this.base(); this.wrapper = wrapper; this.toolbar = toolbar; } UpdateProcess.prototype = new Ajax(); UpdateProcess.prototype.setButtonEnable = function (b) { if (this.toolbar) { this.toolbar.setButtonEnable(b); } }; UpdateProcess.prototype.updateProcess = function () { var model = this.wrapper.getModel(); var name = model.getName(); if (!name) { this.name = null; //工作流程图名字为空! alert("u5de5u4f5cu6d41u7a0bu56feu540du5b57u4e3au7a7auff01"); return false; } // this.setButtonEnable(false); // var doc = XiorkFlowModelConverter.convertModelToXML(model); if (!doc) { //将工作流程图转化成xml时出错! alert("u5c06u5de5u4f5cu6d41u7a0bu56feu8f6cu5316u6210xmlu65f6u51fau9519uff01"); this.setButtonEnable(true); return false; } // var url = XiorkFlowWorkSpace.URL_UPDATE_PROCESS; var method = "POST"; var params = "name=" + name; params += "&xml=" + doc.xml; // this.loadXMLHttpRequest(url, method, params); }; UpdateProcess.prototype.onReadyStateChange = function (httpRequest) { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { this.processXMLHttpRequest(httpRequest); } else { //处理过程出现错误! alert("u5904u7406u8fc7u7a0bu51fau73b0u9519u8befuff01"); this.setButtonEnable(true); } } }; UpdateProcess.prototype.processXMLHttpRequest = function (httpRequest) { var doc = httpRequest.responseXML; if (!doc) { //操作结束,未知服务器处理结果! alert("u64cdu4f5cu7ed3u675fuff0cu672au77e5u670du52a1u5668u5904u7406u7ed3u679cuff01"); this.setButtonEnable(true); return false; } // var responseNode = doc.getElementsByTagName("Response")[0]; var statusValue = eval(responseNode.getAttribute("status")); var alertStr = ""; switch (statusValue) { case XiorkFlowWorkSpace.STATUS_SUCCESS: //更新成功。 alertStr = "u66f4u65b0u6210u529fu3002"; this.wrapper.getModel().setName(this.name); this.wrapper.setChanged(false); break; case XiorkFlowWorkSpace.STATUS_FAIL: //更新失败。 alertStr = "u66f4u65b0u5931u8d25u3002"; break; case XiorkFlowWorkSpace.STATUS_XML_PARSER_ERROR: //更新失败,xml解析出错。 alertStr = "u66f4u65b0u5931u8d25uff0cxmlu89e3u6790u51fau9519u3002"; break; case XiorkFlowWorkSpace.STATUS_FILE_NOT_FOUND: //更新失败,文件未找到。系统自动转成添加模式。 document.title = "u589eu52a0"; alertStr = "u66f4u65b0u5931u8d25uff0cu6587u4ef6u672au627eu5230u3002u7cfbu7edfu81eau52a8u8f6cu6210u6dfbu52a0u6a21u5f0fu3002"; break; case XiorkFlowWorkSpace.STATUS_IO_ERROR: //更新失败,IO错误。 alertStr = "u66f4u65b0u5931u8d25uff0cIOu9519u8befu3002"; break; default: //更新失败,未知错误。 alertStr = "u66f4u65b0u5931u8d25uff0cu672au77e5u9519u8befu3002"; break; } this.setButtonEnable(true); alert(alertStr); };