roojs-bootstrap.js
authoredward <edward@roojs.com>
Thu, 18 Feb 2016 08:04:37 +0000 (16:04 +0800)
committeredward <edward@roojs.com>
Thu, 18 Feb 2016 08:04:37 +0000 (16:04 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 4186702..efd21ec 100644 (file)
@@ -25166,6 +25166,12 @@ Roo.bootstrap.DocumentManager = function(config){
     Roo.bootstrap.DocumentManager.superclass.constructor.call(this, config);
     
     this.addEvents({
+        /**
+         * @event initial
+         * Fire when initial the DocumentManager
+         * @param {Roo.bootstrap.DocumentManager} this
+         */
+        "initial" : true,
         /**
          * @event inspect
          * inspect selected file
@@ -25327,6 +25333,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
         
         window.addEventListener("resize", function() { _this.refresh(); } );
         
+        this.fireEvent('initial', this);
     },
     
     onUpload : function(e)
index 13e1d42..d9cde59 100644 (file)
@@ -1038,13 +1038,13 @@ return;}if(E===1){return G.getValue(A,I,F);}J=[];for(i=0;i<E;i+=1){J[i]=G.getVal
 },size:8},9:{getValue:function(A,B,C){return A.getInt32(B,C);},size:4},10:{getValue:function(A,B,C){return A.getInt32(B,C)/A.getInt32(B+4,C);},size:8}},footer:{STANDARD:[{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-picture',action:'picture',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-picture-o"></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>'}]}],DOCUMENT:[{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-download',action:'download',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-download"></i>'}]},{tag:'div',cls:'btn-group roo-upload-cropbox-crop',action:'crop',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-crop"></i>'}]},{tag:'div',cls:'btn-group roo-upload-cropbox-trash',action:'trash',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-trash"></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.addEvents({"inspect":true,"exception":true,"prepare":true,"remove":true,"refresh":true,"click":true});};Roo.extend(Roo.bootstrap.DocumentManager,Roo.bootstrap.Component,{boxes:12,inputName:'',minWidth:300,minHeight:300,thumbSize:300,multiple:true,files:[],method:'POST',url:'',paramName:'imageUpload',fieldLabel:'',labelWidth:4,labelAlign:'left',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>'}]}]};
+Roo.bootstrap.DocumentManager=function(A){Roo.bootstrap.DocumentManager.superclass.constructor.call(this,A);this.addEvents({"initial":true,"inspect":true,"exception":true,"prepare":true,"remove":true,"refresh":true,"click":true});};Roo.extend(Roo.bootstrap.DocumentManager,Roo.bootstrap.Component,{boxes:12,inputName:'',minWidth:300,minHeight:300,thumbSize:300,multiple:true,files:[],method:'POST',url:'',paramName:'imageUpload',fieldLabel:'',labelWidth:4,labelAlign:'left',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 col-md-'+this.labelWidth,html:this.fieldLabel},{tag:'div',cls:'column col-md-'+(12-this.labelWidth),cn:A}];
 }}var C={tag:'div',cls:'row clearfix',cn:B};return C;},initEvents:function(){this.managerEl=this.el.select('.roo-document-manager',true).first();this.managerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.selectorEl=this.el.select('.roo-document-manager-selector',true).first();
 this.selectorEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.selectorEl.hide();if(this.multiple){this.selectorEl.attr('multiple','multiple');}this.selectorEl.on('change',this.onSelect,this);this.uploader=this.el.select('.roo-document-manager-uploader',true).first();
-this.uploader.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.uploader.on('click',this.onUpload,this);var A=this;window.addEventListener("resize",function(){A.refresh();});},onUpload:function(e){e.preventDefault();this.selectorEl.dom.click();
-},onSelect:function(e){e.preventDefault();if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return;}Roo.each(this.selectorEl.dom.files,function(A){if(this.fireEvent('inspect',this,A)!=false){this.files.push(A);}},this);
-this.process();},process:function(){this.selectorEl.dom.value='';if(!this.files.length){return;}if(this.files.length>12){this.files=this.files.slice(0,12);}var A=new XMLHttpRequest();Roo.each(this.files,function(G,H){if(typeof(G.id)!='undefined'&&G.id*1>0){return;
+this.uploader.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.uploader.on('click',this.onUpload,this);var A=this;window.addEventListener("resize",function(){A.refresh();});this.fireEvent('initial',this);},onUpload:function(e){e.preventDefault();
+this.selectorEl.dom.click();},onSelect:function(e){e.preventDefault();if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return;}Roo.each(this.selectorEl.dom.files,function(A){if(this.fireEvent('inspect',this,A)!=false){this.files.push(A);
+}},this);this.process();},process:function(){this.selectorEl.dom.value='';if(!this.files.length){return;}if(this.files.length>12){this.files=this.files.slice(0,12);}var A=new XMLHttpRequest();Roo.each(this.files,function(G,H){if(typeof(G.id)!='undefined'&&G.id*1>0){return;
 }G.xhr=A;this.managerEl.createChild({tag:'div',cls:'roo-document-manager-loading',cn:[{tag:'div',tooltip:G.name,cls:'roo-document-manager-thumb',html:'<i class="fa fa-spinner fa-pulse"></i>'}]});},this);if(this.files.length>11){this.uploader.hide();}var B={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};
 A.open(this.method,this.url,true);for(var C in B){var D=B[C];if(D){A.setRequestHeader(C,D);}}var E=this;A.onload=function(){E.xhrOnLoad(A);};A.onerror=function(){E.xhrOnError(A);};var F=new FormData();F.append('returnHTML','NO');Roo.each(this.files,function(G,H){if(typeof(G.id)!='undefined'&&G.id*1>0){return;
 }F.append(this.getParamName(H),G,G.name);},this);if(this.fireEvent('prepare',this,F)!=false){A.send(F);};},getParamName:function(i){if(!this.multiple){return this.paramName;}return this.paramName+"_"+i;},refresh:function(){Roo.each(this.managerEl.select('.roo-document-manager-loading',true).elements,function(el){el.remove();