Image.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. }
  27. try{
  28. this.node.set("src", value);
  29. }catch(e){}
  30. }else if (this.json.srcfile && this.json.srcfile!="none"){
  31. value = this.json.srcfile;
  32. if (typeOf(value)==="object"){
  33. var url = (value.portal) ? MWF.xDesktop.getPortalFileUr(value.id, value.portal) : MWF.xDesktop.getProcessFileUr(value.id, value.application);
  34. this.node.set("src", url);
  35. }else{
  36. var host = MWF.Actions.getHost("x_portal_assemble_surface");
  37. var action = MWF.Actions.get("x_portal_assemble_surface");
  38. var uri = action.action.actions.readFile.uri;
  39. uri = uri.replace("{flag}", value);
  40. uri = uri.replace("{applicationFlag}", this.form.json.application);
  41. value = host+"/x_portal_assemble_surface"+uri;
  42. this.node.set("src", value);
  43. }
  44. }else if (typeOf(this.json.src)=="object"){
  45. var src = MWF.xDesktop.getImageSrc( this.json.src.imageId );
  46. this.node.set("src", src);
  47. }
  48. },
  49. reset: function(){
  50. this._loadUserInterface();
  51. }
  52. });