Main.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  1. MWF.xApplication.AppCenter.Main = new Class({
  2. Extends: MWF.xApplication.Common.Main,
  3. Implements: [Options, Events],
  4. options: {
  5. "style": "default",
  6. "name": "AppCenter",
  7. "icon": "icon.png",
  8. "width": "1000",
  9. "height": "700",
  10. "title": MWF.xApplication.AppCenter.LP.title
  11. },
  12. onQueryLoad: function(){
  13. this.lp = MWF.xApplication.AppCenter.LP;
  14. this.actions = MWF.Actions.get("x_program_center");
  15. },
  16. loadApplication: function(callback){
  17. this.components = [];
  18. //this.node = new Element("div", {"styles": {"width": "100%", "height": "100%", "overflow": "hidden"}}).inject(this.content);
  19. this.loadTitle();
  20. this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
  21. this.contentModuleArea = new Element("div", {"styles": this.css.contentModuleArea}).inject(this.contentNode);
  22. this.setContentSize();
  23. this.addEvent("resize", this.setContentSize);
  24. this.loadModuleContent();
  25. },
  26. loadTitle: function(){
  27. this.titleBar = new Element("div", {"styles": this.css.titleBar}).inject(this.content);
  28. if (MWF.AC.isProcessPlatformCreator()){
  29. this.createApplicationNode = new Element("div", {
  30. "styles": this.css.createApplicationNode,
  31. "title": this.lp.export
  32. }).inject(this.titleBar);
  33. this.createApplicationNode.addEvent("click", function(){
  34. this.createApplication();
  35. }.bind(this));
  36. }
  37. this.taskTitleTextNode = new Element("div", {"styles": this.css.titleTextNode,"text": this.lp.title}).inject(this.titleBar);
  38. },
  39. setContentSize: function(){
  40. var size = this.content.getSize();
  41. var titleSize = this.titleBar.getSize();
  42. var height = size.y-titleSize.y;
  43. this.contentNode.setStyles({"height": ""+height+"px", "overflow": "auto"});
  44. var max = size.x*0.98;
  45. var n = (size.x/320).toInt();
  46. var x = n*320;
  47. while (x>max){
  48. n--;
  49. x = n*320;
  50. }
  51. this.contentModuleArea.setStyle("width", ""+x+"px");
  52. },
  53. loadModuleContent: function(){
  54. this.actions.listStructure(function(json){
  55. this.moduleList = json.data;
  56. if (this.moduleList.length){
  57. this.moduleList.each(function(module){
  58. new MWF.xApplication.AppCenter.Module(this, module);
  59. }.bind(this));
  60. }else{
  61. this.createEmptyElement();
  62. }
  63. }.bind(this));
  64. },
  65. createEmptyElement: function(){
  66. this.emptyNode = new Element("div", {"styles": this.css.emptyNode}).inject(this.contentModuleArea);
  67. if (MWF.AC.isProcessPlatformCreator()){
  68. this.emptyNode.set("text", this.lp.emptyModuleManagerInfo);
  69. this.emptyNode.addEvent("click", function(){
  70. this.createApplication();
  71. }.bind(this));
  72. }else{
  73. this.emptyNode.set("text", this.lp.emptyModuleInfo);
  74. }
  75. },
  76. createApplication: function(){
  77. new MWF.xApplication.AppCenter.Exporter(this);
  78. }
  79. });
  80. MWF.xApplication.AppCenter.Module = new Class({
  81. initialize: function(app, data){
  82. this.app = app;
  83. this.data = data;
  84. this.json = JSON.decode(this.data.data);
  85. this.json.structure = this.data.id;
  86. this.lp = this.app.lp;
  87. this.css = this.app.css;
  88. this.content = this.app.contentModuleArea;
  89. this.load();
  90. },
  91. load: function(){
  92. this.node = new Element("div", {"styles": this.css.moduleNode}).inject(this.content);
  93. this.iconNode = new Element("div", {"styles": this.css.moduleIconNode}).inject(this.node);
  94. this.contentNode = new Element("div", {"styles": this.css.moduleContentNode}).inject(this.node);
  95. this.nameNode = new Element("div", {"styles": this.css.moduleNameNode}).inject(this.contentNode);
  96. this.categoryNode = new Element("div", {"styles": this.css.moduleCategoryNode}).inject(this.contentNode);
  97. this.descriptionNode = new Element("div", {"styles": this.css.moduleDescriptionNode}).inject(this.contentNode);
  98. this.actionNode = new Element("div", {"styles": this.css.moduleActionNode}).inject(this.contentNode);
  99. this.nameNode.set("text", this.data.name);
  100. this.categoryNode.set("text", this.json.category);
  101. this.descriptionNode.set("text", this.data.description);
  102. this.actionNode.set("text", this.lp.output);
  103. this.loadEvent();
  104. },
  105. loadEvent: function(){
  106. this.actionNode.addEvent("click", function(e){
  107. this.outputApp();
  108. e.stopPropagation();
  109. }.bind(this));
  110. this.node.addEvent("click", function(){
  111. this.openApp();
  112. }.bind(this));
  113. },
  114. outputApp: function(){
  115. new MWF.xApplication.AppCenter.Exporter(this.app, this.json)
  116. },
  117. openApp: function(){
  118. }
  119. });
  120. MWF.xApplication.AppCenter.Exporter = new Class({
  121. initialize: function(app, selectData){
  122. this.app = app;
  123. this.lp = this.app.lp;
  124. this.css = this.app.css;
  125. this.structure = null;
  126. this.dlg = null;
  127. this.selectData = selectData || {
  128. "structure": "",
  129. "name": "",
  130. "description": "",
  131. "processPlatformList": [],
  132. "portalList": [],
  133. "queryList": [],
  134. "cmsList": []
  135. };
  136. this.setp = 1;
  137. this.load();
  138. },
  139. loadStructure: function(){
  140. this.structureRes = this.app.actions.outputStructure(function(json){
  141. this.structure = json.data;
  142. this.createContent();
  143. }.bind(this));
  144. },
  145. showDlg: function(callback){
  146. var position = this.app.createApplicationNode.getPosition(this.app.content);
  147. var size = this.app.contentNode.getSize();
  148. var width = size.x*0.9;
  149. if (width>600) width = 600;
  150. var height = size.y*0.9;
  151. var x = (size.x-width)/2;
  152. var y = (size.y-height)/2;
  153. if (y<80) y = 80;
  154. var _self = this;
  155. MWF.require("MWF.xDesktop.Dialog", function(){
  156. this.dlg = new MWF.xDesktop.Dialog({
  157. "title": this.lp.exportTitle,
  158. "style": "appCenter",
  159. "top": y+20,
  160. "left": x,
  161. "fromTop":position.y,
  162. "fromLeft": position.x,
  163. "width": width,
  164. "height": height,
  165. "html": "",
  166. "maskNode": this.app.content,
  167. "container": this.app.content,
  168. "buttonList": [
  169. {
  170. "text": this.lp.next,
  171. "action": function(){
  172. _self.next();
  173. //this.close();
  174. }
  175. },
  176. {
  177. "text": this.lp.prev,
  178. "action": function(){
  179. _self.prev();
  180. //this.close();
  181. }
  182. },
  183. {
  184. "text": this.lp.ok,
  185. "action": function(){
  186. _self.output();
  187. //this.close();
  188. }
  189. },
  190. {
  191. "text": this.lp.cancel,
  192. "action": function(){
  193. this.close();
  194. if (_self.structureRes){
  195. if (_self.structureRes.isRunning()){_self.structureRes.cancel();}
  196. _self.structureRes = null;
  197. }
  198. MWF.release(_self);
  199. }
  200. }
  201. ],
  202. "onPostShow": function(){
  203. if (callback) callback();
  204. }.bind(this)
  205. });
  206. this.dlg.show();
  207. }.bind(this));
  208. },
  209. checkInput: function(){
  210. var name = this.moduleNameInput.get("value");
  211. var category = this.moduleCategoryInput.get("value");
  212. var description = this.moduleDescriptionInput.get("value");
  213. if (!name){
  214. this.app.notice(this.lp.noNameError, "error");
  215. return false;
  216. }
  217. if (!this.selectData.processPlatformList.length &&
  218. !this.selectData.portalList.length &&
  219. !this.selectData.queryList.length &&
  220. !this.selectData.cmsList.length){
  221. this.app.notice(this.lp.noModuleError, "error");
  222. return false;
  223. }
  224. this.selectData.name = name;
  225. this.selectData.category = category;
  226. this.selectData.description = description;
  227. return true;
  228. },
  229. next: function(){
  230. if (this.setp==1){
  231. if (this.checkInput()) this.showStatus();
  232. }
  233. },
  234. prev: function(){
  235. if (this.step==2){
  236. if (this.statusContentNode){
  237. this.statusContentNode.destroy();
  238. this.statusContentNode = null;
  239. }
  240. this.contentNode.setStyle("display", "block");
  241. this.okBut.setStyle("display", "none");
  242. this.prevBut.setStyle("display", "nonde");
  243. this.nextBut.setStyle("display", "inline");
  244. }
  245. },
  246. output: function(){
  247. if (this.step==2){
  248. if (this.checkInput()){
  249. MWF.require("o2.widget.Mask", function(){
  250. this.mask = new o2.widget.Mask();
  251. this.mask.loadNode(this.dlg.node);
  252. this.app.actions.output(this.selectData, function(json){
  253. var uri = this.app.actions.action.actions["download"].uri;
  254. uri = uri.replace("{flag}", json.data.flag);
  255. if (this.mask) this.mask.hide();
  256. this.dlg.close();
  257. window.open(this.app.actions.action.address+uri);
  258. MWF.release(this);
  259. }.bind(this), function(xhr, text, error){
  260. if (xhr.status!=0){
  261. var errorText = error;
  262. if (xhr){
  263. var json = JSON.decode(xhr.responseText);
  264. if (json){
  265. errorText = json.message.trim() || "request json error";
  266. }else{
  267. errorText = "request json error: "+xhr.responseText;
  268. }
  269. }
  270. MWF.xDesktop.notice("error", {x: "right", y:"top"}, errorText);
  271. }
  272. if (this.mask) this.mask.hide();
  273. }.bind(this));
  274. }.bind(this));
  275. }
  276. }
  277. },
  278. showStatus: function(){
  279. this.statusContentNode = new Element("div", {"styles": this.css.moduleSelectContentAreaNode}).inject(this.contentNode, "after");
  280. this.statusTitleNode = new Element("div", {"styles": this.css.moduleSelectTitleNode, "text": this.lp.selected}).inject(this.statusContentNode);
  281. this.statusInfoNode = new Element("div", {"styles": this.css.moduleSelectContentNode}).inject(this.statusContentNode);
  282. var size = this.contentNode.getSize();
  283. var position = this.contentNode.getPosition(this.contentNode.getOffsetParent());
  284. var css = {
  285. "height": ""+size.y+"px",
  286. "width": ""+size.x+"px",
  287. "top": ""+position.y+"px",
  288. "left": ""+position.x+"px",
  289. "background-color": "#eeeeee"
  290. };
  291. this.statusContentNode.setStyles(css);
  292. var titleSize = this.statusTitleNode.getSize();
  293. var h = size.y-titleSize.y-20;
  294. this.statusInfoNode.setStyle("height", ""+h+"px");
  295. this.showStatusList();
  296. this.contentNode.setStyle("display", "none");
  297. this.okBut.setStyle("display", "inline");
  298. this.prevBut.setStyle("display", "inline");
  299. this.nextBut.setStyle("display", "none");
  300. this.step = 2;
  301. },
  302. showStatusList: function(){
  303. this.showStatusItemList("processPlatformList", ["processList", "formList", "applicationDictList", "scriptList", "fileList"]);
  304. this.showStatusItemList("portalList", ["pageList", "scriptList", "widgetList", "fileList"]);
  305. this.showStatusItemList("cmsList", ["categoryInfoList", "formList", "appDictList", "scriptList"]);
  306. this.showStatusItemList("queryList", ["viewList", "statList", "revealList"]);
  307. },
  308. showStatusItemList: function(listName, subList){
  309. this.selectData[listName].each(function(app){
  310. new Element("div", {"styles": this.css.moduleStatusInforNode1, "text": "["+this.lp[listName]+"] "+(app.name || app.appName)}).inject(this.statusInfoNode);
  311. subList.each(function(name){
  312. if (app[name] && app[name].length) app[name].each(function(process){
  313. new Element("div", {"styles": this.css.moduleStatusInforNode2, "text": "["+this.lp[name]+"] "+(process.name || process.categoryName)}).inject(this.statusInfoNode);
  314. }.bind(this));
  315. }.bind(this));
  316. }.bind(this));
  317. },
  318. load: function(){
  319. this.showDlg(function(){
  320. this.createLayout();
  321. this.loadStructure();
  322. }.bind(this));
  323. },
  324. createLayout: function(){
  325. this.nextBut = this.dlg.button.getFirst("input");
  326. this.prevBut = this.nextBut.getNext("input");
  327. this.okBut = this.prevBut.getNext("input");
  328. if (this.setp==1){
  329. this.okBut.setStyle("display", "none");
  330. this.prevBut.setStyle("display", "none");
  331. }
  332. this.node = new Element("div", {"styles": this.css.moduleSetupContentNode}).inject(this.dlg.content);
  333. this.titleNode = new Element("div", {"styles": this.css.moduleSetupTitleNode}).inject(this.node);
  334. var iconNode = new Element("div", {"styles": this.css.moduleIconNode}).inject(this.titleNode);
  335. var contentNode = new Element("div", {"styles": this.css.moduleSetupTitleContentNode}).inject(this.titleNode);
  336. var nameNode = new Element("div", {"styles": this.css.moduleSetupNameNode}).inject(contentNode);
  337. var categoryNode = new Element("div", {"styles": this.css.moduleSetupCategoryNode}).inject(contentNode);
  338. var descriptionNode = new Element("div", {"styles": this.css.moduleSetupDescriptionNode}).inject(contentNode);
  339. var nameTitleNode = new Element("div", {"styles": this.css.moduleInputTitleNode, "text": this.lp.moduleName}).inject(nameNode);
  340. var nameContentNode = new Element("div", {"styles": this.css.moduleInputContentNode}).inject(nameNode);
  341. this.moduleNameInput = new Element("input", {"styles": this.css.moduleInputNode}).inject(nameContentNode);
  342. var categoryTitleNode = new Element("div", {"styles": this.css.moduleInputTitleNode, "text": this.lp.moduleCategory}).inject(categoryNode);
  343. var categoryContentNode = new Element("div", {"styles": this.css.moduleInputContentNode}).inject(categoryNode);
  344. this.moduleCategoryInput = new Element("input", {"styles": this.css.moduleInputNode}).inject(categoryContentNode);
  345. var descriptionTitleNode = new Element("div", {"styles": this.css.moduleInputTitleNode, "text": this.lp.moduleDescription}).inject(descriptionNode);
  346. var descriptionContentNode = new Element("div", {"styles": this.css.moduleInputContentNode}).inject(descriptionNode);
  347. this.moduleDescriptionInput = new Element("input", {"styles": this.css.moduleInputNode}).inject(descriptionContentNode);
  348. this.moduleNameInput.set("value", this.selectData.name);
  349. this.moduleCategoryInput.set("value", this.selectData.category);
  350. this.moduleDescriptionInput.set("value", this.selectData.description);
  351. this.contentNode = new Element("div", {"styles": this.css.moduleSetupCompareContentNode}).inject(this.node);
  352. this.setListContentSize();
  353. this.createLoading(this.contentNode);
  354. },
  355. setListContentSize: function(){
  356. var size = this.dlg.content.getSize();
  357. var h = size.y;
  358. var titleH = this.titleNode.getSize().y+10;
  359. var contentH = h-titleH-10;
  360. this.contentNode.setStyle("height", ""+contentH+"px");
  361. },
  362. createLoading: function(node){
  363. //this.okBut.setStyle("display", "none");
  364. this.nextBut.setStyle("display", "none");
  365. this.loadingAreaNode = new Element("div", {"styles": this.css.moduleLoadingAreaNode}).inject(node);
  366. var img = new Element("img", {
  367. "styles": this.css.moduleLoadingImgNode,
  368. "src": this.app.path+this.app.options.style+"/icon/loading.gif"
  369. }).inject(this.loadingAreaNode);
  370. },
  371. clearLoading: function(){
  372. if (this.loadingAreaNode){
  373. this.loadingAreaNode.destroy();
  374. this.loadingAreaNode = null;
  375. }
  376. //this.okBut.setStyle("display", "inline");
  377. this.nextBut.setStyle("display", "inline");
  378. },
  379. createContent: function(){
  380. this.clearLoading();
  381. this.createListArea();
  382. this.loadProcessList();
  383. this.loadPortalList();
  384. this.loadCMSList();
  385. this.loadQueryList();
  386. //this.structure
  387. },
  388. createListArea: function(){
  389. this.contentAreaNode = new Element("div").inject(this.contentNode);
  390. // this.contentInforNode = new Element("div", {"styles": this.css.moduleSetupContentInforNode, "text": this.lp.selectModules}).inject(this.contentAreaNode);
  391. // //this.processArea = new Element("div", {"styles": this.css.moduleSetupListAreaNode}).inject(this.contentNode);
  392. //
  393. // this.listAreaNode = new Element("div").inject(this.contentAreaNode);
  394. this.processAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.process}).inject(this.contentAreaNode);
  395. this.processAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  396. this.portalAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.portal}).inject(this.contentAreaNode);
  397. this.portalAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  398. this.cmsAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.cms}).inject(this.contentAreaNode);
  399. this.cmsAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  400. this.queryAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.query}).inject(this.contentAreaNode);
  401. this.queryAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  402. },
  403. loadProcessList: function(){
  404. this.processListNodes = [];
  405. this.structure.processPlatformList.each(function(item){
  406. var postData = null;
  407. for (var i=0; i<this.selectData.processPlatformList.length; i++){
  408. if (this.selectData.processPlatformList[i].id == item.id){
  409. postData = this.selectData.processPlatformList[i];
  410. break;
  411. }
  412. }
  413. this.processListNodes.push(new MWF.xApplication.AppCenter.Exporter.ProcessElement(this, this.processAreaContent, item, postData));
  414. }.bind(this));
  415. },
  416. loadPortalList: function(){
  417. this.portalListNodes = [];
  418. this.structure.portalList.each(function(item){
  419. this.portalListNodes.push(new MWF.xApplication.AppCenter.Exporter.PortalElement(this, this.portalAreaContent, item));
  420. }.bind(this));
  421. },
  422. loadCMSList: function(){
  423. this.cmsListNodes = [];
  424. this.structure.cmsList.each(function(item){
  425. this.cmsListNodes.push(new MWF.xApplication.AppCenter.Exporter.CmsElement(this, this.cmsAreaContent, item));
  426. }.bind(this));
  427. },
  428. loadQueryList: function(){
  429. this.queryListNodes = [];
  430. this.structure.queryList.each(function(item){
  431. this.queryListNodes.push(new MWF.xApplication.AppCenter.Exporter.QueryElement(this, this.queryAreaContent, item));
  432. }.bind(this));
  433. }
  434. });
  435. MWF.xApplication.AppCenter.Exporter.Element = new Class({
  436. initialize: function(exporter, content, data, postData){
  437. this.exporter = exporter;
  438. this.app = this.exporter.app;
  439. this.data = data;
  440. this.lp = this.app.lp;
  441. this.css = this.app.css;
  442. this.content = content;
  443. this.initPostData(postData);
  444. //this.selectStatus = selectStatus || "none";
  445. this.load();
  446. },
  447. initPostData: function(postData){
  448. this.postData = postData || {
  449. "id": this.data.id,
  450. "name": this.data.name || this.data.appName,
  451. "alias": this.data.alias,
  452. "description": this.data.description,
  453. "processList": [],
  454. "formList": [],
  455. "applicationDictList": [],
  456. "scriptList": [],
  457. "fileList": []
  458. };
  459. },
  460. load: function(){
  461. this.contentNode = new Element("div", {"styles": this.css.moduleSetupListContentNode}).inject(this.content);
  462. this.iconNode = new Element("div", {"styles": this.css.moduleSetupListIconNode}).inject(this.contentNode);
  463. this.actionNode = new Element("div", {"styles": this.css.moduleSetupListActionNode}).inject(this.contentNode);
  464. this.inforNode = new Element("div", {"styles": this.css.moduleSetupListInforNode}).inject(this.contentNode);
  465. this.nameNode = new Element("div", {"styles": this.css.moduleSetupListNameNode}).inject(this.contentNode);
  466. this.nameNode.set(this.getNameContent());
  467. // switch (this.selectStatus){
  468. // case "all":
  469. // this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  470. // break;
  471. // case "part":
  472. // this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  473. // break;
  474. // default:
  475. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  476. //}
  477. this.action = new Element("div", {"styles": this.css.moduleSelectActionNode, "text": this.lp.select}).inject(this.actionNode);
  478. this.setEvent();
  479. this.checkSelect(this.postData);
  480. },
  481. setEvent: function(){
  482. this.contentNode.addEvents({
  483. "mouseover": function(){this.contentNode.setStyles(this.css.moduleSetupListContentNode_over);}.bind(this),
  484. "mouseout": function(){this.contentNode.setStyles(this.css.moduleSetupListContentNode);}.bind(this)
  485. });
  486. this.iconNode.addEvent("click", this.selectAll.bind(this));
  487. this.action.addEvent("click", function(){
  488. this.selectElements();
  489. }.bind(this));
  490. this.nameNode.addEvent("click", function(){
  491. this.selectElements();
  492. }.bind(this));
  493. },
  494. selectAll: function(){
  495. debugger;
  496. var selectData = this.postData;
  497. if (selectData.processList.length || selectData.formList.length || selectData.applicationDictList.length || selectData.scriptList.length || selectData.fileList.length){
  498. if (selectData.processList.length===this.data.processList.length &&
  499. selectData.formList.length===this.data.formList.length &&
  500. selectData.applicationDictList.length===this.data.applicationDictList.length &&
  501. selectData.scriptList.length===this.data.scriptList.length &&
  502. selectData.fileList.length===this.data.fileList.length){
  503. selectData = {
  504. "processList": [],
  505. "formList": [],
  506. "applicationDictList": [],
  507. "scriptList": [],
  508. "fileList": []
  509. };
  510. }else{
  511. selectData = {
  512. "processList": this.data.processList,
  513. "formList": this.data.formList,
  514. "applicationDictList": this.data.applicationDictList,
  515. "scriptList": this.data.scriptList,
  516. "fileList": this.data.fileList
  517. };
  518. }
  519. }else{
  520. selectData = {
  521. "processList": this.data.processList,
  522. "formList": this.data.formList,
  523. "applicationDictList": this.data.applicationDictList,
  524. "scriptList": this.data.scriptList,
  525. "fileList": this.data.fileList
  526. };
  527. }
  528. this.checkSelect(selectData);
  529. },
  530. getNameContent: function(){
  531. return {
  532. "title": this.lp.name+": "+this.data.name+" "+this.lp.id+": "+this.data.id,
  533. "text": this.data.name
  534. }
  535. },
  536. selectElements: function(){
  537. new MWF.xApplication.AppCenter.Exporter.Element.Selector(this, this.data);
  538. },
  539. checkSelect: function(selectData){
  540. this.postData.processList = selectData.processList;
  541. this.postData.formList = selectData.formList;
  542. this.postData.applicationDictList = selectData.applicationDictList;
  543. this.postData.scriptList = selectData.scriptList;
  544. this.postData.fileList = selectData.fileList;
  545. this.exporter.selectData.processPlatformList.erase(this.postData);
  546. if (selectData.processList.length || selectData.formList.length || selectData.applicationDictList.length || selectData.scriptList.length || selectData.fileList.length){
  547. this.exporter.selectData.processPlatformList.push(this.postData);
  548. if (selectData.processList.length==this.data.processList.length &&
  549. selectData.formList.length==this.data.formList.length &&
  550. selectData.applicationDictList.length==this.data.applicationDictList.length &&
  551. selectData.scriptList.length==this.data.scriptList.length &&
  552. selectData.fileList.length==this.data.fileList.length){
  553. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  554. }else{
  555. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  556. }
  557. }else{
  558. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  559. }
  560. }
  561. });
  562. MWF.xApplication.AppCenter.Exporter.ProcessElement = new Class({
  563. Extends: MWF.xApplication.AppCenter.Exporter.Element
  564. });
  565. MWF.xApplication.AppCenter.Exporter.PortalElement = new Class({
  566. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  567. initPostData: function(postData){
  568. this.postData = postData || {
  569. "id": this.data.id,
  570. "name": this.data.name || this.data.appName,
  571. "alias": this.data.alias,
  572. "description": this.data.description,
  573. "pageList": [],
  574. "scriptList": [],
  575. "widgetList": [],
  576. "fileList": []
  577. };
  578. },
  579. selectAll: function(){
  580. var selectData = this.postData;
  581. if (selectData.pageList.length || selectData.scriptList.length || selectData.widgetList.length || selectData.fileList.length){
  582. if (selectData.pageList.length===this.data.pageList.length &&
  583. selectData.scriptList.length===this.data.scriptList.length &&
  584. selectData.widgetList.length===this.data.widgetList.length &&
  585. selectData.fileList.length===this.data.fileList.length){
  586. selectData = {
  587. "pageList": [],
  588. "scriptList": [],
  589. "widgetList": [],
  590. "fileList": []
  591. };
  592. }else{
  593. selectData = {
  594. "pageList": this.data.pageList,
  595. "scriptList": this.data.scriptList,
  596. "widgetList": this.data.widgetList,
  597. "fileList": this.data.fileList
  598. };
  599. }
  600. }else{
  601. selectData = {
  602. "pageList": this.data.pageList,
  603. "scriptList": this.data.scriptList,
  604. "widgetList": this.data.widgetList,
  605. "fileList": this.data.fileList
  606. };
  607. }
  608. this.checkSelect(selectData);
  609. },
  610. selectElements: function(){
  611. new MWF.xApplication.AppCenter.Exporter.Element.PortalSelector(this, this.data);
  612. },
  613. checkSelect: function(selectData){
  614. this.postData.pageList = selectData.pageList;
  615. this.postData.scriptList = selectData.scriptList;
  616. this.postData.widgetList = selectData.widgetList;
  617. this.postData.fileList = selectData.fileList;
  618. if (selectData.pageList.length || selectData.scriptList.length || selectData.widgetList.length || selectData.fileList.length){
  619. this.exporter.selectData.portalList.push(this.postData);
  620. if (selectData.pageList.length==this.data.pageList.length &&
  621. selectData.scriptList.length==this.data.scriptList.length &&
  622. selectData.widgetList.length==this.data.widgetList.length &&
  623. selectData.fileList.length==this.data.fileList.length){
  624. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  625. }else{
  626. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  627. }
  628. }else{
  629. this.exporter.selectData.portalList.erase(this.postData);
  630. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  631. }
  632. }
  633. });
  634. MWF.xApplication.AppCenter.Exporter.CmsElement = new Class({
  635. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  636. getNameContent: function(){
  637. return {
  638. "title": this.lp.name+": "+this.data.appName+" "+this.lp.id+": "+this.data.id,
  639. "text": this.data.appName
  640. }
  641. },
  642. initPostData: function(postData){
  643. this.postData = postData || {
  644. "id": this.data.id,
  645. "name": this.data.name || this.data.appName,
  646. "alias": this.data.alias,
  647. "description": this.data.description,
  648. "categoryInfoList": [],
  649. "formList": [],
  650. "appDictList": [],
  651. "scriptList": [],
  652. "fileList": []
  653. };
  654. },
  655. selectElements: function(){
  656. new MWF.xApplication.AppCenter.Exporter.Element.CmsSelector(this, this.data);
  657. },
  658. selectAll: function(){
  659. var selectData = this.postData;
  660. if (selectData.categoryInfoList.length || selectData.formList.length || selectData.appDictList.length || selectData.scriptList.length || selectData.fileList.length){
  661. if (selectData.categoryInfoList.length===this.data.categoryInfoList.length &&
  662. selectData.formList.length===this.data.formList.length &&
  663. selectData.appDictList.length===this.data.appDictList.length &&
  664. selectData.scriptList.length===this.data.scriptList.length &&
  665. selectData.fileList.length===this.data.fileList.length){
  666. selectData = {
  667. "categoryInfoList": [],
  668. "formList": [],
  669. "appDictList": [],
  670. "scriptList": [],
  671. "fileList": []
  672. };
  673. }else{
  674. selectData = {
  675. "categoryInfoList": this.data.categoryInfoList,
  676. "formList": this.data.formList,
  677. "appDictList": this.data.appDictList,
  678. "scriptList": this.data.scriptList,
  679. "fileList": this.data.fileList
  680. };
  681. }
  682. }else{
  683. selectData = {
  684. "categoryInfoList": this.data.categoryInfoList,
  685. "formList": this.data.formList,
  686. "appDictList": this.data.appDictList,
  687. "scriptList": this.data.scriptList,
  688. "fileList": this.data.fileList
  689. };
  690. }
  691. this.checkSelect(selectData);
  692. },
  693. checkSelect: function(selectData){
  694. this.postData.categoryInfoList = selectData.categoryInfoList;
  695. this.postData.formList = selectData.formList;
  696. this.postData.appDictList = selectData.appDictList;
  697. this.postData.scriptList = selectData.scriptList;
  698. this.postData.fileList = selectData.fileList;
  699. if (selectData.categoryInfoList.length || selectData.formList.length || selectData.appDictList.length || selectData.scriptList.length || selectData.fileList.length){
  700. this.exporter.selectData.cmsList.push(this.postData);
  701. if (selectData.categoryInfoList.length===this.data.categoryInfoList.length &&
  702. selectData.formList.length===this.data.formList.length &&
  703. selectData.appDictList.length===this.data.appDictList.length &&
  704. selectData.scriptList.length===this.data.scriptList.length &&
  705. selectData.fileList.length===this.data.fileList.length){
  706. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  707. }else{
  708. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  709. }
  710. }else{
  711. this.exporter.selectData.cmsList.erase(this.postData);
  712. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  713. }
  714. }
  715. });
  716. MWF.xApplication.AppCenter.Exporter.QueryElement = new Class({
  717. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  718. initPostData: function(postData){
  719. this.postData = postData || {
  720. "id": this.data.id,
  721. "name": this.data.name || this.data.appName,
  722. "alias": this.data.alias,
  723. "description": this.data.description,
  724. "viewList": [],
  725. "statList": [],
  726. "revealList": []
  727. };
  728. },
  729. selectElements: function(){
  730. new MWF.xApplication.AppCenter.Exporter.Element.QuerySelector(this, this.data);
  731. },
  732. selectAll: function(){
  733. var selectData = this.postData;
  734. if (selectData.viewList.length || selectData.statList.length || selectData.revealList.length){
  735. if (selectData.viewList.length===this.data.viewList.length &&
  736. selectData.statList.length===this.data.statList.length &&
  737. selectData.revealList.length===this.data.revealList.length){
  738. selectData = {
  739. "viewList": this.data.viewList,
  740. "statList": this.data.statList,
  741. "revealList": this.data.revealList
  742. };
  743. }else{
  744. selectData = {
  745. "viewList": this.data.viewList,
  746. "statList": this.data.statList,
  747. "revealList": this.data.revealList
  748. };
  749. }
  750. }else{
  751. selectData = {
  752. "viewList": this.data.viewList,
  753. "statList": this.data.statList,
  754. "revealList": this.data.revealList
  755. };
  756. }
  757. this.checkSelect(selectData);
  758. },
  759. checkSelect: function(selectData){
  760. this.postData.viewList = selectData.viewList;
  761. this.postData.statList = selectData.statList;
  762. this.postData.revealList = selectData.revealList;
  763. if (selectData.viewList.length || selectData.statList.length || selectData.revealList.length){
  764. this.exporter.selectData.queryList.push(this.postData);
  765. if (selectData.viewList.length==this.data.viewList.length &&
  766. selectData.statList.length==this.data.statList.length &&
  767. selectData.revealList.length==this.data.revealList.length){
  768. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  769. }else{
  770. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  771. }
  772. }else{
  773. this.exporter.selectData.queryList.erase(this.postData);
  774. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  775. }
  776. }
  777. });
  778. MWF.xApplication.AppCenter.Exporter.Element.Selector = new Class({
  779. initialize: function(element, data){
  780. this.element = element;
  781. this.app = this.element.app;
  782. this.data = data;
  783. this.lp = this.app.lp;
  784. this.css = this.app.css;
  785. this.content = this.element.contentNode;
  786. this.areaNode = this.element.exporter.contentNode;
  787. this.selectData = this.initData();
  788. this.load();
  789. },
  790. initData: function(){
  791. return {
  792. "processList": [],
  793. "formList": [],
  794. "applicationDictList": [],
  795. "scriptList": [],
  796. "fileList": []
  797. }
  798. },
  799. load: function(){
  800. this.node = new Element("div", {"styles": this.css.moduleSelectContentAreaNode}).inject(this.areaNode, "after");
  801. this.titleNode = new Element("div", {"styles": this.css.moduleSelectTitleNode, "text": this.data.name}).inject(this.node);
  802. var size = this.content.getSize();
  803. this.node.setStyle("width", ""+size.x+"px");
  804. this.node.position({
  805. "relativeTo": this.content,
  806. "position": "topLeft",
  807. "edge": "topLeft"
  808. });
  809. this.element.exporter.dlg.button.setStyle("display", "none");
  810. this.show();
  811. },
  812. show: function(){
  813. var size = this.areaNode.getSize();
  814. var height = size.y+40;
  815. var width = size.x;
  816. var position = this.areaNode.getPosition(this.areaNode.getOffsetParent());
  817. //var oStyles = this.node.getStyles("height", "width", "top", "left", "background-color");
  818. //this.node.store("ostyles", oStyles);
  819. var css = {
  820. "height": ""+height+"px",
  821. "width": ""+width+"px",
  822. "top": ""+position.y+"px",
  823. "left": ""+position.x+"px",
  824. "background-color": "#eeeeee"
  825. };
  826. this.morph = new Fx.Morph(this.node, {"duration": 100});
  827. this.morph.start(css).chain(function(){
  828. this.loadContent();
  829. }.bind(this));
  830. },
  831. hide: function(){
  832. if (!this.morph) this.morph = new Fx.Morph(this.node, {"duration": 100});
  833. this.areaNode.setStyle("display", "block");
  834. this.element.exporter.dlg.button.setStyle("display", "block");
  835. var size = this.content.getSize();
  836. var height = size.y;
  837. var width = size.x;
  838. var position = this.content.getPosition(this.areaNode);
  839. var thisPosition = this.node.getPosition(this.node.getOffsetParent());
  840. var x = thisPosition.x+position.x;
  841. var y = thisPosition.y+position.y;
  842. var css = {
  843. "height": ""+height+"px",
  844. "width": ""+width+"px",
  845. "top": ""+y+"px",
  846. "left": ""+x+"px"
  847. };
  848. this.contentNode.destroy();
  849. this.morph.start(css).chain(function(){
  850. this.node.destroy();
  851. MWF.release(this);
  852. }.bind(this));
  853. },
  854. loadContent: function(){
  855. this.areaNode.setStyle("display", "none");
  856. this.contentNode = new Element("div", {"styles": this.css.moduleSelectContentNode}).inject(this.node);
  857. this.buttonNode = new Element("div", {"styles": this.css.moduleSelectButtonNode}).inject(this.node);
  858. this.cancelButton = new Element("div", {"styles": this.css.moduleSelectButtonActionNode, "text": this.lp.cancel}).inject(this.buttonNode);
  859. this.okButton = new Element("div", {"styles": this.css.moduleSelectButtonActionNode, "text": this.lp.ok}).inject(this.buttonNode);
  860. this.setContentHeight();
  861. this.loadContentList();
  862. this.cancelButton.addEvent("click", function(){
  863. this.hide();
  864. }.bind(this));
  865. this.okButton.addEvent("click", function(){
  866. this.checkSelect();
  867. }.bind(this));
  868. },
  869. checkSelect: function() {
  870. this.selectData.processList = this.getCheckedList(this.listProcessContent);
  871. this.selectData.formList = this.getCheckedList(this.listFormContent);
  872. this.selectData.applicationDictList = this.getCheckedList(this.listDictContent);
  873. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  874. this.selectData.fileList = this.getCheckedList(this.listFileContent);
  875. this.element.checkSelect(this.selectData);
  876. this.hide();
  877. },
  878. getCheckedList: function(node){
  879. var list = [];
  880. node.getElements("input").each(function(input){
  881. if (input.checked){
  882. list.push(input.retrieve("data"));
  883. }
  884. }.bind());
  885. return list;
  886. },
  887. setContentHeight: function(){
  888. var size = this.node.getSize();
  889. var titleSize = this.titleNode.getSize();
  890. var buttonSize = this.buttonNode.getSize();
  891. var h = size.y-titleSize.y-buttonSize.y;
  892. this.contentNode.setStyle("height", ""+h+"px");
  893. },
  894. loadContentList: function(){
  895. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  896. this.listProcessContent = this.listProcess("processList");
  897. this.listFormContent = this.listProcess("formList");
  898. this.listDictContent = this.listProcess("applicationDictList");
  899. this.listScriptContent = this.listProcess("scriptList");
  900. this.listFileContent = this.listProcess("fileList");
  901. },
  902. listProcess: function(name){
  903. var title = new Element("div", {"styles": this.css.moduleSelectContentTitleNode}).inject(this.contentAreaNode);
  904. var titleActionNode = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonNode}).inject(title);
  905. var inverseAction = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonActionNode, "text": this.lp.inverse}).inject(titleActionNode);
  906. var selectAllAction = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonActionNode, "text": this.lp.selectAll}).inject(titleActionNode);
  907. var titleText = new Element("div", {"styles": this.css.moduleSelectContentTitleTextNode, "text": this.lp[name]}).inject(title);
  908. //moduleSelectContentTitleButtonActionNode
  909. var listContent = new Element("div", {"styles": this.css.moduleSelectContentListNode}).inject(this.contentAreaNode);
  910. this.listProcessItems(name, listContent);
  911. inverseAction.addEvent("click", function(){
  912. inputs = listContent.getElements("input");
  913. inputs.each(function(checkbox){
  914. checkbox.set("checked", !checkbox.get("checked"));
  915. });
  916. });
  917. selectAllAction.addEvent("click", function(){
  918. inputs = listContent.getElements("input");
  919. inputs.each(function(checkbox){
  920. checkbox.set("checked", true);
  921. });
  922. });
  923. return listContent;
  924. },
  925. listProcessItems: function(name, listContent){
  926. this.data[name].each(function(item){
  927. var div = new Element("div", {"styles": this.css.moduleSelectContentListItemNode}).inject(listContent);
  928. var flag = false;
  929. var selectedList = this.element.postData[name];
  930. if (selectedList){
  931. for (var i=0; i<selectedList.length; i++){
  932. if (selectedList[i].id==item.id){
  933. flag = true;
  934. break;
  935. }
  936. }
  937. }
  938. var checkNode = new Element("input", {
  939. "styles": {"float": "left"},
  940. "type": "checkbox",
  941. //"checked": (this.element.postData[name] && this.element.postData[name].indexOf(item)!=-1),
  942. "checked": flag,
  943. "value": item.id
  944. }).inject(div);
  945. new Element("div", {
  946. "styles": {"float": "left"},
  947. "text": this.getItemName(item),
  948. "events": {
  949. "click": function(){checkNode.click();}
  950. }
  951. }).inject(div);
  952. checkNode.store("data", item);
  953. }.bind(this));
  954. },
  955. getItemName: function(item){
  956. return item.name;
  957. }
  958. });
  959. MWF.xApplication.AppCenter.Exporter.Element.ProcessSelector = new Class({
  960. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector
  961. });
  962. MWF.xApplication.AppCenter.Exporter.Element.PortalSelector = new Class({
  963. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  964. initData: function(){
  965. return {
  966. "pageList": [],
  967. "scriptList": [],
  968. "widgetList": [],
  969. "fileList": []
  970. }
  971. },
  972. checkSelect: function() {
  973. this.selectData.pageList = this.getCheckedList(this.listPageContent);
  974. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  975. this.selectData.widgetList = this.getCheckedList(this.listWidgetContent);
  976. this.selectData.fileList = this.getCheckedList(this.listFileContent);
  977. this.element.checkSelect(this.selectData);
  978. this.hide();
  979. },
  980. loadContentList: function(){
  981. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  982. this.listPageContent = this.listProcess("pageList");
  983. this.listScriptContent = this.listProcess("scriptList");
  984. this.listWidgetContent = this.listProcess("widgetList");
  985. this.listFileContent = this.listProcess("fileList");
  986. }
  987. });
  988. MWF.xApplication.AppCenter.Exporter.Element.CmsSelector = new Class({
  989. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  990. initData: function(){
  991. return {
  992. "categoryInfoList": [],
  993. "formList": [],
  994. "appDictList": [],
  995. "scriptList": [],
  996. "fileList": []
  997. }
  998. },
  999. checkSelect: function() {
  1000. this.selectData.categoryInfoList = this.getCheckedList(this.listCategoryInfoContent);
  1001. this.selectData.formList = this.getCheckedList(this.listFormContent);
  1002. this.selectData.appDictList = this.getCheckedList(this.listDictContent);
  1003. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  1004. this.selectData.fileList = this.getCheckedList(this.listFileContent);
  1005. this.element.checkSelect(this.selectData);
  1006. this.hide();
  1007. },
  1008. loadContentList: function(){
  1009. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1010. this.listCategoryInfoContent = this.listProcess("categoryInfoList");
  1011. this.listFormContent = this.listProcess("formList");
  1012. this.listDictContent = this.listProcess("appDictList");
  1013. this.listScriptContent = this.listProcess("scriptList");
  1014. this.listFileContent = this.listProcess("fileList");
  1015. },
  1016. getItemName: function(item){
  1017. return item.name || item.categoryName;
  1018. }
  1019. });
  1020. MWF.xApplication.AppCenter.Exporter.Element.QuerySelector = new Class({
  1021. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  1022. initData: function(){
  1023. return {
  1024. "viewList": [],
  1025. "statList": [],
  1026. "revealList": []
  1027. }
  1028. },
  1029. checkSelect: function() {
  1030. this.selectData.viewList = this.getCheckedList(this.listViewContent);
  1031. this.selectData.statList = this.getCheckedList(this.listStatContent);
  1032. this.selectData.revealList = this.getCheckedList(this.listRevealContent);
  1033. this.element.checkSelect(this.selectData);
  1034. this.hide();
  1035. },
  1036. loadContentList: function(){
  1037. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1038. this.listViewContent = this.listProcess("viewList");
  1039. this.listStatContent = this.listProcess("statList");
  1040. this.listRevealContent = this.listProcess("revealList");
  1041. }
  1042. });