uploader-queue-min.js revision 66900b43227bf441b6a6b1084af2c96ce2c747c8
YUI.add("uploader-queue",function(b){var g=b.Lang,k=b.bind,h=b.config.win,a,e,f,i,j,d;var c=function(l){a={};e=0;f=0;i=0;j=0;d=0;c.superclass.constructor.apply(this,arguments);};b.extend(c,b.Base,{initializer:function(l){},_uploadErrorHandler:function(m){var l=m;l.file=m.target;l.originEvent=m;this.fire("uploaderror",l);},_uploadCompleteHandler:function(o){i-=1;j+=o.target.get("size");delete a[o.target.get("id")];if(e<f){var m=this.get("fileList")[e],n=this.get("perFileParameters"),p=g.isArray(n)?n[e]:n;m.on("uploadprogress",this._uploadProgressHandler,this);m.on("uploadcomplete",this._uploadCompleteHandler,this);m.startUpload(this.get("uploadURL"),p,this.get("fileFieldName"));a[m.get("id")]=0;e+=1;}var l=o;l.file=o.target;l.originEvent=o;this.fire("uploadcomplete",l);if(i==0){this.fire("alluploadscomplete");}},_uploadProgressHandler:function(o){a[o.target.get("id")]=o.bytesLoaded;var n=o;n.originEvent=o;n.file=o.target;this.fire("uploadprogress",n);var m=j;b.each(a,function(p){m+=p;});var l=Math.min(100,Math.round(10000*m/d)/100);this.fire("totaluploadprogress",{bytesLoaded:m,bytesTotal:d,percentLoaded:l});},startUpload:function(){while(e<this.get("simUploads")&&e<f){var m=this.get("fileList")[e],l=m.get("id"),n=this.get("perFileParameters"),o=g.isArray(n)?n[e]:n;a[l]=0;m.on("uploadprogress",this._uploadProgressHandler,this);m.on("uploadcomplete",this._uploadCompleteHandler,this);m.on("uploaderror",this._uploadErrorHandler,this);m.startUpload(this.get("uploadURL"),o,this.get("fileFieldName"));e+=1;}},pauseUpload:function(){},restartUpload:function(){},cancelUpload:function(){}},{NAME:"uploaderqueue",ATTRS:{simUploads:{value:2,validator:function(m,l){return(m>=2&&m<=5);}},errorAction:{value:c.CONTINUE,validator:function(m,l){return(m===c.CONTINUE||m===c.STOP||m===c.RESTART);}},bytesUploaded:{readOnly:true,value:0},bytesTotal:{readOnly:true,value:0},fileList:{value:[],lazyAdd:false,setter:function(m){var l=m;b.each(l,function(n){d+=n.get("size");});f=i=l.length;return m;}},fileFieldName:{value:"Filedata"},uploadURL:{value:""},perFileParameters:{value:[]}},CONTINUE:"continue",STOP:"stop",RESTART:"restart"});b.namespace("Uploader");b.Uploader.Queue=c;},"@VERSION@",{requires:["base"]});