| 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:"",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="770";var o="580";i=i.toInt();o=o.toInt();var s=this.app.content.getSize();var n=(s.x-i)/2;var a=(s.y-o)/2;if(n<0)n=0;if(a<0)a=0;if(layout.mobile){n=20;a=0}var p=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:o,html:"<div></div>",maskNode:this.app.content,container:this.app.content,buttonList:[{text:MWF.LP.process.button.ok,action:function(){p.image.uploadImage(function(e){p.imageSrc=MWF.xDesktop.getImageSrc(e.id);p.imageId=e.id;p.fireEvent("change");this.close()}.bind(this))}},{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,imageUrl:this.options.imageUrl,reference:this.options.reference,referenceType:this.options.referenceType,resetEnable:true});this.image.load(this.data)}.bind(this))}});
|