| 1 |
- MWF.xApplication.process.ProcessDesigner.Property=new Class({Implements:[Options,Events],load:function(){if(!this.process.options.isView){if(this.fireEvent("queryLoad")){MWF.getRequestText(this.htmlPath,function(t,e){this.htmlString=t;MWF.require("MWF.widget.JsonTemplate",function(){this.fireEvent("postLoad")}.bind(this))}.bind(this))}this.propertyContent=new Element("div",{styles:{overflow:"hidden"}}).inject(this.process.propertyListNode);this.process.propertyListNode.addEvent("keydown",function(t){t.stopPropagation()})}},editProperty:function(t){},show:function(){if(!this.process.options.isView){this.process.panel.propertyTabPage.showTabIm();this.JsonTemplate=new MWF.widget.JsonTemplate(this.data,this.htmlString);this.process.propertyContent.set("html",this.JsonTemplate.load());this.process.panel.data=this.data;this.setEditNodeEvent();this.setEditNodeStyles(this.process.propertyListNode);this.loadPropertyTab();this.loadPersonInput();this.loadScriptInput();this.loadScriptText();this.loadFormSelect()}},hide:function(){if(!this.process.options.isView){this.JsonTemplate=null}},loadPropertyTab:function(){var t=this.process.propertyListNode.getElements(".MWFTab");if(t.length){var e=this.process.propertyListNode.getFirst();var s=new Element("div",{styles:this.process.css.propertyTabNode}).inject(e,"before");MWF.require("MWF.widget.Tab",function(){var e=new MWF.widget.Tab(s,{style:"moduleList"});e.load();var i=[];t.each(function(t){var s=e.addTab(t,t.get("title"),false);i.push(s)}.bind(this));i[0].showTab()}.bind(this))}},setEditNodeEvent:function(){var t=this;var e=this.process.propertyListNode.getElements("input");e.each(function(e){var s=e.get("name");if(s){var i=e.get("type").toLowerCase();switch(i){case"radio":e.addEvent("change",function(e){t.setRadioValue(s,this)});e.addEvent("blur",function(e){t.setRadioValue(s,this)});e.addEvent("keydown",function(t){t.stopPropagation()});break;case"checkbox":e.addEvent("keydown",function(t){t.stopPropagation()});break;default:e.addEvent("change",function(e){t.setValue(s,this.value)});e.addEvent("blur",function(e){t.setValue(s,this.value)});e.addEvent("keydown",function(e){if(e.code==13){t.setValue(s,this.value)}e.stopPropagation()})}}}.bind(this));var s=this.process.propertyListNode.getElements("select");s.each(function(e){var s=e.get("name");if(s){e.addEvent("change",function(e){t.setSelectValue(s,this)})}});var i=this.process.propertyListNode.getElements("textarea");i.each(function(e){var s=e.get("name");if(s){e.addEvent("change",function(e){t.setValue(s,this.value)});e.addEvent("blur",function(e){t.setValue(s,this.value)});e.addEvent("keydown",function(t){t.stopPropagation()})}}.bind(this))},setSelectValue:function(t,e){var s=e.selectedIndex;var i=e.getElements("option");var n="";if(i[s]){n=i[s].get("value")}this.data[t]=n},setRadioValue:function(t,e){if(e.checked){var s=e.value;if(s=="false")c=false;if(s=="true")c=true;this.data[t]=s}},setValue:function(t,e){this.data[t]=e;if(t=="name"){if(!e)this.data[t]=MWF.APPPD.LP.unnamed}},setEditNodeStyles:function(t){var e=t.getChildren();if(e.length){e.each(function(t){var e=t.get("class");if(e){if(this.process.css[e])t.setStyles(this.process.css[e])}this.setEditNodeStyles(t)}.bind(this))}},loadScriptText:function(){this.scriptTexts=[];var t=this.process.propertyListNode.getElements(".MWFScriptText");MWF.require("MWF.xApplication.process.ProcessDesigner.widget.ScriptText",function(){var e=this;t.each(function(t){var s=new MWF.xApplication.process.ProcessDesigner.widget.ScriptText(t,this.data[t.get("name")],this.process.designer,{maskNode:this.process.designer.content,maxObj:this.process.designer.paperNode,onChange:function(s){e.data[t.get("name")]=s}});this.scriptTexts.push(s)}.bind(this))}.bind(this))},loadScriptInput:function(){var t=this.process.propertyListNode.getElements(".MWFScript");MWF.require("MWF.xApplication.process.ProcessDesigner.widget.ScriptSelector",function(){var e=this;t.each(function(t){var s=new MWF.xApplication.process.ProcessDesigner.widget.ScriptSelector(t,this.data[t.get("name")],this.process.designer,{maskNode:this.process.designer.content,onSelected:function(s){e.data[t.get("name")]=s.name},onDelete:function(){e.data[t.get("name")]="";t.empty()}})}.bind(this))}.bind(this))},loadPersonInput:function(){var t=this.process.propertyListNode.getElements(".MWFPersonIdentity");var e=this.process.propertyListNode.getElements(".MWFPersonDepartment");var s=this.process.propertyListNode.getElements(".MWFPersonCompany");MWF.require("MWF.xApplication.process.ProcessDesigner.widget.PersonSelector",function(){t.each(function(t){new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(t,this.process.designer,{type:"identity",names:this.data[t.get("name")],onChange:function(e){this.savePersonItem(t,e)}.bind(this)})}.bind(this));e.each(function(t){new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(t,this.process.designer,{type:"department",names:this.data[t.get("name")],onChange:function(e){this.savePersonItem(t,e)}.bind(this)})}.bind(this));s.each(function(t){new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(t,this.process.designer,{type:"company",names:this.data[t.get("name")],onChange:function(e){this.savePersonItem(t,e)}.bind(this)})}.bind(this))}.bind(this))},savePersonItem:function(t,e){var s=[];e.each(function(t){s.push(t.data.name)}.bind(this));this.data[t.get("name")]=s},loadConditionInput:function(){var t=this.process.propertyListNode.getElements(".MWFCondition");t.each(function(t){MWF.require("MWF.xApplication.process.ProcessDesigner.widget.ConditionEditor",function(){var e=new MWF.xApplication.process.ProcessDesigner.widget.ConditionEditor(t,{onPostSave:function(e){this.saveScriptItem(t,e)}.bind(this),onQueryDelete:function(e){this.deleteScriptItem(t,e)}.bind(this)});this.setScriptItems(e,t)}.bind(this))}.bind(this))},loadFormSelect:function(){var t=this.process.propertyListNode.getElements(".MWFFormSelect");if(t.length){this.getFormList(function(){t.each(function(t){var e=new Element("select").inject(t);var s=new Element("option",{text:"none"}).inject(e);e.addEvent("change",function(t){this.setValue(t.target.getParent("div").get("name"),t.target.options[t.target.selectedIndex].value)}.bind(this));var i=t.get("name");this.forms.each(function(t){var s=new Element("option",{text:t.name,value:t.id,selected:this.data[i]==t.id}).inject(e)}.bind(this))}.bind(this))}.bind(this))}},getFormList:function(t){if(!this.forms){this.process.designer.actions.listForm(this.process.designer.application.id,function(e){this.forms=e.data;if(t)t()}.bind(this))}else{if(t)t()}},deleteScriptItem:function(t,e){var s=t.get("name");this.data[s].erase(e.data.id);this.process.scripts[e.data.id]=null;delete this.process.scripts[e.data.id];this.process.process.scriptList.erase(e.data)},saveScriptItem:function(t,e){var s=t.get("name");var i=this.data[s];var n=e.data;var o=this.process.scripts[e.data.id];if(!o){this.process.process.scriptList.push(n);this.process.scripts[e.data.id]=n}if(i.indexOf(n.id)==-1){this.data[s].push(n.id)}},setScriptItems:function(t,e){var s=e.get("name");var i=this.data[s];if(i){i.each(function(e){if(e){var s=this.process.scripts[e];if(s)t.setScriptItem(s)}}.bind(this))}},showMultiActivity:function(t){this.hide();var e=new HtmlTable({properties:this.process.css.activityListTable}).inject(this.process.propertyListNode);t.each(function(t){this.row=e.push([{content:" ",properties:{styles:t.style.listIcon}},{content:t.data.name,properties:{width:"80px",styles:this.process.css.list.listText}},{content:" "+t.data.description,properties:{styles:this.process.css.list.listTextDescription}}])}.bind(this))}});
|