Fix user feedback when editing attachment details immediately after upload. Props andy. fixes #6398
git-svn-id: https://develop.svn.wordpress.org/trunk@7534 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f7c21d131d
commit
b3190f7164
@ -203,7 +203,7 @@ function media_upload_form_handler() {
|
||||
check_admin_referer('media-form');
|
||||
|
||||
// Insert media button was clicked
|
||||
if ( !empty($_FILES) ) {
|
||||
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
|
||||
// Upload File button was clicked
|
||||
|
||||
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
|
||||
@ -259,7 +259,7 @@ function media_upload_form_handler() {
|
||||
}
|
||||
|
||||
function media_upload_image() {
|
||||
if ( !empty($_FILES) ) {
|
||||
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
|
||||
// Upload File button was clicked
|
||||
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
|
||||
unset($_FILES);
|
||||
@ -292,11 +292,14 @@ function media_upload_image() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
|
||||
}
|
||||
|
||||
function media_upload_audio() {
|
||||
if ( !empty($_FILES) ) {
|
||||
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
|
||||
// Upload File button was clicked
|
||||
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
|
||||
unset($_FILES);
|
||||
@ -327,11 +330,14 @@ function media_upload_audio() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
|
||||
}
|
||||
|
||||
function media_upload_video() {
|
||||
if ( !empty($_FILES) ) {
|
||||
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
|
||||
// Upload File button was clicked
|
||||
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
|
||||
unset($_FILES);
|
||||
@ -362,11 +368,14 @@ function media_upload_video() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
|
||||
}
|
||||
|
||||
function media_upload_file() {
|
||||
if ( !empty($_FILES) ) {
|
||||
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
|
||||
// Upload File button was clicked
|
||||
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
|
||||
unset($_FILES);
|
||||
@ -397,6 +406,9 @@ function media_upload_file() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
|
||||
}
|
||||
|
||||
@ -753,7 +765,7 @@ function media_upload_form( $errors = null ) {
|
||||
$flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
|
||||
|
||||
// If Mac and mod_security, no Flash. :(
|
||||
$flash = true;
|
||||
$flash = false;
|
||||
if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
|
||||
$flash = false;
|
||||
|
||||
@ -761,6 +773,11 @@ function media_upload_form( $errors = null ) {
|
||||
|
||||
?>
|
||||
<input type='hidden' name='post_id' value='<?php echo $post_id; ?>' />
|
||||
<div id="media-upload-notice">
|
||||
<?php if (isset($errors['upload_notice']) ) { ?>
|
||||
<?php echo $errors['upload_notice']; ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<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(); ?>
|
||||
@ -811,7 +828,7 @@ jQuery(function($){
|
||||
|
||||
<div id="html-upload-ui">
|
||||
<p>
|
||||
<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
|
||||
<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
|
||||
</p>
|
||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
|
||||
<br class="clear" />
|
||||
|
Loading…
Reference in New Issue
Block a user