AddProcess.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 AddProcess(wrapper, toolbar, processList) { this.base = Ajax; this.base(); this.wrapper = wrapper; this.toolbar = toolbar; this.processList = processList; } AddProcess.prototype = new Ajax(); AddProcess.prototype.setButtonEnable = function (b) { if (this.toolbar) { this.toolbar.setButtonEnable(b); } }; AddProcess.prototype.addProcess = function (name) { if (!name) { this.name = null; //您输入的名字为空! alert("u60a8u8f93u5165u7684u540du5b57u4e3au7a7auff01"); return false; } this.name = name; // this.setButtonEnable(false); // var model = this.wrapper.getModel(); var doc = XiorkFlowModelConverter.convertModelToXML(model); if (!doc) { //将工作流程图转化成xml时出错! alert("u5c06u5de5u4f5cu6d41u7a0bu56feu8f6cu5316u6210xmlu65f6u51fau9519uff01"); this.setButtonEnable(true); return false; } // var url = XiorkFlowWorkSpace.URL_ADD_PROCESS; var method = "POST"; var params = "name=" + name; params += "&xml=" + doc.xml; // this.loadXMLHttpRequest(url, method, params); }; AddProcess.prototype.onReadyStateChange = function (httpRequest) { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { this.processXMLHttpRequest(httpRequest); } else { //处理过程出现错误! alert("u5904u7406u8fc7u7a0bu51fau73b0u9519u8befuff01"); this.setButtonEnable(true); } } }; AddProcess.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 = "u4fddu5b58u6210u529fu3002"; this.wrapper.getModel().setName(this.name); if (this.processList) { this.processList.refreshProcessList(); } this.wrapper.setChanged(false); break; case XiorkFlowWorkSpace.STATUS_FAIL: //保存失败。 alertStr = "u4fddu5b58u5931u8d25u3002"; break; case XiorkFlowWorkSpace.STATUS_FILE_EXIST: //保存失败,已有同名文件存在。 alertStr = "u4fddu5b58u5931u8d25uff0cu5df2u6709u540cu540du6587u4ef6u5b58u5728u3002"; break; case XiorkFlowWorkSpace.STATUS_XML_PARSER_ERROR: //保存失败,xml解析出错。 alertStr = "u4fddu5b58u5931u8d25uff0cxmlu89e3u6790u51fau9519u3002"; break; case XiorkFlowWorkSpace.STATUS_IO_ERROR: //保存失败,IO错误。 alertStr = "u4fddu5b58u5931u8d25uff0cIOu9519u8befu3002"; break; default: //保存失败,未知错误。 alertStr = "u4fddu5b58u5931u8d25uff0cu672au77e5u9519u8befu3002"; break; } this.setButtonEnable(true); alert(alertStr); };