Roo/bootstrap/DocumentManager.js
authorjohn <john@roojs.com>
Fri, 14 Sep 2018 04:09:46 +0000 (12:09 +0800)
committerjohn <john@roojs.com>
Fri, 14 Sep 2018 04:09:46 +0000 (12:09 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/DocumentManager.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 47bf6b3..84ed6df 100644 (file)
@@ -118,7 +118,7 @@ Roo.bootstrap.DocumentManager = function(config){
         "previewrendered" : true,
         /**
          */
-        "previewResize" : true,
+        "previewResize" : true
         
     });
 };
index e54a328..f3fe10c 100644 (file)
@@ -28687,7 +28687,10 @@ Roo.bootstrap.DocumentManager = function(config){
          * @param {Roo.bootstrap.DocumentManager} this
          * @param {Object} file
          */
-        "previewrendered" : true
+        "previewrendered" : true,
+        /**
+         */
+        "previewResize" : true
         
     });
 };
@@ -29290,6 +29293,10 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
         var width = image.dom.naturalWidth || image.dom.width;
         var height = image.dom.naturalHeight || image.dom.height;
         
+        if(!this.previewResize) {
+            return;
+        }
+        
         if(width > height){
             file.target.addClass('wide');
             return;
index 4ca2ea6..8ef6113 100644 (file)
@@ -1212,7 +1212,7 @@ i+=1){c=J[i];if(c==='\u0000'){break;}K+=c;}return K;}return J;}});Roo.apply(Roo.
 ]},{tag:'div',cls:'btn-group roo-upload-cropbox-rotate-right',action:'rotate-right',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-repeat"></i>'}]}],ROTATOR:[{tag:'div',cls:'btn-group roo-upload-cropbox-rotate-left',action:'rotate-left',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-undo"></i>'}
 ]},{tag:'div',cls:'btn-group roo-upload-cropbox-rotate-right',action:'rotate-right',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-repeat"></i>'}]}]}});
 // Roo/bootstrap/DocumentManager.js
-Roo.bootstrap.DocumentManager=function(A){Roo.bootstrap.DocumentManager.superclass.constructor.call(this,A);this.files=[];this.delegates=[];this.addEvents({"initial":true,"inspect":true,"exception":true,"afterupload":true,"prepare":true,"remove":true,"refresh":true,"click":true,"edit":true,"beforeselectfile":true,"process":true,"previewrendered":true}
+Roo.bootstrap.DocumentManager=function(A){Roo.bootstrap.DocumentManager.superclass.constructor.call(this,A);this.files=[];this.delegates=[];this.addEvents({"initial":true,"inspect":true,"exception":true,"afterupload":true,"prepare":true,"remove":true,"refresh":true,"click":true,"edit":true,"beforeselectfile":true,"process":true,"previewrendered":true,"previewResize":true}
 );};Roo.extend(Roo.bootstrap.DocumentManager,Roo.bootstrap.Component,{boxes:0,inputName:'',thumbSize:300,multiple:true,files:false,method:'POST',url:'',paramName:'imageUpload',toolTipName:'filename',fieldLabel:'',labelWidth:4,labelAlign:'left',editable:true,delegates:false,xhr:false,labellg:0,labelmd:0,labelsm:0,labelxs:0,getAutoCreate:function(){var A={tag:'div',cls:'roo-document-manager',cn:[{tag:'input',cls:'roo-document-manager-selector',type:'file'}
 ,{tag:'div',cls:'roo-document-manager-uploader',cn:[{tag:'div',cls:'roo-document-manager-upload-btn',html:'<i class="fa fa-plus"></i>'}]}]};var B=[{tag:'div',cls:'column col-md-12',cn:A}];if(this.fieldLabel.length){B=[{tag:'div',cls:'column col-md-12',html:this.fieldLabel}
 ,{tag:'div',cls:'column col-md-12',cn:A}];if(this.labelAlign=='left'){B=[{tag:'div',cls:'column',html:this.fieldLabel},{tag:'div',cls:'column',cn:A}];if(this.labelWidth>12){B[0].style="width: "+this.labelWidth+'px';}if(this.labelWidth<13&&this.labelmd==0){this.labelmd=this.labelWidth;
@@ -1239,8 +1239,8 @@ if(typeof(A.id)!='undefined'&&A.id*1>0){this.arrange();return;}A.xhr=this.xhr;th
 }this.xhr.send(G);return;};this.uploadCancel();},uploadCancel:function(){if(this.xhr){this.xhr.abort();}this.delegates=[];Roo.each(this.managerEl.select('.roo-document-manager-loading',true).elements,function(el){el.remove();},this);this.arrange();},renderPreview:function(A){if(typeof(A.target)!='undefined'&&A.target){return A;
 }var B=encodeURI(baseURL+'/Images/Thumb/'+this.thumbSize+'/'+A.id+'/'+A.filename);var C=this.managerEl.createChild({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:A[this.toolTipName],cls:'roo-document-manager-thumb',html:'<img tooltip="'+A[this.toolTipName]+'" src="'+B+'">'}
 ,{tag:'button',cls:'close',html:'<i class="fa fa-times-circle"></i>'}]});var D=C.select('button.close',true).first();D.on('click',this.onRemove,this,A);A.target=C;var E=C.select('img',true).first();var F=this;E.dom.addEventListener("load",function(){F.onPreviewLoad(A,E);
-});E.on('click',this.onClick,this,A);this.fireEvent('previewrendered',this,A);return A;},onPreviewLoad:function(A,B){if(typeof(A.target)=='undefined'||!A.target){return;}var C=B.dom.naturalWidth||B.dom.width;var D=B.dom.naturalHeight||B.dom.height;if(C>D){A.target.addClass('wide');
-return;}A.target.addClass('tall');return;},uploadFromSource:function(A,B){this.xhr=new XMLHttpRequest();this.managerEl.createChild({tag:'div',cls:'roo-document-manager-loading',cn:[{tag:'div',tooltip:A.name,cls:'roo-document-manager-thumb',html:'<i class="fa fa-circle-o-notch fa-spin"></i>'}
+});E.on('click',this.onClick,this,A);this.fireEvent('previewrendered',this,A);return A;},onPreviewLoad:function(A,B){if(typeof(A.target)=='undefined'||!A.target){return;}var C=B.dom.naturalWidth||B.dom.width;var D=B.dom.naturalHeight||B.dom.height;if(!this.previewResize){return;
+}if(C>D){A.target.addClass('wide');return;}A.target.addClass('tall');return;},uploadFromSource:function(A,B){this.xhr=new XMLHttpRequest();this.managerEl.createChild({tag:'div',cls:'roo-document-manager-loading',cn:[{tag:'div',tooltip:A.name,cls:'roo-document-manager-thumb',html:'<i class="fa fa-circle-o-notch fa-spin"></i>'}
 ]});this.xhr.open(this.method,this.url,true);var C={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};for(var D in C){var E=C[D];if(E){this.xhr.setRequestHeader(D,E);}}var F=this;this.xhr.onload=function(){F.xhrOnLoad(F.xhr);
 };this.xhr.onerror=function(){F.xhrOnError(F.xhr);};var G=new FormData();G.append('returnHTML','NO');G.append('crop',B);if(typeof(A.filename)!='undefined'){G.append('filename',A.filename);}if(typeof(A.mimetype)!='undefined'){G.append('mimetype',A.mimetype);
 }Roo.log(G);if(this.fireEvent('prepare',this,G)!=false){this.xhr.send(G);};}});