Image.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. MWF.xApplication.process.Xform.Image = MWF.APPImage = new Class({
  3. Extends: MWF.APP$Module,
  4. _loadUserInterface: function(){
  5. if (this.json.properties && this.json.properties["src"]){
  6. var value = this.json.properties["src"];
  7. if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1 || value.indexOf("x_cms_assemble_control")!=-1)){
  8. var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
  9. var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
  10. var host3 = MWF.Actions.getHost("x_cms_assemble_control");
  11. if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
  12. value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
  13. }else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
  14. value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
  15. }
  16. if (value.indexOf("/x_portal_assemble_surface")!==-1){
  17. value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  18. }else if (value.indexOf("x_portal_assemble_surface")!==-1){
  19. value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  20. }
  21. if (value.indexOf("/x_cms_assemble_control")!==-1){
  22. value = value.replace("/x_cms_assemble_control", host3+"/x_cms_assemble_control");
  23. }else if (value.indexOf("x_cms_assemble_control")!==-1){
  24. value = value.replace("x_cms_assemble_control", host3+"/x_cms_assemble_control");
  25. }
  26. value = o2.filterUrl(value);
  27. }
  28. try{
  29. this.node.set("src", value);
  30. }catch(e){}
  31. }else if (this.json.srcfile && this.json.srcfile!="none"){
  32. value = this.json.srcfile;
  33. if (typeOf(value)==="object"){
  34. var url = (value.portal) ? MWF.xDesktop.getPortalFileUr(value.id, value.portal) : MWF.xDesktop.getProcessFileUr(value.id, value.application);
  35. url = o2.filterUrl(url);
  36. this.node.set("src", url);
  37. }else{
  38. var host = MWF.Actions.getHost("x_portal_assemble_surface");
  39. var action = MWF.Actions.get("x_portal_assemble_surface");
  40. var uri = action.action.actions.readFile.uri;
  41. uri = uri.replace("{flag}", value);
  42. uri = uri.replace("{applicationFlag}", this.form.json.application);
  43. value = host+"/x_portal_assemble_surface"+uri;
  44. value = o2.filterUrl(value);
  45. this.node.set("src", value);
  46. }
  47. }else if (typeOf(this.json.src)=="object"){
  48. var src = MWF.xDesktop.getImageSrc( this.json.src.imageId );
  49. this.node.set("src", src);
  50. }
  51. },
  52. reset: function(){
  53. this._loadUserInterface();
  54. }
  55. });