aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-04-14 14:08:19 +0000
committerplegall <plg@piwigo.org>2010-04-14 14:08:19 +0000
commitce82578b0478108e16b8d6e9a16216df68f2608b (patch)
treed53a0838ab4962a034f88f1aacd0b71165a7d743
parent535f7933a830ea058ae325ce3489b9c12f86c852 (diff)
feature 1601: improve error feedback on multiple upload : use jGrowl jQuery
plugin to display individual state for each uploaded file. git-svn-id: http://piwigo.org/svn/trunk@5848 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/photos_add_direct.tpl72
-rw-r--r--admin/themes/default/uploadify.jGrowl.css147
-rw-r--r--themes/default/js/plugins/jquery.jgrowl_minimized.js9
3 files changed, 228 insertions, 0 deletions
diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl
index e80024e5b..652bada78 100644
--- a/admin/themes/default/template/photos_add_direct.tpl
+++ b/admin/themes/default/template/photos_add_direct.tpl
@@ -1,10 +1,13 @@
{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
+{known_script id="jquery.jgrowl" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.jgrowl_minimized.js"}
{if $upload_mode eq 'multiple'}
<script type="text/javascript" src="{$uploadify_path}/swfobject.js"></script>
<script type="text/javascript" src="{$uploadify_path}/jquery.uploadify.v2.1.0.min.js"></script>
{/if}
+<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/themes/default/uploadify.jGrowl.css">
+
{literal}
<script type="text/javascript">
jQuery(document).ready(function(){
@@ -105,6 +108,75 @@ var buttonText = 'Browse';
else {
$("input[name=submit_upload]").click();
}
+ },
+ onError: function (event, queueID ,fileObj, errorObj) {
+ var msg;
+ if (errorObj.status == 404) {
+ alert('Could not find upload script.');
+ msg = 'Could not find upload script.';
+ }
+ else if (errorObj.type === "HTTP") {
+ msg = errorObj.type+": "+errorObj.status;
+ }
+ else if (errorObj.type ==="File Size") {
+ msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB';
+ }
+ else {
+ msg = errorObj.type+": "+errorObj.text;
+ }
+
+ $.jGrowl(
+ '<p></p>'+msg,
+ {
+ theme: 'error',
+ header: 'ERROR',
+ sticky: true
+ }
+ );
+
+ $("#fileUploadgrowl" + queueID).fadeOut(
+ 250,
+ function() {
+ $("#fileUploadgrowl" + queueID).remove()
+ }
+ );
+ return false;
+ },
+ onCancel: function (a, b, c, d) {
+ var msg = "Cancelled uploading: "+c.name;
+ $.jGrowl(
+ '<p></p>'+msg,
+ {
+ theme: 'warning',
+ header: 'Cancelled Upload',
+ life: 4000,
+ sticky: false
+ }
+ );
+ },
+ onClearQueue: function (a, b) {
+ var msg = "Cleared "+b.fileCount+" files from queue";
+ $.jGrowl(
+ '<p></p>'+msg,
+ {
+ theme: 'warning',
+ header: 'Cleared Queue',
+ life: 4000,
+ sticky: false
+ }
+ );
+ },
+ onComplete: function (a, b ,c, d, e) {
+ var size = Math.round(c.size/1024);
+ $.jGrowl(
+ '<p></p>'+c.name+' - '+size+'KB',
+ {
+ theme: 'success',
+ header: 'Upload Complete',
+ life: 4000,
+ sticky: false
+ }
+ );
}
});
diff --git a/admin/themes/default/uploadify.jGrowl.css b/admin/themes/default/uploadify.jGrowl.css
new file mode 100644
index 000000000..954531387
--- /dev/null
+++ b/admin/themes/default/uploadify.jGrowl.css
@@ -0,0 +1,147 @@
+/*
+Default jGrowl style definitions for:
+
+Uploadify v1.6.2
+Copyright (C) 2009 by Ronnie Garcia
+Co-developed by Travis Nickels
+*/
+
+/** Uploadify Styling here Styling **/
+div.jGrowl div.success {
+ background: url(images/Check.png) no-repeat 6px 6px;
+}
+div.jGrowl div.error {
+ background: url(images/Error.png) no-repeat 6px 6px;
+}
+div.jGrowl div.warning {
+ background: url(images/Alert.png) no-repeat 6px 6px;
+}
+
+div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer {
+ background-color: #000;
+ color: #fff;
+ opacity: .85;
+ filter: alpha(opacity = 85);
+ zoom: 1;
+ width: 300px;
+ padding: 10px;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ text-align: left;
+ display: none;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+
+/* original jGrowl css styling */
+
+div.center div.jGrowl-notification, div.center div.jGrowl-closer {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+div.jGrowl div.jGrowl-notification {
+ min-height: 40px;
+}
+
+div.jGrowl div.jGrowl-notification div.close {
+ float: right;
+ font-weight: bold;
+ font-size: 12px;
+ cursor: pointer;
+}
+
+div.jGrowl div.jGrowl-closer {
+ height: 15px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ cursor: pointer;
+ font-size: 11px;
+ font-weight: bold;
+ text-align: center;
+}
+
+div.jGrowl div.jGrowl-notification div.header {
+ font-weight: bold;
+ font-size: 14px;
+ margin-left: 60px;
+}
+div.jGrowl div.jGrowl-notification div.message {
+ font-size: 12px;
+ margin-left: 60px;
+}
+div.jGrowl div.jGrowl-notification p {
+ font-size: 6px;
+}
+
+div.jGrowl {
+ padding: 10px;
+ z-index: 9999;
+}
+
+/** Special IE6 Style Positioning **/
+div.ie6 {
+ position: absolute;
+}
+
+div.ie6.top-right {
+ right: auto;
+ bottom: auto;
+ left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+ top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.top-left {
+ left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+ top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.bottom-right {
+ left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+ top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.bottom-left {
+ left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+ top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.center {
+ left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+ top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+ width: 100%;
+}
+
+/** Normal Style Positions **/
+body > div.jGrowl {
+ position: fixed;
+}
+
+body > div.jGrowl.top-left {
+ left: 0px;
+ top: 0px;
+}
+
+body > div.jGrowl.top-right {
+ right: 0px;
+ top: 0px;
+}
+
+body > div.jGrowl.bottom-left {
+ left: 0px;
+ bottom: 0px;
+}
+
+body > div.jGrowl.bottom-right {
+ right: 0px;
+ bottom: 0px;
+}
+
+body > div.jGrowl.center {
+ top: 0px;
+ width: 50%;
+ left: 25%;
+}
+
diff --git a/themes/default/js/plugins/jquery.jgrowl_minimized.js b/themes/default/js/plugins/jquery.jgrowl_minimized.js
new file mode 100644
index 000000000..02503a0db
--- /dev/null
+++ b/themes/default/js/plugins/jquery.jgrowl_minimized.js
@@ -0,0 +1,9 @@
+(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)
+$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',$.extend(new $.fn.jGrowl(),{notifications:[],element:null,interval:null}));$(this).data('jGrowl.instance').startup(this);}
+if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',corners:'10px',check:250,life:3000,speed:'normal',easing:'swing',closer:true,closeTemplate:'&times;',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);this.notifications.push({message:message,options:o});o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('<div class="jGrowl-notification ui-state-highlight ui-corner-all'+
+((o.group!=undefined&&o.group!='')?' '+o.group:'')+'">'+'<div class="close">'+o.closeTemplate+'</div>'+'<div class="header">'+o.header+'</div>'+'<div class="message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();$(notification).bind("mouseover.jGrowl",function(){$('div.jGrowl-notification',self.element).data("jGrowl.pause",true);}).bind("mouseout.jGrowl",function(){$('div.jGrowl-notification',self.element).data("jGrowl.pause",false);}).bind('jGrowl.beforeOpen',function(){if(o.beforeOpen.apply(notification,[notification,message,o,self.element])!=false){$(this).trigger('jGrowl.open');}}).bind('jGrowl.open',function(){if(o.open.apply(notification,[notification,message,o,self.element])!=false){if(o.glue=='after'){$('div.jGrowl-notification:last',self.element).after(notification);}else{$('div.jGrowl-notification:first',self.element).before(notification);}
+$(this).animate(o.animateOpen,o.speed,o.easing,function(){if($.browser.msie&&(parseInt($(this).css('opacity'),10)===1||parseInt($(this).css('opacity'),10)===0))
+this.style.removeAttribute('filter');$(this).data("jGrowl").created=new Date();});}}).bind('jGrowl.beforeClose',function(){if(o.beforeClose.apply(notification,[notification,message,o,self.element])!=false)
+$(this).trigger('jGrowl.close');}).bind('jGrowl.close',function(){$(this).data('jGrowl.pause',true);$(this).animate(o.animateClose,o.speed,o.easing,function(){$(this).remove();var close=o.close.apply(notification,[notification,message,o,self.element]);if($.isFunction(close))
+close.apply(notification,[notification,message,o,self.element]);});}).trigger('jGrowl.beforeOpen');if($.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',self.element).size()>1&&$('div.jGrowl-closer',self.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer ui-state-highlight ui-corner-all').addClass(this.defaults.theme).appendTo(self.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children('div.close').trigger("click.jGrowl");if($.isFunction(self.defaults.closer)){self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);}});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl.pause")==undefined||$(this).data("jGrowl.pause")!=true)){$(this).trigger('jGrowl.beforeClose');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()<this.defaults.pool))
+this.render(this.notifications.shift());if($(this.element).find('div.jGrowl-notification:parent').size()<2){$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});}},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"]){$(this.element).addClass('ie6');}},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);},close:function(){$(this.element).find('div.jGrowl-notification').each(function(){$(this).trigger('jGrowl.beforeClose');});}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery); \ No newline at end of file