| 1 |
- MWF.xApplication.process.Xform.widget=MWF.xApplication.process.Xform.widget||{};MWF.require("MWF.widget.ImageClipper",null,false);MWF.xApplication.process.Xform.widget.ImageClipper=new Class({Implements:[Options,Events],Extends:MWF.widget.Common,options:{reference:"",referenceType:"",imageUrl:"",resultMaxSize:800,description:"",title:"Select Image",style:"default",aspectRatio:1},initialize:function(e,t){debugger;this.setOptions(t);this.app=e;this.path="/x_component_process_Xform/widget/$ImageClipper/";this.cssPath="/x_component_process_Xform/widget/$ImageClipper/"+this.options.style+"/css.wcss";this._loadCss()},load:function(e){this.data=e;var t={};var i="668";var s="510";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(){if(r.image.getResizedImage()){r.image.uploadImage(function(e){r.imageSrc=MWF.xDesktop.getImageSrc(e.id);r.imageId=e.id;r.fireEvent("change");this.close()}.bind(this))}else{r.imageSrc="";r.imageId="";r.fireEvent("change");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.aspectRatio,description:this.options.description,imageUrl:this.options.imageUrl,resultMaxSize:this.options.resultMaxSize,reference:this.options.reference,referenceType:this.options.referenceType,resetEnable:true});this.image.load(this.data)}.bind(this))}});
|