Make uploader selection "sticky"
git-svn-id: http://svn.automattic.com/wordpress/trunk@10844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3ca8d791a8
commit
d2f10cfa07
|
@ -1267,6 +1267,14 @@ function media_upload_form( $errors = null ) {
|
|||
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<!--
|
||||
jQuery(document).ready(function($){
|
||||
$('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');swfuploadPreLoad(0);return false;});
|
||||
$('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');swfuploadPreLoad(1);return false;});
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
<div id="media-upload-notice">
|
||||
<?php if (isset($errors['upload_notice']) ) { ?>
|
||||
<?php echo $errors['upload_notice']; ?>
|
||||
|
@ -1340,12 +1348,11 @@ SWFUpload.onload = function() {
|
|||
<p id="async-upload-wrap">
|
||||
<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>
|
||||
|
||||
<br class="clear" />
|
||||
<div class="clear"></div>
|
||||
<?php if ( is_lighttpd_before_150() ): ?>
|
||||
<p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
|
||||
<?php endif;?>
|
||||
<?php do_action('post-html-upload-ui'); ?>
|
||||
<?php do_action('post-html-upload-ui', $flash); ?>
|
||||
</div>
|
||||
<?php do_action('post-upload-ui'); ?>
|
||||
<?php
|
||||
|
@ -2037,16 +2044,15 @@ function media_upload_flash_bypass() {
|
|||
*
|
||||
* @since unknown
|
||||
*/
|
||||
function media_upload_html_bypass() {
|
||||
function media_upload_html_bypass($flash = true) {
|
||||
echo '<p class="upload-html-bypass">';
|
||||
if ( array_key_exists('flash', $_REQUEST) )
|
||||
_e('You are using the Browser uploader.');
|
||||
if ( $flash ) {
|
||||
// the user manually selected the browser uploader, so let them switch back to Flash
|
||||
printf( __('You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
|
||||
else
|
||||
// the user probably doesn't have Flash
|
||||
printf( __('You are using the Browser uploader.') );
|
||||
|
||||
echo '</p>';
|
||||
echo ' ';
|
||||
printf( __('Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
|
||||
}
|
||||
echo "</p>\n";
|
||||
}
|
||||
|
||||
add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
|
||||
|
@ -2070,8 +2076,6 @@ function media_upload_bypass_url($url) {
|
|||
|
||||
add_filter('media_upload_form_url', 'media_upload_bypass_url');
|
||||
|
||||
|
||||
|
||||
add_filter('async_upload_image', 'get_media_item', 10, 2);
|
||||
add_filter('async_upload_audio', 'get_media_item', 10, 2);
|
||||
add_filter('async_upload_video', 'get_media_item', 10, 2);
|
||||
|
|
|
@ -206,12 +206,15 @@ function fileDialogComplete(num_files_queued) {
|
|||
}
|
||||
}
|
||||
|
||||
function swfuploadPreLoad() {
|
||||
var swfupload_element = jQuery('#'+swfu.customSettings.swfupload_element_id).get(0);
|
||||
jQuery('#' + swfu.customSettings.degraded_element_id).hide();
|
||||
// Doing this directly because jQuery().show() seems to have timing problems
|
||||
if ( swfupload_element && ! swfupload_element.style.display )
|
||||
swfupload_element.style.display = 'block';
|
||||
function swfuploadPreLoad(a) {
|
||||
if ( typeof(a) == 'undefined' && typeof(getUserSetting) == 'function' )
|
||||
a = getUserSetting('uploader');
|
||||
|
||||
if ( !a ) {
|
||||
jQuery('#' + swfu.customSettings.swfupload_element_id).show();
|
||||
jQuery('#' + swfu.customSettings.degraded_element_id).hide();
|
||||
} else
|
||||
swfuploadLoadFailed();
|
||||
}
|
||||
|
||||
function swfuploadLoadFailed() {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -178,7 +178,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'swfupload-queue', false, array('swfupload') );
|
||||
}
|
||||
|
||||
$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload'), '2.2.0-20081201');
|
||||
$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload'), '2.2.0-20090327');
|
||||
// these error messages came from the sample swfupload js, they might need changing.
|
||||
$scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
|
||||
'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
|
||||
|
|
Loading…
Reference in New Issue