Image.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.Image", null, false);
  3. MWF.xApplication.cms.FormDesigner.Module.Image = MWF.CMSFCImage = new Class({
  4. Extends: MWF.FCImage,
  5. Implements : [MWF.CMSFCMI],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_cms_FormDesigner/Module/Image/image.html"
  9. },
  10. _setEditStyle_custom: function(name){
  11. if (name=="src"){
  12. if (this.json.src){
  13. var src = this.json.src.imageSrc;
  14. this.node.src = src;
  15. this.setPropertiesOrStyles("styles");
  16. }else{
  17. this.node.set("src", this.path +this.options.style+"/icon/image1.png");
  18. }
  19. }
  20. if (name=="srcfile"){
  21. debugger;
  22. var value = this.json.srcfile;
  23. if (value==="none"){
  24. this.json.srcfile = "";
  25. value = "";
  26. }
  27. if (value){
  28. if (typeOf(value)==="object"){
  29. var url;
  30. if( value.application ){ //兼容之前的版本,都是从流程中获取的
  31. url = MWF.xDesktop.getProcessFileUr(value.id, value.application);
  32. }else{
  33. url = MWF.xDesktop.getCMSFileUr(value.id, value.appId);
  34. }
  35. try{
  36. this.node.set("src", url);
  37. }catch(e){}
  38. }else{
  39. var host = MWF.Actions.getHost("x_processplatform_assemble_surface");
  40. var action = MWF.Actions.get("x_processplatform_assemble_surface");
  41. var uri = action.action.actions.readFile.uri;
  42. uri = uri.replace("{flag}", value);
  43. uri = uri.replace("{applicationFlag}", this.form.json.application);
  44. value = host+"/x_processplatform_assemble_surface"+uri;
  45. try{
  46. this.node.set("src", value);
  47. }catch(e){}
  48. }
  49. }else{
  50. if (this.json.properties.src) {
  51. this._setEditStyle_custom("properties");
  52. }else if (this.json.src){
  53. this._setEditStyle_custom("src");
  54. }else{
  55. this.node.set("src", this.path +this.options.style+"/icon/image1.png");
  56. }
  57. }
  58. }
  59. if (name=="properties"){
  60. this._setNodeProperty();
  61. }
  62. }
  63. });