Update plupload; correct incorrect setTimeout call

This commit is contained in:
Daniel Munn 2012-06-07 11:18:49 +01:00
parent 83dd802e30
commit 4d29097c0e
18 changed files with 191 additions and 4786 deletions

View File

@ -118,7 +118,7 @@
}
if(pluploader.total.uploaded == pluploader.files.length) jQuery('#uploadform').submit();
else if(pluploader.total.uploaded + pluploader.total.failed == pluploader.files.length) setTimeout(2000, function() {jQuery('#uploadform').submit();})
else if(pluploader.total.uploaded + pluploader.total.failed == pluploader.files.length) setTimeout(function() {jQuery('#uploadform').submit();}, 2000)
else dmsfFileFieldCount++;
});
}

View File

@ -0,0 +1,14 @@
// Greek
plupload.addI18n({
'Select files' : 'Επιλέξτε Αρχεία',
'Add files to the upload queue and click the start button.' : 'Προσθήκη αρχείων στην ουρά μεταφόρτωσης',
'Filename' : 'Όνομα αρχείου',
'Status' : 'Κατάσταση',
'Size' : 'Μέγεθος',
'Add Files' : 'Προσθέστε αρχεία',
'Stop current upload' : 'Διακοπή τρέχουσας μεταφόρτωσης',
'Start uploading queue' : 'Εκκίνηση μεταφόρτωσης ουράς αρχείων',
'Drag files here.' : 'Σύρετε αρχεία εδώ',
'Start Upload': 'Εκκίνηση μεταφόρτωσης',
'Uploaded %d/%d files': 'Ανέβηκαν %d/%d αρχεία'
});

View File

@ -0,0 +1,33 @@
// Estonian translation, et.js
plupload.addI18n({
'Select files' : 'Vali faile',
'Add files to the upload queue and click the start button.' : 'Lisa failid üleslaadimise järjekorda ja klõpsa alustamise nupule.',
'Filename' : 'Failinimi',
'Status' : 'Olek',
'Size' : 'Suurus',
'Add files' : 'Lisa faile',
'Stop current upload' : 'Praeguse üleslaadimise peatamine',
'Start uploading queue' : 'Järjekorras ootavate failide üleslaadimise alustamine',
'Drag files here.' : 'Lohista failid siia.',
'Start upload' : 'Alusta üleslaadimist',
'Uploaded %d/%d files': 'Üles laaditud %d/%d',
'Stop upload': 'Peata üleslaadimine',
'Start upload': 'Alusta üleslaadimist',
'%d files queued': 'Järjekorras on %d faili',
'File: %s': 'Fail: %s',
'Close': 'Sulge',
'Using runtime: ': 'Kasutatakse varianti: ',
'File: %f, size: %s, max file size: %m': 'Fail: %f, suurus: %s, suurim failisuurus: %m',
'Upload element accepts only %d file(s) at a time. Extra files were stripped.': 'Üleslaadimise element saab vastu võtta ainult %d faili ühe korraga. Ülejäänud failid jäetakse laadimata.',
'Upload URL might be wrong or doesn\'t exist': 'Üleslaadimise URL võib olla vale või seda pole',
'Error: File too large: ': 'Viga: fail on liiga suur: ',
'Error: Invalid file extension: ': 'Viga: sobimatu faililaiend: ',
'File extension error.': 'Faililaiendi viga.',
'File size error.': 'Failisuuruse viga.',
'File count error.': 'Failide arvu viga.',
'Init error.': 'Lähtestamise viga.',
'HTTP Error.': 'HTTP ühenduse viga.',
'Security error.': 'Turvaviga.',
'Generic error.': 'Üldine viga.',
'IO error.': 'S/V (I/O) viga.'
});

View File

@ -0,0 +1,37 @@
// Persian
plupload.addI18n({
'Select files' : 'انتخاب فایل',
'Add files to the upload queue and click the start button.' : 'اضافه کنید فایل ها را به صف آپلود و دکمه شروع را کلیک کنید.',
'Filename' : 'نام فایل',
'Status' : 'وضعیت',
'Size' : 'سایز',
'Add Files' : 'افزودن فایل',
'Stop Upload' : 'توقف انتقال',
'Start Upload' : 'شروع انتقال',
'Add files' : 'افزودن فایل',
'Add files.' : 'افزودن فایل',
'Stop current upload' : 'توقف انتقال جاری',
'Start uploading queue' : 'شروع صف انتقال',
'Stop upload' : 'توقف انتقال',
'Start upload' : 'شروع انتقال',
'Uploaded %d/%d files': 'منتقل شد %d/%d از فایلها',
'N/A' : 'N/A',
'Drag files here.' : 'بکشید فایل ها رو به اینجا',
'File extension error.': 'خطا پیشوند فایل',
'File size error.': 'خطای سایز فایل',
'File count error.': 'خطای تعداد فایل',
'Init error.': 'خطا در استارت اسکریپت',
'HTTP Error.': 'HTTP خطای',
'Security error.': 'خطای امنیتی',
'Generic error.': 'خطای عمومی',
'IO error.': 'IO خطای',
'File: %s': ' فایل ها : %s',
'Close': 'بستن',
'%d files queued': '%d فایل در صف',
'Using runtime: ': 'استفاده میکنید از : ',
'File: %f, size: %s, max file size: %m': فایل: %f, سایز: %s, بزرگترین سایز فایل: %m',
'Upload element accepts only %d file(s) at a time. Extra files were stripped.': 'عنصر بارگذار فقط %d فایل رو در یک زمان می پذیرد. سایر فایل ها مجرد از این موضوع هستند.',
'Upload URL might be wrong or doesn\'t exist': 'آدرس آپلود اشتباه می باشد یا وجود ندارد',
'Error: File too large: ': 'خطا: فایل حجیم است :: ',
'Error: Invalid file extension: ': 'خطا پسوند فایل معتبر نمی باشد : '
});

View File

@ -0,0 +1,35 @@
// French-Canadian
plupload.addI18n({
'Select files' : 'Sélectionnez les fichiers',
'Add files to the upload queue and click the start button.' : 'Ajoutez des fichiers à la file d\'attente et appuyez sur le bouton démarrer.',
'Filename' : 'Nom du fichier',
'Status' : 'Statut',
'Size' : 'Taille',
'Add files' : 'Ajouter Fichiers',
'Stop current upload' : 'Arrêter le téléversement actuel',
'Start uploading queue' : 'Démarrer le téléversement',
'Uploaded %d/%d files': '%d/%d fichiers envoyés',
'N/A' : 'Non applicable',
'Drag files here.' : 'Glisser-déposer les fichiers ici',
'File extension error.': 'Erreur d\'extension de fichier',
'File size error.': 'Erreur de taille de fichier',
'Init error.': 'Erreur d\'initialisation',
'HTTP Error.': 'Erreur HTTP',
'Security error.': 'Erreur de sécurité',
'Generic error.': 'Erreur commune',
'IO error.': 'Erreur E/S',
'Stop Upload': 'Arrêter le téléversement',
'Add Files': 'Ajouter des fichiers',
'Start upload': 'Démarrer le téléversement',
'%d files queued': '%d fichiers en attente',
'File: %s':'Fichier: %s',
'Close':'Fermer',
'Using runtime:':'Moteur logiciel:',
'File: %f, size: %s, max file size: %m':'Fichier: %f, poids: %s, poids maximal: %m',
'Upload element accepts only %d file(s) at a time. Extra files were stripped.':'La file accepte %d fichier(s) à la fois. Les fichiers en trop sont ignorés',
'Upload URL might be wrong or doesn\'t exist':'L\'URL de téléversement est erroné ou inexistant',
'Error: File to large: ':'Fichier trop volumineux: ',
'Error: Invalid file extension: ':'Extension de fichier invalide: ',
'File size error.':'Erreur de taile de fichier',
'File count error.':'Erreur de décompte des fichiers'
});

View File

@ -0,0 +1,36 @@
// Republic of Korea
plupload.addI18n({
'Select files' : '파일 선택',
'Add files to the upload queue and click the start button.' : '파일을 업로드 큐에 추가하여 시작 버튼을 클릭하십시오.',
'Filename' : '파일 이름',
'Status' : '상태',
'Size' : '크기',
'Add Files' : '파일 추가',
'Stop Upload': '업로드 중지',
'Start Upload': '업로드',
'Add files': '파일 추가',
'Stop current upload': '현재 업로드를 정지',
'Start uploading queue': '업로드',
'Stop upload': '업로드 중지',
'Start upload': '업로드',
'Uploaded % d / % d files': '업로드 중 % d / % d 파일',
'N / A': 'N / A',
'Drag files here': '여기에 파일을 드래그',
'File extension error': '파일 확장자 오류',
'File size error': '파일 크기 오류',
'File count error': '이미지 : 오류',
'Init error': '초기화 오류',
'HTTP Error': 'HTTP 오류',
'Security error': '보안 오류',
'Generic error': '오류',
'IO error': 'IO 오류',
'File : % s': '파일 % s',
'Close': '닫기',
'% d files queued': '% d 파일이 추가되었습니다',
'Using runtime :': '모드',
'File : % f, size : % s, max file size : % m': '파일 : % f, 크기 : % s, 최대 파일 크기 : % m',
'Upload element accepts only % d file (s) at a time. Extra files were stripped': '업로드 가능한 파일의 수는 % d입니다. 불필요한 파일은 삭제되었습니다 ',
'Upload URL might be wrong or doesn \'t exist ':'업로드할 URL이 존재하지 않습니다 ',
'Error : File too large :': '오류 : 크기가 너무 큽니다',
'Error : Invalid file extension :': '오류 : 확장자가 허용되지 않습니다 :'
});

View File

@ -0,0 +1,24 @@
plupload.addI18n({
'Select files' : 'Wybierz pliki:',
'Add files to the upload queue and click the start button.' : 'Dodaj pliki i kliknij \'Rozpocznij transfer\'.',
'Filename' : 'Nazwa pliku',
'Status' : 'Status',
'Size' : 'Rozmiar',
'Add files' : 'Dodaj pliki',
'Stop current upload' : 'Przerwij aktualny transfer',
'Start uploading queue' : 'Rozpocznij wysyłanie',
'Uploaded %d/%d files': 'Wysłano %d/%d plików',
'N/A' : 'Nie dostępne',
'Drag files here.' : 'Przeciągnij tu pliki',
'File extension error.': 'Nieobsługiwany format pliku.',
'File size error.': 'Plik jest zbyt duży.',
'Init error.': 'Błąd inicjalizacji.',
'HTTP Error.': 'Błąd HTTP.',
'Security error.': 'Błąd bezpieczeństwa.',
'Generic error.': 'Błąd ogólny.',
'IO error.': 'Błąd IO.',
'Stop Upload': 'Przerwij transfer.',
'Add Files': 'Dodaj pliki',
'Start upload': 'Rozpocznij transfer.',
'%d files queued': '%d plików w kolejce.'
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}},init:function(g,i){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(n){var m,l,j=[],k,o;for(l=0;l<n.length;l++){k=n[l];o=a.guid();h[o]=k;j.push(new a.File(o,k.name,k.size))}if(l){g.trigger("FilesAdded",j)}}function b(){var j=false;g.bind("PostInit",function(){var n,l=d.drop_element,p=g.id+"_droptarget",k=document.getElementById(l),m;function q(s,r){e.DragAndDrop.AddDropTarget({id:s},function(t){e.DragAndDrop.AttachCallbacks({id:s,hover:function(u){if(!u&&r){r()}},drop:function(u){if(r){r()}f(u)}},function(){})})}function o(){document.getElementById(p).style.top="-1000px"}if(k){if(document.attachEvent&&(/MSIE/gi).test(navigator.userAgent)){n=document.createElement("div");n.setAttribute("id",p);a.extend(n.style,{position:"absolute",top:"-1000px",background:"red",filter:"alpha(opacity=0)",opacity:0});document.body.appendChild(n);a.addEvent(k,"dragenter",function(s){var r,t;r=document.getElementById(l);t=a.getPos(r);a.extend(document.getElementById(p).style,{top:t.y+"px",left:t.x+"px",width:r.offsetWidth+"px",height:r.offsetHeight+"px"})});q(p,o)}else{q(l)}}a.addEvent(document.getElementById(d.browse_button),"click",function(x){var r=[],t,s,w=d.filters,v,u;x.preventDefault();if(j){return}no_type_restriction:for(t=0;t<w.length;t++){v=w[t].extensions.split(",");for(s=0;s<v.length;s++){if(v[s]==="*"){r=[];break no_type_restriction}u=a.mimeTypes[v[s]];if(u&&a.inArray(u,r)===-1){r.push(a.mimeTypes[v[s]])}}}e.FileBrowse.OpenBrowseDialog({mimeTypes:r},function(y){if(y.success){f(y.value)}})});k=n=null});g.bind("CancelUpload",function(){e.Uploader.cancel({},function(){})});g.bind("DisableBrowse",function(k,l){j=l});g.bind("UploadFile",function(n,k){var m=h[k.id],s={},l=n.settings.chunk_size,o,p=[];function r(t,v){var u;if(k.status==a.FAILED){return}s.name=k.target_name||k.name;if(l){s.chunk=""+t;s.chunks=""+v}u=p.shift();e.Uploader.upload({url:n.settings.url,files:{file:u},cookies:document.cookies,postvars:a.extend(s,n.settings.multipart_params),progressCallback:function(y){var x,w=0;o[t]=parseInt(y.filePercent*u.size/100,10);for(x=0;x<o.length;x++){w+=o[x]}k.loaded=w;n.trigger("UploadProgress",k)}},function(x){var w,y;if(x.success){w=x.value.statusCode;if(l){n.trigger("ChunkUploaded",k,{chunk:t,chunks:v,response:x.value.body,status:w})}if(p.length>0){r(++t,v)}else{k.status=a.DONE;n.trigger("FileUploaded",k,{response:x.value.body,status:w});if(w>=400){n.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error."),file:k,status:w})}}}else{n.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:k,details:x.error})}})}function q(t){k.size=t.size;if(l){e.FileAccess.chunk({file:t,chunkSize:l},function(w){if(w.success){var x=w.value,u=x.length;o=Array(u);for(var v=0;v<u;v++){o[v]=0;p.push(x[v])}r(0,u)}})}else{o=Array(1);p.push(t);r(0,1)}}if(c&&/\.(png|jpg|jpeg)$/i.test(k.name)){BrowserPlus.ImageAlter.transform({file:m,quality:c.quality||90,actions:[{scale:{maxwidth:c.width,maxheight:c.height}}]},function(t){if(t.success){q(t.value.file)}})}else{q(m)}});i({success:true})}if(e){e.init(function(k){var j=[{service:"Uploader",version:"3"},{service:"DragAndDrop",version:"1"},{service:"FileBrowse",version:"1"},{service:"FileAccess",version:"2"}];if(c){j.push({service:"ImageAlter",version:"4"})}if(k.success){e.require({services:j},function(l){if(l.success){b()}else{i()}})}else{i()}})}else{i()}}})})(plupload);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(function(){if(window.google&&google.gears){return}var a=null;if(typeof GearsFactory!="undefined"){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(a.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if(!window.google){window.google={}}if(!google.gears){google.gears={factory:a}}})();(function(e,b,c,d){var f={};function a(h,j,l){var g,i,k,n;i=google.gears.factory.create("beta.canvas");try{i.decode(h);if(!j.width){j.width=i.width}if(!j.height){j.height=i.height}n=Math.min(width/i.width,height/i.height);if(n<1||(n===1&&l==="image/jpeg")){i.resize(Math.round(i.width*n),Math.round(i.height*n));if(j.quality){return i.encode(l,{quality:j.quality/100})}return i.encode(l)}}catch(m){}return h}c.runtimes.Gears=c.addRuntime("gears",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}},init:function(k,m){var l,h,g=false;if(!e.google||!google.gears){return m({success:false})}try{l=google.gears.factory.create("beta.desktop")}catch(j){return m({success:false})}function i(p){var o,n,q=[],r;for(n=0;n<p.length;n++){o=p[n];r=c.guid();f[r]=o.blob;q.push(new c.File(r,o.name,o.blob.length))}k.trigger("FilesAdded",q)}k.bind("PostInit",function(){var o=k.settings,n=b.getElementById(o.drop_element);if(n){c.addEvent(n,"dragover",function(p){l.setDropEffect(p,"copy");p.preventDefault()},k.id);c.addEvent(n,"drop",function(q){var p=l.getDragData(q,"application/x-gears-files");if(p){i(p.files)}q.preventDefault()},k.id);n=0}c.addEvent(b.getElementById(o.browse_button),"click",function(t){var s=[],q,p,r;t.preventDefault();if(g){return}no_type_restriction:for(q=0;q<o.filters.length;q++){r=o.filters[q].extensions.split(",");for(p=0;p<r.length;p++){if(r[p]==="*"){s=[];break no_type_restriction}s.push("."+r[p])}}l.openFiles(i,{singleFile:!o.multi_selection,filter:s})},k.id)});k.bind("CancelUpload",function(){if(h.abort){h.abort()}});k.bind("UploadFile",function(t,q){var v=0,u,r,s=0,p=t.settings.resize,n;if(p&&/\.(png|jpg|jpeg)$/i.test(q.name)){f[q.id]=a(f[q.id],p,/\.png$/i.test(q.name)?"image/png":"image/jpeg")}q.size=f[q.id].length;r=t.settings.chunk_size;n=r>0;u=Math.ceil(q.size/r);if(!n){r=q.size;u=1}function o(){var B,x=t.settings.multipart,w=0,A={name:q.target_name||q.name},y=t.settings.url;function z(D){var C,I="----pluploadboundary"+c.guid(),F="--",H="\r\n",E,G;if(x){h.setRequestHeader("Content-Type","multipart/form-data; boundary="+I);C=google.gears.factory.create("beta.blobbuilder");c.each(c.extend(A,t.settings.multipart_params),function(K,J){C.append(F+I+H+'Content-Disposition: form-data; name="'+J+'"'+H+H);C.append(K+H)});G=c.mimeTypes[q.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";C.append(F+I+H+'Content-Disposition: form-data; name="'+t.settings.file_data_name+'"; filename="'+q.name+'"'+H+"Content-Type: "+G+H+H);C.append(D);C.append(H+F+I+F+H);E=C.getAsBlob();w=E.length-D.length;D=E}h.send(D)}if(q.status==c.DONE||q.status==c.FAILED||t.state==c.STOPPED){return}if(n){A.chunk=v;A.chunks=u}B=Math.min(r,q.size-(v*r));if(!x){y=c.buildUrl(t.settings.url,A)}h=google.gears.factory.create("beta.httprequest");h.open("POST",y);if(!x){h.setRequestHeader("Content-Disposition",'attachment; filename="'+q.name+'"');h.setRequestHeader("Content-Type","application/octet-stream")}c.each(t.settings.headers,function(D,C){h.setRequestHeader(C,D)});h.upload.onprogress=function(C){q.loaded=s+C.loaded-w;t.trigger("UploadProgress",q)};h.onreadystatechange=function(){var C;if(h.readyState==4&&t.state!==c.STOPPED){if(h.status==200){C={chunk:v,chunks:u,response:h.responseText,status:h.status};t.trigger("ChunkUploaded",q,C);if(C.cancelled){q.status=c.FAILED;return}s+=B;if(++v>=u){q.status=c.DONE;t.trigger("FileUploaded",q,{response:h.responseText,status:h.status})}else{o()}}else{t.trigger("Error",{code:c.HTTP_ERROR,message:c.translate("HTTP Error."),file:q,chunk:v,chunks:u,status:h.status})}}};if(v<u){z(f[q.id].slice(v*r,B))}}o()});k.bind("DisableBrowse",function(n,o){g=o});k.bind("Destroy",function(n){var o,p,q={browseButton:n.settings.browse_button,dropElm:n.settings.drop_element};for(o in q){p=b.getElementById(q[o]);if(p){c.removeAllEvents(p,n.id)}}});m({success:true})}})})(window,document,plupload);

View File

@ -1,422 +1 @@
/**
* plupload.html4.js
*
* Copyright 2010, Ryan Demmer
* Copyright 2009, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
// JSLint defined globals
/*global plupload:false, window:false */
(function(window, document, plupload, undef) {
function getById(id) {
return document.getElementById(id);
}
/**
* HTML4 implementation. This runtime has no special features it uses an form that posts files into an hidden iframe.
*
* @static
* @class plupload.runtimes.Html4
* @extends plupload.Runtime
*/
plupload.runtimes.Html4 = plupload.addRuntime("html4", {
/**
* Returns a list of supported features for the runtime.
*
* @return {Object} Name/value object with supported features.
*/
getFeatures : function() {
// Only multipart feature
return {
multipart: true,
// WebKit and Gecko 2+ can trigger file dialog progrmmatically
triggerDialog: (plupload.ua.gecko && window.FormData || plupload.ua.webkit)
};
},
/**
* Initializes the upload runtime.
*
* @method init
* @param {plupload.Uploader} uploader Uploader instance that needs to be initialized.
* @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true.
*/
init : function(uploader, callback) {
uploader.bind("Init", function(up) {
var container = document.body, iframe, url = "javascript", currentFile,
input, currentFileId, fileIds = [], IE = /MSIE/.test(navigator.userAgent), mimes = [],
filters = up.settings.filters, i, ext, type, y;
// Convert extensions to mime types list
no_type_restriction:
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/,/);
for (y = 0; y < ext.length; y++) {
// If there's an asterisk in the list, then accept attribute is not required
if (ext[y] === '*') {
mimes = [];
break no_type_restriction;
}
type = plupload.mimeTypes[ext[y]];
if (type && plupload.inArray(type, mimes) === -1) {
mimes.push(type);
}
}
}
mimes = mimes.join(',');
function createForm() {
var form, input, bgcolor, browseButton;
// Setup unique id for form
currentFileId = plupload.guid();
// Save id for Destroy handler
fileIds.push(currentFileId);
// Create form
form = document.createElement('form');
form.setAttribute('id', 'form_' + currentFileId);
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
form.setAttribute("target", up.id + '_iframe');
form.style.position = 'absolute';
// Create input and set attributes
input = document.createElement('input');
input.setAttribute('id', 'input_' + currentFileId);
input.setAttribute('type', 'file');
input.setAttribute('accept', mimes);
input.setAttribute('size', 1);
browseButton = getById(up.settings.browse_button);
// Route click event to input element programmatically, if possible
if (up.features.triggerDialog && browseButton) {
plupload.addEvent(getById(up.settings.browse_button), 'click', function(e) {
if (!input.disabled) {
input.click();
}
e.preventDefault();
}, up.id);
}
// Set input styles
plupload.extend(input.style, {
width : '100%',
height : '100%',
opacity : 0,
fontSize: '99px' // force input element to be bigger then needed to occupy whole space
});
plupload.extend(form.style, {
overflow: 'hidden'
});
// Show the container if shim_bgcolor is specified
bgcolor = up.settings.shim_bgcolor;
if (bgcolor) {
form.style.background = bgcolor;
}
// no opacity in IE
if (IE) {
plupload.extend(input.style, {
filter : "alpha(opacity=0)"
});
}
// add change event
plupload.addEvent(input, 'change', function(e) {
var element = e.target, name, files = [], topElement;
if (element.value) {
getById('form_' + currentFileId).style.top = -0xFFFFF + "px";
// Get file name
name = element.value.replace(/\\/g, '/');
name = name.substring(name.length, name.lastIndexOf('/') + 1);
// Push files
files.push(new plupload.File(currentFileId, name));
// Clean-up events - they won't be needed anymore
if (!up.features.triggerDialog) {
plupload.removeAllEvents(form, up.id);
} else {
plupload.removeEvent(browseButton, 'click', up.id);
}
plupload.removeEvent(input, 'change', up.id);
// Create and position next form
createForm();
// Fire FilesAdded event
if (files.length) {
uploader.trigger("FilesAdded", files);
}
}
}, up.id);
// append to container
form.appendChild(input);
container.appendChild(form);
up.refresh();
}
function createIframe() {
var temp = document.createElement('div');
// Create iframe using a temp div since IE 6 won't be able to set the name using setAttribute or iframe.name
temp.innerHTML = '<iframe id="' + up.id + '_iframe" name="' + up.id + '_iframe" src="' + url + ':&quot;&quot;" style="display:none"></iframe>';
iframe = temp.firstChild;
container.appendChild(iframe);
// Add IFrame onload event
plupload.addEvent(iframe, 'load', function(e) {
var n = e.target, el, result;
// Ignore load event if there is no file
if (!currentFile) {
return;
}
try {
el = n.contentWindow.document || n.contentDocument || window.frames[n.id].document;
} catch (ex) {
// Probably a permission denied error
up.trigger('Error', {
code : plupload.SECURITY_ERROR,
message : plupload.translate('Security error.'),
file : currentFile
});
return;
}
// Get result
result = el.body.innerHTML;
// Assume no error
if (result) {
currentFile.status = plupload.DONE;
currentFile.loaded = 1025;
currentFile.percent = 100;
up.trigger('UploadProgress', currentFile);
up.trigger('FileUploaded', currentFile, {
response : result
});
}
}, up.id);
} // end createIframe
if (up.settings.container) {
container = getById(up.settings.container);
if (plupload.getStyle(container, 'position') === 'static') {
container.style.position = 'relative';
}
}
// Upload file
up.bind("UploadFile", function(up, file) {
var form, input;
// File upload finished
if (file.status == plupload.DONE || file.status == plupload.FAILED || up.state == plupload.STOPPED) {
return;
}
// Get the form and input elements
form = getById('form_' + file.id);
input = getById('input_' + file.id);
// Set input element name attribute which allows it to be submitted
input.setAttribute('name', up.settings.file_data_name);
// Store action
form.setAttribute("action", up.settings.url);
// Append multipart parameters
plupload.each(plupload.extend({name : file.target_name || file.name}, up.settings.multipart_params), function(value, name) {
var hidden = document.createElement('input');
plupload.extend(hidden, {
type : 'hidden',
name : name,
value : value
});
form.insertBefore(hidden, form.firstChild);
});
currentFile = file;
// Hide the current form
getById('form_' + currentFileId).style.top = -0xFFFFF + "px";
form.submit();
form.parentNode.removeChild(form);
});
up.bind('FileUploaded', function(up) {
up.refresh(); // just to get the form back on top of browse_button
});
up.bind('StateChanged', function(up) {
if (up.state == plupload.STARTED) {
createIframe();
}
if (up.state == plupload.STOPPED) {
window.setTimeout(function() {
plupload.removeEvent(iframe, 'load', up.id);
if (iframe.parentNode) { // #382
iframe.parentNode.removeChild(iframe);
}
}, 0);
}
});
// Refresh button, will reposition the input form
up.bind("Refresh", function(up) {
var browseButton, topElement, hoverClass, activeClass, browsePos, browseSize, inputContainer, inputFile, zIndex;
browseButton = getById(up.settings.browse_button);
if (browseButton) {
browsePos = plupload.getPos(browseButton, getById(up.settings.container));
browseSize = plupload.getSize(browseButton);
inputContainer = getById('form_' + currentFileId);
inputFile = getById('input_' + currentFileId);
plupload.extend(inputContainer.style, {
top : browsePos.y + 'px',
left : browsePos.x + 'px',
width : browseSize.w + 'px',
height : browseSize.h + 'px'
});
// for IE and WebKit place input element underneath the browse button and route onclick event
// TODO: revise when browser support for this feature will change
if (up.features.triggerDialog) {
if (plupload.getStyle(browseButton, 'position') === 'static') {
plupload.extend(browseButton.style, {
position : 'relative'
});
}
zIndex = parseInt(browseButton.style.zIndex, 10);
if (isNaN(zIndex)) {
zIndex = 0;
}
plupload.extend(browseButton.style, {
zIndex : zIndex
});
plupload.extend(inputContainer.style, {
zIndex : zIndex - 1
});
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers (FF, Opera),
browse_button loses interactivity, here we try to neutralize this issue highlighting browse_button
with a special class
TODO: needs to be revised as things will change */
hoverClass = up.settings.browse_button_hover;
activeClass = up.settings.browse_button_active;
topElement = up.features.triggerDialog ? browseButton : inputContainer;
if (hoverClass) {
plupload.addEvent(topElement, 'mouseover', function() {
plupload.addClass(browseButton, hoverClass);
}, up.id);
plupload.addEvent(topElement, 'mouseout', function() {
plupload.removeClass(browseButton, hoverClass);
}, up.id);
}
if (activeClass) {
plupload.addEvent(topElement, 'mousedown', function() {
plupload.addClass(browseButton, activeClass);
}, up.id);
plupload.addEvent(document.body, 'mouseup', function() {
plupload.removeClass(browseButton, activeClass);
}, up.id);
}
}
});
// Remove files
uploader.bind("FilesRemoved", function(up, files) {
var i, n;
for (i = 0; i < files.length; i++) {
n = getById('form_' + files[i].id);
if (n) {
n.parentNode.removeChild(n);
}
}
});
uploader.bind("DisableBrowse", function(up, disabled) {
var input = document.getElementById('input_' + currentFileId);
if (input) {
input.disabled = disabled;
}
});
// Completely destroy the runtime
uploader.bind("Destroy", function(up) {
var name, element, form,
elements = {
inputContainer: 'form_' + currentFileId,
inputFile: 'input_' + currentFileId,
browseButton: up.settings.browse_button
};
// Unbind event handlers
for (name in elements) {
element = getById(elements[name]);
if (element) {
plupload.removeAllEvents(element, up.id);
}
}
plupload.removeAllEvents(document.body, up.id);
// Remove mark-up
plupload.each(fileIds, function(id, i) {
form = getById('form_' + id);
if (form) {
container.removeChild(form);
}
});
});
// Create initial form
createForm();
});
callback({success : true});
}
});
})(window, document, plupload);
(function(d,a,b,c){function e(f){return a.getElementById(f)}b.runtimes.Html4=b.addRuntime("html4",{getFeatures:function(){return{multipart:true,triggerDialog:(b.ua.gecko&&d.FormData||b.ua.webkit)}},init:function(f,g){f.bind("Init",function(p){var j=a.body,n,h="javascript",k,x,q,z=[],r=/MSIE/.test(navigator.userAgent),t=[],m=p.settings.filters,o,l,s,w;no_type_restriction:for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(w=0;w<l.length;w++){if(l[w]==="*"){t=[];break no_type_restriction}s=b.mimeTypes[l[w]];if(s&&b.inArray(s,t)===-1){t.push(s)}}}t=t.join(",");function v(){var B,y,i,A;q=b.guid();z.push(q);B=a.createElement("form");B.setAttribute("id","form_"+q);B.setAttribute("method","post");B.setAttribute("enctype","multipart/form-data");B.setAttribute("encoding","multipart/form-data");B.setAttribute("target",p.id+"_iframe");B.style.position="absolute";y=a.createElement("input");y.setAttribute("id","input_"+q);y.setAttribute("type","file");y.setAttribute("accept",t);y.setAttribute("size",1);A=e(p.settings.browse_button);if(p.features.triggerDialog&&A){b.addEvent(e(p.settings.browse_button),"click",function(C){if(!y.disabled){y.click()}C.preventDefault()},p.id)}b.extend(y.style,{width:"100%",height:"100%",opacity:0,fontSize:"99px",cursor:"pointer"});b.extend(B.style,{overflow:"hidden"});i=p.settings.shim_bgcolor;if(i){B.style.background=i}if(r){b.extend(y.style,{filter:"alpha(opacity=0)"})}b.addEvent(y,"change",function(F){var D=F.target,C,E=[],G;if(D.value){e("form_"+q).style.top=-1048575+"px";C=D.value.replace(/\\/g,"/");C=C.substring(C.length,C.lastIndexOf("/")+1);E.push(new b.File(q,C));if(!p.features.triggerDialog){b.removeAllEvents(B,p.id)}else{b.removeEvent(A,"click",p.id)}b.removeEvent(y,"change",p.id);v();if(E.length){f.trigger("FilesAdded",E)}}},p.id);B.appendChild(y);j.appendChild(B);p.refresh()}function u(){var i=a.createElement("div");i.innerHTML='<iframe id="'+p.id+'_iframe" name="'+p.id+'_iframe" src="'+h+':&quot;&quot;" style="display:none"></iframe>';n=i.firstChild;j.appendChild(n);b.addEvent(n,"load",function(C){var D=C.target,B,y;if(!k){return}try{B=D.contentWindow.document||D.contentDocument||d.frames[D.id].document}catch(A){p.trigger("Error",{code:b.SECURITY_ERROR,message:b.translate("Security error."),file:k});return}y=B.body.innerHTML;if(y){k.status=b.DONE;k.loaded=1025;k.percent=100;p.trigger("UploadProgress",k);p.trigger("FileUploaded",k,{response:y})}},p.id)}if(p.settings.container){j=e(p.settings.container);if(b.getStyle(j,"position")==="static"){j.style.position="relative"}}p.bind("UploadFile",function(i,A){var B,y;if(A.status==b.DONE||A.status==b.FAILED||i.state==b.STOPPED){return}B=e("form_"+A.id);y=e("input_"+A.id);y.setAttribute("name",i.settings.file_data_name);B.setAttribute("action",i.settings.url);b.each(b.extend({name:A.target_name||A.name},i.settings.multipart_params),function(E,C){var D=a.createElement("input");b.extend(D,{type:"hidden",name:C,value:E});B.insertBefore(D,B.firstChild)});k=A;e("form_"+q).style.top=-1048575+"px";B.submit()});p.bind("FileUploaded",function(i){i.refresh()});p.bind("StateChanged",function(i){if(i.state==b.STARTED){u()}else{if(i.state==b.STOPPED){d.setTimeout(function(){b.removeEvent(n,"load",i.id);if(n.parentNode){n.parentNode.removeChild(n)}},0)}}b.each(i.files,function(A,y){if(A.status===b.DONE||A.status===b.FAILED){var B=e("form_"+A.id);if(B){B.parentNode.removeChild(B)}}})});p.bind("Refresh",function(y){var F,A,B,C,i,G,H,E,D;F=e(y.settings.browse_button);if(F){i=b.getPos(F,e(y.settings.container));G=b.getSize(F);H=e("form_"+q);E=e("input_"+q);b.extend(H.style,{top:i.y+"px",left:i.x+"px",width:G.w+"px",height:G.h+"px"});if(y.features.triggerDialog){if(b.getStyle(F,"position")==="static"){b.extend(F.style,{position:"relative"})}D=parseInt(F.style.zIndex,10);if(isNaN(D)){D=0}b.extend(F.style,{zIndex:D});b.extend(H.style,{zIndex:D-1})}B=y.settings.browse_button_hover;C=y.settings.browse_button_active;A=y.features.triggerDialog?F:H;if(B){b.addEvent(A,"mouseover",function(){b.addClass(F,B)},y.id);b.addEvent(A,"mouseout",function(){b.removeClass(F,B)},y.id)}if(C){b.addEvent(A,"mousedown",function(){b.addClass(F,C)},y.id);b.addEvent(a.body,"mouseup",function(){b.removeClass(F,C)},y.id)}}});f.bind("FilesRemoved",function(y,B){var A,C;for(A=0;A<B.length;A++){C=e("form_"+B[A].id);if(C){C.parentNode.removeChild(C)}}});f.bind("DisableBrowse",function(i,A){var y=a.getElementById("input_"+q);if(y){y.disabled=A}});f.bind("Destroy",function(i){var y,A,B,C={inputContainer:"form_"+q,inputFile:"input_"+q,browseButton:i.settings.browse_button};for(y in C){A=e(C[y]);if(A){b.removeAllEvents(A,i.id)}}b.removeAllEvents(a.body,i.id);b.each(z,function(E,D){B=e("form_"+E);if(B){j.removeChild(B)}})});v()});g({success:true})}})})(window,document,plupload);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.