Main.js 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768
  1. MWF.xApplication.AppCenter = MWF.xApplication.AppCenter || {};
  2. MWF.xDesktop.requireApp("AppCenter", "lp."+MWF.language, null, false);
  3. MWF.xApplication.AppCenter.Main = new Class({
  4. Extends: MWF.xApplication.Common.Main,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "name": "AppCenter",
  9. "icon": "icon.png",
  10. "width": "1000",
  11. "height": "700",
  12. "title": MWF.xApplication.AppCenter.LP.title
  13. },
  14. onQueryLoad: function(){
  15. this.lp = MWF.xApplication.AppCenter.LP;
  16. this.actions = MWF.Actions.get("x_program_center");
  17. },
  18. loadApplication: function(callback){
  19. this.components = [];
  20. //this.node = new Element("div", {"styles": {"width": "100%", "height": "100%", "overflow": "hidden"}}).inject(this.content);
  21. this.loadTitle();
  22. this.contentNode = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
  23. this.contentModuleArea = new Element("div", {"styles": this.css.contentModuleArea}).inject(this.contentNode);
  24. this.setContentSize();
  25. this.addEvent("resize", this.setContentSize);
  26. this.loadModuleContent();
  27. },
  28. loadTitle: function(){
  29. this.titleBar = new Element("div", {"styles": this.css.titleBar}).inject(this.content);
  30. if (MWF.AC.isProcessPlatformCreator()){
  31. this.createApplicationNode = new Element("div", {
  32. "styles": this.css.createApplicationNode,
  33. "title": this.lp.export
  34. }).inject(this.titleBar);
  35. this.createApplicationNode.addEvent("click", function(){
  36. this.createApplication();
  37. }.bind(this));
  38. this.importApplicationNode = new Element("div", {
  39. "styles": this.css.setupApplicationNode,
  40. "title": this.lp.setup
  41. }).inject(this.titleBar);
  42. this.importApplicationNode.addEvent("click", function(){
  43. this.implodeLocal();
  44. }.bind(this));
  45. }
  46. this.taskTitleTextNode = new Element("div", {"styles": this.css.titleTextNode,"text": this.lp.title}).inject(this.titleBar);
  47. },
  48. implodeLocal: function(){
  49. if (!this.uploadFileAreaNode){
  50. this.uploadFileAreaNode = new Element("div");
  51. var html = "<input name=\"file\" type=\"file\" accept=\".xapp\"/>";
  52. this.uploadFileAreaNode.set("html", html);
  53. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  54. this.fileUploadNode.addEvent("change", this.implodeLocalFile.bind(this));
  55. }else{
  56. if (this.fileUploadNode) this.fileUploadNode.destroy();
  57. this.uploadFileAreaNode.empty();
  58. var html = "<input name=\"file\" type=\"file\" accept=\".xapp\"/>";
  59. this.uploadFileAreaNode.set("html", html);
  60. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  61. this.fileUploadNode.addEvent("change", this.implodeLocalFile.bind(this));
  62. }
  63. this.fileUploadNode.click();
  64. },
  65. implodeLocalFile: function(){
  66. var files = this.fileUploadNode.files;
  67. if (files.length){
  68. var file = files[0];
  69. var position = this.titleBar.getPosition(this.content);
  70. var size = this.contentNode.getSize();
  71. var width = size.x*0.9;
  72. if (width>600) width = 600;
  73. var height = size.y*0.9;
  74. var x = (size.x-width)/2;
  75. var y = (size.y-height)/2;
  76. var setupModule = null;
  77. MWF.require("MWF.xDesktop.Dialog", function(){
  78. var dlg = new MWF.xDesktop.Dialog({
  79. "title": this.lp.setupTitle,
  80. "style": "appMarket",
  81. "top": y+20,
  82. "left": x,
  83. "fromTop":position.y,
  84. "fromLeft": position.x,
  85. "width": width,
  86. "height": height,
  87. "html": "",
  88. "maskNode": this.content,
  89. "container": this.content,
  90. "buttonList": [
  91. {
  92. "text": this.lp.ok,
  93. "action": function(){
  94. if (setupModule) setupModule.setup();
  95. this.close();
  96. }
  97. },
  98. {
  99. "text": this.lp.cancel,
  100. "action": function(){this.close();}
  101. }
  102. ]
  103. });
  104. dlg.show();
  105. setupModule = new MWF.xApplication.AppCenter.Module.SetupLocal(file, dlg, this);
  106. }.bind(this));
  107. }
  108. },
  109. setContentSize: function(){
  110. var size = this.content.getSize();
  111. var titleSize = this.titleBar.getSize();
  112. var height = size.y-titleSize.y;
  113. this.contentNode.setStyles({"height": ""+height+"px", "overflow": "auto"});
  114. var max = size.x*0.98;
  115. var n = (size.x/320).toInt();
  116. var x = n*320;
  117. while (x>max){
  118. n--;
  119. x = n*320;
  120. }
  121. this.contentModuleArea.setStyle("width", ""+x+"px");
  122. },
  123. loadModuleContent: function(){
  124. this.actions.listStructure(function(json){
  125. this.moduleList = json.data;
  126. if (this.moduleList.length){
  127. this.moduleList.each(function(module){
  128. if( module && module.id ){
  129. new MWF.xApplication.AppCenter.Module(this, module);
  130. }
  131. }.bind(this));
  132. }else{
  133. this.createEmptyElement();
  134. }
  135. }.bind(this));
  136. },
  137. createEmptyElement: function(){
  138. this.emptyNode = new Element("div", {"styles": this.css.emptyNode}).inject(this.contentModuleArea);
  139. if (MWF.AC.isProcessPlatformCreator()){
  140. this.emptyNode.set("text", this.lp.emptyModuleManagerInfo);
  141. this.emptyNode.addEvent("click", function(){
  142. this.createApplication();
  143. }.bind(this));
  144. }else{
  145. this.emptyNode.set("text", this.lp.emptyModuleInfo);
  146. }
  147. },
  148. createApplication: function(target,id){
  149. if(id) this.curAppId = id;
  150. if(target) this.content = target;
  151. new MWF.xApplication.AppCenter.Exporter(this);
  152. }
  153. });
  154. MWF.xApplication.AppCenter.Module = new Class({
  155. initialize: function(app, data){
  156. this.app = app;
  157. this.data = data;
  158. this.json = JSON.decode(this.data.data);
  159. if (!this.json) this.json = {};
  160. this.json.structure = this.data.id;
  161. this.lp = this.app.lp;
  162. this.css = this.app.css;
  163. this.content = this.app.contentModuleArea;
  164. this.load();
  165. },
  166. load: function(){
  167. this.node = new Element("div", {"styles": this.css.moduleNode}).inject(this.content);
  168. this.iconNode = new Element("div", {"styles": this.css.moduleIconNode}).inject(this.node);
  169. this.contentNode = new Element("div", {"styles": this.css.moduleContentNode}).inject(this.node);
  170. this.nameNode = new Element("div", {"styles": this.css.moduleNameNode}).inject(this.contentNode);
  171. this.categoryNode = new Element("div", {"styles": this.css.moduleCategoryNode}).inject(this.contentNode);
  172. this.descriptionNode = new Element("div", {"styles": this.css.moduleDescriptionNode}).inject(this.contentNode);
  173. this.actionNode = new Element("div", {"styles": this.css.moduleActionNode}).inject(this.contentNode);
  174. this.viewActionNode = new Element("div", {"styles": this.css.moduleActionNode}).inject(this.contentNode);
  175. this.deleteActionNode = new Element("div", {"styles": this.css.moduleDeleteActionNode}).inject(this.contentNode);
  176. this.deleteActionNode.set("text", this.lp.delete);
  177. this.nameNode.set("text", this.data.name);
  178. this.categoryNode.set("text", this.data.createTime);
  179. this.descriptionNode.set("text", this.data.description);
  180. this.actionNode.set("text", this.lp.output);
  181. this.viewActionNode.set("text", this.lp.outputView);
  182. this.viewActionNode.setStyle("margin-left", "10px");
  183. this.loadEvent();
  184. },
  185. loadEvent: function(){
  186. this.actionNode.addEvent("click", function(e){
  187. var uri = this.app.actions.action.actions["download"].uri;
  188. uri = uri.replace("{flag}", this.json.structure);
  189. window.open(o2.filterUrl(this.app.actions.action.address+uri));
  190. }.bind(this));
  191. this.viewActionNode.addEvent("click", function(e){
  192. this.outputApp();
  193. e.stopPropagation();
  194. }.bind(this));
  195. this.node.addEvent("click", function(){
  196. this.openApp();
  197. }.bind(this));
  198. var _self = this;
  199. this.deleteActionNode.addEvent("click",function (e) {
  200. this.app.confirm("warn", e, "tip", "confirm delete?", 300, 120, function(){
  201. this.structureRes = _self.app.actions.removeStructure(_self.json.structure,function(json){
  202. _self.app.notice("success");
  203. _self.node.destroy();
  204. }.bind(this));
  205. this.close();
  206. }, function(){
  207. this.close();
  208. }, null);
  209. }.bind(this));
  210. },
  211. outputApp: function(){
  212. new MWF.xApplication.AppCenter.Exporter(this.app, this.json)
  213. },
  214. openApp: function(){
  215. }
  216. });
  217. MWF.xApplication.AppCenter.Exporter = new Class({
  218. initialize: function(app, selectData){
  219. this.app = app;
  220. this.lp = this.app.lp;
  221. this.css = this.app.css;
  222. this.structure = null;
  223. this.dlg = null;
  224. this.selectData = selectData || {
  225. "structure": "",
  226. "name": "",
  227. "description": "",
  228. "processPlatformList": [],
  229. "portalList": [],
  230. "queryList": [],
  231. "serviceModuleList": [],
  232. "cmsList": []
  233. };
  234. this.setp = 1;
  235. this.load();
  236. },
  237. loadStructure: function(){
  238. this.structureRes = this.app.actions.outputStructure(function(json){
  239. if(this.app.curAppId){
  240. var cmsList = json.data.cmsList;
  241. var portalList = json.data.portalList;
  242. var processPlatformList = json.data.processPlatformList;
  243. var queryList = json.data.queryList;
  244. var serviceModuleList = json.data.serviceModuleList;
  245. var curAppData = {
  246. "portalList":[],
  247. "cmsList":[],
  248. "processPlatformList":[],
  249. "queryList":[],
  250. "serviceModuleList":[]
  251. };
  252. cmsList.each(function (cms) {
  253. if(cms.id===this.app.curAppId) {
  254. curAppData.cmsList.push(cms);
  255. }
  256. }.bind(this));
  257. portalList.each(function (portal) {
  258. if(portal.id === this.app.curAppId){
  259. curAppData.portalList.push(portal);
  260. }
  261. }.bind(this));
  262. processPlatformList.each(function (processPlatform) {
  263. if(processPlatform.id===this.app.curAppId){
  264. curAppData.processPlatformList.push(processPlatform)
  265. }
  266. }.bind(this));
  267. queryList.each(function (query) {
  268. if(query.id===this.app.curAppId) {
  269. curAppData.queryList.push(query);
  270. }
  271. }.bind(this));
  272. serviceModuleList.each(function (service) {
  273. if(service.id===this.app.curAppId) {
  274. curAppData.serviceModuleList.push(service);
  275. }
  276. }.bind(this));
  277. this.structure = curAppData;
  278. }else{
  279. this.structure = json.data;
  280. }
  281. this.createContent();
  282. }.bind(this));
  283. },
  284. showDlg: function(callback){
  285. var position = this.app.createApplicationNode.getPosition(this.app.content);
  286. var size = this.app.content.getSize();
  287. var width = size.x*0.9;
  288. if (width>600) width = 600;
  289. var height = size.y*0.8;
  290. var x = (size.x-width)/2;
  291. var y = (size.y-height)/2;
  292. if (y<80) y = 80;
  293. var _self = this;
  294. MWF.require("MWF.xDesktop.Dialog", function(){
  295. this.dlg = new MWF.xDesktop.Dialog({
  296. "title": this.lp.exportTitle,
  297. "style": "appCenter",
  298. "top": y+20,
  299. "left": x,
  300. "fromTop":position.y,
  301. "fromLeft": position.x,
  302. "width": width,
  303. "height": height,
  304. "html": "",
  305. "maskNode": this.app.content,
  306. "container": this.app.content,
  307. "buttonList": [
  308. {
  309. "text": this.lp.next,
  310. "action": function(){
  311. _self.next();
  312. //this.close();
  313. }
  314. },
  315. {
  316. "text": this.lp.prev,
  317. "action": function(){
  318. _self.prev();
  319. //this.close();
  320. }
  321. },
  322. {
  323. "text": this.lp.ok,
  324. "action": function(){
  325. _self.output();
  326. //this.close();
  327. }
  328. },
  329. {
  330. "text": this.lp.cancel,
  331. "action": function(){
  332. this.close();
  333. if (_self.structureRes && _self.structureRes.res){
  334. if (_self.structureRes.res.isRunning()){_self.structureRes.res.cancel();}
  335. _self.structureRes = null;
  336. }
  337. }
  338. }
  339. ],
  340. "onPostShow": function(){
  341. if (callback) callback();
  342. }.bind(this),
  343. "onPostClose": function() {
  344. if(_self.app){
  345. _self.app.fireEvent("exporterClose");
  346. }
  347. MWF.release(_self);
  348. }
  349. });
  350. this.dlg.show();
  351. }.bind(this));
  352. },
  353. checkInput: function(){
  354. var name = this.moduleNameInput.get("value");
  355. var category = this.moduleCategoryInput.get("value");
  356. var description = this.moduleDescriptionInput.get("value");
  357. if (!name){
  358. this.app.notice(this.lp.noNameError, "error");
  359. return false;
  360. }
  361. if (!this.selectData.processPlatformList.length &&
  362. !this.selectData.portalList.length &&
  363. !this.selectData.queryList.length &&
  364. !this.selectData.serviceModuleList.length &&
  365. !this.selectData.cmsList.length){
  366. this.app.notice(this.lp.noModuleError, "error");
  367. return false;
  368. }
  369. this.selectData.name = name;
  370. this.selectData.category = category;
  371. this.selectData.description = description;
  372. return true;
  373. },
  374. next: function(){
  375. if (this.setp==1){
  376. if (this.checkInput()) this.showStatus();
  377. }
  378. },
  379. prev: function(){
  380. if (this.step==2){
  381. if (this.statusContentNode){
  382. this.statusContentNode.destroy();
  383. this.statusContentNode = null;
  384. }
  385. this.contentNode.setStyle("display", "block");
  386. this.okBut.setStyle("display", "none");
  387. this.prevBut.setStyle("display", "nonde");
  388. this.nextBut.setStyle("display", "inline");
  389. }
  390. },
  391. output: function(){
  392. if (this.step==2){
  393. if (this.checkInput()){
  394. MWF.require("o2.widget.Mask", function(){
  395. this.mask = new o2.widget.Mask();
  396. this.mask.loadNode(this.dlg.node);
  397. this.app.actions.output(this.selectData, function(json){
  398. var uri = this.app.actions.action.actions["download"].uri;
  399. uri = uri.replace("{flag}", json.data.flag);
  400. if (this.mask) this.mask.hide();
  401. this.dlg.close();
  402. window.open(o2.filterUrl(this.app.actions.action.address+uri));
  403. this.app.fireEvent("exporterClose");
  404. MWF.release(this);
  405. }.bind(this), function(xhr, text, error){
  406. if (xhr.status!=0){
  407. var errorText = error;
  408. if (xhr){
  409. var json = JSON.decode(xhr.responseText);
  410. if (json){
  411. errorText = json.message.trim() || "request json error";
  412. }else{
  413. errorText = "request json error: "+xhr.responseText;
  414. }
  415. }
  416. MWF.xDesktop.notice("error", {x: "right", y:"top"}, errorText);
  417. }
  418. if (this.mask) this.mask.hide();
  419. }.bind(this));
  420. }.bind(this));
  421. }
  422. }
  423. },
  424. showStatus: function(){
  425. this.statusContentNode = new Element("div", {"styles": this.css.moduleSelectContentAreaNode}).inject(this.contentNode, "after");
  426. this.statusTitleNode = new Element("div", {"styles": this.css.moduleSelectTitleNode, "text": this.lp.selected}).inject(this.statusContentNode);
  427. this.statusInfoNode = new Element("div", {"styles": this.css.moduleSelectContentNode}).inject(this.statusContentNode);
  428. var size = this.contentNode.getSize();
  429. var position = this.contentNode.getPosition(this.contentNode.getOffsetParent());
  430. var css = {
  431. "height": ""+size.y+"px",
  432. "width": ""+size.x+"px",
  433. "top": ""+position.y+"px",
  434. "left": ""+position.x+"px",
  435. "background-color": "#eeeeee"
  436. };
  437. this.statusContentNode.setStyles(css);
  438. var titleSize = this.statusTitleNode.getSize();
  439. var h = size.y-titleSize.y-20;
  440. this.statusInfoNode.setStyle("height", ""+h+"px");
  441. this.showStatusList();
  442. this.contentNode.setStyle("display", "none");
  443. this.okBut.setStyle("display", "inline");
  444. this.prevBut.setStyle("display", "inline");
  445. this.nextBut.setStyle("display", "none");
  446. this.step = 2;
  447. },
  448. showStatusList: function(){
  449. this.showStatusItemList("processPlatformList", ["processList", "formList", "applicationDictList", "scriptList", "fileList"]);
  450. this.showStatusItemList("portalList", ["pageList", "scriptList", "widgetList", "applicationDictList","fileList"]);
  451. this.showStatusItemList("cmsList", ["categoryInfoList", "formList", "appDictList", "scriptList"]);
  452. this.showStatusItemList("queryList", ["viewList", "statList", "tableList", "statementList", "importModelList"]);
  453. this.showStatusItemList("serviceModuleList", ["agentList", "invokeList", "scriptList", "dictList"]);
  454. },
  455. showStatusItemList: function(listName, subList){
  456. this.selectData[listName].each(function(app){
  457. new Element("div", {"styles": this.css.moduleStatusInforNode1, "text": "["+this.lp[listName]+"] "+(app.name || app.appName)}).inject(this.statusInfoNode);
  458. subList.each(function(name){
  459. if (app[name] && app[name].length) app[name].each(function(process){
  460. new Element("div", {"styles": this.css.moduleStatusInforNode2, "text": "["+this.lp[name]+"] "+(process.name || process.categoryName)}).inject(this.statusInfoNode);
  461. }.bind(this));
  462. }.bind(this));
  463. }.bind(this));
  464. },
  465. load: function(){
  466. this.showDlg(function(){
  467. this.createLayout();
  468. this.loadStructure();
  469. }.bind(this));
  470. },
  471. createLayout: function(){
  472. this.nextBut = this.dlg.button.getFirst("input");
  473. this.prevBut = this.nextBut.getNext("input");
  474. this.okBut = this.prevBut.getNext("input");
  475. if (this.setp==1){
  476. this.okBut.setStyle("display", "none");
  477. this.prevBut.setStyle("display", "none");
  478. }
  479. this.node = new Element("div", {"styles": this.css.moduleSetupContentNode}).inject(this.dlg.content);
  480. this.titleNode = new Element("div", {"styles": this.css.moduleSetupTitleNode}).inject(this.node);
  481. var iconNode = new Element("div", {"styles": this.css.moduleIconNode}).inject(this.titleNode);
  482. var contentNode = new Element("div", {"styles": this.css.moduleSetupTitleContentNode}).inject(this.titleNode);
  483. var nameNode = new Element("div", {"styles": this.css.moduleSetupNameNode}).inject(contentNode);
  484. var categoryNode = new Element("div", {"styles": this.css.moduleSetupCategoryNode}).inject(contentNode);
  485. categoryNode.hide();
  486. var descriptionNode = new Element("div", {"styles": this.css.moduleSetupDescriptionNode}).inject(contentNode);
  487. var nameTitleNode = new Element("div", {"styles": this.css.moduleInputTitleNode, "text": this.lp.moduleName}).inject(nameNode);
  488. var nameContentNode = new Element("div", {"styles": this.css.moduleInputContentNode}).inject(nameNode);
  489. this.moduleNameInput = new Element("input", {"styles": this.css.moduleInputNode}).inject(nameContentNode);
  490. var categoryTitleNode = new Element("div", {"styles": this.css.moduleInputTitleNode, "text": this.lp.moduleCategory}).inject(categoryNode);
  491. var categoryContentNode = new Element("div", {"styles": this.css.moduleInputContentNode}).inject(categoryNode);
  492. this.moduleCategoryInput = new Element("input", {"styles": this.css.moduleInputNode}).inject(categoryContentNode);
  493. var descriptionTitleNode = new Element("div", {"styles": this.css.moduleInputTitleNode, "text": this.lp.moduleDescription}).inject(descriptionNode);
  494. var descriptionContentNode = new Element("div", {"styles": this.css.moduleInputContentNode}).inject(descriptionNode);
  495. this.moduleDescriptionInput = new Element("input", {"styles": this.css.moduleInputNode}).inject(descriptionContentNode);
  496. this.moduleNameInput.set("value", this.selectData.name);
  497. this.moduleCategoryInput.set("value", this.selectData.category);
  498. this.moduleDescriptionInput.set("value", this.selectData.description);
  499. this.contentNode = new Element("div", {"styles": this.css.moduleSetupCompareContentNode}).inject(this.node);
  500. this.setListContentSize();
  501. this.createLoading(this.contentNode);
  502. },
  503. setListContentSize: function(){
  504. var size = this.dlg.content.getSize();
  505. var h = size.y;
  506. var titleH = this.titleNode.getSize().y+10;
  507. var contentH = h-titleH-10;
  508. this.contentNode.setStyle("height", ""+contentH+"px");
  509. },
  510. createLoading: function(node){
  511. //this.okBut.setStyle("display", "none");
  512. this.nextBut.setStyle("display", "none");
  513. this.loadingAreaNode = new Element("div", {"styles": this.css.moduleLoadingAreaNode}).inject(node);
  514. var img = new Element("img", {
  515. "styles": this.css.moduleLoadingImgNode,
  516. "src": this.app.path+this.app.options.style+"/icon/loading.gif"
  517. }).inject(this.loadingAreaNode);
  518. },
  519. clearLoading: function(){
  520. if (this.loadingAreaNode){
  521. this.loadingAreaNode.destroy();
  522. this.loadingAreaNode = null;
  523. }
  524. //this.okBut.setStyle("display", "inline");
  525. this.nextBut.setStyle("display", "inline");
  526. },
  527. createContent: function(){
  528. this.clearLoading();
  529. this.createListArea();
  530. this.loadProcessList();
  531. this.loadPortalList();
  532. this.loadCMSList();
  533. this.loadQueryList();
  534. this.loadServiceList();
  535. //this.structure
  536. },
  537. createListArea: function(){
  538. this.contentAreaNode = new Element("div").inject(this.contentNode);
  539. // this.contentInforNode = new Element("div", {"styles": this.css.moduleSetupContentInforNode, "text": this.lp.selectModules}).inject(this.contentAreaNode);
  540. // //this.processArea = new Element("div", {"styles": this.css.moduleSetupListAreaNode}).inject(this.contentNode);
  541. //
  542. // this.listAreaNode = new Element("div").inject(this.contentAreaNode);
  543. this.processAreaTitle = new Element("div.moduleSetupListAreaTitle", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.process, "data-type":"process"}).inject(this.contentAreaNode);
  544. this.processAreaContent = new Element("div.", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  545. this.portalAreaTitle = new Element("div.moduleSetupListAreaTitle", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.portal, "data-type":"portal"}).inject(this.contentAreaNode);
  546. this.portalAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  547. this.cmsAreaTitle = new Element("div.moduleSetupListAreaTitle", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.cms, "data-type":"cms"}).inject(this.contentAreaNode);
  548. this.cmsAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  549. this.queryAreaTitle = new Element("div.moduleSetupListAreaTitle", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.query, "data-type":"query"}).inject(this.contentAreaNode);
  550. this.queryAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  551. this.serviceAreaTitle = new Element("div.moduleSetupListAreaTitle", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.service, "data-type":"service"}).inject(this.contentAreaNode);
  552. this.serviceAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  553. this.contentAreaNode.getElements(".moduleSetupListAreaTitle").each(function (node){
  554. debugger;
  555. var spanNode = new Element("div",{
  556. styles: {
  557. "float": "left",
  558. "padding-right": "10px",
  559. "cursor": "pointer",
  560. "width": "24px",
  561. "height": "30px",
  562. "background": "url("+this.app.path+this.app.options.style+"/icon/arrow_down.png) center center no-repeat"
  563. }
  564. }).inject(node, "top");
  565. spanNode.addEvent("click",function (ev){
  566. if(spanNode.retrieve("collapse")){
  567. node.getNext().show();
  568. spanNode.store("collapse", false);
  569. spanNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/arrow_down.png)");
  570. }else {
  571. node.getNext().hide();
  572. spanNode.store("collapse", true);
  573. spanNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/arrow_up.png)");
  574. }
  575. ev.stopPropagation();
  576. }.bind(this));
  577. node.addEvent("click",function (){
  578. if(spanNode.retrieve("collapse")){
  579. node.getNext().show();
  580. spanNode.store("collapse", false);
  581. spanNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/arrow_down.png)");
  582. }else {
  583. node.getNext().hide();
  584. spanNode.store("collapse", true);
  585. spanNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/arrow_up.png)");
  586. }
  587. }.bind(this));
  588. var inverseAction = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonActionNode, "text": this.lp.inverse}).inject(node);
  589. inverseAction.addEvent("click", function(ev){
  590. var type = node.get("data-type");
  591. this[type+"ListNodes"].each(function( element ){
  592. element.selectAll( false );
  593. }.bind(this));
  594. ev.stopPropagation();
  595. }.bind(this));
  596. var selectAllAction = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonActionNode, "text": this.lp.selectAll}).inject(node);
  597. selectAllAction.addEvent("click", function(ev){
  598. var type = node.get("data-type");
  599. this[type+"ListNodes"].each(function( element ){
  600. element.selectAll( true );
  601. }.bind(this));
  602. ev.stopPropagation();
  603. }.bind(this));
  604. }.bind(this));
  605. },
  606. loadProcessList: function(){
  607. this.processListNodes = [];
  608. this.structure.processPlatformList.each(function(item){
  609. var postData = null;
  610. for (var i=0; i<this.selectData.processPlatformList.length; i++){
  611. if (this.selectData.processPlatformList[i].id == item.id){
  612. postData = this.selectData.processPlatformList[i];
  613. break;
  614. }
  615. }
  616. this.processListNodes.push(new MWF.xApplication.AppCenter.Exporter.ProcessElement(this, this.processAreaContent, item, postData));
  617. }.bind(this));
  618. },
  619. loadPortalList: function(){
  620. this.portalListNodes = [];
  621. this.structure.portalList.each(function(item){
  622. this.portalListNodes.push(new MWF.xApplication.AppCenter.Exporter.PortalElement(this, this.portalAreaContent, item));
  623. }.bind(this));
  624. },
  625. loadCMSList: function(){
  626. this.cmsListNodes = [];
  627. this.structure.cmsList.each(function(item){
  628. this.cmsListNodes.push(new MWF.xApplication.AppCenter.Exporter.CmsElement(this, this.cmsAreaContent, item));
  629. }.bind(this));
  630. },
  631. loadQueryList: function(){
  632. this.queryListNodes = [];
  633. this.structure.queryList.each(function(item){
  634. this.queryListNodes.push(new MWF.xApplication.AppCenter.Exporter.QueryElement(this, this.queryAreaContent, item));
  635. }.bind(this));
  636. },
  637. loadServiceList: function(){
  638. this.serviceListNodes = [];
  639. this.structure.serviceModuleList.each(function(item){
  640. this.serviceListNodes.push(new MWF.xApplication.AppCenter.Exporter.ServiceElement(this, this.serviceAreaContent, item));
  641. }.bind(this));
  642. }
  643. });
  644. MWF.xApplication.AppCenter.Exporter.Element = new Class({
  645. initialize: function(exporter, content, data, postData){
  646. this.exporter = exporter;
  647. this.app = this.exporter.app;
  648. this.data = data;
  649. this.lp = this.app.lp;
  650. this.css = this.app.css;
  651. this.content = content;
  652. this.initPostData(postData);
  653. //this.selectStatus = selectStatus || "none";
  654. this.load();
  655. },
  656. initPostData: function(postData){
  657. this.postData = postData || {
  658. "id": this.data.id,
  659. "name": this.data.name || this.data.appName,
  660. "alias": this.data.alias,
  661. "description": this.data.description,
  662. "processList": [],
  663. "formList": [],
  664. "applicationDictList": [],
  665. "scriptList": [],
  666. "fileList": []
  667. };
  668. },
  669. load: function(){
  670. this.contentNode = new Element("div", {"styles": this.css.moduleSetupListContentNode}).inject(this.content);
  671. this.iconNode = new Element("div", {"styles": this.css.moduleSetupListIconNode}).inject(this.contentNode);
  672. this.actionNode = new Element("div", {"styles": this.css.moduleSetupListActionNode}).inject(this.contentNode);
  673. this.inforNode = new Element("div", {"styles": this.css.moduleSetupListInforNode}).inject(this.contentNode);
  674. this.nameNode = new Element("div", {"styles": this.css.moduleSetupListNameNode}).inject(this.contentNode);
  675. this.nameNode.set(this.getNameContent());
  676. // switch (this.selectStatus){
  677. // case "all":
  678. // this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  679. // break;
  680. // case "part":
  681. // this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  682. // break;
  683. // default:
  684. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  685. //}
  686. this.action = new Element("div", {"styles": this.css.moduleSelectActionNode, "text": this.lp.select}).inject(this.actionNode);
  687. this.setEvent();
  688. this.checkSelect(this.postData);
  689. },
  690. setEvent: function(){
  691. this.contentNode.addEvents({
  692. "mouseover": function(){this.contentNode.setStyles(this.css.moduleSetupListContentNode_over);}.bind(this),
  693. "mouseout": function(){this.contentNode.setStyles(this.css.moduleSetupListContentNode);}.bind(this)
  694. });
  695. this.iconNode.addEvent("click", this.selectAll.bind(this));
  696. this.action.addEvent("click", function(){
  697. this.selectElements();
  698. }.bind(this));
  699. this.nameNode.addEvent("click", function(){
  700. this.selectElements();
  701. }.bind(this));
  702. },
  703. isAllSelected: function( selectData ){
  704. return selectData.processList.length===this.data.processList.length &&
  705. selectData.formList.length===this.data.formList.length &&
  706. selectData.applicationDictList.length===this.data.applicationDictList.length &&
  707. selectData.scriptList.length===this.data.scriptList.length &&
  708. selectData.fileList.length===this.data.fileList.length;
  709. },
  710. selectAll: function( forceStatus ){
  711. var selectData = this.postData;
  712. if (selectData.processList.length || selectData.formList.length || selectData.applicationDictList.length || selectData.scriptList.length || selectData.fileList.length){
  713. if ( this.isAllSelected( selectData ) ){
  714. selectData = {
  715. "processList": [],
  716. "formList": [],
  717. "applicationDictList": [],
  718. "scriptList": [],
  719. "fileList": []
  720. };
  721. }else{
  722. selectData = {
  723. "processList": this.data.processList,
  724. "formList": this.data.formList,
  725. "applicationDictList": this.data.applicationDictList,
  726. "scriptList": this.data.scriptList,
  727. "fileList": this.data.fileList
  728. };
  729. }
  730. }else{
  731. selectData = {
  732. "processList": this.data.processList,
  733. "formList": this.data.formList,
  734. "applicationDictList": this.data.applicationDictList,
  735. "scriptList": this.data.scriptList,
  736. "fileList": this.data.fileList
  737. };
  738. }
  739. if( forceStatus === true && !this.isAllSelected(selectData) ){
  740. return;
  741. }else if( forceStatus === false && this.isAllSelected(selectData) ){
  742. return;
  743. }
  744. this.checkSelect(selectData);
  745. },
  746. getNameContent: function(){
  747. return {
  748. "title": this.lp.name+": "+this.data.name+" "+this.lp.id+": "+this.data.id,
  749. "text": this.data.name
  750. }
  751. },
  752. selectElements: function(){
  753. new MWF.xApplication.AppCenter.Exporter.Element.Selector(this, this.data);
  754. },
  755. checkSelect: function(selectData){
  756. this.postData.processList = selectData.processList;
  757. this.postData.formList = selectData.formList;
  758. this.postData.applicationDictList = selectData.applicationDictList;
  759. this.postData.scriptList = selectData.scriptList;
  760. this.postData.fileList = selectData.fileList;
  761. this.exporter.selectData.processPlatformList.erase(this.postData);
  762. if (selectData.processList.length || selectData.formList.length || selectData.applicationDictList.length || selectData.scriptList.length || selectData.fileList.length){
  763. this.exporter.selectData.processPlatformList.push(this.postData);
  764. if ( this.isAllSelected( selectData ) ){
  765. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  766. }else{
  767. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  768. }
  769. }else{
  770. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  771. }
  772. }
  773. });
  774. MWF.xApplication.AppCenter.Exporter.ProcessElement = new Class({
  775. Extends: MWF.xApplication.AppCenter.Exporter.Element
  776. });
  777. MWF.xApplication.AppCenter.Exporter.PortalElement = new Class({
  778. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  779. initPostData: function(postData){
  780. this.postData = postData || {
  781. "id": this.data.id,
  782. "name": this.data.name || this.data.appName,
  783. "alias": this.data.alias,
  784. "description": this.data.description,
  785. "pageList": [],
  786. "scriptList": [],
  787. "widgetList": [],
  788. "applicationDictList": [],
  789. "fileList": []
  790. };
  791. },
  792. isAllSelected: function( selectData ){
  793. return selectData.pageList.length===this.data.pageList.length &&
  794. selectData.scriptList.length===this.data.scriptList.length &&
  795. selectData.widgetList.length===this.data.widgetList.length &&
  796. selectData.applicationDictList.length===this.data.applicationDictList.length &&
  797. selectData.fileList.length===this.data.fileList.length;
  798. },
  799. selectAll: function( forceStatus ){
  800. var selectData = this.postData;
  801. if (selectData.pageList.length || selectData.scriptList.length || selectData.widgetList.length || selectData.applicationDictList.length || selectData.fileList.length){
  802. if ( this.isAllSelected( selectData )){
  803. selectData = {
  804. "pageList": [],
  805. "scriptList": [],
  806. "widgetList": [],
  807. "applicationDictList": [],
  808. "fileList": []
  809. };
  810. }else{
  811. selectData = {
  812. "pageList": this.data.pageList,
  813. "scriptList": this.data.scriptList,
  814. "widgetList": this.data.widgetList,
  815. "applicationDictList": this.data.applicationDictList,
  816. "fileList": this.data.fileList
  817. };
  818. }
  819. }else{
  820. selectData = {
  821. "pageList": this.data.pageList,
  822. "scriptList": this.data.scriptList,
  823. "widgetList": this.data.widgetList,
  824. "applicationDictList": this.data.applicationDictList,
  825. "fileList": this.data.fileList
  826. };
  827. }
  828. if( forceStatus === true && !this.isAllSelected(selectData) ){
  829. return;
  830. }else if( forceStatus === false && this.isAllSelected(selectData) ){
  831. return;
  832. }
  833. this.checkSelect(selectData);
  834. },
  835. selectElements: function(){
  836. new MWF.xApplication.AppCenter.Exporter.Element.PortalSelector(this, this.data);
  837. },
  838. checkSelect: function(selectData){
  839. this.postData.pageList = selectData.pageList;
  840. this.postData.scriptList = selectData.scriptList;
  841. this.postData.widgetList = selectData.widgetList;
  842. this.postData.applicationDictList = selectData.applicationDictList;
  843. this.postData.fileList = selectData.fileList;
  844. this.exporter.selectData.portalList.erase(this.postData);
  845. if (selectData.pageList.length || selectData.scriptList.length || selectData.widgetList.length || selectData.applicationDictList.length || selectData.fileList.length){
  846. this.exporter.selectData.portalList.push(this.postData);
  847. if ( this.isAllSelected( selectData ) ){
  848. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  849. }else{
  850. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  851. }
  852. }else{
  853. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  854. }
  855. }
  856. });
  857. MWF.xApplication.AppCenter.Exporter.CmsElement = new Class({
  858. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  859. getNameContent: function(){
  860. return {
  861. "title": this.lp.name+": "+this.data.appName+" "+this.lp.id+": "+this.data.id,
  862. "text": this.data.appName
  863. }
  864. },
  865. initPostData: function(postData){
  866. this.postData = postData || {
  867. "id": this.data.id,
  868. "name": this.data.name || this.data.appName,
  869. "alias": this.data.alias,
  870. "description": this.data.description,
  871. "categoryInfoList": [],
  872. "formList": [],
  873. "appDictList": [],
  874. "scriptList": [],
  875. "fileList": []
  876. };
  877. },
  878. selectElements: function(){
  879. new MWF.xApplication.AppCenter.Exporter.Element.CmsSelector(this, this.data);
  880. },
  881. isAllSelected: function( selectData ){
  882. return selectData.categoryInfoList.length===this.data.categoryInfoList.length &&
  883. selectData.formList.length===this.data.formList.length &&
  884. selectData.appDictList.length===this.data.appDictList.length &&
  885. selectData.scriptList.length===this.data.scriptList.length &&
  886. selectData.fileList.length===this.data.fileList.length;
  887. },
  888. selectAll: function( forceStatus ){
  889. var selectData = this.postData;
  890. if (selectData.categoryInfoList.length || selectData.formList.length || selectData.appDictList.length || selectData.scriptList.length || selectData.fileList.length){
  891. if ( this.isAllSelected(selectData) ){
  892. selectData = {
  893. "categoryInfoList": [],
  894. "formList": [],
  895. "appDictList": [],
  896. "scriptList": [],
  897. "fileList": []
  898. };
  899. }else{
  900. selectData = {
  901. "categoryInfoList": this.data.categoryInfoList,
  902. "formList": this.data.formList,
  903. "appDictList": this.data.appDictList,
  904. "scriptList": this.data.scriptList,
  905. "fileList": this.data.fileList
  906. };
  907. }
  908. }else{
  909. selectData = {
  910. "categoryInfoList": this.data.categoryInfoList,
  911. "formList": this.data.formList,
  912. "appDictList": this.data.appDictList,
  913. "scriptList": this.data.scriptList,
  914. "fileList": this.data.fileList
  915. };
  916. }
  917. if( forceStatus === true && !this.isAllSelected(selectData) ){
  918. return;
  919. }else if( forceStatus === false && this.isAllSelected(selectData) ){
  920. return;
  921. }
  922. this.checkSelect(selectData);
  923. },
  924. checkSelect: function(selectData){
  925. this.postData.categoryInfoList = selectData.categoryInfoList;
  926. this.postData.formList = selectData.formList;
  927. this.postData.appDictList = selectData.appDictList;
  928. this.postData.scriptList = selectData.scriptList;
  929. this.postData.fileList = selectData.fileList;
  930. this.exporter.selectData.cmsList.erase(this.postData);
  931. if (selectData.categoryInfoList.length || selectData.formList.length || selectData.appDictList.length || selectData.scriptList.length || selectData.fileList.length){
  932. this.exporter.selectData.cmsList.push(this.postData);
  933. if ( this.isAllSelected(selectData) ){
  934. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  935. }else{
  936. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  937. }
  938. }else{
  939. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  940. }
  941. }
  942. });
  943. MWF.xApplication.AppCenter.Exporter.QueryElement = new Class({
  944. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  945. initPostData: function(postData){
  946. this.postData = postData || {
  947. "id": this.data.id,
  948. "name": this.data.name || this.data.appName,
  949. "alias": this.data.alias,
  950. "description": this.data.description,
  951. "viewList": [],
  952. "statList": [],
  953. "statementList": [],
  954. "tableList": [],
  955. "importModelList": []
  956. };
  957. },
  958. selectElements: function(){
  959. new MWF.xApplication.AppCenter.Exporter.Element.QuerySelector(this, this.data);
  960. },
  961. isAllSelected: function( selectData ){
  962. return selectData.viewList.length===this.data.viewList.length &&
  963. selectData.statList.length===this.data.statList.length &&
  964. selectData.statementList.length===this.data.statementList.length &&
  965. selectData.tableList.length===this.data.tableList.length &&
  966. selectData.importModelList.length===this.data.importModelList.length;
  967. },
  968. selectAll: function( forceStatus ){
  969. var selectData = this.postData;
  970. if (selectData.viewList.length || selectData.statList.length || selectData.statementList.length|| selectData.tableList.length|| selectData.importModelList.length){
  971. if ( this.isAllSelected( selectData ) ){
  972. selectData = {
  973. "viewList": [],
  974. "statList": [],
  975. "statementList": [],
  976. "tableList": [],
  977. "importModelList": []
  978. };
  979. }else{
  980. selectData = {
  981. "viewList": this.data.viewList,
  982. "statList": this.data.statList,
  983. "statementList": this.data.statementList,
  984. "tableList": this.data.tableList,
  985. "importModelList": this.data.importModelList,
  986. };
  987. }
  988. }else{
  989. selectData = {
  990. "viewList": this.data.viewList,
  991. "statList": this.data.statList,
  992. "statementList": this.data.statementList,
  993. "tableList": this.data.tableList,
  994. "importModelList": this.data.importModelList
  995. };
  996. }
  997. if( forceStatus === true && !this.isAllSelected(selectData) ){
  998. return;
  999. }else if( forceStatus === false && this.isAllSelected(selectData) ){
  1000. return;
  1001. }
  1002. this.checkSelect(selectData);
  1003. },
  1004. checkSelect: function(selectData){
  1005. this.postData.viewList = selectData.viewList;
  1006. this.postData.statList = selectData.statList;
  1007. this.postData.statementList = selectData.statementList;
  1008. this.postData.tableList = selectData.tableList;
  1009. this.postData.importModelList = selectData.importModelList;
  1010. this.exporter.selectData.queryList.erase(this.postData);
  1011. //|| selectData.revealList.length
  1012. if (selectData.viewList.length || selectData.statList.length || selectData.statementList.length|| selectData.tableList.length|| selectData.importModelList.length){
  1013. this.exporter.selectData.queryList.push(this.postData);
  1014. if ( this.isAllSelected( selectData ) ){
  1015. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  1016. }else{
  1017. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  1018. }
  1019. }else{
  1020. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  1021. }
  1022. }
  1023. });
  1024. MWF.xApplication.AppCenter.Exporter.ServiceElement = new Class({
  1025. Extends: MWF.xApplication.AppCenter.Exporter.Element,
  1026. initPostData: function(postData){
  1027. this.postData = postData || {
  1028. "id": this.data.id,
  1029. "name": this.data.name || this.data.appName,
  1030. "alias": this.data.alias,
  1031. "description": this.data.description,
  1032. "agentList": [],
  1033. "invokeList": [],
  1034. "scriptList": [],
  1035. "dictList": []
  1036. };
  1037. },
  1038. selectElements: function(){
  1039. new MWF.xApplication.AppCenter.Exporter.Element.ServiceSelector(this, this.data);
  1040. },
  1041. isAllSelected: function( selectData ){
  1042. return selectData.agentList.length===this.data.agentList.length &&
  1043. selectData.invokeList.length===this.data.invokeList.length &&
  1044. selectData.scriptList.length===this.data.scriptList.length &&
  1045. selectData.dictList.length===this.data.dictList.length;
  1046. },
  1047. selectAll: function( forceStatus ){
  1048. if( !this.data.agentList )this.data.agentList = [];
  1049. if( !this.data.invokeList )this.data.invokeList = [];
  1050. if( !this.data.scriptList )this.data.scriptList = [];
  1051. if( !this.data.dictList )this.data.dictList = [];
  1052. var selectData = this.postData;
  1053. //if( selectData.scriptList )selectData.scriptList = [];
  1054. if (selectData.agentList.length || selectData.invokeList.length || selectData.scriptList.length || selectData.dictList.length){
  1055. if ( this.isAllSelected(selectData) ){
  1056. selectData = {
  1057. "agentList": [],
  1058. "invokeList": [],
  1059. "scriptList": [],
  1060. "dictList": []
  1061. };
  1062. }else{
  1063. selectData = {
  1064. "agentList": this.data.agentList,
  1065. "invokeList": this.data.invokeList,
  1066. "scriptList": this.data.scriptList,
  1067. "dictList": this.data.dictList
  1068. };
  1069. }
  1070. }else{
  1071. selectData = {
  1072. "agentList": this.data.agentList,
  1073. "invokeList": this.data.invokeList,
  1074. "scriptList": this.data.scriptList,
  1075. "dictList": this.data.dictList
  1076. };
  1077. }
  1078. if( forceStatus === true && !this.isAllSelected(selectData) ){
  1079. return;
  1080. }else if( forceStatus === false && this.isAllSelected(selectData) ){
  1081. return;
  1082. }
  1083. this.checkSelect(selectData);
  1084. },
  1085. checkSelect: function(selectData){
  1086. this.postData.agentList = selectData.agentList;
  1087. this.postData.invokeList = selectData.invokeList;
  1088. this.postData.scriptList = selectData.scriptList || [];
  1089. this.postData.dictList = selectData.dictList;
  1090. this.exporter.selectData.serviceModuleList.erase(this.postData);
  1091. if (selectData.agentList.length || selectData.invokeList.length || selectData.scriptList.length || selectData.dictList.length){
  1092. this.exporter.selectData.serviceModuleList.push(this.postData);
  1093. if ( this.isAllSelected( selectData ) ){
  1094. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_all.png) center center no-repeat");
  1095. }else{
  1096. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_part.png) center center no-repeat");
  1097. }
  1098. }else{
  1099. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/sel_none.png) center center no-repeat");
  1100. }
  1101. }
  1102. });
  1103. MWF.xApplication.AppCenter.Exporter.Element.Selector = new Class({
  1104. initialize: function(element, data){
  1105. this.element = element;
  1106. this.app = this.element.app;
  1107. this.data = data;
  1108. this.lp = this.app.lp;
  1109. this.css = this.app.css;
  1110. this.content = this.element.contentNode;
  1111. this.areaNode = this.element.exporter.contentNode;
  1112. this.selectData = this.initData();
  1113. this.load();
  1114. },
  1115. initData: function(){
  1116. return {
  1117. "processList": [],
  1118. "formList": [],
  1119. "applicationDictList": [],
  1120. "scriptList": [],
  1121. "fileList": []
  1122. }
  1123. },
  1124. load: function(){
  1125. this.node = new Element("div", {"styles": this.css.moduleSelectContentAreaNode}).inject(this.areaNode, "after");
  1126. this.titleNode = new Element("div", {"styles": this.css.moduleSelectTitleNode, "text": this.data.name}).inject(this.node);
  1127. var size = this.content.getSize();
  1128. this.node.setStyle("width", ""+size.x+"px");
  1129. this.node.position({
  1130. "relativeTo": this.content,
  1131. "position": "topLeft",
  1132. "edge": "topLeft"
  1133. });
  1134. this.element.exporter.dlg.button.setStyle("display", "none");
  1135. this.show();
  1136. },
  1137. show: function(){
  1138. var size = this.areaNode.getSize();
  1139. var height = size.y+40;
  1140. var width = size.x;
  1141. var position = this.areaNode.getPosition(this.areaNode.getOffsetParent());
  1142. //var oStyles = this.node.getStyles("height", "width", "top", "left", "background-color");
  1143. //this.node.store("ostyles", oStyles);
  1144. var css = {
  1145. "height": ""+height+"px",
  1146. "width": ""+width+"px",
  1147. "top": ""+position.y+"px",
  1148. "left": ""+position.x+"px",
  1149. "background-color": "#eeeeee"
  1150. };
  1151. this.morph = new Fx.Morph(this.node, {"duration": 100});
  1152. this.morph.start(css).chain(function(){
  1153. this.loadContent();
  1154. }.bind(this));
  1155. },
  1156. hide: function(){
  1157. if (!this.morph) this.morph = new Fx.Morph(this.node, {"duration": 100});
  1158. this.areaNode.setStyle("display", "block");
  1159. this.element.exporter.dlg.button.setStyle("display", "block");
  1160. var size = this.content.getSize();
  1161. var height = size.y;
  1162. var width = size.x;
  1163. var position = this.content.getPosition(this.areaNode);
  1164. var thisPosition = this.node.getPosition(this.node.getOffsetParent());
  1165. var x = thisPosition.x+position.x;
  1166. var y = thisPosition.y+position.y;
  1167. var css = {
  1168. "height": ""+height+"px",
  1169. "width": ""+width+"px",
  1170. "top": ""+y+"px",
  1171. "left": ""+x+"px"
  1172. };
  1173. this.contentNode.destroy();
  1174. this.morph.start(css).chain(function(){
  1175. this.node.destroy();
  1176. MWF.release(this);
  1177. }.bind(this));
  1178. },
  1179. loadContent: function(){
  1180. this.areaNode.setStyle("display", "none");
  1181. this.contentNode = new Element("div", {"styles": this.css.moduleSelectContentNode}).inject(this.node);
  1182. this.buttonNode = new Element("div", {"styles": this.css.moduleSelectButtonNode}).inject(this.node);
  1183. this.cancelButton = new Element("div", {"styles": this.css.moduleSelectButtonActionNode, "text": this.lp.cancel}).inject(this.buttonNode);
  1184. this.okButton = new Element("div", {"styles": this.css.moduleSelectButtonActionNode, "text": this.lp.ok}).inject(this.buttonNode);
  1185. this.setContentHeight();
  1186. this.loadContentList();
  1187. this.cancelButton.addEvent("click", function(){
  1188. this.hide();
  1189. }.bind(this));
  1190. this.okButton.addEvent("click", function(){
  1191. this.checkSelect();
  1192. }.bind(this));
  1193. },
  1194. checkSelect: function() {
  1195. this.selectData.processList = this.getCheckedList(this.listProcessContent);
  1196. this.selectData.formList = this.getCheckedList(this.listFormContent);
  1197. this.selectData.applicationDictList = this.getCheckedList(this.listDictContent);
  1198. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  1199. this.selectData.fileList = this.getCheckedList(this.listFileContent);
  1200. this.element.checkSelect(this.selectData);
  1201. this.hide();
  1202. },
  1203. getCheckedList: function(node){
  1204. var list = [];
  1205. node.getElements("input").each(function(input){
  1206. if (input.checked){
  1207. list.push(input.retrieve("data"));
  1208. }
  1209. }.bind());
  1210. return list;
  1211. },
  1212. setContentHeight: function(){
  1213. var size = this.node.getSize();
  1214. var titleSize = this.titleNode.getSize();
  1215. var buttonSize = this.buttonNode.getSize();
  1216. var h = size.y-titleSize.y-buttonSize.y;
  1217. this.contentNode.setStyle("height", ""+h+"px");
  1218. },
  1219. loadContentList: function(){
  1220. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1221. this.listProcessContent = this.listProcess("processList");
  1222. this.listFormContent = this.listProcess("formList");
  1223. this.listDictContent = this.listProcess("applicationDictList");
  1224. this.listScriptContent = this.listProcess("scriptList");
  1225. this.listFileContent = this.listProcess("fileList");
  1226. },
  1227. listProcess: function(name){
  1228. var title = new Element("div", {"styles": this.css.moduleSelectContentTitleNode}).inject(this.contentAreaNode);
  1229. var titleActionNode = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonNode}).inject(title);
  1230. var inverseAction = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonActionNode, "text": this.lp.inverse}).inject(titleActionNode);
  1231. var selectAllAction = new Element("div", {"styles": this.css.moduleSelectContentTitleButtonActionNode, "text": this.lp.selectAll}).inject(titleActionNode);
  1232. var titleText = new Element("div", {"styles": this.css.moduleSelectContentTitleTextNode, "text": this.lp[name]}).inject(title);
  1233. //moduleSelectContentTitleButtonActionNode
  1234. var listContent = new Element("div", {"styles": this.css.moduleSelectContentListNode}).inject(this.contentAreaNode);
  1235. this.listProcessItems(name, listContent);
  1236. inverseAction.addEvent("click", function(){
  1237. inputs = listContent.getElements("input");
  1238. inputs.each(function(checkbox){
  1239. checkbox.set("checked", !checkbox.get("checked"));
  1240. });
  1241. });
  1242. selectAllAction.addEvent("click", function(){
  1243. inputs = listContent.getElements("input");
  1244. inputs.each(function(checkbox){
  1245. checkbox.set("checked", true);
  1246. });
  1247. });
  1248. return listContent;
  1249. },
  1250. listProcessItems: function(name, listContent){
  1251. this.data[name].each(function(item){
  1252. var div = new Element("div", {"styles": this.css.moduleSelectContentListItemNode}).inject(listContent);
  1253. var flag = false;
  1254. var selectedList = this.element.postData[name];
  1255. if (selectedList){
  1256. for (var i=0; i<selectedList.length; i++){
  1257. if (selectedList[i].id==item.id){
  1258. flag = true;
  1259. break;
  1260. }
  1261. }
  1262. }
  1263. var checkNode = new Element("input", {
  1264. "styles": {"float": "left"},
  1265. "type": "checkbox",
  1266. //"checked": (this.element.postData[name] && this.element.postData[name].indexOf(item)!=-1),
  1267. "checked": flag,
  1268. "value": item.id
  1269. }).inject(div);
  1270. new Element("div", {
  1271. "styles": {"float": "left"},
  1272. "text": this.getItemName(item),
  1273. "events": {
  1274. "click": function(){checkNode.click();}
  1275. }
  1276. }).inject(div);
  1277. checkNode.store("data", item);
  1278. }.bind(this));
  1279. },
  1280. getItemName: function(item){
  1281. return item.name;
  1282. }
  1283. });
  1284. MWF.xApplication.AppCenter.Exporter.Element.ProcessSelector = new Class({
  1285. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector
  1286. });
  1287. MWF.xApplication.AppCenter.Exporter.Element.PortalSelector = new Class({
  1288. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  1289. initData: function(){
  1290. return {
  1291. "pageList": [],
  1292. "scriptList": [],
  1293. "widgetList": [],
  1294. "applicationDictList": [],
  1295. "fileList": []
  1296. }
  1297. },
  1298. checkSelect: function() {
  1299. this.selectData.pageList = this.getCheckedList(this.listPageContent);
  1300. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  1301. this.selectData.widgetList = this.getCheckedList(this.listWidgetContent);
  1302. this.selectData.applicationDictList = this.getCheckedList(this.listDictContent);
  1303. this.selectData.fileList = this.getCheckedList(this.listFileContent);
  1304. this.element.checkSelect(this.selectData);
  1305. this.hide();
  1306. },
  1307. loadContentList: function(){
  1308. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1309. this.listPageContent = this.listProcess("pageList");
  1310. this.listScriptContent = this.listProcess("scriptList");
  1311. this.listWidgetContent = this.listProcess("widgetList");
  1312. this.listDictContent = this.listProcess("applicationDictList");
  1313. this.listFileContent = this.listProcess("fileList");
  1314. }
  1315. });
  1316. MWF.xApplication.AppCenter.Exporter.Element.CmsSelector = new Class({
  1317. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  1318. initData: function(){
  1319. return {
  1320. "categoryInfoList": [],
  1321. "formList": [],
  1322. "appDictList": [],
  1323. "scriptList": [],
  1324. "fileList": []
  1325. }
  1326. },
  1327. checkSelect: function() {
  1328. this.selectData.categoryInfoList = this.getCheckedList(this.listCategoryInfoContent);
  1329. this.selectData.formList = this.getCheckedList(this.listFormContent);
  1330. this.selectData.appDictList = this.getCheckedList(this.listDictContent);
  1331. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  1332. this.selectData.fileList = this.getCheckedList(this.listFileContent);
  1333. this.element.checkSelect(this.selectData);
  1334. this.hide();
  1335. },
  1336. loadContentList: function(){
  1337. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1338. this.listCategoryInfoContent = this.listProcess("categoryInfoList");
  1339. this.listFormContent = this.listProcess("formList");
  1340. this.listDictContent = this.listProcess("appDictList");
  1341. this.listScriptContent = this.listProcess("scriptList");
  1342. this.listFileContent = this.listProcess("fileList");
  1343. },
  1344. getItemName: function(item){
  1345. return item.name || item.categoryName;
  1346. }
  1347. });
  1348. MWF.xApplication.AppCenter.Exporter.Element.QuerySelector = new Class({
  1349. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  1350. initData: function(){
  1351. return {
  1352. "viewList": [],
  1353. "statList": [],
  1354. "tableList": [],
  1355. "statementList": [],
  1356. "importModelList": []
  1357. }
  1358. },
  1359. checkSelect: function() {
  1360. this.selectData.viewList = this.getCheckedList(this.listViewContent);
  1361. this.selectData.statList = this.getCheckedList(this.listStatContent);
  1362. this.selectData.statementList = this.getCheckedList(this.listStatementContent);
  1363. this.selectData.tableList = this.getCheckedList(this.listTableContent);
  1364. this.selectData.importModelList = this.getCheckedList(this.listImportModelContent);
  1365. this.element.checkSelect(this.selectData);
  1366. this.hide();
  1367. },
  1368. loadContentList: function(){
  1369. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1370. this.listViewContent = this.listProcess("viewList");
  1371. this.listStatContent = this.listProcess("statList");
  1372. // this.listRevealContent = this.listProcess("revealList");
  1373. this.listTableContent = this.listProcess("tableList");
  1374. this.listStatementContent = this.listProcess("statementList");
  1375. this.listImportModelContent = this.listProcess("importModelList");
  1376. }
  1377. });
  1378. MWF.xApplication.AppCenter.Exporter.Element.ServiceSelector = new Class({
  1379. Extends: MWF.xApplication.AppCenter.Exporter.Element.Selector,
  1380. initData: function(){
  1381. return {
  1382. "agentList": [],
  1383. "invokeList": [],
  1384. "scriptList": [],
  1385. "dictList": []
  1386. }
  1387. },
  1388. checkSelect: function() {
  1389. this.selectData.agentList = this.getCheckedList(this.listAgentContent);
  1390. this.selectData.invokeList = this.getCheckedList(this.listInvokeContent);
  1391. this.selectData.scriptList = this.getCheckedList(this.listScriptContent);
  1392. this.selectData.dictList = this.getCheckedList(this.listDictContent);
  1393. this.element.checkSelect(this.selectData);
  1394. this.hide();
  1395. },
  1396. loadContentList: function(){
  1397. this.contentAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentNode);
  1398. this.listAgentContent = this.listProcess("agentList");
  1399. this.listInvokeContent = this.listProcess("invokeList");
  1400. this.listScriptContent = this.listProcess("scriptList");
  1401. this.listDictContent = this.listProcess("dictList");
  1402. },
  1403. getItemName: function(item){
  1404. return item.name
  1405. }
  1406. });
  1407. MWF.xApplication.AppCenter.Module.Setup = new Class({
  1408. initialize: function(module, dlg){
  1409. this.module = module;
  1410. this.app = this.module.app;
  1411. this.data = this.module.data;
  1412. this.lp = this.module.lp;
  1413. this.css = this.app.css;
  1414. this.dlg = dlg;
  1415. this.content = this.dlg.content;
  1416. this.setupData = {};
  1417. this.compareData = null;
  1418. this.load();
  1419. },
  1420. load: function(){
  1421. this.node = new Element("div", {"styles": this.css.moduleSetupContentNode}).inject(this.content);
  1422. this.loadTitle();
  1423. this.loadContent();
  1424. },
  1425. loadTitle: function(){
  1426. this.titleNode = new Element("div", {"styles": this.css.moduleSetupTitleNode2}).inject(this.node);
  1427. this.iconAreaNode = new Element("div", {"styles": this.css.moduleSetupIconAreaNode}).inject(this.titleNode);
  1428. var iconNode = new Element("div", {"styles": this.css.moduleSetupIconNode}).inject(this.iconAreaNode);
  1429. if (this.data.icon){
  1430. iconNode.setStyle("background-image", "url(data:image/png;base64,"+this.data.icon+")");
  1431. iconNode.setStyle("background-size", "cover");
  1432. }
  1433. var contentNode = new Element("div", {"styles": this.css.moduleSetupTitleContentNode2}).inject(this.titleNode);
  1434. var nameNode = new Element("div", {"styles": this.css.moduleSetupNameNode2}).inject(contentNode);
  1435. var categoryNode = new Element("div", {"styles": this.css.moduleSetupCategoryNode2}).inject(contentNode);
  1436. var descriptionNode = new Element("div", {"styles": this.css.moduleSetupDescriptionNode2}).inject(contentNode);
  1437. nameNode.set("text", this.data.name);
  1438. categoryNode.set("text", this.data.category);
  1439. descriptionNode.set("text", this.data.description);
  1440. },
  1441. loadContent: function(){
  1442. this.contentNode = new Element("div", {"styles": this.css.moduleSetupCompareContentNode}).inject(this.node);
  1443. this.createLoading(this.contentNode);
  1444. this.loadCompare();
  1445. },
  1446. createLoading: function(node){
  1447. this.dlg.button.setStyle("display", "none");
  1448. this.loadingAreaNode = new Element("div", {"styles": this.css.moduleLoadingAreaNode}).inject(node);
  1449. var img = new Element("img", {
  1450. "styles": this.css.moduleLoadingImgNode,
  1451. "src": this.app.path+this.app.options.style+"/icon/loading.gif"
  1452. }).inject(this.loadingAreaNode);
  1453. },
  1454. clearLoading: function(){
  1455. if (this.loadingAreaNode){
  1456. this.loadingAreaNode.destroy();
  1457. this.loadingAreaNode = null;
  1458. }
  1459. this.dlg.button.setStyle("display", "block");
  1460. },
  1461. loadCompare: function(){
  1462. this.app.actions.compareModule(this.data.id, function(json){
  1463. this.clearLoading();
  1464. this.setupData.flag = json.data.flag;
  1465. this.createListArea();
  1466. this.compareData = json.data;
  1467. this.loadProcessList();
  1468. this.loadPortalList();
  1469. this.loadCMSList();
  1470. this.loadQueryList();
  1471. this.loadServiceList();
  1472. //json.data.processPlatformList
  1473. }.bind(this));
  1474. },
  1475. createListArea: function(){
  1476. this.contentAreaNode = new Element("div").inject(this.contentNode);
  1477. this.contentInforNode = new Element("div", {"styles": this.css.moduleSetupContentInforNode, "text": this.lp.downloadInfor}).inject(this.contentAreaNode);
  1478. //this.processArea = new Element("div", {"styles": this.css.moduleSetupListAreaNode}).inject(this.contentNode);
  1479. this.processAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode2, "text": this.lp.process}).inject(this.contentAreaNode);
  1480. this.processAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode}).inject(this.contentAreaNode);
  1481. this.portalAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.portal}).inject(this.contentAreaNode);
  1482. this.portalAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode2}).inject(this.contentAreaNode);
  1483. this.cmsAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.cms}).inject(this.contentAreaNode);
  1484. this.cmsAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode2}).inject(this.contentAreaNode);
  1485. this.queryAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.query}).inject(this.contentAreaNode);
  1486. this.queryAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode2}).inject(this.contentAreaNode);
  1487. this.serviceAreaTitle = new Element("div", {"styles": this.css.moduleSetupListAreaTitleNode, "text": this.lp.service}).inject(this.contentAreaNode);
  1488. this.serviceAreaContent = new Element("div", {"styles": this.css.moduleSetupListAreaContentNode2}).inject(this.contentAreaNode);
  1489. },
  1490. loadProcessList: function(){
  1491. this.processListNodes = [];
  1492. this.compareData.processPlatformList.each(function(item){
  1493. this.processListNodes.push(new MWF.xApplication.AppCenter.Module.Setup.ProcessElement(this, this.processAreaContent, item));
  1494. }.bind(this));
  1495. },
  1496. loadPortalList: function(){
  1497. this.portalListNodes = [];
  1498. this.compareData.portalList.each(function(item){
  1499. this.portalListNodes.push(new MWF.xApplication.AppCenter.Module.Setup.PortalElement(this, this.portalAreaContent, item));
  1500. }.bind(this));
  1501. },
  1502. loadCMSList: function(){
  1503. this.cmsListNodes = [];
  1504. this.compareData.cmsList.each(function(item){
  1505. this.cmsListNodes.push(new MWF.xApplication.AppCenter.Module.Setup.CmsElement(this, this.cmsAreaContent, item));
  1506. }.bind(this));
  1507. },
  1508. loadQueryList: function(){
  1509. this.queryListNodes = [];
  1510. this.compareData.queryList.each(function(item){
  1511. this.queryListNodes.push(new MWF.xApplication.AppCenter.Module.Setup.QueryElement(this, this.queryAreaContent, item));
  1512. }.bind(this));
  1513. },
  1514. loadServiceList: function(){
  1515. this.serviceListNodes = [];
  1516. this.compareData.serviceModuleList.each(function(item){
  1517. this.serviceListNodes.push(new MWF.xApplication.AppCenter.Module.Setup.ServiceElement(this, this.serviceAreaContent, item));
  1518. }.bind(this));
  1519. },
  1520. setup: function(){
  1521. this.setupData.flag = this.compareData.flag;
  1522. this.setupData.processPlatformList = [];
  1523. this.setupData.portalList = [];
  1524. this.setupData.queryList = [];
  1525. this.setupData.serviceModuleList = [];
  1526. this.setupData.cmsList = [];
  1527. this.getWriteData(this.processListNodes, this.setupData.processPlatformList);
  1528. this.getWriteData(this.portalListNodes, this.setupData.portalList);
  1529. this.getWriteData(this.cmsListNodes, this.setupData.cmsList);
  1530. this.getWriteData(this.queryListNodes, this.setupData.queryList);
  1531. this.getWriteData(this.serviceListNodes, this.setupData.serviceModuleList);
  1532. this.contentAreaNode.setStyle("display", "none");
  1533. this.createLoading(this.contentNode);
  1534. this.app.actions.importModule(this.compareData.flag, this.setupData, function(){
  1535. this.app.notice(this.module.data.name+" "+this.lp.setupSuccess, "success");
  1536. this.clearLoading();
  1537. }.bind(this));
  1538. },
  1539. getWriteData: function(nodes, json){
  1540. nodes.each(function(item){
  1541. if (item.action){
  1542. var v = item.action.options[item.action.selectedIndex].get("value");
  1543. if (v!="ignore"){
  1544. json.push({"id": item.data.id, "method":v});
  1545. }
  1546. }else{
  1547. json.push({"id": item.data.id});
  1548. }
  1549. }.bind(this));
  1550. }
  1551. });
  1552. MWF.xApplication.AppCenter.Module.SetupLocal = new Class({
  1553. Extends: MWF.xApplication.AppCenter.Module.Setup,
  1554. initialize: function(file, dlg, app){
  1555. this.app = app;
  1556. this.file = file;
  1557. this.lp = this.app.lp;
  1558. this.module = {
  1559. "data": {
  1560. "name": this.lp.localApp,
  1561. "category": "",
  1562. "description": ""
  1563. }
  1564. };
  1565. this.data = this.module.data;
  1566. this.css = this.app.css;
  1567. this.dlg = dlg;
  1568. this.content = this.dlg.content;
  1569. this.setupData = {};
  1570. this.compareData = null;
  1571. this.load();
  1572. },
  1573. loadCompare: function(){
  1574. var formData = new FormData();
  1575. formData.append('file', this.file);
  1576. debugger;
  1577. this.app.actions.compareUpload(formData, this.file, function(json){
  1578. this.clearLoading();
  1579. this.setupData.flag = json.data.flag;
  1580. this.createListArea();
  1581. this.compareData = json.data;
  1582. this.loadProcessList();
  1583. this.loadPortalList();
  1584. this.loadCMSList();
  1585. this.loadQueryList();
  1586. this.loadServiceList();
  1587. //json.data.processPlatformList
  1588. }.bind(this));
  1589. }
  1590. });
  1591. MWF.xApplication.AppCenter.Module.Setup.Element = new Class({
  1592. initialize: function(setup, content, data){
  1593. this.setup = setup;
  1594. this.app = this.setup.app;
  1595. this.data = data;
  1596. this.lp = this.app.lp;
  1597. this.css = this.app.css;
  1598. this.content = content;
  1599. this.load();
  1600. },
  1601. load: function(){
  1602. this.contentNode = new Element("div", {"styles": this.css.moduleSetupListContentNode}).inject(this.content);
  1603. this.iconNode = new Element("div", {"styles": this.css.moduleSetupListIconNode}).inject(this.contentNode);
  1604. this.actionNode = new Element("div", {"styles": this.css.moduleSetupListActionNode}).inject(this.contentNode);
  1605. this.inforNode = new Element("div", {"styles": this.css.moduleSetupListInforNode}).inject(this.contentNode);
  1606. this.nameNode = new Element("div", {"styles": this.css.moduleSetupListNameNode}).inject(this.contentNode);
  1607. this.nameNode.set(this.getNameContent());
  1608. if (this.data.exist){
  1609. this.iconNode.setStyle("background", "url("+this.app.path+this.app.options.style+"/icon/conflict.png) center center no-repeat");
  1610. this.contentNode.setStyle("color", "#e86a58");
  1611. this.inforNode.set("text", this.lp.conflict);
  1612. this.action = new Element("select", {"styles": this.css.moduleSetupListActionSelectNode}).inject(this.actionNode);
  1613. var options = "<option value='cover' selected>"+this.lp.cover+"</option>";
  1614. options += "<option value='create'>"+this.lp.create+"</option>";
  1615. options += "<option value='ignore'>"+this.lp.ignore+"</option>";
  1616. this.action.set("html", options);
  1617. // this.action.addEvent("change", function(e){
  1618. //
  1619. // }.bind(this));
  1620. }else{
  1621. this.action = new Element("select", {"styles": this.css.moduleSetupListActionSelectNode}).inject(this.actionNode);
  1622. var options = "<option value='ignore'>"+this.lp.ignore+"</option>";
  1623. options += "<option value='create' selected>"+this.lp.create+"</option>";
  1624. this.action.set("html", options);
  1625. //this.inforNode.set("text", this.lp.setup);
  1626. }
  1627. },
  1628. getNameContent: function(){
  1629. return {
  1630. "title": this.lp.name+": "+this.data.name+" "+this.lp.id+": "+this.data.id,
  1631. "text": this.data.name
  1632. }
  1633. }
  1634. });
  1635. MWF.xApplication.AppCenter.Module.Setup.ProcessElement = new Class({
  1636. Extends: MWF.xApplication.AppCenter.Module.Setup.Element
  1637. });
  1638. MWF.xApplication.AppCenter.Module.Setup.PortalElement = new Class({
  1639. Extends: MWF.xApplication.AppCenter.Module.Setup.Element
  1640. });
  1641. MWF.xApplication.AppCenter.Module.Setup.CmsElement = new Class({
  1642. Extends: MWF.xApplication.AppCenter.Module.Setup.Element
  1643. });
  1644. MWF.xApplication.AppCenter.Module.Setup.QueryElement = new Class({
  1645. Extends: MWF.xApplication.AppCenter.Module.Setup.Element
  1646. });
  1647. MWF.xApplication.AppCenter.Module.Setup.ServiceElement = new Class({
  1648. Extends: MWF.xApplication.AppCenter.Module.Setup.Element
  1649. });