mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 16:21:26 +01:00
Uploader: fix file-size-exceeded error handling, see #18206
git-svn-id: http://svn.automattic.com/wordpress/trunk@19262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f099d03f84
commit
9961962861
File diff suppressed because one or more lines are too long
@ -637,7 +637,7 @@ input.readonly, textarea.readonly {
|
||||
}
|
||||
|
||||
#media-items .media-item,
|
||||
#media-items .describe,
|
||||
.media-item .describe,
|
||||
.imgedit-group {
|
||||
border-color: #dfdfdf;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -636,7 +636,7 @@ input.readonly, textarea.readonly {
|
||||
|
||||
.imgedit-group,
|
||||
#media-items .media-item,
|
||||
#media-items .describe {
|
||||
.media-item .describe {
|
||||
border-color: #dfdfdf;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -3680,7 +3680,7 @@ abbr.required {
|
||||
|
||||
.media-item .pinkynail {
|
||||
float: left;
|
||||
margin: 0 2px;
|
||||
margin: 2px 2px 0;
|
||||
max-width: 40px;
|
||||
max-height: 32px;
|
||||
}
|
||||
@ -3756,6 +3756,17 @@ abbr.required {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.media-upload-form .media-item.error {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.media-upload-form .media-item.error p {
|
||||
line-height: 16px;
|
||||
margin: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
14.1 - Media Library
|
||||
|
@ -1063,7 +1063,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
|
||||
<a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
|
||||
} else {
|
||||
$class = 'form-table';
|
||||
$class = '';
|
||||
$toggle_links = '';
|
||||
}
|
||||
|
||||
@ -1108,7 +1108,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
<thead class='media-item-info' id='media-head-$post->ID'>
|
||||
<tr valign='top'>
|
||||
<td class='A1B1' id='thumbnail-head-$post->ID'>
|
||||
<p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' style='margin-top: 3px' /></a></p>
|
||||
<p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' /></a></p>
|
||||
<p>$image_edit_button</p>
|
||||
</td>
|
||||
<td>
|
||||
@ -1267,6 +1267,8 @@ function media_upload_form( $errors = null ) {
|
||||
|
||||
$upload_action_url = admin_url('async-upload.php');
|
||||
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
|
||||
$_type = isset($type) ? $type : '';
|
||||
$_tab = isset($tab) ? $tab : '';
|
||||
|
||||
$upload_size_unit = $max_upload_size = wp_max_upload_size();
|
||||
$sizes = array( 'KB', 'MB', 'GB' );
|
||||
@ -1307,8 +1309,8 @@ do_action('pre-upload-ui');
|
||||
$post_params = array(
|
||||
"post_id" => $post_id,
|
||||
"_wpnonce" => wp_create_nonce('media-form'),
|
||||
"type" => $type,
|
||||
"tab" => $tab,
|
||||
"type" => $_type,
|
||||
"tab" => $_tab,
|
||||
"short" => "1",
|
||||
);
|
||||
|
||||
|
@ -24,7 +24,7 @@ function fileQueued(fileObj) {
|
||||
jQuery('#insert-gallery').prop('disabled', true);
|
||||
}
|
||||
|
||||
function uploadStart(fileObj) {
|
||||
function uploadStart() {
|
||||
try {
|
||||
if ( typeof topWin.tb_remove != 'undefined' )
|
||||
topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove);
|
||||
@ -310,8 +310,7 @@ function uploadError(fileObj, errorCode, message) {
|
||||
wpQueueError(pluploadL10n.http_error);
|
||||
break;
|
||||
case plupload.INIT_ERROR:
|
||||
switchUploader(0);
|
||||
jQuery('.upload-html-bypass').hide();
|
||||
jQuery('.media-upload-form').addClass('html-uploader');
|
||||
break;
|
||||
case plupload.SECURITY_ERROR:
|
||||
wpQueueError(pluploadL10n.security_error);
|
||||
@ -325,9 +324,16 @@ function uploadError(fileObj, errorCode, message) {
|
||||
}
|
||||
}
|
||||
|
||||
function uploadSizeError( up, error ) {
|
||||
var file = error.file;
|
||||
|
||||
jQuery('#media-items').append('<div id="media-item-' + file.id + '" class="media-item error"><p>' + pluploadL10n.file_exceeds_size_limit.replace('%s', file.name) + '</p></div>');
|
||||
up.removeFile(file);
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
// remember the last used image size, alignment and url
|
||||
$('input[type="radio"]', '#media-items').live('click', function(){
|
||||
$('#media-items input[type="radio"]').live('click', function(){
|
||||
var tr = $(this).closest('tr');
|
||||
|
||||
if ( $(tr).hasClass('align') )
|
||||
@ -336,7 +342,7 @@ jQuery(document).ready(function($){
|
||||
setUserSetting('imgsize', $(this).val());
|
||||
});
|
||||
|
||||
$('button.button', '#media-items').live('click', function(){
|
||||
$('#media-items button.button').live('click', function(){
|
||||
var c = this.className || '';
|
||||
c = c.match(/url([^ '"]+)/);
|
||||
if ( c && c[1] ) {
|
||||
@ -379,26 +385,16 @@ jQuery(document).ready(function($){
|
||||
uploader.init();
|
||||
|
||||
uploader.bind('FilesAdded', function(up, files) {
|
||||
$.each(files, function(i, file) {
|
||||
/*
|
||||
if ( up.features.chunks && file.size > 1048576 )
|
||||
up.settings.chunk_size = '1048576';
|
||||
else
|
||||
delete(up.settings.chunk_size);
|
||||
*/
|
||||
|
||||
fileQueued(file);
|
||||
});
|
||||
|
||||
jQuery('#media-upload-error').html('');
|
||||
$('#media-upload-error').html('');
|
||||
uploadStart();
|
||||
up.refresh();
|
||||
up.start();
|
||||
});
|
||||
|
||||
uploader.bind('BeforeUpload', function(up, file) {
|
||||
uploadStart(file);
|
||||
fileQueued(file);
|
||||
});
|
||||
|
||||
|
||||
uploader.bind('UploadProgress', function(up, file) {
|
||||
var item = $('#media-item-' + file.id);
|
||||
|
||||
@ -413,9 +409,12 @@ jQuery(document).ready(function($){
|
||||
});
|
||||
|
||||
uploader.bind('Error', function(up, err) {
|
||||
uploadError(err.file, err.code, err.message);
|
||||
|
||||
up.refresh();
|
||||
if ( err.code == plupload.FILE_SIZE_ERROR ) {
|
||||
uploadSizeError(up, err);
|
||||
} else {
|
||||
uploadError(err.file, err.code, err.message);
|
||||
up.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('FileUploaded', function(up, file, response) {
|
||||
|
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-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1511');
|
||||
|
||||
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery'), '20111110');
|
||||
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery'), '20111111');
|
||||
$scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
|
||||
|
||||
// keep 'swfupload' for back-compat.
|
||||
@ -437,7 +437,7 @@ function wp_default_styles( &$styles ) {
|
||||
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
|
||||
|
||||
// all colors stylesheets need to have the same query strings (cache manifest compat)
|
||||
$colors_version = '20111110a';
|
||||
$colors_version = '20111111';
|
||||
|
||||
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
|
||||
$styles->add( 'colors', true, array('wp-admin'), $colors_version );
|
||||
|
Loading…
Reference in New Issue
Block a user