123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- MWF.xDesktop.requireApp("process.Xform", "ImageClipper", null, false);
- MWF.xApplication.cms.Xform.ImageClipper = MWF.CMSImageClipper = new Class({
- Extends: MWF.APPImageClipper,
- selectImage: function(d, callback){
- var clipperType = this.json.clipperType || "unrestricted";
- var ratio = 1;
- var description = "";
- var maxSize = 500;
- if( clipperType == "unrestricted" ){
- ratio = 0;
- }else if( clipperType == "size" ){
- var width = ( this.json.imageWidth ) ? this.json.imageWidth.toInt() : 600;
- var height = ( this.json.imageHeight ) ? this.json.imageHeight.toInt() : 500;
- ratio = width / height;
- //maxSize = Math.max( width, height );
- if( !isNaN( width ) && !isNaN( height ) ){
- description = MWF.LP.widget.pictureSize.replace(/{width}/g, width).replace(/{height}/g, height);
- }
- }else if( clipperType == "ratio" ){
- ratio = this.json.imageRatio || 1;
- description = MWF.LP.widget.pictureRatio.replace(/{ratio}/g, ratio);
- }
- MWF.xDesktop.requireApp("process.Xform", "widget.ImageClipper", function(){
- this.imageClipper = new MWF.xApplication.process.Xform.widget.ImageClipper(this.form.app, {
- "style": "default",
- "aspectRatio" : ratio,
- "description" : description,
- "imageUrl" : d ? MWF.xDesktop.getImageSrc( d ) : "",
- "reference" : this.form.businessData.document.id,
- "referenceType": "cmsDocument",
- "resultMaxSize" : maxSize,
- "onChange" : function(){
- callback( { src : this.imageClipper.imageSrc, id : this.imageClipper.imageId } );
- }.bind(this)
- });
- this.imageClipper.load();
- }.bind(this));
- },
- getReferencetypeForMobile: function() {
- return "cmsDocument";
- },
- getReferenceForMobile: function() {
- return this.form.businessData.document.id;
- },
- validationConfigItem: function(routeName, data){
- var flag = (data.status=="all") ? true: (routeName == "publish");
- if (flag){
- var n = this.getData();
- var v = (data.valueType=="value") ? n : n.length;
- switch (data.operateor){
- case "isnull":
- if (!v){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "notnull":
- if (v){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "gt":
- if (v>data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "lt":
- if (v<data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "equal":
- if (v==data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "neq":
- if (v!=data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "contain":
- if (v.indexOf(data.value)!=-1){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "notcontain":
- if (v.indexOf(data.value)==-1){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- }
- }
- return true;
- }
-
- });
|