| 1 |
- MWF.xApplication.process.FormDesigner.widget=MWF.xApplication.process.FormDesigner.widget||{};MWF.require("MWF.widget.ImageClipper",null,false);MWF.xApplication.process.FormDesigner.widget.ImageClipper=new Class({Implements:[Options,Events],Extends:MWF.widget.Common,options:{title:"Select Image",style:"default",width:"92",height:"73",referenceType:"",reference:"",imageUrl:""},initialize:function(e,t){debugger;this.setOptions(t);this.app=e;this.path="/x_component_process_FormDesigner/widget/$ImageClipper/";this.cssPath="/x_component_process_FormDesigner/widget/$ImageClipper/"+this.options.style+"/css.wcss";this._loadCss()},load:function(e){this.data=e;var t={};var i=t.width||"770";var s=t.height||"580";i=i.toInt();s=s.toInt();var o=this.app.content.getSize();var n=(o.x-i)/2;var a=(o.y-s)/2;if(n<0)n=0;if(a<0)a=0;if(layout.mobile){n=20;a=0}var r=this;MWF.require("MWF.xDesktop.Dialog",function(){var e=new MWF.xDesktop.Dialog({title:this.options.title||"Select Image",style:t.style||"image",top:a,left:n-20,fromTop:a,fromLeft:n-20,width:i,height:s,html:"<div></div>",maskNode:this.app.content,container:this.app.content,buttonList:[{text:MWF.LP.process.button.ok,action:function(){r.image.uploadImage(function(e){r.imageSrc=MWF.xDesktop.getImageSrc(e.id);r.imageId=e.id;r.fireEvent("change");this.close()}.bind(this));this.close()}},{text:MWF.LP.process.button.cancel,action:function(){this.close()}}]});e.show();this.image=new MWF.widget.ImageClipper(e.content.getFirst(),{aspectRatio:this.options.width.toInt()/this.options.height.toInt(),imageUrl:this.options.imageUrl,reference:this.options.reference,referenceType:this.options.referenceType,resetEnable:true});this.image.load(this.data)}.bind(this))},uploadImage:function(){}});
|