From d8beb6f5301204cac3b74a827dbbc3082324de6f Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 9 Nov 2009 13:54:55 -0800 Subject: First cut at replacing swfupload with uploadify. Probably need to review the css and remove extra swfupload selectors. Also changed the dialog so tags can be entered for all the files being uploaded. Probably need to add better start processing so the batch is started before the first image is loaded. Maybe add a module variable so the number of simultaneous uploads can be initiated (currently hard ocded to 10. --- lib/uploadify/cancel.png | Bin 0 -> 603 bytes lib/uploadify/default.css | 10 +++++++ lib/uploadify/expressInstall.swf | Bin 0 -> 727 bytes lib/uploadify/jquery.uploadify.min.js | 26 +++++++++++++++++ lib/uploadify/uploadify.allglyphs.swf | Bin 0 -> 239838 bytes lib/uploadify/uploadify.css | 53 ++++++++++++++++++++++++++++++++++ lib/uploadify/uploadify.fla | Bin 0 -> 125952 bytes lib/uploadify/uploadify.swf | Bin 0 -> 23118 bytes 8 files changed, 89 insertions(+) create mode 100644 lib/uploadify/cancel.png create mode 100644 lib/uploadify/default.css create mode 100644 lib/uploadify/expressInstall.swf create mode 100644 lib/uploadify/jquery.uploadify.min.js create mode 100644 lib/uploadify/uploadify.allglyphs.swf create mode 100644 lib/uploadify/uploadify.css create mode 100644 lib/uploadify/uploadify.fla create mode 100644 lib/uploadify/uploadify.swf (limited to 'lib/uploadify') diff --git a/lib/uploadify/cancel.png b/lib/uploadify/cancel.png new file mode 100644 index 00000000..1c062ae5 Binary files /dev/null and b/lib/uploadify/cancel.png differ diff --git a/lib/uploadify/default.css b/lib/uploadify/default.css new file mode 100644 index 00000000..2173d9ec --- /dev/null +++ b/lib/uploadify/default.css @@ -0,0 +1,10 @@ +body { + font: 12px/16px Arial, Helvetica, sans-serif; +} +#fileQueue { + width: 400px; + height: 300px; + overflow: auto; + border: 1px solid #E5E5E5; + margin-bottom: 10px; +} \ No newline at end of file diff --git a/lib/uploadify/expressInstall.swf b/lib/uploadify/expressInstall.swf new file mode 100644 index 00000000..0fbf8fca Binary files /dev/null and b/lib/uploadify/expressInstall.swf differ diff --git a/lib/uploadify/jquery.uploadify.min.js b/lib/uploadify/jquery.uploadify.min.js new file mode 100644 index 00000000..43053119 --- /dev/null +++ b/lib/uploadify/jquery.uploadify.min.js @@ -0,0 +1,26 @@ +/* +Uploadify v2.1.0 +Release Date: August 24, 2009 + +Copyright (c) 2009 Ronnie Garcia, Travis Nickels + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('
');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('
')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('
'+fileName+" ("+k+l+')
')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d Date: Tue, 10 Nov 2009 12:49:13 -0800 Subject: Pass two of uploadify... remove the default.css file, removed the folder option and create a status area where succesful uploads are listed. --- lib/uploadify/default.css | 10 --- lib/uploadify/expressInstall.swf | Bin 727 -> 0 bytes modules/gallery/controllers/simple_uploader.php | 9 --- modules/gallery/css/gallery.css | 51 +++---------- modules/gallery/views/simple_uploader.html.php | 91 +++++++++++------------- 5 files changed, 53 insertions(+), 108 deletions(-) delete mode 100644 lib/uploadify/default.css delete mode 100644 lib/uploadify/expressInstall.swf (limited to 'lib/uploadify') diff --git a/lib/uploadify/default.css b/lib/uploadify/default.css deleted file mode 100644 index 2173d9ec..00000000 --- a/lib/uploadify/default.css +++ /dev/null @@ -1,10 +0,0 @@ -body { - font: 12px/16px Arial, Helvetica, sans-serif; -} -#fileQueue { - width: 400px; - height: 300px; - overflow: auto; - border: 1px solid #E5E5E5; - margin-bottom: 10px; -} \ No newline at end of file diff --git a/lib/uploadify/expressInstall.swf b/lib/uploadify/expressInstall.swf deleted file mode 100644 index 0fbf8fca..00000000 Binary files a/lib/uploadify/expressInstall.swf and /dev/null differ diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index 36464e24..bc508319 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -66,15 +66,6 @@ class Simple_Uploader_Controller extends Controller { log::success("content", t("Added a photo"), html::anchor("photos/$item->id", t("view photo"))); } - $tags = $this->input->post("tags"); - if (!empty($tags)) { - foreach (split(",", $tags) as $tag_name) { - $tag_name = trim($tag_name); - if ($tag_name) { - $tag = tag::add($item, $tag_name); - } - } - } } catch (Exception $e) { Kohana::log("alert", $e->__toString()); if (file_exists($temp_filename)) { diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index 077b21bc..066ab68a 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -56,15 +56,17 @@ /* Simple uploader ~~~~~~~~~~~~~~~~~~~~~~~ */ -#g-add-photos #SWFUpload_0 { - left: 134px; - position: relative; - top: -200px; +#g-add-photos-canvas { + border: 1px solid #ccc; + height: 200px; + margin: .5em 0; + overflow: auto; + width: 469px; } -#g-add-photos-canvas { +#g-add-photos-status { border: 1px solid #ccc; - height: 325px; + height: 125px; margin: .5em 0; overflow: auto; width: 469px; @@ -76,30 +78,9 @@ margin-left: .5em; } -#g-uploadqueue-infobar { - clear: both; -} - -#g-uploadqueue-infobar #g-cancelupload { - cursor: pointer; - display: none; -} - -#g-add-photos-queue .progressbar { - height: 4px; -} - -#g-add-photos-queue .status { - font-size: .75em; -} - -#g-add-photos-queue .box { - padding: .2em; -} - -#g-add-photos-queue .pending { - background-color: #e8e8e8; - border: 1px solid #d7d7d7; +#g-add-photos-status td { + text-align: left; + padding-left: 2em; } #g-add-photos-queue .error { @@ -107,16 +88,6 @@ border: 1px solid #ebb; } -#g-add-photos-queue .uploading { - background-color: #ff9; - border: 1px solid #ee8; -} - -#g-add-photos-queue .complete { - background-color: #cfc; - border: 1px solid #beb; -} - #g-add-photos p { margin: 0 } diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index 014919c3..a84a3b00 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -5,12 +5,10 @@ $("#g-add-photos-canvas").ready(function () { $("#g-uploadify").uploadify({ uploader: "", - folder: "", script: "id}") ?>", scriptData: Session::instance()->id(), "user_agent" => Input::instance()->server("HTTP_USER_AGENT"), - "tags" => "", "csrf" => $csrf)) ?>, fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4", fileDesc: for_js() ?>, @@ -31,6 +29,12 @@ .attr("disabled", "disabled"); return true; }, + onComplete: function(event, queueID, fileObj, response, data) { + $("#g-add-photos-status tbody").append( + "" + fileObj.name + "" + + Math.ceil(fileObj.size / 1000) + " KB" + "" + Math.floor(data.speed) + " KB/s "); + return true; + }, onSelect: function(event) { if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) { $("#g-upload-cancel-all") @@ -40,15 +44,6 @@ return true; } }); - - $('#g-add-photos-tags').autocomplete( - '', - {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1} - ); - $('#g-add-photos-tags').blur(function (event) { - $("#g-uploadify").uploadifySettings("scriptData", {"tags": $(this).val()}); - }); - }); @@ -57,47 +52,45 @@ html::purify($item->title))) ?> -
- -
    -
  • - suhosin.session.encrypt setting from Suhosin. You must disable this setting to upload photos.", +
    + +
      +
    • + suhosin.session.encrypt setting from Suhosin. You must disable this setting to upload photos.", array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt", - "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?> -
    • -
    - + "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?> +
  • +
+ -
-

- -

-
    - parents() as $i => $parent): ?> - > title) ?> - -
  • title) ?>
  • -
-
- - -
- - -
- +
+

+ +

+
    + parents() as $i => $parent): ?> + > title) ?> + +
  • title) ?>
  • +
+
-
-
+
+
+
+ + + +
+
- - - - - + + + + -- cgit v1.2.3