From b3190f71645067901ab8d5590ca7068d995d84e4 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 26 Mar 2008 21:22:19 +0000 Subject: [PATCH] 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 --- wp-admin/includes/media.php | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 2296acfe24..f3cc497c93 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -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 ) { ?> +
+ + + +
get_error_message(); ?> @@ -811,7 +828,7 @@ jQuery(function($){

- +