diff options
-rw-r--r-- | lib/gallery.common.css | 46 | ||||
-rw-r--r-- | modules/gallery/controllers/simple_uploader.php | 2 | ||||
-rw-r--r-- | modules/gallery/css/gallery.css | 42 | ||||
-rw-r--r-- | modules/gallery/views/simple_uploader.html.php | 44 |
4 files changed, 84 insertions, 50 deletions
diff --git a/lib/gallery.common.css b/lib/gallery.common.css index c80dc90f..7fbb9db0 100644 --- a/lib/gallery.common.css +++ b/lib/gallery.common.css @@ -593,6 +593,52 @@ div#g-action-status { margin-left: 0; } +/* Simple uploader ~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-add-photos-canvas { + border: 1px solid #ccc; + height: 200px; + margin: .5em 0; + overflow: auto; + width: 469px; +} + +#g-add-photos-status { + border: 1px solid #ccc; + height: 125px; + margin: .5em 0; + overflow: auto; + width: 469px; +} + +#g-add-photos button { + float: right; + margin-bottom: .5em; + margin-left: .5em; +} + +#g-add-photos-status li { + text-align: left; + padding-left: 2em; +} + +#g-add-photos-status li.g-success { + background: #d9efc2 url('images/ico-success.png') no-repeat .4em 50%; +} + +#g-add-photos-status li.g-error { + background: #f6cbca url('images/ico-error.png') no-repeat .4em 50%; +/* color: #f00;*/ +} + +#g-add-photos p { + margin: 0 +} + +#g-add-photos .g-breadcrumbs li { + padding-top: .5em; +} + /** ******************************************************************* * 7) Right to left language styles **********************************************************************/ diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index bc508319..d43d2f9d 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -79,7 +79,7 @@ class Simple_Uploader_Controller extends Controller { print "FILEID: $item->id"; } else { header("HTTP/1.1 400 Bad Request"); - print "ERROR: Invalid Upload"; + print "ERROR: " . t("Invalid Upload"); } } diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index 066ab68a..113f0e09 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -54,48 +54,6 @@ margin: 0; } -/* Simple uploader ~~~~~~~~~~~~~~~~~~~~~~~ */ - -#g-add-photos-canvas { - border: 1px solid #ccc; - height: 200px; - margin: .5em 0; - overflow: auto; - width: 469px; -} - -#g-add-photos-status { - border: 1px solid #ccc; - height: 125px; - margin: .5em 0; - overflow: auto; - width: 469px; -} - -#g-add-photos button { - float: right; - margin-bottom: .5em; - margin-left: .5em; -} - -#g-add-photos-status td { - text-align: left; - padding-left: 2em; -} - -#g-add-photos-queue .error { - background-color: #fcc; - border: 1px solid #ebb; -} - -#g-add-photos p { - margin: 0 -} - -#g-add-photos .g-breadcrumbs li { - padding-top: .5em; -} - /** ******************************************************************* * 2) Admin **********************************************************************/ diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index a84a3b00..8133f6c2 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -30,11 +30,43 @@ return true; }, onComplete: function(event, queueID, fileObj, response, data) { - $("#g-add-photos-status tbody").append( - "<tr class=\"g-success\"><td>" + fileObj.name + "</td><td>" + - Math.ceil(fileObj.size / 1000) + " KB" + "</td><td>" + Math.floor(data.speed) + " KB/s </td></tr>"); + // @todo handle a response of "Error: xxxx" as an error + var re = /^error: (.*)$/i; + var msg = re.exec(response); + if (msg) { + $("#g-add-photos-status ul").append( + "<li class=\"g-error\">" + fileObj.name + " - " + msg[1] + "</li>"); + } else { + $("#g-add-photos-status ul").append( + "<li class=\"g-success\">" + fileObj.name + "</li>"); + } return true; }, + + onError: function(event, queueID, fileObj, errorObj) { + var msg = " - "; + if (errorObj.type == "HTTP") { + if (errorObj.info == "500") { + msg += "Error occurred processing the file"; + // Server error - check server logs + } else if (errorObj.info == "404") { + msg += "The upload script was not found."; + // Server script not found + } else { + // Server Error: status: errorObj.info + msg += "Error occurred communication with the server, status: " + errorObj.info; + } + } else if (errorObj.type == "File Size") { + var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit); + msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB'; + } else { + msg += "Error occurred communication with the server, error " + errorObj.type + ": " + errorObj.info; + } + $("#g-add-photos-status ul").append( + "<li class=\"g-error\">" + fileObj.name + msg + "</li>"); + $("#g-uploadify" + queueID).remove(); + //return false; + }, onSelect: function(event) { if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) { $("#g-upload-cancel-all") @@ -79,10 +111,8 @@ <div id="g-uploadify"></div> </div> <div id="g-add-photos-status" style="text-align: center;"> - <table> - <tbody> - </tbody> - </table> + <ul> + </ul> </div> <!-- Proxy the done request back to our form, since its been ajaxified --> |