Property.js 8.3 KB

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