text: MWF.xApplication=MWF.xApplication||{},MWF.xApplication.portal=MWF.xApplication.portal||{},MWF.xApplication.portal.PageDesigner=MWF.xApplication.portal.PageDesigner||{},MWF.xDesktop.requireApp("portal.PageDesigner","lp."+MWF.language,null,!1),MWF.require("MWF.widget.JavascriptEditor",null,!1),MWF.xApplication.portal.PageDesigner.Script=new Class({Implements:[Options,Events],options:{style:"default"},initialize:function(t,e,i,s){this.setOptions(s),this.path="../x_component_portal_PageDesigner/$Script/",this.stylePath="../x_component_portal_PageDesigner/$Script/"+this.options.style+"/style.css",this.viewPath="../x_component_portal_PageDesigner/$Script/"+this.options.style+"/view.html",this.designer=t,this.content=e,this.data=i,this.items=[],this.moduleCategorys={},this.pathCategorys={},this.loadView()},loadView:function(){this.content.show(),this.content.set("load",{onSuccess:function(){this.node=this.content.getElement(".node"),this.listNode=this.content.getElement(".listNode"),this.listActionNode=this.content.getElement(".listActionNode"),this.actionButtons=this.content.getElements(".listActionButton"),this.listContentNode=this.content.getElement(".listContentNode"),this.separatorNode=this.content.getElement(".separatorNode"),this.scriptNode=this.content.getElement(".scriptNode"),this.scriptAreaNode=this.content.getElement(".scriptAreaNode"),this.listAreaNode=this.content.getElement(".listAreaNode"),this.scriptTabNode=this.content.getElement(".scriptTabNode"),o2.loadCss(this.stylePath,this.content,function(){this.load()}.bind(this))}.bind(this)}).load(this.viewPath)},load:function(){this.actionButtons[0].set("text",this.designer.lp.byModule),this.actionButtons[1].set("text",this.designer.lp.byPath),this.categoryType="module",MWF.require("MWF.widget.Tab",null,!1),this.scriptTab=new MWF.widget.Tab(this.scriptTabNode,{style:"script"}),this.scriptTab.load(),this.setEvent(),this.data.jsheader||(this.data.jsheader={code:"",html:""}),this.addScriptItem(this.data.jsheader,"code",this.data,"jsheader"),this.addScriptItem(this.data.validationOpinion,"code",this.data,"validationOpinion"),this.addScriptItem(this.data.validationRoute,"code",this.data,"validationRoute"),this.addScriptItem(this.data.validationFormCustom,"code",this.data,"validationFormCustom"),Object.each(this.data.events,function(t,e){this.addScriptItem(t,"code",this.data,this.designer.lp.events+"."+e)}.bind(this)),Object.each(this.data.moduleList,function(t){this.createModuleScript(t)}.bind(this))},createModuleScript:function(t){switch(t.type){case"Button":this.loadButtonScript(t);break;case"Calendar":this.loadCalendarScript(t);break;case"Checkbox":this.loadCheckboxScript(t);break;case"Div":this.loadDivScript(t);break;case"Iframe":this.loadIframeScript(t);break;case"Image":this.loadImageScript(t);break;case"Label":this.loadLabelScript(t);break;case"Personfield":this.loadPersonfieldScript(t);break;case"Org":this.loadOrgScript(t);break;case"Radio":this.loadRadioScript(t);break;case"Select":this.loadSelectScript(t);break;case"Source":this.loadSourceScript(t);break;case"SourceText":this.loadSourceTextScript(t);break;case"Stat":this.loadStatScript(t);break;case"SubSource":this.loadSubSourceScript(t);break;case"Tab$Content":this.loadTab$ContentScript(t);break;case"Tab$Page":this.loadTab$PageScript(t);break;case"Tab":this.loadTabScript(t);break;case"Table$Td":this.loadTable$TdScript(t);break;case"Table":this.loadTableScript(t);break;case"Textarea":this.loadTextareaScript(t);break;case"Textfield":this.loadTextfieldScript(t);break;case"Tree":this.loadTreeScript(t);break;case"View":this.loadViewScript(t);break;case"Actionbar":this.loadActionbarScript(t);break;case"Address":this.loadAddressScript(t);break;case"Attachment":this.loadAttachmentScript(t);break;case"Combox":this.loadComboxScript(t);break;case"Datagrid":this.loadDatagridScript(t);break;case"Datagrid$Data":this.loadDatagrid$DataScript(t);break;case"Datagrid$Title":this.loadDatagrid$TitleScript(t);break;case"Htmleditor":this.loadHtmleditorScript(t);break;case"ImageClipper":this.loadImageClipperScript(t);break;case"Log":this.loadLogScript(t);break;case"Monitor":this.loadMonitorScript(t);break;case"Number":this.loadNumberScript(t);break;case"Office":this.loadOfficeScript(t);break;case"Opinion":this.loadOpinionScript(t);break;case"Orgfield":this.loadOrgfieldScript(t);break;case"Sidebar":this.loadSidebarScript(t);break;case"Subform":this.loadSubformScript(t);break;case"ViewSelector":this.loadViewSelectorScript(t);break;case"Statement":this.loadStatementScript(t);break;case"StatementSelector":this.loadStatementSelectorScript(t)}this.bindDataId(t)},createCategory:function(t,e,i){var s;return"module"===(i||this.categoryType)?"Form"===t.type||"Page"===t.type?(s=new MWF.xApplication.portal.PageDesigner.Script.Category(this,t.type,0,t,"module"),this.moduleCategorys[t.type]=s):(s=new MWF.xApplication.portal.PageDesigner.Script.Category(this,"("+t.type+")-"+t.id,0,t,"module"),this.moduleCategorys[t.id]=s):(s=new MWF.xApplication.portal.PageDesigner.Script.Category(this,e,0,t,"path"),this.pathCategorys[e]=s),s},bindDataId:function(t){var e=t.id;Object.defineProperty(t,"id",{configurable:!0,enumerable:!0,get:function(){return e},set:function(i){Object.each(this.moduleCategorys,(function(e){e.module.id===t.id&&e.resetName("("+t.type+")-"+i,i)})),e=i}.bind(this)})},loadButtonScript:function(t){this.loadEventsScript(t)},loadCalendarScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadCheckboxScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.itemScript,"code",t,"itemScript"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadDivScript:function(t){this.loadEventsScript(t)},loadIframeScript:function(t){this.addScriptItem(t.script,"code",t,"iframeScript"),this.loadEventsScript(t)},loadImageScript:function(t){this.loadEventsScript(t)},loadLabelScript:function(t){this.addScriptItem(t.script,"code",t,"labelScript"),this.loadEventsScript(t)},loadPersonfieldScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.rangeKey,"code",t,"rangeKey"),this.addScriptItem(t.rangeDutyKey,"code",t,"rangeDutyKey"),this.addScriptItem(t.exclude,"code",t,"exclude"),this.addScriptItem(t.rangeKey,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadOrgScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.identityRangeKey,"code",t,"identityRangeKey"),this.addScriptItem(t.unitRangeKey,"code",t,"unitRangeKey"),this.addScriptItem(t.rangeDutyKey,"code",t,"rangeDutyKey"),this.addScriptItem(t.exclude,"code",t,"exclude"),this.addScriptItem(t.rangeKey,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadRadioScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.itemScript,"code",t,"itemScript"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadSelectScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.itemScript,"code",t,"itemScript"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadSourceScript:function(t){this.addScriptItem(t.cookies,"code",t,"cookies"),this.addScriptItem(t.requestBody,"code",t,"requestBody"),this.loadEventsScript(t)},loadSourceTextScript:function(t){this.addScriptItem(t.jsonText,"code",t,"jsonText"),this.loadEventsScript(t)},loadStatScript:function(t){this.loadEventsScript(t)},loadSubSourceScript:function(t){this.loadEventsScript(t)},loadTabScript:function(t){this.loadEventsScript(t)},loadTab$PageScript:function(t){this.loadEventsScript(t)},loadTab$ContentScript:function(t){this.loadEventsScript(t)},loadTableScript:function(t){this.loadEventsScript(t)},loadTable$TdScript:function(t){this.loadEventsScript(t)},loadTextareaScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadTextfieldScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadTreeScript:function(t){this.addScriptItem(t.dataScript,"code",t,"dataScript"),this.loadEventsScript(t)},loadViewScript:function(t){this.loadEventsScript(t)},loadActionbarScript:function(t){t.tools&&t.tools.each(function(e){var i=this.addScriptItem(e,"actionScript",t,"action.tools",e.text);this.bindActionbarToolText(e,i)}.bind(this))},bindActionbarToolText:function(t,e){var i=e,s=t.text;Object.defineProperty(t,"text",{configurable:!0,enumerable:!0,get:function(){return s},set:function(t){i&&(i.par=t,i.resetText()),s=t}.bind(this)})},loadAddressScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadAttachmentScript:function(t){this.addScriptItem(t.validation,"code",t,"validation"),this.loadEventsScript(t)},loadComboxScript:function(t){this.addScriptItem(t.itemScript,"code",t,"itemScript"),this.addScriptItem(t.itemDynamic,"code",t,"itemDynamic"),this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadDatagridScript:function(t){this.addScriptItem(t.defaultData,"code",t,"defaultData"),this.addScriptItem(t.editableScript,"code",t,"editableScript"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadDatagrid$DataScript:function(t){this.loadEventsScript(t)},loadDatagrid$TitleScript:function(t){this.loadEventsScript(t)},loadHtmleditorScript:function(t){this.addScriptItem(t.config,"code",t,"config"),this.loadEventsScript(t)},loadImageClipperScript:function(t){this.loadEventsScript(t)},loadLogScript:function(t){this.addScriptItem(t.filterScript,"code",t,"filterScript"),this.loadEventsScript(t)},loadMonitorScript:function(t){this.loadEventsScript(t)},loadNumberScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.sectionByScript,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadOfficeScript:function(t){this.addScriptItem(t.readScript,"code",t,"readScript"),this.addScriptItem(t.fileSite,"code",t,"fileSite"),this.loadEventsScript(t)},loadOpinionScript:function(t){this.addScriptItem(t.validation,"code",t,"validation"),this.loadEventsScript(t)},loadOrgfieldScript:function(t){this.addScriptItem(t.defaultValue,"code",t,"defaultValue"),this.addScriptItem(t.validation,"code",t,"validation"),this.addScriptItem(t.rangeKey,"code",t,"rangeKey"),this.addScriptItem(t.exclude,"code",t,"exclude"),this.addScriptItem(t.rangeKey,"code",t,"sectionByScript"),this.loadEventsScript(t)},loadSidebarScript:function(t){t.tools&&t.tools.each(function(e){var i=this.addScriptItem(e,"actionScript",t,"action.tools",e.text);this.bindActionbarToolText(e,i)}.bind(this))},loadSubformScript:function(t){this.addScriptItem(t.subformScript,"code",t,"subformScript"),this.loadEventsScript(t)},loadViewSelectorScript:function(t){this.addScriptItem(t.selectedScript,"code",t,"selectedScript"),this.loadEventsScript(t)},loadStatementScript:function(t){this.loadEventsScript(t)},loadStatementSelectorScript:function(t){this.addScriptItem(t.selectedScript,"code",t,"selectedScript"),this.loadEventsScript(t)},loadEventsScript:function(t){Object.each(t.events,function(e,i){this.addModuleEventScriptItem(e,"code",i,t)}.bind(this))},addScriptItem:function(t,e,i,s,a){if(!t)return null;var o=new MWF.xApplication.portal.PageDesigner.Script.Item(this,t,e,i,s,a);return this.items.push(o),o},addModuleEventScriptItem:function(t,e,i,s,a){var o=new MWF.xApplication.portal.PageDesigner.Script.Item(this,t,e,s,this.designer.lp.events+"."+i,a);return this.items.push(o),o},deleteScriptItem:function(t,e,i){var s=this.moduleCategorys[t.id];if(s)for(var a=s.items.length,o=0;o<a;o++){var d=s.items[o];d.module.id!==t.id||d.path!==e||i&&d.par!==i||(d.destroy(),o--,a--)}},setSize:function(){var t=this.content.getSize(),e=this.listAreaNode.getStyles("padding-top","padding-bottom"),i=this.listNode.getStyles("margin-top","margin-bottom"),s=this.listActionNode.getSize(),a=this.listActionNode.getStyles("margin-top","margin-bottom"),o=t.y-e["padding-top"].toFloat()-e["padding-bottom"].toFloat()-i["margin-top"].toFloat()-i["margin-bottom"].toFloat()-5;this.separatorNode.setStyle("height",o+"px"),o=o-s.y-a["margin-top"].toFloat()-a["margin-bottom"].toFloat(),this.listNode.setStyle("height",o+"px"),e=this.scriptAreaNode.getStyles("padding-top","padding-bottom"),i=this.scriptNode.getStyles("margin-top","margin-bottom"),o=t.y-e["padding-top"].toFloat()-e["padding-bottom"].toFloat()-i["margin-top"].toFloat()-i["margin-bottom"].toFloat(),this.scriptNode.setStyle("height",o+"px"),this.scriptTab&&this.scriptTab.resize()},changeCategoryType:function(t){t.target.hasClass("listActionButton_select")||(this.actionButtons.removeClass("listActionButton_select"),t.target.addClass("listActionButton_select"),"module"===this.categoryType?this.changeCategoryTypeToPath():this.changeCategoryTypeToModule())},changeCategoryTypeToPath:function(){this.categoryType="path",this.items.each(function(t){t.relocation()}.bind(this))},changeCategoryTypeToModule:function(){this.categoryType="module",this.items.each(function(t){t.relocation()}.bind(this))},setEvent:function(){this.setSize(),this.setSizeFun=this.setSize.bind(this),this.designer.addEvent("resize",this.setSizeFun),this.actionButtons.addEvents({click:function(t){this.changeCategoryType(t)}.bind(this)}),new Drag(this.separatorNode,{snap:1,onStart:function(t,e){var i="firefox"===Browser.name?e.event.clientX:e.event.x,s="firefox"===Browser.name?e.event.clientY:e.event.y;t.store("position",{x:i,y:s});var a=this.listNode.getSize();t.store("initialWidth",a.x)}.bind(this),onDrag:function(t,e){var i="firefox"===Browser.name?e.event.clientX:e.event.x,s=this.content.getSize(),a=t.retrieve("position"),o=t.retrieve("initialWidth").toFloat()+(i.toFloat()-a.x.toFloat());o>s.x/2&&(o=s.x/2),o<40&&(o=40),this.scriptAreaNode.setStyle("margin-left",o+3),this.listAreaNode.setStyle("width",o),this.jsEditor&&this.jsEditor.resize()}.bind(this)})},createScriptEditor:function(t){this.jsEditor=new MWF.widget.JavascriptEditor(this.scriptNode,{option:{value:"",lineNumbers:!0},onPostLoad:function(){this.editor=this.jsEditor.editor,this.jsEditor.addEditorEvent("change",function(){this.fireEvent("change")}.bind(this)),this.jsEditor.addEditorEvent("blur",function(){this.fireEvent("blur")}.bind(this)),this.jsEditor.resize(),t&&t(),this.fireEvent("postLoad")}.bind(this),onSave:function(){this.fireEvent("change"),this.fireEvent("save")}.bind(this)}),this.jsEditor.load()},removeModule:function(t){for(var e=this.items.length,i=0;i<e;i++){var s=this.items[i];s.module.id===t.id&&(s.destroy(),i--,e--)}var a=Object.keys(this.moduleCategorys);a.each(function(e){var i=this.moduleCategorys[e];i&&i.module.id===t.id&&i.destroy()}.bind(this)),(a=Object.keys(this.pathCategorys)).each(function(t){var e=this.pathCategorys[t];e&&(e.childrenNode.getFirst()||e.destroy())}.bind(this))},checkCategorys:function(){var t=Object.keys(this.moduleCategorys);t.each(function(t){var e=this.moduleCategorys[t];e&&(e.items.length||e.destroy())}.bind(this)),(t=Object.keys(this.pathCategorys)).each(function(t){var e=this.pathCategorys[t];e&&(e.childrenNode.getFirst()||e.destroy())}.bind(this))}}),MWF.xApplication.portal.PageDesigner.Script.Category=new Class({initialize:function(t,e,i,s,a){this.script=t,this.name=e,this.module=s,this.level=i,this.type=a,this.items=[],this.load()},load:function(){var t="";if("path"===this.type)t=this.script.designer.lp.scriptTitle[this.name]||this.name;else{var e;if("Form"===this.module.type||"Page"===this.module.type)e=this.script.designer.lp.pageform;else{e=this.module.type.toLowerCase();var i=this.script.designer.toolsData[e];e=i?i.text:e}t=this.name.replace(/\(.*\)/,"("+e+")")}this.script.listContentNode.appendHTML("<div class='itemCategory'><div class='itemCategoryTitle'><div class='itemCategoryTitleIcon'></div><div class='itemCategoryTitleName' title='"+this.name+"'>"+t+"</div></div><div class='itemCategoryChildren'></div></div>"),this.node=this.script.listContentNode.getLast(),this.titleNode=this.node.getElement(".itemCategoryTitle"),this.iconNode=this.node.getElement(".itemCategoryTitleIcon"),this.nameNode=this.node.getElement(".itemCategoryTitleName"),this.childrenNode=this.node.getElement(".itemCategoryChildren");var s=10*this.level.toInt();this.node.setStyle("margin-left",s+"px"),this.titleNode.addEvents({mouseover:function(){this.addClass("itemCategoryTitle_over")},mouseout:function(){this.removeClass("itemCategoryTitle_over")},click:function(){this.toggle()}.bind(this)})},hide:function(){this.node.hide()},show:function(){this.node.show()},toggle:function(){(this.isExpand?this.collapse:this.expand).apply(this)},expand:function(){this.childrenNode.show(),this.iconNode.addClass("itemCategoryTitleIcon_expand"),this.isExpand=!0},collapse:function(){this.childrenNode.hide(),this.iconNode.removeClass("itemCategoryTitleIcon_expand"),this.isExpand=!1},resetName:function(t,e){delete this.script.moduleCategorys[this.module.id],this.script.moduleCategorys[e]=this,this.name=t,this.nameNode.set({text:this.name,title:this.name}),this.items.each(function(t){t.resetText(e)}.bind(this))},destroy:function(){delete this.script.moduleCategorys[this.module.id],delete this.script.pathCategorys[this.name],this.node.destroy(),this.script.checkCategorys(),MWF.release(this)}}),MWF.xApplication.portal.PageDesigner.Script.Item=new Class({initialize:function(t,e,i,s,a,o){this.script=t,this.data=e,this.key=i,this.module=s,this.path=a,this.text=a,this.par=o,this.bind(),this.data[this.key]&&this.createNode()},reload:function(){this.node||this.createNode(),this.jsEditor&&this.jsEditor.setValue(this.value)},unShow:function(){this.script.editor&&(this.value.code=this.script.editor.getValue()),this.isShow=!1,this.script.currentItem=null},getCategory:function(){return("module"===this.script.categoryType?this.script.moduleCategorys["Form"===this.module.type||"Page"===this.module.type?this.module.type:this.module.id]:this.script.pathCategorys[this.path])||this.script.createCategory(this.module,this.path)},getText:function(t){var e=t||this.module.id,i=this.script.designer.lp.scriptTitle[this.path]||this.path;return i=("Form"===this.module.type||"Page"===this.module.type?this.module.type:e)+":"+i,this.par&&(i=i+"."+this.par),i},relocation:function(){this.node&&(this.category&&this.category.hide(),this.category=this.getCategory(),this.category.show(),this.text=this.getText(),this.node.inject(this.category.childrenNode))},createNode:function(){if(this.category=this.getCategory(),this.category.show(),this.text=this.getText(),this.category.childrenNode.appendHTML("<div class='item'><div class='itemIcon'></div><div class='itemText' title='"+this.text+"'>"+this.text+"</div></div>"),this.node=this.category.childrenNode.getLast(),this.node.addEvents({mouseover:function(){this.addClass("item_over")},mouseout:function(){this.removeClass("item_over")},click:function(){this.selected()}.bind(this)}),"module"===this.script.categoryType)this.category.items.push(this);else{var t=this.script.moduleCategorys["Form"===this.module.type||"Page"===this.module.type?this.module.type:this.module.id];t||(t=this.script.createCategory(this.module,this.path,"module")),t.items.push(this)}},resetText:function(t){if(this.text=this.getText(t),this.node&&this.node.getLast().set({text:this.text,title:this.text}),this.scriptPage){this.scriptPage.options.title=this.text;var e=this.scriptPage.textNode.get("text"),i=this.text;"*"===e.substr(0,1)&&(i="*"+i),this.scriptPage.textNode.set("text",i)}},unselected:function(){this.node.removeClass("item_select"),this.node.getLast().removeClass("itemText_select"),this.isShow=!1,this.script.currentItem=null},selected:function(){if(this.script.currentItem&&this.script.currentItem.unselected(),this.node.addClass("item_select"),this.node.getLast().addClass("itemText_select"),this.isShow=!0,this.script.currentItem=this,this.showScript(),"Form"===this.module.type||"Page"===this.module.type)(this.script.designer.form||this.script.designer.page).selected();else{for(var t=(this.script.designer.form||this.script.designer.page).moduleList,e=null,i=0;i<t.length;i++)if(t[i].json.id===this.module.id){e=t[i];break}e&&e.selected()}},save:function(){this.script.designer.saveForm()},change:function(){this.data[this.key]=this.jsEditor.getValue()},setSize:function(){var t=this.script.scriptTabNode.getComputedSize(),e=this.script.scriptTab.tabNodeContainer.getComputedSize(),i=this.script.scriptTab.tabNodeContainer.getStyle("margin-top").toFloat(),s=this.script.scriptTab.tabNodeContainer.getStyle("margin-bottom").toFloat(),a=t.height-e.totalHeight-i-s;this.scriptPageNode.setStyle("height",a+"px"),this.jsEditor&&this.jsEditor.resize()},createScriptEditor:function(){this.scriptPageNode=new Element("div"),this.setSizeFun=this.setSize.bind(this),this.setSizeFun(),this.script.designer.addEvent("resize",this.setSizeFun);var t=this.getText();this.scriptPage=this.script.scriptTab.addTab(this.scriptPageNode,t,!0),this.scriptPage.scriptItem=this,this.scriptContentNode=new Element("div.scriptContentNode").inject(this.scriptPageNode),this.jsEditor=new MWF.widget.JavascriptEditor(this.scriptContentNode,{option:{value:this.data[this.key],lineNumbers:!0},onPostLoad:function(){this.editor=this.jsEditor.editor,this.editor.id="1",this.jsEditor.addEditorEvent("change",function(){var t=this.scriptPage.textNode.get("text");"*"!==t.substr(0,1)&&this.scriptPage.textNode.set("text","*"+t),this.change()}.bind(this)),this.jsEditor.addEditorEvent("blur",function(){this.change()}.bind(this)),this.jsEditor.resize()}.bind(this),onSave:function(){this.save();var t=this.scriptPage.textNode.get("text");"*"===t.substr(0,1)&&this.scriptPage.textNode.set("text",t.substr(1,t.length))}.bind(this)}),this.jsEditor.load(),this.scriptPage.addEvent("show",function(){this.scriptPage.scriptItem.selected(),this.jsEditor&&this.jsEditor.focus()}.bind(this)),this.scriptPage.addEvent("queryClose",(function(){var t=this.tab.pages.indexOf(this);-1!==t?(0===t?t=1:t--,this.tab.pages[t]?this.tab.pages[t].scriptItem.selected():this.scriptItem.unselected()):this.scriptItem.unselected(),this.scriptItem.scriptPage=null,this.scriptItem.jsEditor=null}))},showScript:function(){this.scriptPage||this.createScriptEditor(),this.scriptPage.showTabIm()},destroy:function(){this.script.items.erase(this);var t=this.script.moduleCategorys["Form"===this.module.type||"Page"===this.module.type?this.module.type:this.module.id];t&&t.items.erase(this),this.scriptPage&&this.scriptPage.closeTab(),this.node&&this.node.destroy(),this.script.checkCategorys(),MWF.release(this)},bind:function(){this.value=this.data[this.key],this.data.editors?this.data.editors.push(this):(Object.defineProperty(this.data,"editors",{configurable:!1,enumerable:!1,writable:!0,value:[]}),this.data.editors.push(this),Object.defineProperty(this.data,this.key,{configurable:!0,enumerable:!0,get:function(){return this.value}.bind(this),set:function(t){this.data.editors.each((function(e){e.editor?t!==e.editor.getValue()&&e.editor.setValue(t,1):e.reload()})),this.value=t}.bind(this)}))}});