MWF.xDesktop.requireApp("Setting","SettingLoginUI",null,false);MWF.xApplication.Setting.UIModuleDocument=new Class({Extends:MWF.xApplication.Setting.UILoginDocument,load:function(){this.node=new Element("div",{styles:{overflow:"hidden","padding-bottom":"80px"}}).inject(this.contentAreaNode);this.titleName=new Element("div",{styles:this.explorer.css.explorerContentTitleNode}).inject(this.node);this.titleName.set("text",this.lp.ui_moduleSetting);MWF.Actions.get("x_component_assemble_control").listComponent(function(t){this.moduleList=new MWF.xApplication.Setting.UIModuleDocument.ModuleList(this,this.node,t.data,{title:this.lp.ui_module_modules,infor:this.lp.ui_module_modules_infor,actionTitle:this.lp.ui_module_modules_Action,type:"loginStyle",onCreateStyle:function(t,e){this.createStyle(t,e)}.bind(this)})}.bind(this))},createStyle:function(t,e){debugger;var i=(new MWF.widget.UUID).id;var n={title:t,name:"indexStyle_"+i,id:"indexStyle_"+i,preview:e.desktop.desktop.background,enabled:true};var s={title:t,name:"indexStyle_"+i,id:"indexStyle_"+i,data:e};this.indexStyleList.styleList.push(n);MWF.UD.putPublicData("indexStyle_"+i,s,function(){MWF.UD.putPublicData("indexStyleList",this.indexStyleList,{success:function(){this.styleList.addItem(n)}.bind(this),failure:function(){MWF.UD.deletePublicData("indexStyle_"+i)}.bind(this)})}.bind(this))}});MWF.xApplication.Setting.UIModuleDocument.ModuleList=new Class({Extends:MWF.xApplication.Setting.UILoginDocument.StyleList,addItem:function(t){this.items.push(new MWF.xApplication.Setting.UIModuleDocument.Item(this,t))},createNewCustomStyle:function(t){layout.desktop.openApplication(t,"Deployment")}});MWF.xApplication.Setting.UIModuleDocument.Item=new Class({Extends:MWF.xApplication.Setting.UILoginDocument.Style.Item,load:function(){this.itemArea=new Element("div",{styles:this.css.explorerContentListModuleActionAreaNode}).inject(this.content);this.itemIconArea=new Element("div",{styles:this.css.explorerContentListItemModuleIconAreaNode}).inject(this.itemArea);this.itemIcon=new Element("div",{styles:this.css.explorerContentListItemModuleIconNode}).inject(this.itemIconArea);this.itemTextArea=new Element("div",{styles:this.css.explorerContentListModuleActionTextAreaNode}).inject(this.itemArea);var t="/x_component_"+this.data.path.replace(/\./g,"_")+"/$Main/"+this.data.iconPath;this.itemIcon.setStyle("background","url("+t+") no-repeat center center");this.itemTextArea.set("text",this.data.title)}});MWF.xApplication.Setting.UIIndexDocument.Editor=new Class({Extends:MWF.xApplication.Setting.UILoginDocument.Style.Editor,createCssEditor:function(){var t=this;MWF.require("MWF.widget.Maplist",function(){Object.each(this.styleCss.desktop,function(e,i){var n=new Element("div",{styles:this.css.explorerContentStyleEditMapNode}).inject(this.editorArea);var s=new MWF.widget.Maplist.Style(n,{title:"desktop."+i,style:"styleEditor",onChange:function(){t.styleCss.desktop[i]=this.toJson();if(i=="desktop"){t.item.data.preview=t.styleCss.desktop[i].background;MWF.UD.putPublicData("indexStyleList",t.item.list.document.indexStyleList)}t.showPreview();var e={name:t.item.data.name,title:t.item.data.title,id:t.item.data.id,data:t.styleCss};MWF.UD.putPublicData(t.item.data.id,e)}});s.app=this.app;s.load(e)}.bind(this));Object.each(this.styleCss.window,function(e,i){var n=new Element("div",{styles:this.css.explorerContentStyleEditMapNode}).inject(this.editorArea);var s=new MWF.widget.Maplist.Style(n,{title:"window."+i,style:"styleEditor",onChange:function(){t.styleCss.window[i]=this.toJson();t.showPreview();var e={name:t.item.data.name,title:t.item.data.title,id:t.item.data.id,data:t.styleCss};MWF.UD.putPublicData(t.item.data.id,e)}});s.app=this.app;s.load(e)}.bind(this))}.bind(this))},showPreview:function(){this.previewArea.empty();this.previewNode=new Element("div",{styles:{position:"relative",height:"216px"}}).inject(this.previewArea);MWF.xDesktop.requireApp("Setting","preview.Layout",function(){var t=new MWF.xApplication.Setting.preview.Layout(this.previewNode,{styles:{position:"absolute",height:"720px",width:"960px","box-shadow":"0px 0px 30px #666666"}});t.app=this.app;t.css=this.styleCss.desktop;t.windowCss=this.styleCss.window;t.load();this.previewMaskNode=new Element("div",{styles:{position:"absolute",top:"0px",left:"0px"}}).inject(this.previewNode);var e=t.node.getSize();var i=t.node.getStyle("z-index")||0;if(MWF.xDesktop.zIndexPool)i=MWF.xDesktop.zIndexPool.applyZindex();this.previewMaskNode.setStyles({width:""+e.x+"px",height:""+e.y+"px","z-index":i});this.previewMaskNode.addEvents({click:function(t){window.open("/x_desktop/index.html?style="+this.item.data.id+"&styletype="+(this.item.data.name=="default"?"default":"custom"));t.stopPropagation()}.bind(this),mousedown:function(t){t.stopPropagation()},mouseup:function(t){t.stopPropagation()}});this.previewNode.setStyles({"transform-origin":"0px 0px",transform:"scale(0.6)"})}.bind(this))}});