Image.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. MWF.xApplication.portal.PageDesigner.Module.Image = MWF.PCImage = new Class({
  2. Extends: MWF.FCImage,
  3. Implements: [Options, Events],
  4. options: {
  5. "style": "default",
  6. "propertyPath": "/x_component_portal_PageDesigner/Module/Image/image.html"
  7. },
  8. initialize: function(form, options){
  9. this.setOptions(options);
  10. this.path = "/x_component_portal_PageDesigner/Module/Image/";
  11. this.cssPath = "/x_component_portal_PageDesigner/Module/Image/"+this.options.style+"/css.wcss";
  12. this._loadCss();
  13. this.moduleType = "element";
  14. this.moduleName = "image";
  15. this.form = form;
  16. this.container = null;
  17. this.containerNode = null;
  18. },
  19. _setEditStyle_custom: function(name){
  20. if (name=="src"){
  21. if (this.json.src){
  22. var src = this.json.src.imageSrc;
  23. this.node.src = src;
  24. this.setPropertiesOrStyles("styles");
  25. }else{
  26. this.node.set("src", this.path +this.options.style+"/icon/image1.png");
  27. }
  28. }
  29. debugger;
  30. if (name=="srcfile"){
  31. var value = this.json.srcfile;
  32. if (value==="none"){
  33. this.json.srcfile = "";
  34. value = "";
  35. }
  36. if (value){
  37. var host = MWF.Actions.getHost("x_portal_assemble_surface");
  38. var action = MWF.Actions.get("x_portal_assemble_surface");
  39. var uri = action.action.actions.readFile.uri;
  40. uri = uri.replace("{flag}", value);
  41. uri = uri.replace("{applicationFlag}", this.form.json.application);
  42. value = host+"/x_portal_assemble_surface"+uri;
  43. try{
  44. this.node.set("src", value);
  45. }catch(e){}
  46. }else{
  47. if (this.json.properties.src) {
  48. this._setEditStyle_custom("properties");
  49. }else if (this.json.src){
  50. this._setEditStyle_custom("src");
  51. }else{
  52. this.node.set("src", this.path +this.options.style+"/icon/image1.png");
  53. }
  54. }
  55. }
  56. if (name=="properties"){
  57. this._setNodeProperty();
  58. }
  59. }
  60. });