Form.js 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.require("MWF.widget.Common", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Form = MWF.FCForm = new Class({
  4. Extends: MWF.widget.Common,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Form/form.html",
  9. "mode": "PC",
  10. "fields": ["Calendar", "Checkbox", "Datagrid", "Datagrid$Title", "Datagrid$Data", "Htmleditor", "Number", "Office", "Orgfield", "org", "Personfield", "Radio", "Select", "Textarea", "Textfield"],
  11. "injectActions" : [
  12. {
  13. "name" : "top",
  14. "styles" : "injectActionTop",
  15. "event" : "click",
  16. "action" : "injectTop",
  17. "title": MWF.APPFD.LP.formAction["insertTop"]
  18. },
  19. {
  20. "name" : "bottom",
  21. "styles" : "injectActionBottom",
  22. "event" : "click",
  23. "action" : "injectBottom",
  24. "title": MWF.APPFD.LP.formAction["insertBottom"]
  25. }
  26. ]
  27. },
  28. initialize: function(designer, container, options){
  29. this.setOptions(options);
  30. this.path = "../x_component_process_FormDesigner/Module/Form/";
  31. this.cssPath = "../x_component_process_FormDesigner/Module/Form/"+this.options.style+"/css.wcss";
  32. this._loadCss();
  33. this.container = null;
  34. this.form = this;
  35. this.moduleType = "form";
  36. this.moduleList = [];
  37. this.moduleNodeList = [];
  38. this.moduleContainerNodeList = [];
  39. this.moduleElementNodeList = [];
  40. this.moduleComponentNodeList = [];
  41. // this.moduleContainerList = [];
  42. this.dataTemplate = {};
  43. this.designer = designer;
  44. this.container = container;
  45. this.selectedModules = [];
  46. },
  47. reload: function(data){
  48. this.moduleList.each(function(module){
  49. if (module.property){
  50. module.property.destroy();
  51. }
  52. }.bind(this));
  53. if (this.property) this.property.destroy();
  54. this.property = null;
  55. this.moduleList = [];
  56. this.moduleNodeList = [];
  57. this.moduleContainerNodeList = [];
  58. this.moduleElementNodeList = [];
  59. this.moduleComponentNodeList = [];
  60. this.dataTemplate = {};
  61. this.selectedModules = [];
  62. this.container.empty();
  63. if (this.treeNode){
  64. this.domTree.empty();
  65. this.domTree.node.destroy();
  66. this.domTree = null;
  67. this.treeNode = null;
  68. }
  69. this.currentSelectedModule = null;
  70. this.propertyMultiTd = null;
  71. if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
  72. this.load(data);
  73. this.selected();
  74. },
  75. load : function(data){
  76. this.data = data;
  77. this.json = data.json;
  78. this.html = data.html;
  79. this.json.mode = this.options.mode;
  80. if (!this.json.css) this.json.css = {"code":""};
  81. if (this.options.mode==="Mobile"){
  82. if (!this.json.defaultTools){
  83. this.json.defaultTools = o2.JSON.get(this.path+"toolbars.json", null,false);
  84. }
  85. if (!this.json.tools) this.json.tools=[];
  86. }
  87. this.isNewForm = (this.json.id) ? false : true;
  88. if (this.isNewForm) this.checkUUID();
  89. if(this.designer.application) this.data.json.applicationName = this.designer.application.name;
  90. if(this.designer.application) this.data.json.application = this.designer.application.id;
  91. this.container.set("html", this.html);
  92. this.loadStylesList(function(){
  93. var oldStyleValue = "";
  94. if ((!this.json.formStyleType) || !this.stylesList[this.json.formStyleType]) this.json.formStyleType="blue-simple";
  95. if (this.options.mode=="Mobile"){
  96. if (this.json.formStyleType != "defaultMobile"){
  97. //oldStyleValue = this.json.formStyleType;
  98. //this.json.formStyleType = "defaultMobile";
  99. var styles = this.stylesList[this.json.formStyleType];
  100. if( !styles || typeOf(styles.mode)!=="array" || !styles.mode.contains( "mobile" ) ){
  101. oldStyleValue = this.json.formStyleType;
  102. this.json.formStyleType = "defaultMobile";
  103. }
  104. }
  105. }
  106. this.loadTemplateStyles( this.stylesList[this.json.formStyleType].file, this.stylesList[this.json.formStyleType].extendFile, function( templateStyles ){
  107. //this.templateStyles = (this.stylesList && this.json.formStyleType) ? this.stylesList[this.json.formStyleType] : null;
  108. this.templateStyles = templateStyles;
  109. this.loadDomModules();
  110. if (this.json.formStyleType && this.templateStyles && this.templateStyles["form"]){
  111. this.setTemplateStyles(this.templateStyles["form"]);
  112. }
  113. this.setCustomStyles();
  114. this.node.setProperties(this.json.properties);
  115. this.setNodeEvents();
  116. if (this.options.mode=="Mobile"){
  117. if (oldStyleValue) this._setEditStyle("formStyleType", null, oldStyleValue);
  118. }
  119. this.selected();
  120. this.autoSave();
  121. this.designer.addEvent("queryClose", function(){
  122. if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
  123. }.bind(this));
  124. }.bind(this));
  125. }.bind(this));
  126. },
  127. removeStyles: function(from, to){
  128. if (this.json[to]){
  129. Object.each(from, function(style, key){
  130. if (this.json[to][key] && this.json[to][key]==style){
  131. delete this.json[to][key];
  132. }
  133. }.bind(this));
  134. }
  135. },
  136. copyStyles: function(from, to){
  137. if (!this.json[to]) this.json[to] = {};
  138. Object.each(from, function(style, key){
  139. if (!this.json[to][key]) this.json[to][key] = style;
  140. }.bind(this));
  141. },
  142. clearTemplateStyles: function(styles){
  143. debugger;
  144. if (styles){
  145. if (styles.styles) this.removeStyles(styles.styles, "styles");
  146. if (styles.properties) this.removeStyles(styles.properties, "properties");
  147. }
  148. if( this.json.confirmStyle )delete this.json.confirmStyle;
  149. if( this.json.dialogStyle )delete this.json.dialogStyle;
  150. if( this.json.attachmentStyle )delete this.json.attachmentStyle;
  151. if( this.json.hideModuleIcon )delete this.json.hideModuleIcon;
  152. if( this.json.nodeStyleWithhideModuleIcon )delete this.json.nodeStyleWithhideModuleIcon;
  153. if( this.json.confirmIcon )delete this.json.confirmIcon;
  154. if( this.json.submitedDlgUseNotice )delete this.json.submitedDlgUseNotice;
  155. if( this.json.submitedDlgStyle )delete this.json.submitedDlgStyle;
  156. if( this.json.selectorStyle )delete this.json.selectorStyle;
  157. if( this.json.errorStyle )delete this.json.errorStyle;
  158. if( this.json.noticeStyle )delete this.json.noticeStyle;
  159. if( this.json.noticeErrorStyle )delete this.json.noticeErrorStyle;
  160. if( this.json.noticeSuccessStyle )delete this.json.noticeSuccessStyle;
  161. if( this.json.noticeOkStyle )delete this.json.noticeOkStyle;
  162. if( this.json.noticeNoticeStyle )delete this.json.noticeNoticeStyle;
  163. },
  164. setTemplateStyles: function(styles){
  165. debugger;
  166. if (styles.styles) this.copyStyles(styles.styles, "styles");
  167. if (styles.properties) this.copyStyles(styles.properties, "properties");
  168. //if( styles.confirmStyle )this.json.confirmStyle = styles.confirmStyle;
  169. //if( styles.dialogStyle )this.json.dialogStyle = styles.dialogStyle;
  170. //if( styles.selectorStyle )this.json.selectorStyle = styles.selectorStyle;
  171. },
  172. loadTemplateStyles : function( file, extendFile, callback ){
  173. if( !file ){
  174. if (callback) callback({});
  175. return;
  176. }
  177. this.templateStylesList = this.templateStylesList || {};
  178. if( this.templateStylesList[file] ){
  179. if (callback) callback(this.templateStylesList[file]);
  180. return;
  181. }
  182. this.loadTemplateStyleFile( file, function( json_file ){
  183. this.loadTemplateExtendStyleFile( extendFile, function( json_extend ){
  184. this.templateStylesList[file] = Object.merge( json_file, json_extend );
  185. if (callback) callback(this.templateStylesList[file]);
  186. }.bind(this))
  187. }.bind(this))
  188. },
  189. loadTemplateStyleFile : function(file, callback ){
  190. if( !file ){
  191. if (callback) callback({});
  192. return;
  193. }
  194. var stylesUrl = "../x_component_process_FormDesigner/Module/Form/skin/"+file;
  195. MWF.getJSON(stylesUrl,{
  196. "onSuccess": function(responseJSON){
  197. //this.templateStylesList[file] = responseJSON;
  198. if (callback) callback(responseJSON);
  199. }.bind(this),
  200. "onRequestFailure": function(){
  201. if (callback) callback({});
  202. }.bind(this),
  203. "onError": function(){
  204. if (callback) callback({});
  205. }.bind(this)
  206. }
  207. );
  208. },
  209. loadTemplateExtendStyleFile : function(extendFile, callback ){
  210. if( !extendFile ){
  211. if (callback) callback({});
  212. return;
  213. }
  214. var stylesUrl = "../x_component_process_FormDesigner/Module/Form/skin/"+extendFile;
  215. MWF.getJSON(stylesUrl,{
  216. "onSuccess": function(responseJSON){
  217. //this.templateStylesList[file] = responseJSON;
  218. if (callback) callback(responseJSON);
  219. }.bind(this),
  220. "onRequestFailure": function(){
  221. if (callback) callback({});
  222. }.bind(this),
  223. "onError": function(){
  224. if (callback) callback({});
  225. }.bind(this)
  226. }
  227. );
  228. },
  229. loadStylesList: function(callback){
  230. //var stylesUrl = "../x_component_process_FormDesigner/Module/Form/template/"+((this.options.mode=="Mobile") ? "mobileStyles": "styles")+".json";
  231. //var stylesUrl = "../x_component_process_FormDesigner/Module/Form/template/"+((this.options.mode=="Mobile") ? "styles": "styles")+".json";
  232. var configUrl = "../x_component_process_FormDesigner/Module/Form/skin/config.json";
  233. MWF.getJSON(configUrl,{
  234. "onSuccess": function(responseJSON){
  235. this.stylesList = responseJSON;
  236. if (callback) callback(this.stylesList);
  237. }.bind(this),
  238. "onRequestFailure": function(){
  239. this.stylesList = {};
  240. if (callback) callback(this.stylesList);
  241. }.bind(this),
  242. "onError": function(){
  243. this.stylesList = {};
  244. if (callback) callback(this.stylesList);
  245. }.bind(this)
  246. }
  247. );
  248. },
  249. autoSave: function(){
  250. this.autoSaveCheckNode = this.designer.formToolbarNode.getElement("#MWFFormAutoSaveCheck");
  251. if (this.autoSaveCheckNode){
  252. this.autoSaveTimerID = window.setInterval(function(){
  253. if (this.autoSaveCheckNode.get("checked")){
  254. this.save();
  255. }
  256. }.bind(this), 60000);
  257. }
  258. },
  259. checkUUID: function(){
  260. this.designer.actions.getUUID(function(id){
  261. this.json.id = id;
  262. }.bind(this));
  263. },
  264. loadDomModules: function(){
  265. this.node = this.container.getFirst();
  266. this.node.set("id", this.json.id);
  267. this.node.setStyles((this.options.mode==="Mobile") ? this.css.formMobileNode : this.css.formNode);
  268. this.node.store("module", this);
  269. var id = this.json.id.replace(/\-/g, "");
  270. this.node.addClass("css"+id);
  271. this.reloadCss();
  272. var y = this.container.getStyle("height");
  273. y = (y) ? y.toInt()-2 : this.container.getSize().y-2;
  274. this.node.setStyle("min-height", ""+y+"px");
  275. this.designer.addEvent("resize", function(){
  276. var y = this.container.getStyle("height");
  277. y = (y) ? y.toInt()-2 : this.container.getSize().y-2;
  278. this.node.setStyle("min-height", ""+y+"px");
  279. }.bind(this));
  280. this.loadDomTree();
  281. },
  282. loadDomTree: function(){
  283. MWF.require("MWF.widget.Tree", function(){
  284. this.domTree = new MWF.widget.Tree(this.designer.propertyDomArea, {"style": "domtree"});
  285. this.domTree.load();
  286. this.createFormTreeNode();
  287. this.parseModules(this, this.node);
  288. }.bind(this));
  289. },
  290. createFormTreeNode: function(){
  291. var text = "<"+this.json.type+"> "+this.json.name+" ["+this.options.mode+"] ";
  292. var o = {
  293. "expand": true,
  294. "title": this.json.id,
  295. "text": "<"+this.json.type+"> "+this.json.name+" ["+this.options.mode+"] ",
  296. "icon": (this.options.mode=="Mobile") ? "mobile.png": "pc.png"
  297. };
  298. o.action = function(){
  299. if (this.module) this.module.selected();
  300. };
  301. this.treeNode = this.domTree.appendChild(o);
  302. this.treeNode.setText(text);
  303. this.treeNode.module = this;
  304. },
  305. parseModules: function(parent, dom){
  306. var subDom = dom.getFirst();
  307. while (subDom){
  308. if (subDom.get("MWFtype")){
  309. // var module = subDom.retrieve("module");
  310. // alert(subDom.get("id")+": "+module);
  311. // if (!module){
  312. var json = this.getDomjson(subDom);
  313. module = this.loadModule(json, subDom, parent);
  314. // }
  315. // if (module.moduleType=="container") this.parseModules(module, subDom);
  316. // }else{
  317. // this.parseModules(parent, subDom);
  318. }
  319. // else if (subDom.getFirst()){
  320. // subDom = subDom.getFirst();
  321. // this.parseModules(parent, subDom);
  322. // }else{
  323. // subDom = subDom.getNext();
  324. // }
  325. subDom = subDom.getNext();
  326. }
  327. },
  328. getDomjson: function(dom){
  329. var mwfType = dom.get("MWFtype");
  330. switch (mwfType) {
  331. case "form":
  332. return this.json;
  333. case "":
  334. return null;
  335. default:
  336. var id = dom.get("id");
  337. if (id){
  338. return this.json.moduleList[id];
  339. }else{
  340. return null;
  341. }
  342. }
  343. },
  344. loadModule: function(json, dom, parent){
  345. if( !json ){
  346. debugger;
  347. var module;
  348. var className = ( dom.get("MWFType") || "div" ).capitalize();
  349. this.getTemplateData(className, function(data){
  350. var moduleData = Object.clone(data);
  351. moduleData.id = dom.get("id");
  352. this.json.moduleList[dom.get("id")] = moduleData;
  353. module = new MWF["FC"+className](this);
  354. module.load(moduleData, dom, parent);
  355. }.bind(this), false);
  356. return module;
  357. }else if( MWF["FC"+json.type] ){
  358. var module = new MWF["FC"+json.type](this);
  359. module.load(json, dom, parent);
  360. //this.moduleList.push(module);
  361. return module;
  362. }else{
  363. var module = new MWF["FCDiv"](this);
  364. module.load(json, dom, parent);
  365. //this.moduleList.push(module);
  366. return module;
  367. }
  368. },
  369. setNodeEvents: function(){
  370. this.node.addEvent("click", function(e){
  371. this.selected();
  372. }.bind(this));
  373. // this._controlKeyEventFun = function(e){
  374. // if (e.control){
  375. // this.controlMode = true;
  376. // if (this.copyNode) this.copyNode.destroy();
  377. // }else{
  378. // this.controlMode = false;
  379. // // var copyNode = this._getCopyNode(this);
  380. // // copyNode.inject(this.node, "before");
  381. // }
  382. // }.bind(this);
  383. this.designer.content.addEvent("keydown", function(e){
  384. if (this.moveModule){
  385. if (e.control){
  386. this.moveModule._setControlMode(true);
  387. }else{
  388. this.moveModule._setControlMode(false);
  389. }
  390. }
  391. }.bind(this));
  392. this.designer.content.addEvent("keyup", function(e){
  393. if (this.moveModule){
  394. if (e.control){
  395. this.moveModule._setControlMode(true);
  396. }else{
  397. this.moveModule._setControlMode(false);
  398. }
  399. }
  400. }.bind(this));
  401. },
  402. createModuleImmediately: function( className, parentModule, relativeNode, position, selectDisabled, async ){
  403. var module;
  404. this.getTemplateData(className, function(data){
  405. var moduleData = Object.clone(data);
  406. module = new MWF["PC"+className](this);
  407. if( parentModule ){
  408. module.onDragModule = parentModule;
  409. if (!parentModule.Component) module.inContainer = parentModule;
  410. module.parentContainer = parentModule;
  411. module.nextModule = null;
  412. }
  413. module.createImmediately(moduleData, relativeNode, position, selectDisabled);
  414. }.bind(this), async);
  415. return module;
  416. },
  417. createModule: function(className, e){
  418. this.getTemplateData(className, function(data){
  419. var moduleData = Object.clone(data);
  420. var newTool = new MWF["FC"+className](this);
  421. newTool.create(moduleData, e);
  422. }.bind(this));
  423. },
  424. getTemplateData: function(className, callback , async){
  425. if (this.dataTemplate[className]){
  426. if (callback) callback(this.dataTemplate[className]);
  427. }else{
  428. var templateUrl = "../x_component_process_FormDesigner/Module/"+className+"/template.json";
  429. MWF.getJSON(templateUrl, function(responseJSON, responseText){
  430. this.dataTemplate[className] = responseJSON;
  431. if (callback) callback(responseJSON);
  432. }.bind(this), async);
  433. }
  434. },
  435. selected: function(){
  436. if (this.currentSelectedModule){
  437. if (this.currentSelectedModule==this){
  438. return true;
  439. }else{
  440. this.currentSelectedModule.unSelected();
  441. }
  442. }
  443. if (this.propertyMultiTd){
  444. this.propertyMultiTd.hide();
  445. this.propertyMultiTd = null;
  446. }
  447. this.unSelectedMulti();
  448. this.currentSelectedModule = this;
  449. if (this.treeNode){
  450. this.treeNode.selectNode();
  451. }
  452. this.showProperty();
  453. // this.isFocus = true;
  454. },
  455. unSelectedMulti: function(){
  456. while (this.selectedModules.length){
  457. this.selectedModules[0].unSelectedMulti();
  458. }
  459. if (this.multimoduleActionsArea) this.multimoduleActionsArea.setStyle("display", "none");
  460. },
  461. unSelectAll: function(){
  462. },
  463. _beginSelectMulti: function(){
  464. if (this.currentSelectedModule) this.currentSelectedModule.unSelected();
  465. this.unSelectedMulti();
  466. this.noSelected = true;
  467. },
  468. _completeSelectMulti: function(){
  469. if (this.selectedModules.length<2){
  470. this.selectedModules[0].selected();
  471. }else{
  472. this._showMultiActions();
  473. }
  474. },
  475. createMultimoduleActionsArea: function(){
  476. this.multimoduleActionsArea = new Element("div", {
  477. styles: {
  478. "display": "none",
  479. // "width": 18*this.options.actions.length,
  480. "position": "absolute",
  481. "background-color": "#F1F1F1",
  482. "padding": "1px",
  483. "padding-right": "0px",
  484. "border": "1px solid #AAA",
  485. "box-shadow": "0px 2px 5px #999",
  486. "z-index": 10001
  487. }
  488. }).inject(this.form.container, "after");
  489. },
  490. _showMultiActions: function(){
  491. if (!this.multimoduleActionsArea) this.createMultimoduleActionsArea();
  492. var firstModule = this._getFirstMultiSelectedModule();
  493. if (firstModule){
  494. // var module = firstModule.module;
  495. var y = firstModule.position.y-25;
  496. var x = firstModule.position.x;
  497. this.multimoduleActionsArea.setPosition({"x": x, "y": y});
  498. this.multimoduleActionsArea.setStyle("display", "block");
  499. }
  500. },
  501. _getFirstMultiSelectedModule: function(){
  502. var firstModule = null;
  503. this.selectedModules.each(function(module){
  504. var position = module.node.getPosition(module.form.node.getOffsetParent());
  505. if (!firstModule){
  506. firstModule = {"module": module, "position": position};
  507. }else{
  508. if (position.y<firstModule.position.y){
  509. firstModule = {"module": module, "position": position};
  510. }else if (position.y==firstModule.position.y){
  511. if (position.x<firstModule.position.x){
  512. firstModule = {"module": module, "position": position};
  513. }
  514. }
  515. }
  516. });
  517. return firstModule;
  518. },
  519. showProperty: function(){
  520. if (!this.property){
  521. this.property = new MWF.xApplication.process.FormDesigner.Property(this, this.designer.propertyContentArea, this.designer, {
  522. "path": this.options.propertyPath,
  523. "onPostLoad": function(){
  524. this.property.show();
  525. }.bind(this)
  526. });
  527. this.property.load();
  528. }else{
  529. this.property.show();
  530. }
  531. },
  532. hideProperty: function(){
  533. if (this.property) this.property.hide();
  534. },
  535. unSelected: function(){
  536. this.currentSelectedModule = null;
  537. this.hideProperty();
  538. },
  539. _dragIn: function(module){
  540. if (!this.Component) module.inContainer = this;
  541. module.parentContainer = this;
  542. this.node.setStyles({"border": "1px solid #ffa200"});
  543. var copyNode = module._getCopyNode();
  544. copyNode.inject(this.node);
  545. },
  546. _dragOut: function(module){
  547. module.inContainer = null;
  548. module.parentContainer = null;
  549. this.node.setStyles((this.options.mode==="Mobile") ? this.css.formMobileNode : this.css.formNode);
  550. this.node.setStyles(this.json.styles);
  551. var copyNode = module._getCopyNode();
  552. copyNode.setStyle("display", "none");
  553. },
  554. _dragDrop: function(module, flag){
  555. var f = flag || !(new Event(event)).control;
  556. if( f ){
  557. this.node.setStyles((this.options.mode==="Mobile") ? this.css.formMobileNode : this.css.formNode);
  558. this.node.setStyles(this.json.styles);
  559. }
  560. //this._hideInjectAction();
  561. },
  562. _showInjectAction : function( module ){
  563. if ( module.moveNode ){
  564. module.moveNode.setStyle("display","none");
  565. }
  566. //debugger;
  567. this.draggingModule = module;
  568. //if( !this.node.getFirst() ){
  569. // this.inject( "top" );
  570. // return;
  571. //}
  572. if( !this.injectActionArea )this._createInjectAction();
  573. this.injectActionArea.setStyle("display","block");
  574. this._setInjectActionAreaPosition();
  575. this.injectActionEffect = new Fx.Morph(this.injectActionArea, {
  576. duration: 200,
  577. transition: Fx.Transitions.Sine.easeOut
  578. });
  579. this.injectActionEffect.start(this.form.css.injectActionArea_to);
  580. },
  581. _hideInjectAction : function(){
  582. this.draggingModule = null;
  583. if( this.injectActionArea ){
  584. this.injectActionArea.setStyle("display","none");
  585. }
  586. },
  587. _createInjectAction : function(){
  588. var css = this.form.css;
  589. if( !this.injectActionArea ){
  590. this.injectActionArea = new Element("div", { styles: css.injectActionArea }).inject(this.form.container, "after");
  591. this.injectActionTopBGNode = new Element("div", { styles : css.injectActionTopBGNode }).inject( this.injectActionArea );
  592. this.injectActionLeftBGNode = new Element("div", { styles : css.injectActionLeftBGNode }).inject( this.injectActionArea );
  593. this.injectActionRightBGNode = new Element("div", { styles : css.injectActionRightBGNode }).inject( this.injectActionArea );
  594. this.injectActionBottomBGNode = new Element("div", { styles : css.injectActionBottomBGNode }).inject( this.injectActionArea );
  595. var injectActions = {};
  596. this.options.injectActions.each( function( action ){
  597. injectActions[ action.name ] = action;
  598. });
  599. if( injectActions.before )this._createInjectActionNode( injectActions.before, this.injectActionTopBGNode );
  600. if( injectActions.top )this._createInjectActionNode( injectActions.top, this.injectActionLeftBGNode );
  601. if( injectActions.bottom )this._createInjectActionNode( injectActions.bottom, this.injectActionRightBGNode );
  602. if( injectActions.after )this._createInjectActionNode( injectActions.after, this.injectActionBottomBGNode );
  603. new Element("div", {
  604. styles : css.injectActionCancelNode,
  605. events : {
  606. click : function(){
  607. this.draggingModule._dragCancel();
  608. this._dragDrop( this.node, true );
  609. this._hideInjectAction();
  610. }.bind(this),
  611. mouseover : function(){
  612. this.setStyles( css.injectActionCancelNode_over )
  613. },
  614. mouseout : function(){
  615. this.setStyles( css.injectActionCancelNode )
  616. }
  617. }
  618. }).inject(this.injectActionArea);
  619. }
  620. },
  621. _createInjectActionNode : function( action, relativeNode ){
  622. var actionNode = new Element("div", {
  623. "styles": this.css[action.styles],
  624. "title": action.title
  625. }).inject( this.injectActionArea );
  626. actionNode.addEvent(action.event, function(e){
  627. this[action.action](e);
  628. }.bind(this));
  629. actionNode.addEvents({
  630. "mouseover": function(e){
  631. relativeNode.setStyle("background", "#ddd");
  632. this.draggingModule.copyNode.setStyle("display","");
  633. this.draggingModule.copyNode.inject( this.node, action.name );
  634. }.bind(this),
  635. "mouseout": function(e){
  636. relativeNode.setStyle("background", "transparent");
  637. }.bind(this)
  638. });
  639. relativeNode.set("title",action.title);
  640. relativeNode.addEvent(action.event, function(e){
  641. this[action.action](e);
  642. }.bind(this));
  643. relativeNode.setStyle("cursor","pointer");
  644. relativeNode.addEvents({
  645. "mouseenter": function(e){
  646. relativeNode.setStyle("background", "#ddd");
  647. this.draggingModule.copyNode.setStyle("display","");
  648. this.draggingModule.copyNode.inject( this.node, action.name );
  649. }.bind(this),
  650. "mouseleave": function(e){
  651. relativeNode.setStyle("background", "transparent");
  652. //this.draggingModule.copyNode.setStyle("display","none");
  653. }.bind(this)
  654. });
  655. },
  656. _setInjectActionAreaPosition: function(){
  657. var e = new Event(event);
  658. var formOffset = this.node.getOffsetParent().getPosition();
  659. //var p = this.node.getPosition(this.form.node.getOffsetParent());
  660. var y = e.page.y - formOffset.y - 60;
  661. var x = e.page.x - formOffset.x - 60;
  662. this.injectActionArea.setPosition({"x": x, "y": y});
  663. },
  664. injectBefore : function( e ){
  665. this.inject( "before" )
  666. },
  667. injectAfter : function( e ){
  668. this.inject( "after" )
  669. },
  670. injectTop : function( e ){
  671. this.inject( "top" )
  672. },
  673. injectBottom : function( e ){
  674. this.inject( "bottom" )
  675. },
  676. inject : function( position ){
  677. if ( this.draggingModule.moveNode ){
  678. this.draggingModule.moveNode.setStyle("display","");
  679. }
  680. this.draggingModule._dragComplete( this.node, position );
  681. this._dragDrop( this.node, true );
  682. this._hideInjectAction();
  683. },
  684. _clearNoId: function(node){
  685. var subNode = node.getFirst();
  686. while (subNode){
  687. var nextNode = subNode.getNext();
  688. if (subNode.get("MWFType")){
  689. if (!subNode.get("id")){
  690. subNode.destroy();
  691. }else{
  692. if (subNode) this._clearNoId(subNode);
  693. }
  694. }else{
  695. if (subNode) this._clearNoId(subNode);
  696. }
  697. subNode = nextNode;
  698. }
  699. },
  700. _getFormData: function(callback){
  701. this.fireEvent("queryGetFormData");
  702. var copy = this.node.clone(true, true);
  703. copy.clearStyles(true);
  704. this.fireEvent("postGetFormData");
  705. this._clearNoId(copy);
  706. var html = copy.outerHTML;
  707. //this._clearNoDomModule();
  708. copy.destroy();
  709. this.data.json.mode = this.options.mode;
  710. this.data.html = html;
  711. //@todo 预先整理表单样式
  712. // var tmpFormNode = new Element("div", {
  713. // "opacity": 0
  714. // }).inject(this.designer.content);
  715. // MWF.xDesktop.requireApp("process.Xform2", "Form_", null, false);
  716. // this.appForm = new MWF.APPForm_(tmpFormNode, this.data, {
  717. // "onAfterLoad": function(){
  718. // var preprocessHtml = tmpFormNode.get("html");
  719. // this.data.preprocessHtml = preprocessHtml;
  720. //
  721. // if (callback) callback();
  722. // }.bind(this)
  723. // });
  724. // this.appForm.businessData = {};
  725. // this.appForm.load();
  726. return this.data;
  727. },
  728. _clearNoDomModule : function(){
  729. debugger;
  730. var existModuleList = {};
  731. Object.each( this.moduleList, function( module ){
  732. existModuleList[ module.json.id ] = true;
  733. });
  734. Object.each( this.data.json.moduleList , function( module, key ){
  735. //if( !this.node.getElement( "#" + module.id ) && !existModuleList[ module.id ] ){
  736. if( !existModuleList[ module.id ] ){
  737. delete this.data.json.moduleList[key];
  738. }
  739. }.bind(this));
  740. },
  741. preview: function(){
  742. MWF.xDesktop.requireApp("process.FormDesigner", "Preview", function(){
  743. if (this.options.mode=="Mobile"){
  744. this.previewBox = new MWF.xApplication.process.FormDesigner.Preview(this, {"size": {"x": "400", "y": 580}, "mode": "mobile"});
  745. }else{
  746. this.previewBox = new MWF.xApplication.process.FormDesigner.Preview(this);
  747. }
  748. this.previewBox.load();
  749. }.bind(this));
  750. },
  751. save: function(callback){
  752. // debugger;
  753. // this.moduleList.each(function(module){
  754. // if (module.moduleName==="subform"){
  755. // module.refreshSubform();
  756. // }
  757. // }.bind(this));
  758. this.designer.saveForm();
  759. //this._getFormData();
  760. //this.designer.actions.saveForm(this.data, function(responseJSON){
  761. // this.form.designer.notice(MWF.APPFD.LP.notice["save_success"], "ok", null, {x: "left", y:"bottom"});
  762. //
  763. // //this.json.id = responseJSON.data;
  764. // if (!this.json.name) this.treeNode.setText("<"+this.json.type+"> "+this.json.id);
  765. // this.treeNode.setTitle(this.json.id);
  766. // this.node.set("id", this.json.id);
  767. //
  768. // if (callback) callback();
  769. // //this.reload(responseJSON.data);
  770. //}.bind(this));
  771. },
  772. explode: function(){
  773. this._getFormData();
  774. MWF.require("MWF.widget.Base64", null, false);
  775. var data = MWF.widget.Base64.encode(JSON.encode(this.data));
  776. MWF.require("MWF.widget.Panel", function(){
  777. var node = new Element("div");
  778. var size = this.designer.formNode.getSize();
  779. var position = this.designer.formNode.getPosition(this.designer.formNode.getOffsetParent());
  780. var textarea = new Element("textarea", {
  781. "styles": {
  782. "border": "1px solid #999",
  783. "width": "770px",
  784. "margin-left": "14px",
  785. "margin-top": "14px",
  786. "height": "580px"
  787. },
  788. "text": JSON.encode(this.data)
  789. }).inject(node);
  790. this.explodePanel = new MWF.widget.Panel(node, {
  791. "style": "form",
  792. "isResize": false,
  793. "isMax": false,
  794. "title": "",
  795. "width": 800,
  796. "height": 660,
  797. "top": position.y,
  798. "left": position.x+3,
  799. "isExpand": false,
  800. "target": this.designer.node
  801. });
  802. this.explodePanel.load();
  803. }.bind(this));
  804. },
  805. implode: function(){
  806. MWF.xDesktop.requireApp("portal.PageDesigner", "Import", function(){
  807. MWF.FormImport.create("O2", this);
  808. }.bind(this));
  809. },
  810. // implodeJsonData: function(str){
  811. // if (str){
  812. // //try{
  813. // debugger;
  814. // var data = JSON.decode(str);
  815. // if (data){
  816. // var json = data.json;
  817. // data.id = this.data.id;
  818. // data.isNewPage = this.data.isNewPage;
  819. // json.id = this.json.id;
  820. // json.name = this.json.name;
  821. // json.application = this.json.application;
  822. // json.applicationName = this.json.applicationName;
  823. //
  824. // this.reload(data);
  825. // this.implodePanel.closePanel();
  826. // }else{
  827. // this.designer.notice(this.designer.lp.implodeError, "error");
  828. // }
  829. // // }catch(e){
  830. // // this.designer.notice(this.designer.lp.implodeError, "error");
  831. // // }
  832. // }else{
  833. // this.designer.notice(this.designer.lp.implodeEmpty, "error");
  834. // }
  835. // },
  836. implodeHTML: function(){
  837. MWF.xDesktop.requireApp("portal.PageDesigner", "Import", function(){
  838. MWF.FormImport.create("html", this, {"type": "process"});
  839. }.bind(this));
  840. },
  841. implodeOffice: function(){
  842. MWF.xDesktop.requireApp("portal.PageDesigner", "Import", function(){
  843. MWF.FormImport.create("office", this);
  844. }.bind(this));
  845. },
  846. deletePropertiesOrStyles: function(name, key){
  847. if (name=="styles"){
  848. try{
  849. if( key && this.json.styles[key] ){
  850. delete this.json.styles[key];
  851. }
  852. this.setCustomStyles();
  853. }catch(e){}
  854. }
  855. if (name=="properties"){
  856. try{
  857. this.node.removeProperty(key);
  858. }catch(e){}
  859. }
  860. },
  861. setPropertiesOrStyles: function(name){
  862. if (name=="styles"){
  863. this.setCustomStyles();
  864. }
  865. if (name=="properties"){
  866. this.node.setProperties(this.json.properties);
  867. }
  868. },
  869. setCustomStyles: function(){
  870. debugger;
  871. var border = this.node.getStyle("border");
  872. this.node.clearStyles();
  873. this.node.setStyles((this.options.mode==="Mobile") ? this.css.formMobileNode : this.css.formNode);
  874. var y = this.container.getStyle("height");
  875. y = (y) ? y.toInt()-2 : this.container.getSize().y-2;
  876. this.node.setStyle("min-height", ""+y+"px");
  877. if (this.initialStyles) this.node.setStyles(this.initialStyles);
  878. this.node.setStyle("border", border);
  879. Object.each(this.json.styles, function(value, key){
  880. var reg = /^border\w*/ig;
  881. if (!key.test(reg)){
  882. this.node.setStyle(key, value);
  883. }
  884. }.bind(this));
  885. },
  886. _setEditStyle: function(name, obj, oldValue){
  887. debugger;
  888. if (name=="name"){
  889. var title = this.json.name || this.json.id;
  890. this.treeNode.setText("<"+this.json.type+"> "+title+" ["+this.options.mode+"] ");
  891. }
  892. if (name=="id"){
  893. if (!this.json.name) this.treeNode.setText("<"+this.json.type+"> "+this.json.id+" ["+this.options.mode+"] ");
  894. this.treeNode.setTitle(this.json.id);
  895. this.node.set("id", this.json.id);
  896. }
  897. if (name=="formStyleType"){
  898. var file = (this.stylesList && this.json.formStyleType) ? this.stylesList[this.json.formStyleType].file : null;
  899. var extendFile = (this.stylesList && this.json.formStyleType) ? this.stylesList[this.json.formStyleType].extendFile : null;
  900. this.loadTemplateStyles( file, extendFile, function( templateStyles ){
  901. //this.templateStyles = (this.stylesList && this.json.formStyleType) ? this.stylesList[this.json.formStyleType] : null;
  902. this.templateStyles = templateStyles;
  903. var oldFile, oldExtendFile;
  904. if( oldValue && this.stylesList[oldValue] ){
  905. oldFile = this.stylesList[oldValue].file;
  906. oldExtendFile = this.stylesList[oldValue].extendFile;
  907. }
  908. this.loadTemplateStyles( oldFile, oldExtendFile, function( oldTemplateStyles ){
  909. //if (oldValue) {
  910. // var oldTemplateStyles = this.stylesList[oldValue];
  911. // if (oldTemplateStyles){
  912. // if (oldTemplateStyles["form"]) this.clearTemplateStyles(oldTemplateStyles["form"]);
  913. // }
  914. //}
  915. this.json.styleConfig = (this.stylesList && this.json.formStyleType) ? this.stylesList[this.json.formStyleType] : null;
  916. if (oldTemplateStyles["form"]) this.clearTemplateStyles(oldTemplateStyles["form"]);
  917. if (this.templateStyles["form"]) this.setTemplateStyles(this.templateStyles["form"]);
  918. this.setAllStyles();
  919. this.moduleList.each(function(module){
  920. if (oldTemplateStyles[module.moduleName]){
  921. module.clearTemplateStyles(oldTemplateStyles[module.moduleName]);
  922. }
  923. module.setStyleTemplate();
  924. module.setAllStyles();
  925. }.bind(this));
  926. }.bind(this))
  927. }.bind(this))
  928. }
  929. if (name==="css"){
  930. this.reloadCss();
  931. }
  932. this._setEditStyle_custom(name, obj, oldValue);
  933. },
  934. parseCSS: function(css){
  935. var rex = /(url\(.*\))/g;
  936. var match;
  937. while ((match = rex.exec(css)) !== null) {
  938. var pic = match[0];
  939. var len = pic.length;
  940. var s = pic.substring(pic.length-2, pic.length-1);
  941. var n0 = (s==="'" || s==="\"") ? 5 : 4;
  942. var n1 = (s==="'" || s==="\"") ? 2 : 1;
  943. pic = pic.substring(n0, pic.length-n1);
  944. if ((pic.indexOf("x_processplatform_assemble_surface")!=-1 || pic.indexOf("x_portal_assemble_surface")!=-1)){
  945. var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
  946. var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
  947. if (pic.indexOf("/x_processplatform_assemble_surface")!==-1){
  948. pic = pic.replace("/x_processplatform_assemble_surface", pic+"/x_processplatform_assemble_surface");
  949. }else if (pic.indexOf("x_processplatform_assemble_surface")!==-1){
  950. pic = pic.replace("x_processplatform_assemble_surface", pic+"/x_processplatform_assemble_surface");
  951. }
  952. if (pic.indexOf("/x_portal_assemble_surface")!==-1){
  953. pic = pic.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  954. }else if (pic.indexOf("x_portal_assemble_surface")!==-1){
  955. pic = pic.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  956. }
  957. }
  958. pic = "url('"+pic+"')";
  959. var len2 = pic.length;
  960. css = css.substring(0, match.index) + pic + css.substring(rex.lastIndex, css.length);
  961. rex.lastIndex = rex.lastIndex + (len2-len);
  962. }
  963. return css;
  964. },
  965. reloadCss: function(){
  966. cssText = (this.json.css) ? this.json.css.code : "";
  967. //var head = (document.head || document.getElementsByTagName("head")[0] || document.documentElement);
  968. var styleNode = $("style"+this.json.id);
  969. if (styleNode) styleNode.destroy();
  970. if (cssText){
  971. cssText = this.parseCSS(cssText);
  972. var rex = new RegExp("(.+)(?=\\{)", "g");
  973. var match;
  974. var id = this.json.id.replace(/\-/g, "");
  975. var prefix = ".css" + id + " ";
  976. while ((match = rex.exec(cssText)) !== null) {
  977. // var rule = prefix + match[0];
  978. // cssText = cssText.substring(0, match.index) + rule + cssText.substring(rex.lastIndex, cssText.length);
  979. // rex.lastIndex = rex.lastIndex + prefix.length;
  980. var rulesStr = match[0];
  981. if (rulesStr.indexOf(",")!=-1){
  982. var rules = rulesStr.split(/\s*,\s*/g);
  983. rules = rules.map(function(r){
  984. return prefix + r;
  985. });
  986. var rule = rules.join(", ");
  987. cssText = cssText.substring(0, match.index) + rule + cssText.substring(rex.lastIndex, cssText.length);
  988. rex.lastIndex = rex.lastIndex + (prefix.length*rules.length);
  989. }else{
  990. var rule = prefix + match[0];
  991. cssText = cssText.substring(0, match.index) + rule + cssText.substring(rex.lastIndex, cssText.length);
  992. rex.lastIndex = rex.lastIndex + prefix.length;
  993. }
  994. }
  995. var styleNode = document.createElement("style");
  996. styleNode.setAttribute("type", "text/css");
  997. styleNode.id="style"+this.json.id;
  998. styleNode.inject(this.container, "before");
  999. if(styleNode.styleSheet){
  1000. var setFunc = function(){
  1001. styleNode.styleSheet.cssText = cssText;
  1002. };
  1003. if(styleNode.styleSheet.disabled){
  1004. setTimeout(setFunc, 10);
  1005. }else{
  1006. setFunc();
  1007. }
  1008. }else{
  1009. var cssTextNode = document.createTextNode(cssText);
  1010. styleNode.appendChild(cssTextNode);
  1011. }
  1012. }
  1013. },
  1014. setAllStyles: function(){
  1015. this.setPropertiesOrStyles("styles");
  1016. this.setPropertiesOrStyles("properties");
  1017. this.reloadMaplist();
  1018. },
  1019. reloadMaplist: function(){
  1020. if (this.property) Object.each(this.property.maplists, function(map, name){ map.reload(this.json[name]);}.bind(this));
  1021. },
  1022. _setEditStyle_custom: function(){
  1023. },
  1024. saveAsTemplete: function(){
  1025. },
  1026. isModuleExited : function( id ){
  1027. for( var i=0; i<this.moduleList.length; i++ ){
  1028. if(this.moduleList[i].json.id === id)return true;
  1029. }
  1030. return false;
  1031. },
  1032. checkModuleId: function(id, type, currentSubform){
  1033. var fieldConflict = false;
  1034. var elementConflict = false;
  1035. //if (this.json.moduleList[id]){
  1036. if( this.isModuleExited(id) ){
  1037. elementConflict = true;
  1038. if (this.options.fields.indexOf(type)!=-1 || this.options.fields.indexOf(this.json.moduleList[id].type)!=-1){
  1039. fieldConflict = true;
  1040. }
  1041. return {"fieldConflict": fieldConflict, "elementConflict": elementConflict};
  1042. }
  1043. //if (this.subformList){
  1044. // Object.each(this.subformList, function(subform){
  1045. // if (!currentSubform || currentSubform!=subform.id){
  1046. // if (subform.moduleList[id]){
  1047. // elementConflict = true;
  1048. // if (this.options.fields.indexOf(type)!=-1 || this.options.fields.indexOf(subform.moduleList[id].type)!=-1){
  1049. // fieldConflict = true;
  1050. // }
  1051. // }
  1052. // }
  1053. // }.bind(this));
  1054. //}
  1055. var subformList = this.getAllSubformJsonObject();
  1056. if (subformList){
  1057. Object.each(subformList, function(subform){
  1058. if (!currentSubform || currentSubform!=subform.id){
  1059. if (subform.moduleList[id]){
  1060. elementConflict = true;
  1061. if (this.options.fields.indexOf(type)!=-1 || this.options.fields.indexOf(subform.moduleList[id].type)!=-1){
  1062. fieldConflict = true;
  1063. }
  1064. }
  1065. }
  1066. }.bind(this));
  1067. }
  1068. return {"fieldConflict": fieldConflict, "elementConflict": elementConflict};
  1069. },
  1070. _resetTreeNode: function(){},
  1071. clearSubformList : function( level1subformName ){
  1072. if( !this.level1Subformlist )return;
  1073. if( !this.level1Subformlist[level1subformName] )return;
  1074. delete this.level1Subformlist[level1subformName];
  1075. },
  1076. addSubformList : function( level1subformName, addedSubformId ){
  1077. if( !this.level1Subformlist ){
  1078. this.level1Subformlist = {};
  1079. }
  1080. if( !this.level1Subformlist[level1subformName] ){
  1081. this.level1Subformlist[level1subformName] = [];
  1082. }
  1083. this.level1Subformlist[level1subformName].push( addedSubformId );
  1084. },
  1085. isSubformUnique : function( checkedSubformId, level1subformName, deletedSubformId){
  1086. if( !this.level1Subformlist )return true;
  1087. var level1Subformlist = Object.clone( this.level1Subformlist );
  1088. if( deletedSubformId && level1Subformlist[deletedSubformId] )delete level1Subformlist[deletedSubformId];
  1089. for( var key in level1Subformlist ){
  1090. if( key !== level1subformName ){
  1091. if( level1Subformlist[key].contains( checkedSubformId ) ){
  1092. return false;
  1093. }
  1094. }
  1095. }
  1096. return true;
  1097. },
  1098. getAllSubformTiled : function(){
  1099. var _nestToTiled = function( form , array ){
  1100. if ( form.subformModuleList && form.subformModuleList.length){
  1101. Array.each( form.subformModuleList, function( module ){
  1102. array.push( module );
  1103. if( module.subformModule )_nestToTiled( module.subformModule, array );
  1104. }.bind(this))
  1105. }
  1106. };
  1107. var array = [];
  1108. _nestToTiled( this, array );
  1109. return array;
  1110. },
  1111. getAllSubformJsonObject : function(){
  1112. var list = this.getAllSubformTiled();
  1113. var object = {};
  1114. Array.each( list, function( subform ){
  1115. if( subform && subform.json.subformSelected && subform.subformData && subform.subformData.json){
  1116. object[ subform.json.subformSelected ] = subform.subformData.json;
  1117. }
  1118. }.bind(this));
  1119. return object;
  1120. }
  1121. // getAllFieldModuleNameList: function(){
  1122. // var moduleNameList = [];
  1123. // Object.each(this.json.moduleList, function(o, k){
  1124. // if (this.options.fields.indexOf(o.type))
  1125. // }.bind(this))
  1126. // }
  1127. });