|
@@ -1608,82 +1608,160 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
|
|
|
var dlg = o2.DL.open(options);
|
|
var dlg = o2.DL.open(options);
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
+ startDraftProcess: function(){
|
|
|
|
|
+ if (!this.formCustomValidation("", "")) {
|
|
|
|
|
+ this.app.content.unmask();
|
|
|
|
|
+ // if (callback) callback();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.formValidation("", "")) {
|
|
|
|
|
+ this.app.content.unmask();
|
|
|
|
|
+ // if (callback) callback();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.saveFormData(function(){
|
|
|
|
|
+ this.workAction.startDraft(this.businessData.work.id, function(json){
|
|
|
|
|
+ this.app.options.workId = json.data[0].work;
|
|
|
|
|
+ var msg = {
|
|
|
|
|
+ "subject": MWF.xApplication.process.Xform.LP.processStarted,
|
|
|
|
|
+ "content": "<div>"+MWF.xApplication.process.Xform.LP.processStartedMessage+"“["+json.data[0].processName+"]"+(this.businessData.data.title || this.businessData.data.subject)+"”</div>"
|
|
|
|
|
+ };
|
|
|
|
|
+ var tooltip = layout.desktop.message.addTooltip(msg);
|
|
|
|
|
+ var item = layout.desktop.message.addMessage(msg);
|
|
|
|
|
+
|
|
|
|
|
+ this.app.reload();
|
|
|
|
|
+
|
|
|
|
|
+ //this.app.notice(MWF.xApplication.process.Xform.LP.dataSaved, "success");
|
|
|
|
|
+ //草稿模式暂时不能上传附件,不能直接流转文件
|
|
|
|
|
+ // o2.Actions.invokeAsync([
|
|
|
|
|
+ // {"action": this.workAction, "name": "loadWork"},
|
|
|
|
|
+ // {"action": this.workAction, "name": "getWorkControl"},
|
|
|
|
|
+ // {"action": this.workAction, "name": "getWorkLog"},
|
|
|
|
|
+ // {"action": this.workAction, "name": "getRecordLog"},
|
|
|
|
|
+ // {"action": this.workAction, "name": "listAttachments"}
|
|
|
|
|
+ // ], {"success": function(json_work, json_control, json_log, json_record, json_att){
|
|
|
|
|
+ // if (json_work && json_control && json_log && json_att){
|
|
|
|
|
+ // this.app.parseData(json_work.data, json_control.data, null, json_log.data, json_record.data, json_att.data);
|
|
|
|
|
+ // var workData = json_work.data;
|
|
|
|
|
+ // this.businessData.activity = workData.activity;
|
|
|
|
|
+ // this.businessData.originalData = Object.clone( this.businessData.data );
|
|
|
|
|
+ // this.businessData.taskList = workData.taskList;
|
|
|
|
|
+ // this.businessData.task = this.getCurrentTaskData(workData);
|
|
|
|
|
+ // this.businessData.taskList = workData.taskList;
|
|
|
|
|
+ // this.businessData.readList = workData.readList;
|
|
|
|
|
+ // this.businessData.work = workData.work;
|
|
|
|
|
+ // this.businessData.workCompleted = (workData.work.completedTime) ? workData.work : null;
|
|
|
|
|
+ //
|
|
|
|
|
+ // this.businessData.workLogList = json_log.data;
|
|
|
|
|
+ // this.businessData.recordList = json_record.data;
|
|
|
|
|
+ // this.businessData.attachmentList = json_att.data;
|
|
|
|
|
+ // this.businessData.control = json_control.data;
|
|
|
|
|
+ //
|
|
|
|
|
+ // if (this.businessData.task){
|
|
|
|
|
+ // this.processWork();
|
|
|
|
|
+ // }else{
|
|
|
|
|
+ // this.app.options.workId = json.data[0].work;
|
|
|
|
|
+ // this.app.reload();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }.bind(this), "failure": function(){}}, json.data[0].work);
|
|
|
|
|
+
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }.bind(this), null, false, null, false)
|
|
|
|
|
+ },
|
|
|
|
|
+ getCurrentTaskData: function(data){
|
|
|
|
|
+ if ((data.currentTaskIndex || data.currentTaskIndex===0) && data.currentTaskIndex != -1){
|
|
|
|
|
+ this.app.options.taskId = this.businessData.taskList[data.currentTaskIndex].id;
|
|
|
|
|
+ return this.businessData.taskList[data.currentTaskIndex];
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
processWork: function () {
|
|
processWork: function () {
|
|
|
- if (this.json.mode == "Mobile") {
|
|
|
|
|
- this.processWork_mobile();
|
|
|
|
|
- } else {
|
|
|
|
|
- this.fireEvent("beforeProcessWork");
|
|
|
|
|
- if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
|
|
|
|
|
|
|
+ if (!this.businessData.activity || !this.businessData.activity.id){
|
|
|
|
|
+ this.startDraftProcess();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if (this.json.mode == "Mobile") {
|
|
|
|
|
+ this.processWork_mobile();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.fireEvent("beforeProcessWork");
|
|
|
|
|
+ if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
|
|
|
|
|
|
|
|
- if (!this.formCustomValidation("", "")) {
|
|
|
|
|
- this.app.content.unmask();
|
|
|
|
|
- // if (callback) callback();
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- // MWF.require("MWF.widget.Mask", function() {
|
|
|
|
|
- // this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
|
|
|
|
|
- // this.mask.loadNode(this.app.content);
|
|
|
|
|
-
|
|
|
|
|
- if (!this.formValidation("", "")) {
|
|
|
|
|
- this.app.content.unmask();
|
|
|
|
|
- // if (callback) callback();
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!this.formCustomValidation("", "")) {
|
|
|
|
|
+ this.app.content.unmask();
|
|
|
|
|
+ // if (callback) callback();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // MWF.require("MWF.widget.Mask", function() {
|
|
|
|
|
+ // this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
|
|
|
|
|
+ // this.mask.loadNode(this.app.content);
|
|
|
|
|
+
|
|
|
|
|
+ if (!this.formValidation("", "")) {
|
|
|
|
|
+ this.app.content.unmask();
|
|
|
|
|
+ // if (callback) callback();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- var setSize = function (notRecenter) {
|
|
|
|
|
- var dlg = this;
|
|
|
|
|
- if (!dlg || !dlg.node) return;
|
|
|
|
|
- dlg.node.setStyle("display", "block");
|
|
|
|
|
- var size = processNode.getSize();
|
|
|
|
|
- dlg.content.setStyles({
|
|
|
|
|
- "height": size.y,
|
|
|
|
|
- "width": size.x
|
|
|
|
|
- });
|
|
|
|
|
- var s = dlg.setContentSize();
|
|
|
|
|
- if (dlg.content.getStyle("overflow-y") === "auto" && dlg.content.getStyle("overflow-x") !== "auto") {
|
|
|
|
|
- dlg.node.setStyle("width", dlg.node.getStyle("width").toInt() + 20 + "px");
|
|
|
|
|
- dlg.content.setStyle("width", dlg.content.getStyle("width").toInt() + 20 + "px");
|
|
|
|
|
|
|
+ var setSize = function (notRecenter) {
|
|
|
|
|
+ debugger;
|
|
|
|
|
+ var dlg = this;
|
|
|
|
|
+ if (!dlg || !dlg.node) return;
|
|
|
|
|
+ dlg.node.setStyle("display", "block");
|
|
|
|
|
+ var size = processNode.getSize();
|
|
|
|
|
+ dlg.content.setStyles({
|
|
|
|
|
+ "height": size.y,
|
|
|
|
|
+ "width": size.x
|
|
|
|
|
+ });
|
|
|
|
|
+ var s = dlg.setContentSize();
|
|
|
|
|
+ if (dlg.content.getStyle("overflow-y") === "auto" && dlg.content.getStyle("overflow-x") !== "auto") {
|
|
|
|
|
+ dlg.node.setStyle("width", dlg.node.getStyle("width").toInt() + 20 + "px");
|
|
|
|
|
+ dlg.content.setStyle("width", dlg.content.getStyle("width").toInt() + 20 + "px");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!notRecenter) dlg.reCenter();
|
|
|
}
|
|
}
|
|
|
- if (!notRecenter) dlg.reCenter();
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
|
|
|
|
|
- var processNode = new Element("div", { "styles": this.app.css.processNode_Area }).inject(this.app.content);
|
|
|
|
|
- this.setProcessNode(processNode, "process", function () {
|
|
|
|
|
- this.processDlg = o2.DL.open({
|
|
|
|
|
- "title": this.app.lp.process,
|
|
|
|
|
- "style": this.json.dialogStyle || "user",
|
|
|
|
|
- "isResize": false,
|
|
|
|
|
- "content": processNode,
|
|
|
|
|
- "positionHeight": 800,
|
|
|
|
|
- "maxHeight": 800,
|
|
|
|
|
- "maxHeightPercent": "98%",
|
|
|
|
|
- "minTop": 5,
|
|
|
|
|
- "width": "auto", //processNode.retrieve("width") || 1000, //600,
|
|
|
|
|
- "height": "auto", //processNode.retrieve("height") || 401,
|
|
|
|
|
- "buttonList": [
|
|
|
|
|
- {
|
|
|
|
|
- "type": "ok",
|
|
|
|
|
- "text": MWF.LP.process.button.ok,
|
|
|
|
|
- "action": function (d, e) {
|
|
|
|
|
- if (this.processor) this.processor.okButton.click();
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- "type": "cancel",
|
|
|
|
|
- "text": MWF.LP.process.button.cancel,
|
|
|
|
|
- "action": function () { this.processDlg.close(); }.bind(this)
|
|
|
|
|
|
|
+ //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
|
|
|
|
|
+ var processNode = new Element("div", {"styles": this.app.css.processNode_Area}).inject(this.node);
|
|
|
|
|
+ this.setProcessNode(processNode, "process", function () {
|
|
|
|
|
+ this.processDlg = o2.DL.open({
|
|
|
|
|
+ "title": this.app.lp.process,
|
|
|
|
|
+ "style": this.json.dialogStyle || "user",
|
|
|
|
|
+ "isResize": false,
|
|
|
|
|
+ "content": processNode,
|
|
|
|
|
+ "maskNode": this.app.content,
|
|
|
|
|
+ "positionHeight": 800,
|
|
|
|
|
+ "maxHeight": 800,
|
|
|
|
|
+ "maxHeightPercent": "98%",
|
|
|
|
|
+ "minTop": 5,
|
|
|
|
|
+ "width": "auto", //processNode.retrieve("width") || 1000, //600,
|
|
|
|
|
+ "height": "auto", //processNode.retrieve("height") || 401,
|
|
|
|
|
+ "buttonList": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "type": "ok",
|
|
|
|
|
+ "text": MWF.LP.process.button.ok,
|
|
|
|
|
+ "action": function (d, e) {
|
|
|
|
|
+ if (this.processor) this.processor.okButton.click();
|
|
|
|
|
+ }.bind(this)
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "type": "cancel",
|
|
|
|
|
+ "text": MWF.LP.process.button.cancel,
|
|
|
|
|
+ "action": function () {
|
|
|
|
|
+ this.processDlg.close();
|
|
|
|
|
+ if (this.processor) this.processor.destroy();
|
|
|
|
|
+ }.bind(this)
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ "onPostLoad": function () {
|
|
|
|
|
+ setSize.call(this)
|
|
|
}
|
|
}
|
|
|
- ],
|
|
|
|
|
- "onPostLoad": function () {
|
|
|
|
|
- setSize.call(this)
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- }.bind(this), function () {
|
|
|
|
|
- setSize.call(this.processDlg, true)
|
|
|
|
|
- }.bind(this));
|
|
|
|
|
|
|
+ }.bind(this), function () {
|
|
|
|
|
+ if (this.processDlg) setSize.call(this.processDlg, true)
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
processWork_mobile: function () {
|
|
processWork_mobile: function () {
|
|
@@ -3176,28 +3254,29 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- deleteWork: function () {
|
|
|
|
|
|
|
+ deleteDraftWork: function(){
|
|
|
var _self = this;
|
|
var _self = this;
|
|
|
if (this.json.mode === "Mobile") {
|
|
if (this.json.mode === "Mobile") {
|
|
|
if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
|
|
if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
|
|
|
MWF.require("MWF.widget.Mask", function () {
|
|
MWF.require("MWF.widget.Mask", function () {
|
|
|
- _self.mask = new MWF.widget.Mask({ "style": "desktop", "zIndex": 50000 });
|
|
|
|
|
|
|
+ _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
|
|
|
_self.mask.loadNode(_self.app.content);
|
|
_self.mask.loadNode(_self.app.content);
|
|
|
|
|
|
|
|
- _self.fireEvent("beforeDelete");
|
|
|
|
|
- if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
|
|
|
|
|
-
|
|
|
|
|
_self.doDeleteWork(function () {
|
|
_self.doDeleteWork(function () {
|
|
|
- _self.fireEvent("afterDelete");
|
|
|
|
|
- if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
|
|
|
|
|
_self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
|
|
_self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
|
|
|
- if (_self.mask) { _self.mask.hide(); _self.mask = null; }
|
|
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
_self.finishOnMobile()
|
|
_self.finishOnMobile()
|
|
|
}.bind(this), function (xhr, text, error) {
|
|
}.bind(this), function (xhr, text, error) {
|
|
|
var errorText = error + ":" + text;
|
|
var errorText = error + ":" + text;
|
|
|
if (xhr) errorText = xhr.responseText;
|
|
if (xhr) errorText = xhr.responseText;
|
|
|
_self.app.notice("request json error: " + errorText, "error", dlg.node);
|
|
_self.app.notice("request json error: " + errorText, "error", dlg.node);
|
|
|
- if (_self.mask) { _self.mask.hide(); _self.mask = null; }
|
|
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
}
|
|
}
|
|
@@ -3212,58 +3291,147 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
this.app.confirm("infor", event, MWF.xApplication.process.Xform.LP.deleteWorkTitle, MWF.xApplication.process.Xform.LP.deleteWorkText, 380, 120, function () {
|
|
this.app.confirm("infor", event, MWF.xApplication.process.Xform.LP.deleteWorkTitle, MWF.xApplication.process.Xform.LP.deleteWorkText, 380, 120, function () {
|
|
|
- // _self.app.content.mask({
|
|
|
|
|
- // "style": {
|
|
|
|
|
- // "background-color": "#999",
|
|
|
|
|
- // "opacity": 0.6
|
|
|
|
|
- // }
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
MWF.require("MWF.widget.Mask", function () {
|
|
MWF.require("MWF.widget.Mask", function () {
|
|
|
- _self.mask = new MWF.widget.Mask({ "style": "desktop", "zIndex": 50000 });
|
|
|
|
|
|
|
+ _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
|
|
|
_self.mask.loadNode(_self.app.content);
|
|
_self.mask.loadNode(_self.app.content);
|
|
|
|
|
|
|
|
- _self.fireEvent("beforeDelete");
|
|
|
|
|
- if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
|
|
|
|
|
-
|
|
|
|
|
_self.doDeleteWork(function () {
|
|
_self.doDeleteWork(function () {
|
|
|
- _self.fireEvent("afterDelete");
|
|
|
|
|
- if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
|
|
|
|
|
_self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
|
|
_self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
|
|
|
_self.app.close();
|
|
_self.app.close();
|
|
|
this.close();
|
|
this.close();
|
|
|
- if (_self.mask) { _self.mask.hide(); _self.mask = null; }
|
|
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
}.bind(this), function (xhr, text, error) {
|
|
}.bind(this), function (xhr, text, error) {
|
|
|
var errorText = error + ":" + text;
|
|
var errorText = error + ":" + text;
|
|
|
if (xhr) errorText = xhr.responseText;
|
|
if (xhr) errorText = xhr.responseText;
|
|
|
_self.app.notice("request json error: " + errorText, "error", dlg.node);
|
|
_self.app.notice("request json error: " + errorText, "error", dlg.node);
|
|
|
- if (_self.mask) { _self.mask.hide(); _self.mask = null; }
|
|
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //_self.workAction.deleteWork(function(json){
|
|
|
|
|
- // _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete+": “"+_self.businessData.work.title+"”", "success");
|
|
|
|
|
- // _self.app.close();
|
|
|
|
|
- // this.close();
|
|
|
|
|
- //}.bind(this), null, _self.businessData.work.id);
|
|
|
|
|
- //this.close();
|
|
|
|
|
}, function () {
|
|
}, function () {
|
|
|
this.close();
|
|
this.close();
|
|
|
}, null, this.app.content, this.json.confirmStyle);
|
|
}, null, this.app.content, this.json.confirmStyle);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ deleteWork: function () {
|
|
|
|
|
+ if (!this.businessData.activity || !this.businessData.activity.id) {
|
|
|
|
|
+ this.deleteDraftWork();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ if (this.json.mode === "Mobile") {
|
|
|
|
|
+ if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
|
|
|
|
|
+ MWF.require("MWF.widget.Mask", function () {
|
|
|
|
|
+ _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
|
|
|
|
|
+ _self.mask.loadNode(_self.app.content);
|
|
|
|
|
+
|
|
|
|
|
+ _self.fireEvent("beforeDelete");
|
|
|
|
|
+ if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
|
|
|
|
|
+
|
|
|
|
|
+ _self.doDeleteWork(function () {
|
|
|
|
|
+ _self.fireEvent("afterDelete");
|
|
|
|
|
+ if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
|
|
|
|
|
+ _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ _self.finishOnMobile()
|
|
|
|
|
+ }.bind(this), function (xhr, text, error) {
|
|
|
|
|
+ var errorText = error + ":" + text;
|
|
|
|
|
+ if (xhr) errorText = xhr.responseText;
|
|
|
|
|
+ _self.app.notice("request json error: " + errorText, "error", dlg.node);
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var p = MWF.getCenterPosition(this.app.content, 380, 150);
|
|
|
|
|
+ var event = {
|
|
|
|
|
+ "event": {
|
|
|
|
|
+ "x": p.x,
|
|
|
|
|
+ "y": p.y - 200,
|
|
|
|
|
+ "clientX": p.x,
|
|
|
|
|
+ "clientY": p.y - 200
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ this.app.confirm("infor", event, MWF.xApplication.process.Xform.LP.deleteWorkTitle, MWF.xApplication.process.Xform.LP.deleteWorkText, 380, 120, function () {
|
|
|
|
|
+ // _self.app.content.mask({
|
|
|
|
|
+ // "style": {
|
|
|
|
|
+ // "background-color": "#999",
|
|
|
|
|
+ // "opacity": 0.6
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ MWF.require("MWF.widget.Mask", function () {
|
|
|
|
|
+ _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
|
|
|
|
|
+ _self.mask.loadNode(_self.app.content);
|
|
|
|
|
+
|
|
|
|
|
+ _self.fireEvent("beforeDelete");
|
|
|
|
|
+ if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
|
|
|
|
|
+
|
|
|
|
|
+ _self.doDeleteWork(function () {
|
|
|
|
|
+ _self.fireEvent("afterDelete");
|
|
|
|
|
+ if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
|
|
|
|
|
+ _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
|
|
|
|
|
+ _self.app.close();
|
|
|
|
|
+ this.close();
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }.bind(this), function (xhr, text, error) {
|
|
|
|
|
+ var errorText = error + ":" + text;
|
|
|
|
|
+ if (xhr) errorText = xhr.responseText;
|
|
|
|
|
+ _self.app.notice("request json error: " + errorText, "error", dlg.node);
|
|
|
|
|
+ if (_self.mask) {
|
|
|
|
|
+ _self.mask.hide();
|
|
|
|
|
+ _self.mask = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //_self.workAction.deleteWork(function(json){
|
|
|
|
|
+ // _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete+": “"+_self.businessData.work.title+"”", "success");
|
|
|
|
|
+ // _self.app.close();
|
|
|
|
|
+ // this.close();
|
|
|
|
|
+ //}.bind(this), null, _self.businessData.work.id);
|
|
|
|
|
+ //this.close();
|
|
|
|
|
+ }, function () {
|
|
|
|
|
+ this.close();
|
|
|
|
|
+ }, null, this.app.content, this.json.confirmStyle);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ doDeleteDraftWork: function(success, failure){
|
|
|
|
|
+ this.workAction.deleteDraftWork(function (json) {
|
|
|
|
|
+ if (success) success(json);
|
|
|
|
|
+ }.bind(this), function (xhr, text, error) {
|
|
|
|
|
+ if (failure) failure(xhr, text, error);
|
|
|
|
|
+ }, this.businessData.work.id);
|
|
|
|
|
+ },
|
|
|
doDeleteWork: function (success, failure) {
|
|
doDeleteWork: function (success, failure) {
|
|
|
- if (this.businessData.control["allowDelete"]) {
|
|
|
|
|
- this.workAction.deleteWork(function (json) {
|
|
|
|
|
- if (success) success(json);
|
|
|
|
|
- }.bind(this), function (xhr, text, error) {
|
|
|
|
|
- if (failure) failure(xhr, text, error);
|
|
|
|
|
- }, this.businessData.work.id);
|
|
|
|
|
- } else {
|
|
|
|
|
- if (failure) failure(null, "Permission Denied", "");
|
|
|
|
|
|
|
+ if (!this.businessData.activity || !this.businessData.activity.id) {
|
|
|
|
|
+ this.doDeleteDraftWork(success, failure);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if (this.businessData.control["allowDelete"]) {
|
|
|
|
|
+ this.workAction.deleteWork(function (json) {
|
|
|
|
|
+ if (success) success(json);
|
|
|
|
|
+ }.bind(this), function (xhr, text, error) {
|
|
|
|
|
+ if (failure) failure(xhr, text, error);
|
|
|
|
|
+ }, this.businessData.work.id);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (failure) failure(null, "Permission Denied", "");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|