Comment.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.cms.FormDesigner.Module.Comment = MWF.CMSFCComment = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_cms_FormDesigner/Module/Comment/comment.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "../x_component_cms_FormDesigner/Module/Comment/";
  13. this.cssPath = "../x_component_cms_FormDesigner/Module/Comment/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "comment";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. load : function(json, node, parent){
  22. this.json = json;
  23. this.node= node;
  24. this.node.store("module", this);
  25. //this.node.empty();
  26. this.node.setStyles(this.css.moduleNode);
  27. this._loadNodeStyles();
  28. this._initModule();
  29. this._loadTreeNode(parent);
  30. this.setCustomStyles();
  31. this.parentContainer = this.treeNode.parentNode.module;
  32. this._setEditStyle_custom("id");
  33. this.parseModules();
  34. this.json.moduleName = this.moduleName;
  35. },
  36. clearTemplateStyles: function(styles){
  37. if (styles){
  38. //if (styles.properties) this.removeStyles(styles.properties, "tableProperties");
  39. }
  40. },
  41. setTemplateStyles: function(styles){
  42. //if (styles.properties) this.copyStyles(styles.properties, "tableProperties");
  43. },
  44. _createMoveNode: function(){
  45. this.moveNode = new Element("div", {
  46. "MWFType": "log",
  47. "id": this.json.id,
  48. "styles": this.css.moduleNodeMove,
  49. "events": {
  50. "selectstart": function(){
  51. return false;
  52. }
  53. }
  54. }).inject(this.form.container);
  55. },
  56. _createNode: function(){
  57. this.node = this.moveNode.clone(true, true);
  58. this.node.setStyles(this.css.moduleNode);
  59. this.node.set("id", this.json.id);
  60. this.node.addEvent("selectstart", function(){
  61. return false;
  62. });
  63. this.iconNode = new Element("div", {
  64. "styles": this.css.iconNode
  65. }).inject(this.node);
  66. new Element("div", {
  67. "styles": this.css.iconNodeIcon
  68. }).inject(this.iconNode);
  69. new Element("div", {
  70. "styles": this.css.iconNodeText,
  71. "text": "COMMENT"
  72. }).inject(this.iconNode);
  73. },
  74. _loadNodeStyles: function(){
  75. this.iconNode = this.node.getElement("div").setStyles(this.css.iconNode);
  76. this.iconNode.getFirst("div").setStyles(this.css.iconNodeIcon);
  77. this.iconNode.getLast("div").setStyles(this.css.iconNodeText);
  78. }
  79. });