SettingIndexUI.min.js 8.0 KB

1
  1. MWF.xDesktop.requireApp("Setting","SettingLoginUI",null,false);MWF.xApplication.Setting.UIIndexDocument=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_indexSetting);MWF.getJSON("/x_desktop/res/mwf4/package/xDesktop/$Layout/styles.json",function(t){MWF.UD.getPublicData("indexThemes",function(e){var i=false;if(e){this.enabledThemes=e}else{this.enabledThemes=[];i=true}t.map(function(t,e){t.id=t.style;t.name="default";t.url=t.style;t.enabled=!this.enabledThemes.length||this.enabledThemes.indexOf(t.style)!=-1;if(i)this.enabledThemes.push(t.style);return t}.bind(this));this.styleList=new MWF.xApplication.Setting.UIIndexDocument.StyleList(this,this.node,t,{title:this.lp.ui_index_systemStyle,infor:this.lp.ui_index_systemStyle_infor,type:"loginStyle",onCreateStyle:function(t,e){this.createStyle(t,e)}.bind(this)});MWF.UD.getPublicData("indexStyleList",function(t){debugger;this.indexStyleList=t;if(!this.indexStyleList)this.indexStyleList={styleList:[]};this.styleList=new MWF.xApplication.Setting.UIIndexDocument.StyleList(this,this.node,this.indexStyleList.styleList,{title:this.lp.ui_index_customStyle,infor:this.lp.ui_index_customStyle_infor,actionTitle:this.lp.ui_index_customStyle_Action,type:"loginStyle",onCreateStyle:function(t,e){this.createStyle(t,e)}.bind(this)})}.bind(this))}.bind(this))}.bind(this))},createStyle:function(t,e){debugger;var i=(new MWF.widget.UUID).id;var s={title:t,name:"indexStyle_"+i,id:"indexStyle_"+i,preview:e.desktop.desktop.background,enabled:true};var n={title:t,name:"indexStyle_"+i,id:"indexStyle_"+i,data:e};this.indexStyleList.styleList.push(s);MWF.UD.putPublicData("indexStyle_"+i,n,function(){MWF.UD.putPublicData("indexStyleList",this.indexStyleList,{success:function(){this.styleList.addItem(s)}.bind(this),failure:function(){MWF.UD.deletePublicData("indexStyle_"+i)}.bind(this)})}.bind(this))}});MWF.xApplication.Setting.UIIndexDocument.StyleList=new Class({Extends:MWF.xApplication.Setting.UILoginDocument.StyleList,addItem:function(t){this.items.push(new MWF.xApplication.Setting.UIIndexDocument.Item(this,t))}});MWF.xApplication.Setting.UIIndexDocument.Item=new Class({Extends:MWF.xApplication.Setting.UILoginDocument.Style.Item,getCss:function(){var t=null;if(this.data.url){var e="/x_desktop/res/mwf4/package/xDesktop/$Layout/"+this.data.url+"/css.wcss";e=e.indexOf("?")!=-1?e+"&v="+COMMON.version:e+"?v="+COMMON.version;var i="/x_desktop/res/mwf4/package/xDesktop/$Window/desktop_"+this.data.url+"/css.wcss";i=i.indexOf("?")!=-1?i+"&v="+COMMON.version:i+"?v="+COMMON.version;t={};MWF.getJSON(e,function(e){t.desktop=e}.bind(this),false);MWF.getJSON(i,function(e){t.window=e}.bind(this),false)}else{MWF.UD.getPublicData(this.data.name,function(e){t=e.data},false)}return t},showPreview:function(){this.styleCss=this.getCss();this.previewNode=new Element("div.previewNode",{styles:{"margin-top":"10px",position:"relative"}}).inject(this.itemArea);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.data.id+"&styletype="+(this.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.4)"})}.bind(this))},hidePreview:function(){this.previewMaskNode.destroy();this.previewNode.getFirst().destroy();this.previewNode.empty();this.previewNode.destroy();this.previewMaskNode=null;this.previewNode=null},setCurrent:function(t){if(this.data.enabled){this.list.document.enabledThemes.erase(this.data.id);this.setUncurrentStyle()}else{this.list.document.enabledThemes.push(this.data.id);this.setCurrentStyle()}MWF.UD.putPublicData("indexThemes",this.list.document.enabledThemes);MWF.UD.putPublicData("indexStyleList",this.list.document.indexStyleList);t.stopPropagation()},setUncurrentStyle:function(){this.data.enabled=false;this.checkIcon.setStyles(this.css.explorerContentListNotCheckIconAreaNode);this.checkIcon.set("title",this.lp.ui_index_disabled)},setCurrentStyle:function(t){this.data.enabled=true;this.checkIcon.setStyles(this.css.explorerContentListCheckIconAreaNode);this.checkIcon.set("title",this.lp.ui_index_enabled)},createNewCustomStyleData:function(t){var e=t.content.getElement("input").get("value");if(!e){this.app.notice(ui_login_customStyle_newName_empty,"error");return false}else{var i=this.getCss();var s=Object.clone(i);this.list.fireEvent("createStyle",[e,s]);t.close()}},editStyle:function(){this.editor=new MWF.xApplication.Setting.UIIndexDocument.Editor(this)},deleteStyleData:function(){this.list.document.indexStyleList.styleList.erase(this.data);MWF.UD.deletePublicData(this.data.id,function(){MWF.UD.putPublicData("indexStyleList",this.list.document.indexStyleList,function(){this.list.items.erase(this);this.destroy()}.bind(this))}.bind(this))}});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 s=new Element("div",{styles:this.css.explorerContentStyleEditMapNode}).inject(this.editorArea);var n=new MWF.widget.Maplist.Style(s,{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)}});n.app=this.app;n.load(e)}.bind(this));Object.each(this.styleCss.window,function(e,i){var s=new Element("div",{styles:this.css.explorerContentStyleEditMapNode}).inject(this.editorArea);var n=new MWF.widget.Maplist.Style(s,{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)}});n.app=this.app;n.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))}});