try and get ctrl-enter to add a clear all
[roojs1] / Roo / bootstrap / DocumentManager.js
index 985f408..dce4442 100644 (file)
@@ -108,7 +108,17 @@ Roo.bootstrap.DocumentManager = function(config){
          * @param {Roo.bootstrap.DocumentManager} this
          * @param {Object} file
          */
-        "process" : true
+        "process" : true,
+        /**
+         * @event previewrendered
+         * Fire when preview rendered
+         * @param {Roo.bootstrap.DocumentManager} this
+         * @param {Object} file
+         */
+        "previewrendered" : true,
+        /**
+         */
+        "previewResize" : true
         
     });
 };
@@ -208,23 +218,23 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
                 }
 
                 if(this.labellg > 0){
-                    labelCfg.cls += ' col-lg-' + this.labellg;
-                    contentCfg.cls += ' col-lg-' + (12 - this.labellg);
+                    content[0].cls += ' col-lg-' + this.labellg;
+                    content[1].cls += ' col-lg-' + (12 - this.labellg);
                 }
 
                 if(this.labelmd > 0){
-                    labelCfg.cls += ' col-md-' + this.labelmd;
-                    contentCfg.cls += ' col-md-' + (12 - this.labelmd);
+                    content[0].cls += ' col-md-' + this.labelmd;
+                    content[1].cls += ' col-md-' + (12 - this.labelmd);
                 }
 
                 if(this.labelsm > 0){
-                    labelCfg.cls += ' col-sm-' + this.labelsm;
-                    contentCfg.cls += ' col-sm-' + (12 - this.labelsm);
+                    content[0].cls += ' col-sm-' + this.labelsm;
+                    content[1].cls += ' col-sm-' + (12 - this.labelsm);
                 }
 
                 if(this.labelxs > 0){
-                    labelCfg.cls += ' col-xs-' + this.labelxs;
-                    contentCfg.cls += ' col-xs-' + (12 - this.labelxs);
+                    content[0].cls += ' col-xs-' + this.labelxs;
+                    content[1].cls += ' col-xs-' + (12 - this.labelxs);
                 }
                 
             }
@@ -275,6 +285,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
         this.progressDialog = new Roo.bootstrap.Modal({
             cls : 'roo-document-manager-progress-dialog',
             allow_close : false,
+            animate : false,
             title : '',
             buttons : [
                 {
@@ -344,7 +355,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
     {
         this.selectorEl.dom.value = '';
         
-        if(!this.files.length){
+        if(!this.files || !this.files.length){
             return;
         }
         
@@ -662,6 +673,8 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
             return file;
         }
         
+        var img_src = encodeURI(baseURL +'/Images/Thumb/' + this.thumbSize + '/' + file.id + '/' + file.filename);
+        
         var previewEl = this.managerEl.createChild({
             tag : 'div',
             cls : 'roo-document-manager-preview',
@@ -670,7 +683,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
                     tag : 'div',
                     tooltip : file[this.toolTipName],
                     cls : 'roo-document-manager-thumb',
-                    html : '<img tooltip="' + file[this.toolTipName] + '" src="' + baseURL +'/Images/Thumb/' + this.thumbSize + '/' + file.id + '/' + file.filename + '">'
+                    html : '<img tooltip="' + file[this.toolTipName] + '" src="' + img_src + '">'
                 },
                 {
                     tag : 'button',
@@ -694,6 +707,8 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
         
         image.on('click', this.onClick, this, file);
         
+        this.fireEvent('previewrendered', this, file);
+        
         return file;
         
     },
@@ -707,6 +722,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;
@@ -776,6 +795,8 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
             formData.append('mimetype', file.mimetype);
         }
         
+        Roo.log(formData);
+        
         if(this.fireEvent('prepare', this, formData) != false){
             this.xhr.send(formData);
         };