Attachment.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Attachment = MWF.FCAttachment = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Attachment/attachment.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Attachment/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Attachment/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "attachment";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. _createMoveNode: function(){
  22. this.moveNode = new Element("div", {
  23. "MWFType": "itmleditor",
  24. "id": this.json.id,
  25. "styles": this.css.moduleNodeMove,
  26. "events": {
  27. "selectstart": function(){
  28. return false;
  29. }
  30. }
  31. }).inject(this.form.container);
  32. },
  33. _createNode: function(){
  34. this.node = this.moveNode.clone(true, true);
  35. this.node.setStyles(this.css.moduleNode);
  36. this.node.set("id", this.json.id);
  37. this.node.addEvent("selectstart", function(e){
  38. e.preventDefault();
  39. });
  40. // this.loadCkeditor();
  41. },
  42. _setEditStyle_custom: function(name){
  43. if (name=="size"){
  44. if (this.json[name]=="min"){
  45. this.attachmentController.changeControllerSizeToMin();
  46. }else{
  47. this.attachmentController.changeControllerSizeToMax();
  48. }
  49. };
  50. },
  51. _initModule: function(){
  52. this.node.empty();
  53. this.loadAttachmentController(this.json.editorProperties);
  54. this._setNodeProperty();
  55. if (!this.form.isSubform) this._createIconAction();
  56. this._setNodeEvent();
  57. },
  58. loadAttachmentController: function(){
  59. MWF.require("MWF.widget.AttachmentController", function(){
  60. this.attachmentController = new MWF.widget.ATTER(this.node, this, {"readonly": true, "size": this.json.size});
  61. this.attachmentController.load();
  62. }.bind(this));
  63. }
  64. });