Don't close upload when an error occurred #203
This commit is contained in:
parent
5d1b6261dc
commit
4d6c2b2ca4
@ -36,16 +36,18 @@ upload = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
notify: function(title) {
|
notify: function(title, text) {
|
||||||
|
|
||||||
var popup;
|
var popup;
|
||||||
|
|
||||||
|
if (!text||text==="") text = "You can now manage your new photo(s).";
|
||||||
|
|
||||||
if (!window.webkitNotifications) return false;
|
if (!window.webkitNotifications) return false;
|
||||||
|
|
||||||
if (window.webkitNotifications.checkPermission()!==0) window.webkitNotifications.requestPermission();
|
if (window.webkitNotifications.checkPermission()!==0) window.webkitNotifications.requestPermission();
|
||||||
|
|
||||||
if (window.webkitNotifications.checkPermission()===0&&title) {
|
if (window.webkitNotifications.checkPermission()===0&&title) {
|
||||||
popup = window.webkitNotifications.createNotification("", title, "You can now manage your new photo(s).");
|
popup = window.webkitNotifications.createNotification("", title, text);
|
||||||
popup.show();
|
popup.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +58,7 @@ upload = {
|
|||||||
local: function(files) {
|
local: function(files) {
|
||||||
|
|
||||||
var albumID = album.getID(),
|
var albumID = album.getID(),
|
||||||
|
error = false,
|
||||||
process = function(files, file) {
|
process = function(files, file) {
|
||||||
|
|
||||||
var formData = new FormData(),
|
var formData = new FormData(),
|
||||||
@ -68,9 +71,20 @@ upload = {
|
|||||||
|
|
||||||
$("#upload_files").val("");
|
$("#upload_files").val("");
|
||||||
|
|
||||||
|
if (error===false) {
|
||||||
|
|
||||||
|
// Success
|
||||||
upload.close();
|
upload.close();
|
||||||
upload.notify("Upload complete");
|
upload.notify("Upload complete");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Error
|
||||||
|
$(".upload_message a.close").show();
|
||||||
|
upload.notify("Upload complete", "Failed to upload one or more photos.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (album.getID()===false) lychee.goto("0");
|
if (album.getID()===false) lychee.goto("0");
|
||||||
else album.load(albumID);
|
else album.load(albumID);
|
||||||
|
|
||||||
@ -135,6 +149,9 @@ upload = {
|
|||||||
.html("Server returned the status code " + xhr.status)
|
.html("Server returned the status code " + xhr.status)
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
|
// Set global error
|
||||||
|
error = true;
|
||||||
|
|
||||||
// Throw error
|
// Throw error
|
||||||
lychee.error("Upload failed. Server returned the status code " + xhr.status + "!", xhr, xhr.responseText);
|
lychee.error("Upload failed. Server returned the status code " + xhr.status + "!", xhr, xhr.responseText);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user