Label.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("cms.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.cms.FormDesigner.Module.Label = MWF.CMSFCLabel = new Class({
  4. Extends: MWF.CMSFC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_cms_FormDesigner/Module/Label/label.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_cms_FormDesigner/Module/Label/";
  13. this.cssPath = "/x_component_cms_FormDesigner/Module/Label/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "label";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. _createMoveNode: function(){
  22. this.moveNode = new Element("div", {
  23. "MWFType": "label",
  24. "id": this.json.id,
  25. "styles": this.css.moduleNodeMove,
  26. "text": "(T)Text",
  27. "events": {
  28. "selectstart": function(){
  29. return false;
  30. }
  31. }
  32. }).inject(this.form.container);
  33. },
  34. _setEditStyle_custom: function(name){
  35. if (name=="valueType" || name=="text"){
  36. if (this.json.valueType=="text"){
  37. if (this.json.text){
  38. this.node.set("text", this.json.text);
  39. }else{
  40. this.node.set("text", "(T)Text");
  41. }
  42. }else{
  43. this.node.set("text", "(C)Text");
  44. }
  45. }
  46. }
  47. });