Improve status-messages of ajax uploader (#126)
This commit is contained in:
parent
3c21bfb9f4
commit
a8b4f05de2
@ -4,6 +4,8 @@
|
||||
Version 2.0-beta3 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Show upload-success or error with the ajax image uploader
|
||||
|
||||
* Fix preview entry exception (issue #119)
|
||||
|
||||
* Add serendipity.toggle_collapsible as a reusable JS function
|
||||
|
@ -340,6 +340,8 @@ switch ($serendipity['GET']['adminAction']) {
|
||||
'created_thumbnail' => $created_thumbnail
|
||||
);
|
||||
} else {
|
||||
// necessary for the ajax-uplaoder to show upload errors
|
||||
header("Internal Server Error", true, 500);
|
||||
$messages[] = ERROR_UNKNOWN_NOUPLOAD;
|
||||
}
|
||||
}
|
||||
|
@ -1307,7 +1307,11 @@ $(function() {
|
||||
if ($('#uploadform').length > 0) {
|
||||
$('input[name="go_properties"]').hide();
|
||||
var progressIcon = document.createElement('span');
|
||||
progressIcon.className = 'icon-info-circled'
|
||||
progressIcon.className = 'uploadIcon icon-info-circled';
|
||||
errorIcon = document.createElement('span');
|
||||
errorIcon.className = 'uploadIcon icon-attention-circled';
|
||||
successIcon = document.createElement('span');
|
||||
successIcon.className = 'uploadIcon icon-ok-circled';
|
||||
$('#uploadform').submit(function(event) {
|
||||
event.preventDefault();
|
||||
$('.uploadform_userfile').each(function() {
|
||||
@ -1376,8 +1380,13 @@ $(function() {
|
||||
}
|
||||
}).done(function(data) {
|
||||
progress.value = 100;
|
||||
progressContainer.className = "msg_success";
|
||||
$(progressContainer).find('.uploadIcon').replaceWith(successIcon.cloneNode(true));
|
||||
}).fail(function(data) {
|
||||
alert("fail:" + data.statusText);
|
||||
progressContainer.className = "msg_error";
|
||||
progress.disabled = true;
|
||||
progressContainer.innerHTML += "{$CONST.ERROR_UNKNOWN_NOUPLOAD}";
|
||||
$(progressContainer).find('.uploadIcon').replaceWith(errorIcon.cloneNode(true));
|
||||
})
|
||||
}, type);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user