Attachment.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. setTemplateStyles: function(styles){
  22. this.json.style = styles.style || "default";
  23. },
  24. clearTemplateStyles: function(styles){
  25. this.json.style = "default";
  26. },
  27. _createMoveNode: function(){
  28. this.moveNode = new Element("div", {
  29. "MWFType": "itmleditor",
  30. "id": this.json.id,
  31. "styles": this.css.moduleNodeMove,
  32. "events": {
  33. "selectstart": function(){
  34. return false;
  35. }
  36. }
  37. }).inject(this.form.container);
  38. },
  39. _createNode: function(){
  40. this.node = this.moveNode.clone(true, true);
  41. this.node.setStyles(this.css.moduleNode);
  42. this.node.set("id", this.json.id);
  43. this.node.addEvent("selectstart", function(e){
  44. e.preventDefault();
  45. });
  46. // this.loadCkeditor();
  47. },
  48. _setEditStyle_custom: function(name){
  49. if (name=="size"){
  50. if (this.json[name]=="min"){
  51. this.attachmentController.changeControllerSizeToMin();
  52. }else{
  53. this.attachmentController.changeControllerSizeToMax();
  54. }
  55. };
  56. },
  57. _initModule: function(){
  58. this.node.empty();
  59. this.loadAttachmentController(this.json.editorProperties);
  60. this._setNodeProperty();
  61. if (!this.form.isSubform) this._createIconAction();
  62. this._setNodeEvent();
  63. },
  64. loadAttachmentController: function(){
  65. MWF.require("MWF.widget.AttachmentController", function(){
  66. this.attachmentController = new MWF.widget.ATTER(this.node, this, {"readonly": true, "size": this.json.size});
  67. this.attachmentController.load();
  68. }.bind(this));
  69. }
  70. });