uploader 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +275 -0
- data/Rakefile +66 -0
- data/TODO +2 -0
- data/VERSION +1 -0
- data/app/controllers/uploader/uploads_controller.rb +122 -0
- data/app/helpers/uploader_helper.rb +17 -0
- data/app/views/uploads/_swf_javascript.html.erb +63 -0
- data/app/views/uploads/_swf_upload.html.erb +32 -0
- data/config/uploader_routes.rb +3 -0
- data/db/migrate/20090517040220_create_uploads.rb +38 -0
- data/lib/active_record/acts/uploader_upload.rb +235 -0
- data/lib/uploader/exceptions.rb +5 -0
- data/lib/uploader/initialize_routes.rb +8 -0
- data/lib/uploader/middleware/flash_session_cookie_middleware.rb +18 -0
- data/lib/uploader/mime_type_groups.rb +18 -0
- data/lib/uploader/tasks.rb +36 -0
- data/lib/uploader.rb +24 -0
- data/locales/ar.yml +17 -0
- data/locales/bg.yml +17 -0
- data/locales/ca.yml +17 -0
- data/locales/cs.yml +17 -0
- data/locales/da.yml +17 -0
- data/locales/de.yml +17 -0
- data/locales/el.yml +17 -0
- data/locales/en.yml +16 -0
- data/locales/es.yml +17 -0
- data/locales/fr.yml +17 -0
- data/locales/it.yml +17 -0
- data/locales/iw.yml +17 -0
- data/locales/ja.yml +17 -0
- data/locales/ko.yml +17 -0
- data/locales/lt.yml +17 -0
- data/locales/lv.yml +17 -0
- data/locales/nl.yml +17 -0
- data/locales/no.yml +18 -0
- data/locales/pl.yml +17 -0
- data/locales/pt.yml +17 -0
- data/locales/ro.yml +17 -0
- data/locales/ru.yml +17 -0
- data/locales/sk.yml +17 -0
- data/locales/sl.yml +17 -0
- data/locales/sr.yml +17 -0
- data/locales/sv.yml +17 -0
- data/locales/tl.yml +17 -0
- data/locales/uk.yml +17 -0
- data/locales/vi.yml +17 -0
- data/locales/zh-CN.yml +17 -0
- data/locales/zh-TW.yml +17 -0
- data/locales/zh.yml +17 -0
- data/pkg/uploader-0.1.0.gem +0 -0
- data/pkg/uploader-0.1.1.gem +0 -0
- data/pkg/uploader-0.1.2.gem +0 -0
- data/public/images/SWFUploadButton.png +0 -0
- data/public/images/file_icons/excel.gif +0 -0
- data/public/images/file_icons/file.gif +0 -0
- data/public/images/file_icons/mp3.gif +0 -0
- data/public/images/file_icons/pdf.gif +0 -0
- data/public/images/file_icons/text.gif +0 -0
- data/public/images/file_icons/word.gif +0 -0
- data/public/javascripts/swfupload/fileprogress.js +151 -0
- data/public/javascripts/swfupload/handlers.js +206 -0
- data/public/javascripts/swfupload/swfupload.cookies.js +53 -0
- data/public/javascripts/swfupload/swfupload.js +945 -0
- data/public/javascripts/swfupload/swfupload.queue.js +77 -0
- data/public/javascripts/swfupload/swfupload.swfobject.js +110 -0
- data/public/stylesheets/swfupload.css +26 -0
- data/public/swf/swfupload.swf +0 -0
- data/rails/init.rb +10 -0
- data/tasks/rails.rake +2 -0
- data/test/test_helper.rb +3 -0
- data/test/unit/upload_test.rb +5 -0
- data/uninstall.rb +0 -0
- data/uploader.gemspec +127 -0
- metadata +128 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
Queue Plug-in
|
3
|
+
|
4
|
+
Features:
|
5
|
+
*Adds a cancelQueue() method for cancelling the entire queue.
|
6
|
+
*All queued files are uploaded when startUpload() is called.
|
7
|
+
*If false is returned from uploadComplete then the queue upload is stopped.
|
8
|
+
If false is not returned (strict comparison) then the queue upload is continued.
|
9
|
+
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
|
10
|
+
Set the event handler with the queue_complete_handler setting.
|
11
|
+
|
12
|
+
*/
|
13
|
+
|
14
|
+
var SWFUpload;
|
15
|
+
if (typeof(SWFUpload) === "function") {
|
16
|
+
SWFUpload.queue = {};
|
17
|
+
|
18
|
+
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
19
|
+
return function () {
|
20
|
+
if (typeof(oldInitSettings) === "function") {
|
21
|
+
oldInitSettings.call(this);
|
22
|
+
}
|
23
|
+
|
24
|
+
this.customSettings.queue_cancelled_flag = false;
|
25
|
+
this.customSettings.queue_upload_count = 0;
|
26
|
+
|
27
|
+
this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
28
|
+
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
29
|
+
|
30
|
+
this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
|
31
|
+
};
|
32
|
+
})(SWFUpload.prototype.initSettings);
|
33
|
+
|
34
|
+
SWFUpload.prototype.startUpload = function (fileID) {
|
35
|
+
this.customSettings.queue_cancelled_flag = false;
|
36
|
+
this.callFlash("StartUpload", false, [fileID]);
|
37
|
+
};
|
38
|
+
|
39
|
+
SWFUpload.prototype.cancelQueue = function () {
|
40
|
+
this.customSettings.queue_cancelled_flag = true;
|
41
|
+
this.stopUpload();
|
42
|
+
|
43
|
+
var stats = this.getStats();
|
44
|
+
while (stats.files_queued > 0) {
|
45
|
+
this.cancelUpload();
|
46
|
+
stats = this.getStats();
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
SWFUpload.queue.uploadCompleteHandler = function (file) {
|
51
|
+
var user_upload_complete_handler = this.settings.user_upload_complete_handler;
|
52
|
+
var continueUpload;
|
53
|
+
|
54
|
+
if (file.file_status === SWFUpload.FILE_STATUS.COMPLETE) {
|
55
|
+
this.customSettings.queue_upload_count++;
|
56
|
+
}
|
57
|
+
|
58
|
+
if (typeof(user_upload_complete_handler) === "function") {
|
59
|
+
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
|
60
|
+
} else {
|
61
|
+
continueUpload = true;
|
62
|
+
}
|
63
|
+
|
64
|
+
if (continueUpload) {
|
65
|
+
var stats = this.getStats();
|
66
|
+
if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
|
67
|
+
this.startUpload();
|
68
|
+
} else if (this.customSettings.queue_cancelled_flag === false) {
|
69
|
+
this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
|
70
|
+
this.customSettings.queue_upload_count = 0;
|
71
|
+
} else {
|
72
|
+
this.customSettings.queue_cancelled_flag = false;
|
73
|
+
this.customSettings.queue_upload_count = 0;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
};
|
77
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/*
|
2
|
+
SWFUpload.SWFObject Plugin
|
3
|
+
|
4
|
+
Summary:
|
5
|
+
This plugin uses SWFObject to embed SWFUpload dynamically in the page. SWFObject provides accurate Flash Player detection and DOM Ready loading.
|
6
|
+
This plugin replaces the Graceful Degradation plugin.
|
7
|
+
|
8
|
+
Features:
|
9
|
+
* swfupload_load_failed_hander event
|
10
|
+
* swfupload_pre_load_handler event
|
11
|
+
* minimum_flash_version setting (default: "9.0.28")
|
12
|
+
* SWFUpload.onload event for early loading
|
13
|
+
|
14
|
+
Usage:
|
15
|
+
Provide handlers and settings as needed. When using the SWFUpload.SWFObject plugin you should initialize SWFUploading
|
16
|
+
in SWFUpload.onload rather than in window.onload. When initialized this way SWFUpload can load earlier preventing the UI flicker
|
17
|
+
that was seen using the Graceful Degradation plugin.
|
18
|
+
|
19
|
+
<script type="text/javascript">
|
20
|
+
var swfu;
|
21
|
+
SWFUpload.onload = function () {
|
22
|
+
swfu = new SWFUpload({
|
23
|
+
minimum_flash_version: "9.0.28",
|
24
|
+
swfupload_pre_load_handler: swfuploadPreLoad,
|
25
|
+
swfupload_load_failed_handler: swfuploadLoadFailed
|
26
|
+
});
|
27
|
+
};
|
28
|
+
</script>
|
29
|
+
|
30
|
+
Notes:
|
31
|
+
You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8.
|
32
|
+
The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met. Other issues such as missing SWF files, browser bugs
|
33
|
+
or corrupt Flash Player installations will not trigger this event.
|
34
|
+
The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found. It does not wait for SWFUpload to load and can
|
35
|
+
be used to prepare the SWFUploadUI and hide alternate content.
|
36
|
+
swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser.
|
37
|
+
Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made.
|
38
|
+
*/
|
39
|
+
|
40
|
+
|
41
|
+
/* SWFObject v2.0 rc4 <http://code.google.com/p/swfobject/>
|
42
|
+
Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
|
43
|
+
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
44
|
+
*/
|
45
|
+
var swfobject=function(){var X="undefined",P="object",a="visibility:visible",e="visibility:hidden",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",V="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,S=false,C=false;var Y=function(){var l=typeof g.getElementById!=X&&typeof g.getElementsByTagName!=X&&typeof g.createElement!=X&&typeof g.appendChild!=X&&typeof g.replaceChild!=X&&typeof g.removeChild!=X&&typeof g.cloneNode!=X,t=[0,0,0],n=null;if(typeof N.plugins!=X&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=X){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var d=function(){if(!Y.w3cdom){return }J(I);if(Y.ie&&Y.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=b("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);U()}}}}catch(j){}}if(Y.webkit&&typeof g.readyState!=X){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){U()}},10)}if(typeof g.addEventListener!=X){g.addEventListener("DOMContentLoaded",U,null)}M(U)}();function U(){if(S){return }if(Y.ie&&Y.win){var m=W("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=X){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=X){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=X){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(Y.pv[0]>0){var k=b(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(Y.webkit&&Y.webkit<312){T(k)}}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(Y.win||Y.mac)){D(H[j])}else{c(k)}}}}A("#"+m,a)}}function T(m){var k=m.getElementsByTagName(P)[0];if(k){var p=W("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(Y.ie&&Y.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=b(i);for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)})}}function D(j){C=true;var o=b(j.id);if(o){if(j.altContentId){var l=b(j.altContentId);if(l){L=l}}else{L=Z(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=Y.ie&&Y.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(Y.ie&&Y.win&&o.readyState!=4){var i=W("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function c(j){if(Y.ie&&Y.win&&j.readyState!=4){var i=W("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(Z(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(Z(j),j)}}function Z(n){var m=W("div");if(Y.win&&Y.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=b(q);if(typeof AE.id==X){AE.id=q}if(Y.ie&&Y.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=b(AE.id)}else{if(Y.webkit&&Y.webkit<312){var AA=W("embed");AA.setAttribute("type",V);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=W(P);s.setAttribute("type",V);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=W("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function b(i){return g.getElementById(i)}function W(i){return g.createElement(i)}function O(k){var j=Y.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(Y.ie&&Y.mac){return }var l=g.getElementsByTagName("head")[0],k=W("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(Y.ie&&Y.win)&&typeof g.createTextNode!=X){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(Y.ie&&Y.win&&typeof g.styleSheets!=X&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}return{registerObject:function(l,i,k){if(!Y.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;A("#"+l,e)},getObjectById:function(l){var i=null;if(Y.w3cdom&&S){var j=b(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=X)){i=j}else{if(typeof k.SetVariable!=X){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!Y.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){A("#"+u,e);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=X){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);A("#"+u,a)})}else{if(m&&!C&&O("6.0.65")&&(Y.win||Y.mac)){A("#"+u,e);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i);A("#"+u,a)})}}},getFlashPlayerVersion:function(){return{major:Y.pv[0],minor:Y.pv[1],release:Y.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(Y.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(Y.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=b(K);if(i){i.parentNode.replaceChild(L,i);L=null;C=false}}}}}();
|
46
|
+
|
47
|
+
|
48
|
+
var SWFUpload;
|
49
|
+
if (typeof(SWFUpload) === "function") {
|
50
|
+
SWFUpload.onload = function () {};
|
51
|
+
|
52
|
+
swfobject.addDomLoadEvent(function () {
|
53
|
+
if (typeof(SWFUpload.onload) === "function") {
|
54
|
+
SWFUpload.onload.call(window);
|
55
|
+
}
|
56
|
+
});
|
57
|
+
|
58
|
+
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
59
|
+
return function () {
|
60
|
+
if (typeof(oldInitSettings) === "function") {
|
61
|
+
oldInitSettings.call(this);
|
62
|
+
}
|
63
|
+
|
64
|
+
this.ensureDefault = function (settingName, defaultValue) {
|
65
|
+
this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
|
66
|
+
};
|
67
|
+
|
68
|
+
this.ensureDefault("minimum_flash_version", "9.0.28");
|
69
|
+
this.ensureDefault("swfupload_pre_load_handler", null);
|
70
|
+
this.ensureDefault("swfupload_load_failed_handler", null);
|
71
|
+
|
72
|
+
delete this.ensureDefault;
|
73
|
+
|
74
|
+
};
|
75
|
+
})(SWFUpload.prototype.initSettings);
|
76
|
+
|
77
|
+
|
78
|
+
SWFUpload.prototype.loadFlash = function (oldLoadFlash) {
|
79
|
+
return function () {
|
80
|
+
var hasFlash = swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version);
|
81
|
+
|
82
|
+
if (hasFlash) {
|
83
|
+
this.queueEvent("swfupload_pre_load_handler");
|
84
|
+
if (typeof(oldLoadFlash) === "function") {
|
85
|
+
oldLoadFlash.call(this);
|
86
|
+
}
|
87
|
+
} else {
|
88
|
+
this.queueEvent("swfupload_load_failed_handler");
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
}(SWFUpload.prototype.loadFlash);
|
93
|
+
|
94
|
+
SWFUpload.prototype.displayDebugInfo = function (oldDisplayDebugInfo) {
|
95
|
+
return function () {
|
96
|
+
if (typeof(oldDisplayDebugInfo) === "function") {
|
97
|
+
oldDisplayDebugInfo.call(this);
|
98
|
+
}
|
99
|
+
|
100
|
+
this.debug(
|
101
|
+
[
|
102
|
+
"SWFUpload.SWFObject Plugin settings:", "\n",
|
103
|
+
"\t", "minimum_flash_version: ", this.settings.minimum_flash_version, "\n",
|
104
|
+
"\t", "swfupload_pre_load_handler assigned: ", (typeof(this.settings.swfupload_pre_load_handler) === "function").toString(), "\n",
|
105
|
+
"\t", "swfupload_load_failed_handler assigned: ", (typeof(this.settings.swfupload_load_failed_handler) === "function").toString(), "\n",
|
106
|
+
].join("")
|
107
|
+
);
|
108
|
+
};
|
109
|
+
}(SWFUpload.prototype.displayDebugInfo);
|
110
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
div.uploadStatus{margin:5px;}
|
2
|
+
#swf_fs_upload_progress{font-size:1.3em;}
|
3
|
+
#deliver-uploads #upload-list{font-size:1.3em;}
|
4
|
+
#deliver-uploads #upload-list table {border-collapse:collapse;}
|
5
|
+
#deliver-uploads #upload-list td{padding:3px 6px;}
|
6
|
+
#deliver-uploads #upload-controls{width:365px;}
|
7
|
+
#deliver-uploads #swfupload_container .legend{color:#231F20;font-size:1.1em;font-weight:bold;}
|
8
|
+
|
9
|
+
#swfupload_container .progressWrapper{width:357px;overflow:hidden;}
|
10
|
+
#swfupload_container .progressContainer{margin:5px;padding:4px;border:solid 1px #E8E8E8;background-color:#F7F7F7;overflow:hidden;}
|
11
|
+
#swfupload_container .message{margin:1em 0;padding:10px 20px;border:solid 1px #FFDD99;background-color:#FFFFCC;overflow:hidden;}
|
12
|
+
#swfupload_container .red{border:solid 1px #B50000;background-color:#FFEBEB;}
|
13
|
+
#swfupload_container .green{border:solid 1px #DDF0DD;background-color:#EBFFEB;}
|
14
|
+
#swfupload_container .blue{border:solid 1px #CEE2F2;background-color:#F0F5FF;}
|
15
|
+
#swfupload_container .progressName{font-size:8pt;font-weight:700;color:#555;width:323px;height:14px;text-align:left;white-space:nowrap;overflow:hidden;}
|
16
|
+
#swfupload_container .progressBarInProgress,
|
17
|
+
#swfupload_container .progressBarComplete,
|
18
|
+
#swfupload_container .progressBarError{font-size:0;width:0%;height:2px;background-color:blue;margin-top:2px;}
|
19
|
+
#swfupload_container .progressBarComplete{width:100%;background-color:green;visibility:hidden;}
|
20
|
+
#swfupload_container .progressBarError{width:100%;background-color:red;visibility:hidden;}
|
21
|
+
#swfupload_container .progressBarStatus{margin-top:2px;width:337px;font-size:7pt;font-family:Arial;text-align:left;white-space:nowrap;}
|
22
|
+
#swfupload_container a.progressCancel{font-size:0;display:block;height:14px;width:14px;background-image:url(../images/cancelbutton.gif);background-repeat:no-repeat;background-position:-14px 0px;float:right;}
|
23
|
+
#swfupload_container a.progressCancel:hover{background-position:0px 0px;}
|
24
|
+
|
25
|
+
.swf-error-msg{background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px;}
|
26
|
+
#swf_cancel_button{margin-left: 2px; height: 22px; font-size: 8pt;}
|
Binary file
|
data/rails/init.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'uploader'
|
2
|
+
require 'uploader/initialize_routes'
|
3
|
+
|
4
|
+
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::UploaderUpload }
|
5
|
+
ActionController::Base.send :helper, UploaderHelper
|
6
|
+
I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locales', '*.{rb,yml}') ]
|
7
|
+
|
8
|
+
config.after_initialize do
|
9
|
+
ActionController::Dispatcher.middleware.use Uploader::FlashSessionCookieMiddleware, ActionController::Base.session_options[:key]
|
10
|
+
end
|
data/tasks/rails.rake
ADDED
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
File without changes
|
data/uploader.gemspec
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{uploader}
|
5
|
+
s.version = "0.1.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Justin Ball", "David South"]
|
9
|
+
s.date = %q{2009-05-22}
|
10
|
+
s.description = %q{Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload and Paperclip}
|
11
|
+
s.email = %q{justinball@gmail.com}
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
"MIT-LICENSE",
|
17
|
+
"README.rdoc",
|
18
|
+
"Rakefile",
|
19
|
+
"TODO",
|
20
|
+
"VERSION",
|
21
|
+
"app/controllers/uploader/uploads_controller.rb",
|
22
|
+
"app/helpers/uploader_helper.rb",
|
23
|
+
"app/views/uploads/_swf_javascript.html.erb",
|
24
|
+
"app/views/uploads/_swf_javascript.html.erb",
|
25
|
+
"app/views/uploads/_swf_upload.html.erb",
|
26
|
+
"app/views/uploads/_swf_upload.html.erb",
|
27
|
+
"config/uploader_routes.rb",
|
28
|
+
"db/migrate/20090517040220_create_uploads.rb",
|
29
|
+
"db/migrate/20090517040220_create_uploads.rb",
|
30
|
+
"lib/active_record/acts/uploader_upload.rb",
|
31
|
+
"lib/uploader.rb",
|
32
|
+
"lib/uploader/exceptions.rb",
|
33
|
+
"lib/uploader/exceptions.rb",
|
34
|
+
"lib/uploader/initialize_routes.rb",
|
35
|
+
"lib/uploader/initialize_routes.rb",
|
36
|
+
"lib/uploader/middleware/flash_session_cookie_middleware.rb",
|
37
|
+
"lib/uploader/middleware/flash_session_cookie_middleware.rb",
|
38
|
+
"lib/uploader/mime_type_groups.rb",
|
39
|
+
"lib/uploader/mime_type_groups.rb",
|
40
|
+
"lib/uploader/tasks.rb",
|
41
|
+
"lib/uploader/tasks.rb",
|
42
|
+
"locales/ar.yml",
|
43
|
+
"locales/bg.yml",
|
44
|
+
"locales/ca.yml",
|
45
|
+
"locales/cs.yml",
|
46
|
+
"locales/da.yml",
|
47
|
+
"locales/de.yml",
|
48
|
+
"locales/el.yml",
|
49
|
+
"locales/en.yml",
|
50
|
+
"locales/es.yml",
|
51
|
+
"locales/fr.yml",
|
52
|
+
"locales/it.yml",
|
53
|
+
"locales/iw.yml",
|
54
|
+
"locales/ja.yml",
|
55
|
+
"locales/ko.yml",
|
56
|
+
"locales/lt.yml",
|
57
|
+
"locales/lv.yml",
|
58
|
+
"locales/nl.yml",
|
59
|
+
"locales/no.yml",
|
60
|
+
"locales/pl.yml",
|
61
|
+
"locales/pt.yml",
|
62
|
+
"locales/ro.yml",
|
63
|
+
"locales/ru.yml",
|
64
|
+
"locales/sk.yml",
|
65
|
+
"locales/sl.yml",
|
66
|
+
"locales/sr.yml",
|
67
|
+
"locales/sv.yml",
|
68
|
+
"locales/tl.yml",
|
69
|
+
"locales/uk.yml",
|
70
|
+
"locales/vi.yml",
|
71
|
+
"locales/zh-CN.yml",
|
72
|
+
"locales/zh-TW.yml",
|
73
|
+
"locales/zh.yml",
|
74
|
+
"pkg/uploader-0.1.0.gem",
|
75
|
+
"pkg/uploader-0.1.1.gem",
|
76
|
+
"pkg/uploader-0.1.2.gem",
|
77
|
+
"public/images/SWFUploadButton.png",
|
78
|
+
"public/images/file_icons/excel.gif",
|
79
|
+
"public/images/file_icons/excel.gif",
|
80
|
+
"public/images/file_icons/file.gif",
|
81
|
+
"public/images/file_icons/file.gif",
|
82
|
+
"public/images/file_icons/mp3.gif",
|
83
|
+
"public/images/file_icons/mp3.gif",
|
84
|
+
"public/images/file_icons/pdf.gif",
|
85
|
+
"public/images/file_icons/pdf.gif",
|
86
|
+
"public/images/file_icons/text.gif",
|
87
|
+
"public/images/file_icons/text.gif",
|
88
|
+
"public/images/file_icons/word.gif",
|
89
|
+
"public/images/file_icons/word.gif",
|
90
|
+
"public/javascripts/swfupload/fileprogress.js",
|
91
|
+
"public/javascripts/swfupload/handlers.js",
|
92
|
+
"public/javascripts/swfupload/swfupload.cookies.js",
|
93
|
+
"public/javascripts/swfupload/swfupload.js",
|
94
|
+
"public/javascripts/swfupload/swfupload.queue.js",
|
95
|
+
"public/javascripts/swfupload/swfupload.swfobject.js",
|
96
|
+
"public/stylesheets/swfupload.css",
|
97
|
+
"public/swf/swfupload.swf",
|
98
|
+
"rails/init.rb",
|
99
|
+
"tasks/rails.rake",
|
100
|
+
"tasks/rails.rake",
|
101
|
+
"test/test_helper.rb",
|
102
|
+
"test/unit/upload_test.rb",
|
103
|
+
"uninstall.rb",
|
104
|
+
"uploader.gemspec"
|
105
|
+
]
|
106
|
+
s.has_rdoc = true
|
107
|
+
s.homepage = %q{http://github.com/jbasdf/uploader}
|
108
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
109
|
+
s.require_paths = ["lib"]
|
110
|
+
s.rubyforge_project = %q{uploader}
|
111
|
+
s.rubygems_version = %q{1.3.1}
|
112
|
+
s.summary = %q{SWFUpload + Paperclip wrapped in an engine with love.}
|
113
|
+
s.test_files = [
|
114
|
+
"test/test_helper.rb",
|
115
|
+
"test/unit/upload_test.rb"
|
116
|
+
]
|
117
|
+
|
118
|
+
if s.respond_to? :specification_version then
|
119
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
120
|
+
s.specification_version = 2
|
121
|
+
|
122
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
123
|
+
else
|
124
|
+
end
|
125
|
+
else
|
126
|
+
end
|
127
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: uploader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Ball
|
8
|
+
- David South
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-05-22 00:00:00 -06:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload and Paperclip
|
18
|
+
email: justinball@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- MIT-LICENSE
|
27
|
+
- README.rdoc
|
28
|
+
- Rakefile
|
29
|
+
- TODO
|
30
|
+
- VERSION
|
31
|
+
- app/controllers/uploader/uploads_controller.rb
|
32
|
+
- app/helpers/uploader_helper.rb
|
33
|
+
- app/views/uploads/_swf_javascript.html.erb
|
34
|
+
- app/views/uploads/_swf_upload.html.erb
|
35
|
+
- config/uploader_routes.rb
|
36
|
+
- db/migrate/20090517040220_create_uploads.rb
|
37
|
+
- lib/active_record/acts/uploader_upload.rb
|
38
|
+
- lib/uploader.rb
|
39
|
+
- lib/uploader/exceptions.rb
|
40
|
+
- lib/uploader/initialize_routes.rb
|
41
|
+
- lib/uploader/middleware/flash_session_cookie_middleware.rb
|
42
|
+
- lib/uploader/mime_type_groups.rb
|
43
|
+
- lib/uploader/tasks.rb
|
44
|
+
- locales/ar.yml
|
45
|
+
- locales/bg.yml
|
46
|
+
- locales/ca.yml
|
47
|
+
- locales/cs.yml
|
48
|
+
- locales/da.yml
|
49
|
+
- locales/de.yml
|
50
|
+
- locales/el.yml
|
51
|
+
- locales/en.yml
|
52
|
+
- locales/es.yml
|
53
|
+
- locales/fr.yml
|
54
|
+
- locales/it.yml
|
55
|
+
- locales/iw.yml
|
56
|
+
- locales/ja.yml
|
57
|
+
- locales/ko.yml
|
58
|
+
- locales/lt.yml
|
59
|
+
- locales/lv.yml
|
60
|
+
- locales/nl.yml
|
61
|
+
- locales/no.yml
|
62
|
+
- locales/pl.yml
|
63
|
+
- locales/pt.yml
|
64
|
+
- locales/ro.yml
|
65
|
+
- locales/ru.yml
|
66
|
+
- locales/sk.yml
|
67
|
+
- locales/sl.yml
|
68
|
+
- locales/sr.yml
|
69
|
+
- locales/sv.yml
|
70
|
+
- locales/tl.yml
|
71
|
+
- locales/uk.yml
|
72
|
+
- locales/vi.yml
|
73
|
+
- locales/zh-CN.yml
|
74
|
+
- locales/zh-TW.yml
|
75
|
+
- locales/zh.yml
|
76
|
+
- pkg/uploader-0.1.0.gem
|
77
|
+
- pkg/uploader-0.1.1.gem
|
78
|
+
- pkg/uploader-0.1.2.gem
|
79
|
+
- public/images/SWFUploadButton.png
|
80
|
+
- public/images/file_icons/excel.gif
|
81
|
+
- public/images/file_icons/file.gif
|
82
|
+
- public/images/file_icons/mp3.gif
|
83
|
+
- public/images/file_icons/pdf.gif
|
84
|
+
- public/images/file_icons/text.gif
|
85
|
+
- public/images/file_icons/word.gif
|
86
|
+
- public/javascripts/swfupload/fileprogress.js
|
87
|
+
- public/javascripts/swfupload/handlers.js
|
88
|
+
- public/javascripts/swfupload/swfupload.cookies.js
|
89
|
+
- public/javascripts/swfupload/swfupload.js
|
90
|
+
- public/javascripts/swfupload/swfupload.queue.js
|
91
|
+
- public/javascripts/swfupload/swfupload.swfobject.js
|
92
|
+
- public/stylesheets/swfupload.css
|
93
|
+
- public/swf/swfupload.swf
|
94
|
+
- rails/init.rb
|
95
|
+
- tasks/rails.rake
|
96
|
+
- test/test_helper.rb
|
97
|
+
- test/unit/upload_test.rb
|
98
|
+
- uninstall.rb
|
99
|
+
- uploader.gemspec
|
100
|
+
has_rdoc: true
|
101
|
+
homepage: http://github.com/jbasdf/uploader
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options:
|
104
|
+
- --charset=UTF-8
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: "0"
|
112
|
+
version:
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: "0"
|
118
|
+
version:
|
119
|
+
requirements: []
|
120
|
+
|
121
|
+
rubyforge_project: uploader
|
122
|
+
rubygems_version: 1.3.1
|
123
|
+
signing_key:
|
124
|
+
specification_version: 2
|
125
|
+
summary: SWFUpload + Paperclip wrapped in an engine with love.
|
126
|
+
test_files:
|
127
|
+
- test/test_helper.rb
|
128
|
+
- test/unit/upload_test.rb
|