Disable the Cancel Upload button after the upload has finished or if it was interrupted, fixes #19050
git-svn-id: http://svn.automattic.com/wordpress/trunk@19099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
13db43d2d3
commit
b63ffa3f38
|
@ -1282,17 +1282,18 @@ function media_upload_form( $errors = null ) {
|
|||
}
|
||||
?>
|
||||
|
||||
<div id="media-upload-notice">
|
||||
<?php if (isset($errors['upload_notice']) ) { ?>
|
||||
<?php echo $errors['upload_notice']; ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div id="media-upload-notice"><?php
|
||||
|
||||
<div id="media-upload-error">
|
||||
<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
|
||||
<?php echo $errors['upload_error']->get_error_message(); ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
if (isset($errors['upload_notice']) )
|
||||
echo $errors['upload_notice'];
|
||||
|
||||
?></div>
|
||||
<div id="media-upload-error"><?php
|
||||
|
||||
if (isset($errors['upload_error']) && is_wp_error($errors['upload_error']))
|
||||
echo $errors['upload_error']->get_error_message();
|
||||
|
||||
?></div>
|
||||
<?php
|
||||
// Check quota for this blog if multisite
|
||||
if ( is_multisite() && !is_upload_space_available() ) {
|
||||
|
@ -2020,4 +2021,4 @@ add_action( 'media_upload_video', 'wp_media_upload_handler' );
|
|||
add_action( 'media_upload_file', 'wp_media_upload_handler' );
|
||||
|
||||
add_filter( 'media_upload_gallery', 'media_upload_gallery' );
|
||||
add_filter( 'media_upload_library', 'media_upload_library' );
|
||||
add_filter( 'media_upload_library', 'media_upload_library' );
|
||||
|
|
|
@ -194,18 +194,18 @@ function prepareMediaItemInit(fileObj) {
|
|||
|
||||
function cancelUpload() {
|
||||
uploader.stop();
|
||||
uploadComplete();
|
||||
jQuery.each(uploader.files, function(i,file) {
|
||||
if (file.status == plupload.STOPPED)
|
||||
if ( file.status == plupload.STOPPED )
|
||||
jQuery('#media-item-' + file.id).remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// wp-specific error handlers
|
||||
|
||||
// generic message
|
||||
function wpQueueError(message) {
|
||||
jQuery('#media-upload-error').show().text(message);
|
||||
jQuery('#media-upload-error').show().html( '<div id="error"><p>' + message + '</p></div>' );
|
||||
}
|
||||
|
||||
// file-specific message
|
||||
|
@ -268,13 +268,9 @@ function deleteError(X, textStatus, errorThrown) {
|
|||
// TODO
|
||||
}
|
||||
|
||||
// SWFUpload?
|
||||
function uploadComplete(fileObj) {
|
||||
// If no more uploads queued, enable the submit button
|
||||
if ( swfu.getStats().files_queued == 0 ) {
|
||||
jQuery('#cancel-upload').prop('disabled', true);
|
||||
jQuery('#insert-gallery').prop('disabled', false);
|
||||
}
|
||||
function uploadComplete() {
|
||||
jQuery('#cancel-upload').prop('disabled', true);
|
||||
jQuery('#insert-gallery').prop('disabled', false);
|
||||
}
|
||||
|
||||
function switchUploader(s) {
|
||||
|
@ -299,21 +295,6 @@ function dndHelper(s) {
|
|||
}
|
||||
}
|
||||
|
||||
// SWFUpload?
|
||||
function swfuploadPreLoad() {
|
||||
if ( !uploaderMode ) {
|
||||
switchUploader(1);
|
||||
} else {
|
||||
switchUploader(0);
|
||||
}
|
||||
}
|
||||
|
||||
// SWFUpload?
|
||||
function swfuploadLoadFailed() {
|
||||
switchUploader(0);
|
||||
jQuery('.upload-html-bypass').hide();
|
||||
}
|
||||
|
||||
function uploadError(fileObj, errorCode, message) {
|
||||
|
||||
switch (errorCode) {
|
||||
|
@ -443,6 +424,10 @@ jQuery(document).ready(function($){
|
|||
uploader.bind('FileUploaded', function(up, file, response) {
|
||||
uploadSuccess(file, response.response);
|
||||
});
|
||||
|
||||
uploader.bind('UploadComplete', function(up, files) {
|
||||
uploadComplete();
|
||||
});
|
||||
}
|
||||
|
||||
if ( typeof(wpUploaderInit) == 'object' )
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -220,7 +220,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
// cannot use the plupload.full.js, as it loads browserplus init JS from Yahoo
|
||||
$scripts->add( 'plupload-full', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.5b');
|
||||
|
||||
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-full', 'jquery'), '20111012');
|
||||
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-full', 'jquery'), '20111031');
|
||||
$scripts->add_script_data( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
|
||||
|
||||
// keep 'swfupload' for back-compat.
|
||||
|
|
Loading…
Reference in New Issue