Bring back the multi-file/html uploader switching, see #19228

git-svn-id: http://svn.automattic.com/wordpress/trunk@19257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-11-11 19:40:23 +00:00
parent 61fca35691
commit a37b440bac
5 changed files with 85 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -3748,6 +3748,14 @@ abbr.required {
width: 25%;
}
.js .html-uploader #plupload-upload-ui {
display: none;
}
.js .html-uploader #html-upload-ui {
display: block;
}
/*------------------------------------------------------------------------------
14.1 - Media Library

View File

@ -1336,9 +1336,25 @@ $plupload_init = apply_filters( 'plupload_init', $plupload_init );
?>
<script type="text/javascript">
var resize_height = <?php echo get_option('large_size_h', 1024); ?>,
resize_width = <?php echo get_option('large_size_w', 1024); ?>,
var resize_height = <?php echo get_option('large_size_h', 1024); ?>, resize_width = <?php echo get_option('large_size_w', 1024); ?>,
wpUploaderInit = <?php echo json_encode($plupload_init); ?>;
jQuery(document).ready(function($){
function _switch(m) {
if ( m ) {
deleteUserSetting('uploader');
$('.media-upload-form').removeClass('html-uploader');
if ( typeof(uploader) == 'object' )
uploader.refresh();
} else {
setUserSetting('uploader', '1'); // 1 == html uploader
$('.media-upload-form').addClass('html-uploader');
}
}
$('.upload-flash-bypass a').click(function(){_switch(0);return false;});
$('.upload-html-bypass a').click(function(){_switch(1);return false;});
});
</script>
<div id="plupload-upload-ui" class="hide-if-no-js">
@ -1388,9 +1404,13 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$form_class = 'media-upload-form type-form validate';
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
?>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
<?php submit_button( '', 'hidden', 'save', false ); ?>
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field('media-form'); ?>
@ -1449,9 +1469,13 @@ function media_upload_type_url_form($type = null, $errors = null, $id = null) {
$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$form_class = 'media-upload-form type-form validate';
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
?>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field('media-form'); ?>
@ -1571,6 +1595,10 @@ function media_upload_gallery_form($errors) {
$post_id = intval($_REQUEST['post_id']);
$form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$form_class = 'media-upload-form validate';
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
?>
<script type="text/javascript">
@ -1595,7 +1623,7 @@ jQuery(function($){
<a href="#" id="desc"><?php _e('Descending'); ?></a> |
<a href="#" id="clear"><?php _ex('Clear', 'verb'); ?></a>
</div>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="<?php echo $form_class; ?>" id="gallery-form">
<?php wp_nonce_field('media-form'); ?>
<?php //media_upload_form( $errors ); ?>
<table class="widefat" cellspacing="0">
@ -1713,6 +1741,10 @@ function media_upload_library_form($errors) {
$form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$form_class = 'media-upload-form validate';
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
$_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
if ( $_GET['paged'] < 1 )
@ -1830,7 +1862,7 @@ foreach ($arc_result as $arc_row) {
</div>
</form>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="library-form">
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="<?php echo $form_class; ?>" id="library-form">
<?php wp_nonce_field('media-form'); ?>
<?php //media_upload_form( $errors ); ?>
@ -1985,6 +2017,35 @@ function _insert_into_post_button($type) {
';
}
/**
* {@internal Missing Short Description}}
*
* @since 2.6.0
*/
function media_upload_flash_bypass() {
?>
<p class="upload-flash-bypass">
<?php _e('You are using the multi-file uploader. Problems? Try the <a href="#">Browser uploader</a> instead.'); ?>
</p>
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since 2.6.0
*/
function media_upload_html_bypass() {
?>
<p class="upload-html-bypass hide-if-no-js">
<?php _e('You are using the Browser uploader. Try the <a href="#">Multi-file uploader</a> instead.'); ?>
</p>
<?php
}
add_action('post-plupload-upload-ui', 'media_upload_flash_bypass');
add_action('post-html-upload-ui', 'media_upload_html_bypass');
/**
* {@internal Missing Short Description}}
*

View File

@ -72,12 +72,18 @@ if ( isset($_GET['inline']) ) {
'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
require_once('./admin-header.php'); ?>
require_once('./admin-header.php');
$form_class = 'media-upload-form type-form validate';
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
?>
<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?></h2>
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-upload.php?inline=&amp;upload-page-form='); ?>" class="media-upload-form type-form validate" id="file-form">
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-upload.php?inline=&amp;upload-page-form='); ?>" class="<?php echo $form_class; ?>" id="file-form">
<?php media_upload_form(); ?>

View File

@ -431,7 +431,7 @@ function wp_default_styles( &$styles ) {
// Any rtl stylesheets that don't have a .dev version for ltr
$no_suffix = array( 'farbtastic' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20111110b' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20111111' );
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20111015' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );