| 1 |
- MWF.xDesktop.requireApp("cms.ColumnManager","Explorer",null,false);MWF.xApplication.cms.ColumnManager.FormExplorer=new Class({Extends:MWF.xApplication.cms.ColumnManager.Explorer,Implements:[Options,Events],options:{create:MWF.CMSCM.LP.form.create,search:MWF.CMSCM.LP.form.search,searchText:MWF.CMSCM.LP.form.searchText,noElement:MWF.CMSCM.LP.form.noFormNoticeText},_createElement:function(e){var t=this;var o=function(e,o){layout.desktop.getFormDesignerStyle(function(){var n={style:layout.desktop.formDesignerStyle,template:o,onQueryLoad:function(){this.actions=t.app.restActions;this.column=t.app.options.column;this.application=t.app.options.column},onPostSave:function(){t.reload()}};layout.desktop.openApplication(e,"cms.FormDesigner",n)}.bind(this))};var n=new Element("div",{styles:this.css.createTemplateMaskNode}).inject(this.app.content);var s=new Element("div",{styles:this.css.createFormTemplateAreaNode}).inject(this.app.content);s.fade("in");var i=new Element("div",{styles:this.css.createTemplateScrollNode}).inject(s);var r=new Element("div",{styles:this.css.createTemplateContentNode}).inject(i);MWF.require("MWF.widget.ScrollBar",function(){new MWF.widget.ScrollBar(i,{indent:false})}.bind(this));var t=this;var a="/x_component_cms_FormDesigner/Module/Form/template/templates.json";MWF.getJSON(a,function(e){e.each(function(e){var i=new Element("div",{styles:this.css.templateNode}).inject(r);var a=new Element("div",{styles:this.css.templateIconNode}).inject(i);var l=new Element("div",{styles:this.css.templateTitleNode,text:e.title}).inject(i);i.store("template",e.name);var c=new Element("img",{styles:this.css.templateIconImgNode}).inject(a);c.set("src","/x_component_cms_FormDesigner/Module/Form/template/"+e.icon);i.addEvents({mouseover:function(){this.setStyles(t.css.templateNode_over)},mouseout:function(){this.setStyles(t.css.templateNode)},mousedown:function(){this.setStyles(t.css.templateNode_down)},mouseup:function(){this.setStyles(t.css.templateNode_over)},click:function(e){o(e,this.retrieve("template"));s.destroy();n.destroy()}})}.bind(this))}.bind(this));n.addEvent("click",function(){s.destroy();n.destroy()});var l=this.app.content.getSize();var c=(l.y-262)/2;var p=(l.x-828)/2;if(c<0)c=0;if(p<0)p=0;s.setStyles({top:""+c+"px",left:""+p+"px"})},_loadItemDataList:function(e){this.app.restActions.listForm(this.app.options.column.id,e)},_getItemObject:function(e){return new MWF.xApplication.cms.ColumnManager.FormExplorer.Form(this,e)},setTooltip:function(){this.options.tooltip={create:MWF.CMSCM.LP.form.create,search:MWF.CMSCM.LP.form.search,searchText:MWF.CMSCM.LP.form.searchText,noElement:MWF.CMSCM.LP.form.noFormNoticeText}},deleteItems:function(){while(this.deleteMarkItems.length){var e=this.deleteMarkItems.shift();if(this.deleteMarkItems.length){e.deleteForm()}else{e.deleteForm(function(){this.hideDeleteAction();this.reload()}.bind(this))}}}});MWF.xApplication.cms.ColumnManager.FormExplorer.Form=new Class({Extends:MWF.xApplication.cms.ColumnManager.Explorer.Item,_open:function(e){layout.desktop.getFormDesignerStyle(function(){var t=this;var o={style:layout.desktop.formDesignerStyle,onQueryLoad:function(){this.actions=t.explorer.actions;this.category=t;this.options.id=t.data.id;this.column=t.explorer.app.options.column;this.application=t.explorer.app.options.column}};this.explorer.app.desktop.openApplication(e,"cms.FormDesigner",o)}.bind(this))},_getIcon:function(){var e=(Math.random()*33).toInt();return"process_icon_"+e+".png"},_getLnkPar:function(){return{icon:this.explorer.path+this.explorer.options.style+"/formIcon/lnk.png",title:this.data.name,par:'cms.FormDesigner#{"id": "'+this.data.id+'"}'}},deleteForm:function(e){this.explorer.app.restActions.deleteForm(this.data.id,function(){this.node.destroy();if(e)e()}.bind(this))}});
|