Common.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.Common", null, false);
  3. MWF.xApplication.cms.FormDesigner.Module.Common = MWF.CMSFCCommon = new Class({
  4. Extends: MWF.FCCommon,
  5. Implements : [MWF.CMSFCMI],
  6. setCustomStyles: function(){
  7. var border = this.node.getStyle("border");
  8. this.node.clearStyles();
  9. var styles = this.node.getStyles("display", "padding");
  10. this.node.setStyles(this.css.moduleNode);
  11. var style = Object.clone(this.json.styles);
  12. //style = Object.merge(style, styles);
  13. if (styles.display.toString().toLowerCase()==="inline"){
  14. if (!style.display) style.display = "inline-block";
  15. if (!style.padding && !style["padding-left"] && !style["padding-right"]) style.padding = "0px 2px";
  16. }
  17. if (this.json.tagName==="button"){
  18. if (!style["min-height"]) style["min-height"] = "20px";
  19. }
  20. if (this.initialStyles) this.node.setStyles(this.initialStyles);
  21. this.node.setStyle("border", border);
  22. if (style) Object.each(style, function(value, key){
  23. if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
  24. var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
  25. var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
  26. var host3 = MWF.Actions.getHost("x_cms_assemble_control");
  27. if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
  28. value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
  29. }else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
  30. value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
  31. }
  32. if (value.indexOf("/x_portal_assemble_surface")!==-1){
  33. value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  34. }else if (value.indexOf("x_portal_assemble_surface")!==-1){
  35. value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  36. }
  37. if (value.indexOf("/x_cms_assemble_control")!==-1){
  38. value = value.replace("/x_cms_assemble_control", host3+"/x_cms_assemble_control");
  39. }else if (value.indexOf("x_cms_assemble_control")!==-1){
  40. value = value.replace("x_cms_assemble_control", host3+"/x_cms_assemble_control");
  41. }
  42. value = o2.filterUrl(value);
  43. }
  44. var reg = /^border\w*/ig;
  45. if (!key.test(reg)){
  46. if (key){
  47. if (key.toString().toLowerCase()==="display"){
  48. if (value.toString().toLowerCase()==="none"){
  49. this.node.setStyle("opacity", 0.3);
  50. }else{
  51. this.node.setStyle("opacity", 1);
  52. this.node.setStyle(key, value);
  53. }
  54. }else{
  55. this.node.setStyle(key, value);
  56. }
  57. }
  58. }
  59. }.bind(this));
  60. }
  61. });