Calendar.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.Calendar = MWF.FCCalendar = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Calendar/calendar.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Calendar/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Calendar/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "calendar";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. setTemplateStyles: function(styles){
  22. if (styles.styles) this.copyStyles(styles.styles, "styles");
  23. if (styles.inputStyles) this.copyStyles(styles.inputStyles, "inputStyles");
  24. if (styles.properties) this.copyStyles(styles.properties, "properties");
  25. },
  26. clearTemplateStyles: function(styles){
  27. if (styles){
  28. if (styles.styles) this.removeStyles(styles.styles, "styles");
  29. if (styles.inputStyles) this.removeStyles(styles.inputStyles, "inputStyles");
  30. if (styles.properties) this.removeStyles(styles.properties, "properties");
  31. }
  32. },
  33. _createMoveNode: function(){
  34. this.moveNode = new Element("div", {
  35. "MWFType": "calendar",
  36. "id": this.json.id,
  37. "styles": this.css.moduleNodeMove,
  38. "events": {
  39. "selectstart": function(){
  40. return false;
  41. }
  42. }
  43. }).inject(this.form.container);
  44. var icon = new Element("div", {
  45. "styles": this.css.personfieldIcon
  46. }).inject(this.moveNode);
  47. var text = new Element("div", {
  48. "styles": this.css.moduleText,
  49. "text": this.json.id
  50. }).inject(this.moveNode);
  51. },
  52. _loadNodeStyles: function(){
  53. var icon = this.node.getFirst("div");
  54. var text = this.node.getLast("div");
  55. if (!icon) icon = new Element("div").inject(this.node, "top");
  56. if (!text) text = new Element("div").inject(this.node, "bottom");
  57. icon.setStyles(this.css.personfieldIcon);
  58. text.setStyles(this.css.moduleText);
  59. },
  60. _getCopyNode: function(){
  61. if (!this.copyNode) this._createCopyNode();
  62. this.copyNode.setStyle("display", "inline-block");
  63. return this.copyNode;
  64. },
  65. _setEditStyle_custom: function(name){
  66. if (name=="id"){
  67. this.node.getLast().set("text", this.json.id);
  68. }
  69. }
  70. });