SettingLoginUI.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. MWF.xDesktop.requireApp("Setting", "Document", null, false);
  2. MWF.xApplication.Setting.UILoginDocument = new Class({
  3. Extends: MWF.xApplication.Setting.Document,
  4. load: function(){
  5. this.node = new Element("div", {"styles": {"overflow": "hidden", "padding-bottom": "80px"}}).inject(this.contentAreaNode);
  6. this.titleName = new Element("div", {"styles": this.explorer.css.explorerContentTitleNode}).inject(this.node);
  7. this.titleName.set("text", this.lp.ui_loginSetting);
  8. var defaultStyleData = {
  9. "title": this.lp.ui_login_default,
  10. "name": "default",
  11. "url": o2.session.path+"/xDesktop/$Authentication/default",
  12. "enabled": true
  13. };
  14. MWF.UD.getPublicData("loginStyleList", function(json){
  15. this.loginStyleList = json;
  16. if (!this.loginStyleList) this.loginStyleList = {"enabledId": "", "styleList": []};
  17. defaultStyleData.enabled = !this.loginStyleList.enabledId;
  18. this.defaultStyle = new MWF.xApplication.Setting.UILoginDocument.Style(this, this.node, defaultStyleData, {
  19. "title": this.lp.ui_login_defaultStyle,
  20. "infor": this.lp.ui_login_defaultStyle_infor,
  21. "onCreateStyle": function(name, css){
  22. this.createStyle(name, css);
  23. }.bind(this)
  24. });
  25. this.styleList = new MWF.xApplication.Setting.UILoginDocument.StyleList(this, this.node, this.loginStyleList.styleList, {
  26. "title": this.lp.ui_login_customStyle,
  27. "infor": this.lp.ui_login_customStyle_infor,
  28. "actionTitle": this.lp.ui_login_customStyle_Action,
  29. "defaultStyleData": defaultStyleData,
  30. "type": "loginStyle",
  31. "onCreateStyle": function(name, css){
  32. this.createStyle(name, css);
  33. }.bind(this)
  34. });
  35. }.bind(this));
  36. },
  37. createStyle: function(name, css){
  38. var id = (new MWF.widget.UUID()).id;
  39. var listItem = {
  40. "title": name,
  41. "name": "loginStyle_"+id,
  42. "enabled": false
  43. };
  44. var styleData = {
  45. "title": name,
  46. "name": "loginStyle_"+id,
  47. "data": css
  48. };
  49. this.loginStyleList.styleList.push(listItem);
  50. MWF.UD.putPublicData("loginStyle_"+id, styleData, function(){
  51. MWF.UD.putPublicData("loginStyleList", this.loginStyleList, {
  52. "success": function(){
  53. this.styleList.addItem(listItem);
  54. }.bind(this),
  55. "failure": function(){
  56. MWF.UD.deletePublicData("loginStyle_"+id);
  57. }.bind(this)
  58. });
  59. }.bind(this));
  60. }
  61. });
  62. MWF.xApplication.Setting.UILoginDocument.StyleList = new Class({
  63. Implements: [Options, Events],
  64. initialize: function(doc, contentAreaNode, data, options){
  65. this.setOptions(options);
  66. this.document = doc;
  67. this.explorer = this.document.explorer;
  68. this.app = this.explorer.app;
  69. this.lp = this.app.lp;
  70. this.contentAreaNode = contentAreaNode;
  71. this.actions = this.app.actions;
  72. this.css = this.app.css;
  73. this.data = data;
  74. this.items = [];
  75. this.load();
  76. },
  77. load: function(){
  78. var titleNode = new Element("div", {"styles": this.css.explorerContentItemTitleNode, "text": this.options.title}).inject(this.contentAreaNode);
  79. if (this.options.infor) var titleInforArea = new Element("div", {"styles": this.css.explorerContentInputInforNode, "text": this.options.infor}).inject(this.contentAreaNode);
  80. var inputArea = new Element("div", {"styles": this.css.explorerContentListAreaNode}).inject(this.contentAreaNode);
  81. if (this.options.actionTitle) this.createCustomStyle(inputArea);
  82. this.itemArea = new Element("div", {"styles": {"overflow": "hidden", "clear": "both"}}).inject(inputArea);
  83. if (this.data && this.data.length){
  84. this.data.each(function(styleData){
  85. this.addItem(styleData);
  86. //new MWF.xApplication.Setting.UILoginDocument.Style.Item(this, styleData);
  87. }.bind(this));
  88. }
  89. },
  90. addItem: function(item){
  91. this.items.push(new MWF.xApplication.Setting.UILoginDocument.Style.Item(this, item));
  92. },
  93. createCustomStyle: function(inputArea){
  94. this.actionArea = new Element("div", {"styles": this.css.explorerContentListStyleActionAreaNode}).inject(inputArea);
  95. var actionIconArea = new Element("div", {"styles": this.css.explorerContentListActionIconAreaNode}).inject(this.actionArea);
  96. var actionIcon = new Element("div", {"styles": this.css.explorerContentListActionIconNode}).inject(actionIconArea);
  97. if (this.type=="object") actionIcon.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/edit.png) no-repeat center center");
  98. var actionTextArea = new Element("div", {"styles": this.css.explorerContentListActionTextAreaNode, "text": this.options.actionTitle}).inject(this.actionArea);
  99. this.actionArea.addEvents({
  100. "mouseover": function(){this.actionArea.setStyles(this.css.explorerContentListStyleActionAreaNode_over);}.bind(this),
  101. "mouseout": function(){this.actionArea.setStyles(this.css.explorerContentListStyleActionAreaNode);}.bind(this),
  102. "mousedown": function(){this.actionArea.setStyles(this.css.explorerContentListStyleActionAreaNode_down);}.bind(this),
  103. "mouseup": function(){this.actionArea.setStyles(this.css.explorerContentListStyleActionAreaNode_over);}.bind(this),
  104. "click": function(e){
  105. this.createNewCustomStyle(e);
  106. }.bind(this)
  107. });
  108. },
  109. getDefaultCss: function(){
  110. var css = null;
  111. var cssPath = this.options.defaultStyleData.url+"/css.wcss";
  112. cssPath = (cssPath.indexOf("?")!=-1) ? cssPath+"&v="+COMMON.version : cssPath+"?v="+COMMON.version;
  113. MWF.getJSON(cssPath, function(json){
  114. css = json;
  115. }.bind(this), false);
  116. return css;
  117. },
  118. createNewCustomStyle: function(e){
  119. var p = this.actionArea.getPosition(this.actionArea.getOffsetParent());
  120. var width = 470;
  121. var height = 110;
  122. var size = this.app.content.getSize();
  123. if (p.y+height>size.y) p.y = size.y-height-10;
  124. if (p.y<0) p.y = 10;
  125. if (p.x+width>size.x) p.x = size.x-width-10;
  126. if (p.x<0) p.x = 10;
  127. var _self = this;
  128. MWF.require("MWF.xDesktop.Dialog", function(){
  129. var dlg = new MWF.xDesktop.Dialog({
  130. "title": this.lp.ui_login_customStyle_newName,
  131. "style": "settingStyle",
  132. "top": p.y,
  133. "left": p.x,
  134. "fromTop":p.y,
  135. "fromLeft": p.x,
  136. "width": width,
  137. "height": height,
  138. "html": "",
  139. "maskNode": this.app.content,
  140. "container": this.app.content,
  141. "buttonList": [
  142. {
  143. "text": this.lp.ok,
  144. "action": function(){
  145. _self.createNewCustomStyleData(this);
  146. }
  147. },
  148. {
  149. "text": this.lp.cancel,
  150. "action": function(){this.close();}
  151. }
  152. ]
  153. });
  154. dlg.show();
  155. var content = new Element("div", {"styles": this.css.explorerContentListStyleEditAreaNode}).inject(dlg.content);
  156. new Element("input", {"styles": this.css.explorerContentListEditInputNode}).inject(content);
  157. }.bind(this));
  158. },
  159. createNewCustomStyleData: function(dlg){
  160. var name = dlg.content.getElement("input").get("value");
  161. if (!name){
  162. this.app.notice(ui_login_customStyle_newName_empty, "error");
  163. return false;
  164. }else{
  165. var css = this.getDefaultCss();
  166. var newCss = Object.clone(css);
  167. this.fireEvent("createStyle", [name, newCss]);
  168. dlg.close();
  169. }
  170. }
  171. });
  172. MWF.xApplication.Setting.UILoginDocument.Style = new Class({
  173. Implements: [Options, Events],
  174. initialize: function(doc, contentAreaNode, data, options){
  175. this.setOptions(options);
  176. this.document = doc;
  177. this.explorer = this.document.explorer;
  178. this.app = this.explorer.app;
  179. this.lp = this.app.lp;
  180. this.contentAreaNode = contentAreaNode;
  181. this.actions = this.app.actions;
  182. this.css = this.app.css;
  183. this.data = data;
  184. this.load();
  185. },
  186. load: function(){
  187. var titleNode = new Element("div", {"styles": this.css.explorerContentItemTitleNode, "text": this.options.title}).inject(this.contentAreaNode);
  188. if (this.options.infor) var titleInforArea = new Element("div", {"styles": this.css.explorerContentInputInforNode, "text": this.options.infor}).inject(this.contentAreaNode);
  189. var inputArea = new Element("div", {"styles": this.css.explorerContentListAreaNode}).inject(this.contentAreaNode);
  190. this.itemArea = new Element("div", {"styles": {"overflow": "hidden", "clear": "both"}}).inject(inputArea);
  191. this.item = new MWF.xApplication.Setting.UILoginDocument.Style.Item(this, this.data);
  192. }
  193. });
  194. MWF.xApplication.Setting.UILoginDocument.Style.Item = new Class({
  195. Extends: MWF.xApplication.Setting.Document.List.Item,
  196. load: function(){
  197. this.itemArea = new Element("div", {"styles": this.css.explorerContentListStyleActionAreaNode}).inject(this.content);
  198. this.itemIconArea = new Element("div", {"styles": this.css.explorerContentListItemIconAreaNode}).inject(this.itemArea);
  199. this.itemIcon = new Element("div", {"styles": this.css.explorerContentListItemIconNode}).inject(this.itemIconArea);
  200. if (this.data.enabled){
  201. this.checkIcon = new Element("div", {"styles": this.css.explorerContentListCheckIconAreaNode}).inject(this.itemArea);
  202. this.checkIcon.set("title", this.lp.ui_login_current);
  203. }else{
  204. this.checkIcon = new Element("div", {"styles": this.css.explorerContentListNotCheckIconAreaNode}).inject(this.itemArea);
  205. this.checkIcon.set("title", this.lp.ui_login_setCurrent);
  206. }
  207. this.itemTextArea = new Element("div", {"styles": this.css.explorerContentListActionTextAreaNode}).inject(this.itemArea);
  208. this.itemIcon.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/style.png) no-repeat center center");
  209. this.itemTextArea.set("text", this.data.title);
  210. if (this.data.name!="default"){
  211. this.editAction = new Element("div", {"styles": this.css.explorerContentStyleActionNode, "text": this.lp.edit}).inject(this.content);
  212. this.copyAction = new Element("div", {"styles": this.css.explorerContentStyleActionNode, "text": this.lp.copy}).inject(this.content);
  213. this.deleteAction = new Element("div", {"styles": this.css.explorerContentStyleActionNode, "text": this.lp.delete}).inject(this.content);
  214. }else{
  215. this.copyAction = new Element("div", {"styles": this.css.explorerContentStyleActionNode, "text": this.lp.copy}).inject(this.content);
  216. }
  217. this.setEvents();
  218. },
  219. setEvents: function(){
  220. var _self = this;
  221. this.itemArea.addEvents({
  222. "mouseover": function(){if (!_self.isSelected) this.setStyles(_self.css.explorerContentListStyleActionAreaNode_over);},
  223. "mouseout": function(){if (!_self.isSelected) this.setStyles(_self.css.explorerContentListStyleActionAreaNode);},
  224. "mousedown": function(){this.setStyles(_self.css.explorerContentListStyleActionAreaNode_down);},
  225. "mouseup": function(){this.setStyles(_self.css.explorerContentListStyleActionAreaNode_over);},
  226. "click": function(){_self.preview(this);}
  227. });
  228. this.checkIcon.addEvents({
  229. "mousedown": function(e){e.stopPropagation();},
  230. "mouseup": function(e){e.stopPropagation();},
  231. "click": function(e){_self.setCurrent(e);}
  232. });
  233. if (this.editAction){
  234. this.editAction.addEvents({
  235. "mouseover": function(){this.setStyles(_self.css.explorerContentStyleActionNode_over);},
  236. "mouseout": function(){this.setStyles(_self.css.explorerContentStyleActionNode);},
  237. "click": function(){_self.editStyle(this);}
  238. });
  239. }
  240. if (this.copyAction){
  241. this.copyAction.addEvents({
  242. "mouseover": function(){this.setStyles(_self.css.explorerContentStyleActionNode_over);},
  243. "mouseout": function(){this.setStyles(_self.css.explorerContentStyleActionNode);},
  244. "click": function(){_self.copyStyle(this);}
  245. });
  246. }
  247. if (this.deleteAction){
  248. this.deleteAction.addEvents({
  249. "mouseover": function(){this.setStyles(_self.css.explorerContentStyleActionNode_over);},
  250. "mouseout": function(){this.setStyles(_self.css.explorerContentStyleActionNode);},
  251. "click": function(e){_self.deleteStyle(e);}
  252. });
  253. }
  254. },
  255. copyStyle: function(){
  256. var p = this.itemArea.getPosition(this.itemArea.getOffsetParent());
  257. var width = 600;
  258. var height = 110;
  259. var size = this.app.content.getSize();
  260. if (p.y+height>size.y) p.y = size.y-height-10;
  261. if (p.y<0) p.y = 10;
  262. if (p.x+width>size.x) p.x = size.x-width-10;
  263. if (p.x<0) p.x = 10;
  264. var _self = this;
  265. MWF.require("MWF.xDesktop.Dialog", function(){
  266. var dlg = new MWF.xDesktop.Dialog({
  267. "title": this.lp.ui_login_customStyle_newName,
  268. "style": "settingStyle",
  269. "top": p.y,
  270. "left": p.x,
  271. "fromTop":p.y,
  272. "fromLeft": p.x,
  273. "width": width,
  274. "height": height,
  275. "html": "",
  276. "maskNode": this.app.content,
  277. "container": this.app.content,
  278. "buttonList": [
  279. {
  280. "text": this.lp.ok,
  281. "action": function(){
  282. _self.createNewCustomStyleData(this);
  283. }
  284. },
  285. {
  286. "text": this.lp.cancel,
  287. "action": function(){this.close();}
  288. }
  289. ]
  290. });
  291. dlg.show();
  292. var content = new Element("div", {"styles": this.css.explorerContentListStyleEditAreaNode}).inject(dlg.content);
  293. new Element("input", {"styles": this.css.explorerContentListEditInputNode, "value": this.data.title+this.lp.copyName}).inject(content);
  294. }.bind(this));
  295. },
  296. createNewCustomStyleData: function(dlg){
  297. var name = dlg.content.getElement("input").get("value");
  298. if (!name){
  299. this.app.notice(ui_login_customStyle_newName_empty, "error");
  300. return false;
  301. }else{
  302. var css = this.getCss();
  303. var newCss = Object.clone(css);
  304. this.list.fireEvent("createStyle", [name, newCss]);
  305. dlg.close();
  306. }
  307. },
  308. editStyle: function(){
  309. this.editor = new MWF.xApplication.Setting.UILoginDocument.Style.Editor(this);
  310. },
  311. deleteStyle: function(e){
  312. var _self = this;
  313. var t = this.lp.ui_login_delete_confirm.replace("{title}", this.data.title);
  314. this.app.confirm("wram", e, this.lp.ui_login_delete_confirmTitle, t, 400, 150, function(){
  315. _self.deleteStyleData();
  316. this.close();
  317. }, function(){this.close()});
  318. },
  319. deleteStyleData: function(){
  320. if (this.list.document.loginStyleList.enabledId==this.data.name){
  321. this.list.document.defaultStyle.item.setCurrentStyle(true);
  322. }
  323. this.list.document.loginStyleList.styleList.erase(this.data);
  324. MWF.UD.deletePublicData(this.data.name, function(){
  325. MWF.UD.putPublicData("loginStyleList", this.list.document.loginStyleList, function(){
  326. this.list.items.erase(this);
  327. this.destroy();
  328. }.bind(this));
  329. }.bind(this))
  330. },
  331. destroy: function(){
  332. this.itemArea.destroy();
  333. if (this.editAction) this.editAction.destroy();
  334. if (this.deleteAction) this.deleteAction.destroy();
  335. if (this.copyAction) this.copyAction.destroy();
  336. MWF.release(this);
  337. },
  338. setCurrent: function(e){
  339. var _self = this;
  340. var t = this.lp.ui_login_setCurrent_confirm.replace("{title}", this.data.title);
  341. this.app.confirm("infor", e, this.lp.ui_login_setCurrent_confirmTitle, t, 400, 150, function(){
  342. _self.setCurrentStyle();
  343. this.close();
  344. }, function(){this.close()});
  345. e.stopPropagation();
  346. },
  347. setUncurrent: function(){
  348. this.data.enabled = false;
  349. this.checkIcon.setStyles(this.css.explorerContentListNotCheckIconAreaNode);
  350. this.checkIcon.set("title", this.lp.ui_login_setCurrent);
  351. },
  352. setCurrentStyle: function(nosave){
  353. this.list.document.defaultStyle.item.setUncurrent();
  354. this.list.document.styleList.items.each(function(item){
  355. item.setUncurrent();
  356. }.bind(this));
  357. this.list.document.loginStyleList.enabledId = (this.data.name=="default") ? "" : this.data.name;
  358. this.data.enabled = true;
  359. this.checkIcon.setStyles(this.css.explorerContentListCheckIconAreaNode);
  360. this.checkIcon.set("title", this.lp.ui_login_current);
  361. if (!nosave) MWF.UD.putPublicData("loginStyleList", this.list.document.loginStyleList);
  362. },
  363. preview: function(){
  364. if (!this.isSelected){
  365. this.itemArea.setStyle("height", "340px");
  366. this.isSelected = true;
  367. this.showPreview();
  368. }else{
  369. this.itemArea.setStyle("height", "40px");
  370. this.isSelected = false;
  371. this.hidePreview();
  372. }
  373. },
  374. getCss: function(){
  375. var css = null;
  376. if (this.data.url){
  377. var cssPath = this.data.url+"/css.wcss";
  378. cssPath = (cssPath.indexOf("?")!=-1) ? cssPath+"&v="+COMMON.version : cssPath+"?v="+COMMON.version;
  379. MWF.getJSON(cssPath, function(json){
  380. css = json;
  381. }.bind(this), false);
  382. }else{
  383. MWF.UD.getPublicData(this.data.name, function(json){
  384. css = json.data;
  385. }, false);
  386. }
  387. return css;
  388. },
  389. showPreview: function(){
  390. this.styleCss = this.getCss();
  391. this.previewNode = new Element("div", {"styles": {"margin-top": "10px", "margin-bottom": "20px", "position": "relative"}}).inject(this.itemArea);
  392. MWF.require("MWF.xDesktop.Authentication", function(){
  393. //var action = new MWF.xApplication.Authentication.Actions.RestActions();
  394. var form = new MWF.xDesktop.Authentication.LoginForm(this, {}, {
  395. "draggable": false,
  396. "closeAction": false,
  397. "hasMask" : false,
  398. "relativeToApp" : false,
  399. "isLimitSize": false,
  400. "hasScroll": false,
  401. "ifFade": false,
  402. "top": "0",
  403. "left": "0"
  404. }, {
  405. "css": this.styleCss,
  406. "container" : this.previewNode,
  407. "lp": MWF.LP.authentication
  408. //"actions": action
  409. });
  410. form.create();
  411. this.previewMaskNode = new Element("div", {"styles": {"position": "absolute", "top": "0px", "left": "0px"}}).inject(this.previewNode);
  412. var size = form.formAreaNode.getSize();
  413. var zidx = form.formAreaNode.getStyle("z-index");
  414. this.previewMaskNode.setStyles({"width": ""+size.x+"px", "height": ""+size.y+"px", "z-index": zidx+1});
  415. this.previewMaskNode.addEvents({
  416. "click": function(e){e.stopPropagation();},
  417. "mousedown": function(e){e.stopPropagation();},
  418. "mouseup": function(e){e.stopPropagation();}
  419. });
  420. form.formAreaNode.setStyles({
  421. "transform-origin": "0px 0px",
  422. "transform": "scale(0.58)"
  423. })
  424. }.bind(this));
  425. },
  426. hidePreview: function(){
  427. this.previewMaskNode.destroy();
  428. this.previewNode.empty();
  429. this.previewNode.destroy();
  430. this.previewMaskNode = null;
  431. this.previewNode = null;
  432. }
  433. });
  434. MWF.xApplication.Setting.UILoginDocument.Style.Editor = new Class({
  435. initialize: function(item){
  436. this.item = item;
  437. this.document = this.item.list.document;
  438. this.explorer = this.document.explorer;
  439. this.app = this.explorer.app;
  440. this.lp = this.app.lp;
  441. this.contentAreaNode = this.document.contentAreaNode;
  442. this.actions = this.app.actions;
  443. this.css = this.app.css;
  444. this.load();
  445. },
  446. load: function(){
  447. this.editAreaNode = new Element("div", {"styles": this.css.explorerContentStyleEditNode}).inject(this.contentAreaNode);
  448. this.editAreaNode.position({
  449. "relativeTo": this.item.itemArea,
  450. "position": 'upperLeft',
  451. "edge": 'upperLeft'
  452. });
  453. this.document.node.setStyle("display", "none");
  454. var myFx = new Fx.Morph(this.editAreaNode, {
  455. "duration": '100',
  456. "transition": Fx.Transitions.Sine.easeOut
  457. });
  458. var p = this.contentAreaNode.getPosition(this.contentAreaNode.getOffsetParent());
  459. var size = this.contentAreaNode.getSize();
  460. var toCss = {
  461. "left": ""+p.x+"px",
  462. "top": ""+p.y+"px",
  463. "width": ""+size.x+"px",
  464. "height": ""+size.y+"px",
  465. "background-color": "#ffffff"
  466. };
  467. myFx.start(toCss).chain(function(){
  468. this.editAreaNode.setStyles({
  469. "width": "100%",
  470. "height": "100%",
  471. "position": "static"
  472. });
  473. new Element("div", {"styles": {
  474. "height": "100px",
  475. "line-height": "100px",
  476. "text-align": "center",
  477. "font-size": "18px",
  478. "color": "#999999"
  479. }, "text": this.lp.loading}).inject(this.editAreaNode);
  480. window.setTimeout(this.createEditorContent.bind(this), 100);
  481. }.bind(this));
  482. },
  483. createEditorContent: function(){
  484. this.area = new Element("div", {"styles": this.css.explorerContentStyleEditorAreaNode}).inject(this.editAreaNode);
  485. leftArea = new Element("div", {"styles": this.css.explorerContentStyleEditorLeftAreaNode}).inject(this.area);
  486. rightArea = new Element("div", {"styles": this.css.explorerContentStyleEditorRightAreaNode}).inject(this.area);
  487. this.editorArea = new Element("div", {"styles": this.css.explorerContentStyleEditEditorNode}).inject(leftArea);
  488. this.previewArea = new Element("div", {"styles": this.css.explorerContentStyleEditPreviewNode}).inject(rightArea);
  489. this.styleCss = this.item.getCss();
  490. this.createCssEditor();
  491. this.showPreview();
  492. this.area.getPrevious().destroy();
  493. this.returnAction = new Element("div", {"styles": this.css.explorerContentStyleEditorReturnNode, "text": this.lp.returnBack}).inject(this.editAreaNode);
  494. this.returnAction.addEvent("click", function(e){
  495. this.destroy();
  496. }.bind(this));
  497. },
  498. destroy: function(){
  499. this.editAreaNode.destroy();
  500. this.document.node.setStyle("display", "block");
  501. MWF.release(this);
  502. },
  503. createCssEditor: function(){
  504. var _self = this;
  505. MWF.require("MWF.widget.Maplist", function(){
  506. Object.each(this.styleCss, function(v, k){
  507. var mapListNode = new Element("div", {"styles": this.css.explorerContentStyleEditMapNode}).inject(this.editorArea);
  508. var mList = new MWF.widget.Maplist.Style(mapListNode, {"title": k, "style": "styleEditor",
  509. "onChange": function(){
  510. _self.styleCss[k] = this.toJson();
  511. _self.showPreview();
  512. var o = {
  513. "name": _self.item.data.name,
  514. "title": _self.item.data.title,
  515. "data": _self.styleCss
  516. };
  517. MWF.UD.putPublicData(_self.item.data.name, o);
  518. }
  519. });
  520. mList.app = this.app;
  521. mList.load(v);
  522. }.bind(this));
  523. }.bind(this));
  524. },
  525. showPreview: function(){
  526. this.previewArea.empty();
  527. MWF.require("MWF.xDesktop.Authentication", function(){
  528. this.previewNode = new Element("div", {"styles": {"position": "relative", "height": "216px"}}).inject(this.previewArea);
  529. //var action = new MWF.xApplication.Authentication.Actions.RestActions();
  530. var loginForm = new MWF.xDesktop.Authentication.LoginForm(this, {}, {
  531. "draggable": false,
  532. "closeAction": false,
  533. "hasMask" : false,
  534. "relativeToApp" : false,
  535. "isLimitSize": false,
  536. "hasScroll": false,
  537. "ifFade": false,
  538. "top": "0",
  539. "left": "0"
  540. }, {
  541. "css": this.styleCss,
  542. "container" : this.previewNode,
  543. "lp": MWF.LP.authentication
  544. //"actions": action
  545. });
  546. loginForm.create();
  547. loginForm.formAreaNode.setStyles({
  548. "transform-origin": "0px 0px",
  549. "transform": "scale(0.4)"
  550. });
  551. var previewSignUpNode = new Element("div", {"styles": {"position": "relative", "height": "268px"}}).inject(this.previewArea);
  552. var signUpForm = new MWF.xDesktop.Authentication.SignUpForm(this, {}, {
  553. "draggable": false,
  554. "closeAction": false,
  555. "hasMask" : false,
  556. "relativeToApp" : false,
  557. "isLimitSize": false,
  558. "hasScroll": false,
  559. "ifFade": false,
  560. "top": "0",
  561. "left": "0"
  562. }, {
  563. "css": this.styleCss,
  564. "container" : previewSignUpNode,
  565. "lp": MWF.LP.authentication
  566. //"actions": action
  567. });
  568. signUpForm.create();
  569. signUpForm.formAreaNode.setStyles({
  570. "transform-origin": "0px 0px",
  571. "transform": "scale(0.4)"
  572. });
  573. var previewResetPasswordNode = new Element("div", {"styles": {"position": "relative", "height": "248px"}}).inject(this.previewArea);
  574. var resetPasswordForm = new MWF.xDesktop.Authentication.ResetPasswordForm(this, {}, {
  575. "draggable": false,
  576. "closeAction": false,
  577. "hasMask" : false,
  578. "relativeToApp" : false,
  579. "isLimitSize": false,
  580. "hasScroll": false,
  581. "ifFade": false,
  582. "top": "0",
  583. "left": "0"
  584. }, {
  585. "css": this.styleCss,
  586. "container" : previewResetPasswordNode,
  587. "lp": MWF.LP.authentication
  588. //"actions": action
  589. });
  590. resetPasswordForm.create();
  591. resetPasswordForm.formAreaNode.setStyles({
  592. "transform-origin": "0px 0px",
  593. "transform": "scale(0.4)"
  594. });
  595. }.bind(this));
  596. }
  597. });