ModuleImplements.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. MWF.xDesktop.requireApp("process.FormDesigner", "Property", null, false);
  2. if( !MWF.CMSProperty_Process ){
  3. MWF.CMSProperty_Process = {
  4. getViewList : MWF.xApplication.process.FormDesigner.Property.prototype.getViewList.$origin,
  5. loadScriptEditor : MWF.xApplication.process.FormDesigner.Property.prototype.loadScriptEditor.$origin,
  6. loadActionArea : MWF.xApplication.process.FormDesigner.Property.prototype.loadActionArea.$origin,
  7. loadEventsEditor : MWF.xApplication.process.FormDesigner.Property.prototype.loadEventsEditor.$origin,
  8. loadValidation : MWF.xApplication.process.FormDesigner.Property.prototype.loadValidation.$origin,
  9. loadFormFieldInput : MWF.xApplication.process.FormDesigner.Property.prototype.loadFormFieldInput.$origin,
  10. loadPersonInput : MWF.xApplication.process.FormDesigner.Property.prototype.loadPersonInput.$origin
  11. };
  12. MWF.xApplication.process.FormDesigner.Property.implement({
  13. loadFormFieldInput: function(){
  14. //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
  15. var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  16. if( isCMS ){
  17. this.loadFormFieldInput_CMS();
  18. }else{
  19. this.loadFormFieldInput_Process();
  20. }
  21. },
  22. loadFormFieldInput_Process : MWF.CMSProperty_Process.loadFormFieldInput,
  23. loadFormFieldInput_CMS: function(){
  24. var fieldNodes = this.propertyContent.getElements(".MWFFormFieldPerson");
  25. MWF.xDesktop.requireApp("cms.QueryViewDesigner", "widget.PersonSelector", function(){
  26. fieldNodes.each(function(node){
  27. new MWF.xApplication.cms.QueryViewDesigner.widget.PersonSelector(node, this.form.designer, {
  28. "type": "formField",
  29. "form": this.form.json.id,
  30. "fieldType": "person",
  31. "names": this.data[node.get("name")],
  32. "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  33. });
  34. }.bind(this));
  35. }.bind(this));
  36. },
  37. //getViewList: function(callback, refresh){
  38. // var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  39. // if( isCMS ){
  40. // this.getViewList_CMS( callback, refresh );
  41. // }else{
  42. // this.getViewList_Process( callback, refresh );
  43. // }
  44. //},
  45. //getViewList_Process : MWF.CMSProperty_Process.getViewList,
  46. //getViewList_CMS : function(callback, refresh){
  47. // if (!this.views || refresh){
  48. // this.form.designer.actions.listQueryView(this.form.designer.application.id, function(json){
  49. // this.views = json.data;
  50. // if (callback) callback();
  51. // }.bind(this));
  52. // }else{
  53. // if (callback) callback();
  54. // }
  55. //},
  56. loadScriptEditor: function(scriptAreas, style){
  57. //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
  58. var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  59. if( isCMS ){
  60. this.loadScriptEditor_CMS( scriptAreas, style );
  61. }else{
  62. this.loadScriptEditor_Process( scriptAreas, style );
  63. }
  64. },
  65. loadScriptEditor_Process : MWF.CMSProperty_Process.loadScriptEditor,
  66. loadScriptEditor_CMS: function(scriptAreas, style){
  67. scriptAreas.each(function(node){
  68. var title = node.get("title");
  69. var name = node.get("name");
  70. var scriptContent = this.data[name];
  71. MWF.require("MWF.widget.ScriptArea", function(){
  72. var scriptArea = new MWF.widget.ScriptArea(node, {
  73. "title": title,
  74. //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  75. "maxObj": this.designer.formContentNode,
  76. "onChange": function(){
  77. this.data[name] = scriptArea.toJson();
  78. }.bind(this),
  79. "onSave": function(){
  80. this.designer.saveForm();
  81. }.bind(this),
  82. "style": style || "default",
  83. "helpStyle" : "cms"
  84. });
  85. scriptArea.load(scriptContent);
  86. }.bind(this));
  87. }.bind(this));
  88. },
  89. loadActionArea: function(){
  90. //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
  91. var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  92. if( isCMS ){
  93. this.loadActionArea_CMS( );
  94. }else{
  95. this.loadActionArea_Process( );
  96. }
  97. },
  98. loadActionArea_Process : MWF.CMSProperty_Process.loadActionArea,
  99. loadActionArea_CMS: function(){
  100. var actionAreas = this.propertyContent.getElements(".MWFActionArea");
  101. actionAreas.each(function(node){
  102. var name = node.get("name");
  103. var actionContent = this.data[name];
  104. MWF.xDesktop.requireApp("cms.FormDesigner", "widget.ActionsEditor", function(){
  105. var actionEditor = new MWF.xApplication.cms.FormDesigner.widget.ActionsEditor(node, this.designer, {
  106. "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  107. "onChange": function(){
  108. this.data[name] = actionEditor.data;
  109. }.bind(this)
  110. });
  111. actionEditor.load(actionContent);
  112. }.bind(this));
  113. }.bind(this));
  114. },
  115. loadEventsEditor: function(){
  116. //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
  117. var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  118. if( isCMS ){
  119. this.loadEventsEditor_CMS( );
  120. }else{
  121. this.loadEventsEditor_Process( );
  122. }
  123. },
  124. loadEventsEditor_Process : MWF.CMSProperty_Process.loadEventsEditor,
  125. loadEventsEditor_CMS: function(){
  126. var events = this.propertyContent.getElement(".MWFEventsArea");
  127. if (events){
  128. var name = events.get("name");
  129. var eventsObj = this.data[name];
  130. MWF.xDesktop.requireApp("cms.FormDesigner", "widget.EventsEditor", function(){
  131. var eventsEditor = new MWF.xApplication.cms.FormDesigner.widget.EventsEditor(events, this.designer, {
  132. //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  133. "maxObj": this.designer.formContentNode
  134. });
  135. eventsEditor.load(eventsObj);
  136. }.bind(this));
  137. }
  138. },
  139. loadValidation: function(){
  140. //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
  141. var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  142. if( isCMS ){
  143. this.loadValidation_CMS();
  144. }else{
  145. this.loadValidation_Process();
  146. }
  147. },
  148. loadValidation_Process : MWF.CMSProperty_Process.loadValidation,
  149. loadValidation_CMS: function(){
  150. MWF.xDesktop.requireApp("cms.FormDesigner", "widget.ValidationEditor", null, false);
  151. var nodes = this.propertyContent.getElements(".MWFValidation");
  152. if (nodes.length){
  153. nodes.each(function(node){
  154. var name = node.get("name");
  155. var validationEditor = new MWF.xApplication.cms.FormDesigner.widget.ValidationEditor(node, this.designer, {
  156. "onChange": function(){
  157. var data = validationEditor.getValidationData();
  158. this.data[name] = data;
  159. }.bind(this)
  160. });
  161. validationEditor.load(this.data[name]);
  162. //new MWF.xApplication.process.FormDesigner.widget.ValidationEditor(node, this.designer);
  163. }.bind(this));
  164. }
  165. }//,
  166. // loadPersonInput: function(){
  167. // var isCMS= this.designer.options.name.toLowerCase().contains("cms");
  168. // if( isCMS ){
  169. // this.loadPersonInput_CMS();
  170. // }else{
  171. // this.loadPersonInput_Process();
  172. // }
  173. // },
  174. // loadPersonInput_Process : MWF.CMSProperty_Process.loadPersonInput,
  175. // loadPersonInput_CMS: function(){
  176. // var personNameNodes = this.propertyContent.getElements(".MWFPersonName");
  177. // var personIdentityNodes = this.propertyContent.getElements(".MWFPersonIdentity");
  178. // var personUnitNodes = this.propertyContent.getElements(".MWFPersonUnit");
  179. // var dutyNodes = this.propertyContent.getElements(".MWFDutySelector");
  180. //
  181. // var viewNodes = this.propertyContent.getElements(".MWFViewSelect");
  182. // var cmsviewNodes = this.propertyContent.getElements(".MWFCMSViewSelect");
  183. //
  184. // MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
  185. // personNameNodes.each(function(node){
  186. // new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  187. // "type": "person",
  188. // "names": this.data[node.get("name")],
  189. // "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  190. // });
  191. // }.bind(this));
  192. //
  193. // personIdentityNodes.each(function(node){
  194. // new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  195. // "type": "identity",
  196. // "names": this.data[node.get("name")],
  197. // "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  198. // });
  199. // }.bind(this));
  200. //
  201. //
  202. // personUnitNodes.each(function(node){
  203. // new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  204. // "type": "unit",
  205. // "names": this.data[node.get("name")],
  206. // "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
  207. // });
  208. // }.bind(this));
  209. //
  210. // dutyNodes.each(function(node){
  211. // new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  212. // "type": "duty",
  213. // "names": this.data[node.get("name")],
  214. // "onChange": function(ids){this.addDutyItem(node, ids);}.bind(this),
  215. // "onRemoveDuty": function(item){this.removeDutyItem(node, item);}.bind(this)
  216. // });
  217. // }.bind(this));
  218. //
  219. // viewNodes.each(function(node){
  220. // new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  221. // "type": "View",
  222. // "count": 1,
  223. // "names": [this.data[node.get("name")]],
  224. // "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  225. // });
  226. // }.bind(this));
  227. //
  228. // cmsviewNodes.each(function(node){
  229. // new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
  230. // "type": "CMSView",
  231. // "count": 1,
  232. // "names": [this.data[node.get("name")]],
  233. // "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
  234. // });
  235. // }.bind(this));
  236. // }.bind(this));
  237. // }
  238. });
  239. }
  240. MWF.xApplication.cms.FormDesigner.ModuleImplements = MWF.CMSFCMI = new Class({
  241. });