Property.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. MWF.require("MWF.widget.Common", null, false);
  2. MWF.require("MWF.widget.JsonTemplate", null, false);
  3. MWF.xDesktop.requireApp("query.ViewDesigner", "Property", null, false);
  4. MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({
  5. Extends: MWF.xApplication.query.ViewDesigner.Property,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default"
  9. },
  10. show: function () {
  11. if (!this.propertyContent) {
  12. this.getHtmlString(function () {
  13. if (this.htmlString) {
  14. this.JsonTemplate = new MWF.widget.JsonTemplate(this.data, this.htmlString);
  15. this.propertyContent = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.propertyNode);
  16. this.propertyContent.set("html", this.JsonTemplate.load());
  17. this.setEditNodeEvent();
  18. this.setEditNodeStyles(this.propertyContent);
  19. this.loadPropertyTab();
  20. this.loadPersonInput();
  21. this.loadPersonSelectInput();
  22. this.loadViewFilter();
  23. this.loadScriptArea();
  24. this.loadColumnExportEditor();
  25. this.loadJSONArea();
  26. this.loadEventsEditor();
  27. this.loadViewStylesArea();
  28. this.loadPagingStylesArea();
  29. this.loadActionStylesArea();
  30. this.loadActionArea();
  31. this.loadStylesList();
  32. this.loadMaplist();
  33. this.loadDataPathSelect();
  34. }
  35. }.bind(this));
  36. } else {
  37. this.propertyContent.setStyle("display", "block");
  38. }
  39. },
  40. loadDataPathSelect : function(){
  41. var nodes = this.propertyContent.getElements(".MWFDataPathSelect");
  42. nodes.each( function (select) {
  43. select.empty();
  44. var option = new Element("option", {"text": "none", "value" : ""}).inject(select);
  45. this.module.getColumnDataPath().each(function(model){
  46. var option = new Element("option", {
  47. "text": model,
  48. "value": model,
  49. "selected": (this.data[name]==model)
  50. }).inject(select);
  51. }.bind(this));
  52. }.bind(this))
  53. },
  54. loadViewFilter: function () {
  55. var nodes = this.propertyContent.getElements(".MWFViewFilter");
  56. var parameterData = this.view.data.data.parameterList;
  57. var customData = this.view.data.data.customFilterList;
  58. nodes.each(function (node) {
  59. MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function () {
  60. var _slef = this;
  61. this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.view.designer, {
  62. "parameterData": parameterData,
  63. "customData": customData
  64. }, {
  65. "onChange": function (ids) {
  66. var data = this.getData();
  67. _slef.changeJsonDate(["data", "parameterList"], data.parameterData);
  68. _slef.changeJsonDate(["data", "customFilterList"], data.customData);
  69. }
  70. });
  71. }.bind(this));
  72. }.bind(this));
  73. },
  74. loadActionArea: function () {
  75. debugger;
  76. MWF.xApplication.process = MWF.xApplication.process || {};
  77. MWF.APPFD = MWF.xApplication.process.FormDesigner = MWF.xApplication.process.FormDesigner || {};
  78. MWF.xDesktop.requireApp("process.FormDesigner", "lp." + o2.language, null, false);
  79. var multiActionArea = this.propertyContent.getElements(".MWFMultiActionArea");
  80. multiActionArea.each(function(node){
  81. debugger;
  82. var name = node.get("name");
  83. var actionContent = this.data[name];
  84. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function(){
  85. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  86. "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  87. "systemToolsAddress": "../x_component_query_StatementDesigner/$Statement/toolbars.json",
  88. "isSystemTool" : false,
  89. "noEditShow": true,
  90. "noReadShow": true,
  91. "onChange": function(){
  92. this.data[name] = actionEditor.data;
  93. this.changeData(name);
  94. }.bind(this)
  95. });
  96. actionEditor.load(actionContent);
  97. }.bind(this));
  98. }.bind(this));
  99. var actionAreas = this.propertyContent.getElements(".MWFActionArea");
  100. actionAreas.each(function (node) {
  101. var name = node.get("name");
  102. var actionContent = this.data[name];
  103. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function () {
  104. // debugger;
  105. // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
  106. // "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  107. // "noCreate": true,
  108. // "noDelete": true,
  109. // "noCode": true,
  110. // "onChange": function(){
  111. // this.data[name] = actionEditor.data;
  112. // }.bind(this)
  113. // });
  114. // actionEditor.load(this.module.defaultToolBarsData);
  115. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  116. "maxObj": this.propertyNode.parentElement.parentElement,
  117. "noEditShow": true,
  118. "noReadShow": true,
  119. "onChange": function () {
  120. this.data[name] = actionEditor.data;
  121. this.changeData(name);
  122. }.bind(this)
  123. });
  124. actionEditor.load(actionContent);
  125. }.bind(this));
  126. }.bind(this));
  127. var actionAreas = this.propertyContent.getElements(".MWFDefaultActionArea");
  128. actionAreas.each(function (node) {
  129. var name = node.get("name");
  130. var actionContent = this.data[name] || this.module.defaultToolBarsData;
  131. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function () {
  132. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  133. "maxObj": this.propertyNode.parentElement.parentElement,
  134. "isSystemTool": true,
  135. "systemToolsAddress": "../x_component_query_StatementDesigner/$Statement/toolbars.json",
  136. "noCreate": true,
  137. "noDelete": false,
  138. "noCode": true,
  139. "noReadShow": true,
  140. "noEditShow": true,
  141. "onChange": function () {
  142. this.data[name] = actionEditor.data;
  143. this.changeData(name);
  144. }.bind(this)
  145. });
  146. actionEditor.load(actionContent);
  147. // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
  148. // "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  149. // "onChange": function(){
  150. // this.data[name] = actionEditor.data;
  151. // }.bind(this)
  152. // });
  153. // actionEditor.load(actionContent);
  154. }.bind(this));
  155. }.bind(this));
  156. }
  157. });