Uploader improvements from mdawaffe. fixes #3191
git-svn-id: https://develop.svn.wordpress.org/trunk@4340 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
29b992e902
commit
3a78f217bf
@ -101,7 +101,7 @@ function wp_upload_form() {
|
||||
echo '[ ';
|
||||
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '">' . __('options') . '</a>';
|
||||
echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '">' . __('links') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . wp_specialchars( remove_query_arg( array('action','ID') ), 1 ) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
|
||||
echo ' ]'; ?></span>
|
||||
@ -297,7 +297,7 @@ function wp_upload_tab_browse() {
|
||||
endwhile; endif;
|
||||
break;
|
||||
default :
|
||||
global $tab, $post_id;
|
||||
global $tab, $post_id, $style;
|
||||
add_action( 'pre_get_posts', 'wp_upload_grab_attachments' );
|
||||
if ( 'browse' == $tab && $post_id )
|
||||
add_filter( 'posts_where', 'wp_upload_posts_where' );
|
||||
@ -309,7 +309,10 @@ function wp_upload_tab_browse() {
|
||||
|
||||
echo "<ul id='upload-files'>\n";
|
||||
if ( have_posts() ) : while ( have_posts() ) : the_post();
|
||||
$href = wp_specialchars( add_query_arg( array('action' => 'view', 'ID' => get_the_ID()) ), 1 );
|
||||
$href = wp_specialchars( add_query_arg( array(
|
||||
'action' => 'inline' == $style ? 'view' : 'edit',
|
||||
'ID' => get_the_ID())
|
||||
), 1 );
|
||||
|
||||
echo "\t<li id='file-";
|
||||
the_ID();
|
||||
@ -331,7 +334,9 @@ function wp_upload_tab_browse() {
|
||||
|
||||
|
||||
function wp_upload_tab_browse_action() {
|
||||
wp_enqueue_script('upload');
|
||||
global $style;
|
||||
if ( 'inline' == $style )
|
||||
wp_enqueue_script('upload');
|
||||
}
|
||||
|
||||
add_action( 'upload_files_browse', 'wp_upload_tab_browse_action' );
|
||||
@ -344,7 +349,6 @@ function wp_upload_admin_head() {
|
||||
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload-rtl.css?version=' . get_bloginfo('version') . "' type='text/css' />\n";
|
||||
if ( 'inline' == @$_GET['style'] ) {
|
||||
echo "<style type='text/css'>\n";
|
||||
echo "\t#wphead, #user_info, #adminmenu, #submenu, #footer { display: none; }\n";
|
||||
echo "\tbody { height: 14em; overflow: hidden; }\n";
|
||||
echo "\t#upload-content { overflow-y: auto; }\n";
|
||||
echo "\t#upload-file { position: absolute; }\n";
|
||||
|
@ -29,7 +29,7 @@ addLoadEvent( function() {
|
||||
return;
|
||||
$$('a.file-link').each( function(i) {
|
||||
var id = i.id.split('-').pop();
|
||||
i.onclick = function(e) { theFileList.imageView(id, e); }
|
||||
i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); }
|
||||
} );
|
||||
},
|
||||
|
||||
@ -117,7 +117,10 @@ addLoadEvent( function() {
|
||||
this.prepView(id);
|
||||
var h = '';
|
||||
|
||||
h += "<form id='upload-file' method='post' action='upload.php?style=inline&tab=upload&post_id=" + this.postID + "'>";
|
||||
var action = 'upload.php?style=' + this.style + '&tab=upload';
|
||||
if ( this.postID )
|
||||
action += '&post_id=' + this.postID;
|
||||
h += "<form id='upload-file' method='post' action='" + action + "'>";
|
||||
h += "<div id='file-title'>"
|
||||
if ( !this.currentImage.thumb )
|
||||
h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
|
||||
|
@ -18,3 +18,5 @@ h2 { margin: 0 0 0 .2em; }
|
||||
table { float: right; }
|
||||
|
||||
#the-attachment-links { float: left; }
|
||||
|
||||
#th { text-align: left; }
|
||||
|
@ -90,11 +90,13 @@ h2 {
|
||||
|
||||
#upload-files li { margin: 0 0 15px 15px; }
|
||||
|
||||
#upload-files a, a.file-link {
|
||||
#upload-files a, #upload-file-view a, a.file-link {
|
||||
border: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#upload-file-view a img { padding-bottom: .2em; border-bottom: 1px solid #6699CC; }
|
||||
|
||||
#upload-files a.file-link {
|
||||
display: block;
|
||||
width: 130px;
|
||||
@ -127,7 +129,7 @@ table {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
th { vertical-align: text-top; }
|
||||
th { text-align: right; vertical-align: text-top; }
|
||||
|
||||
tr, td, th {
|
||||
margin-top: 0;
|
||||
|
@ -14,8 +14,6 @@ if ( !$tab )
|
||||
|
||||
do_action( "upload_files_$tab" );
|
||||
|
||||
add_action( 'admin_head', 'wp_upload_admin_head' );
|
||||
|
||||
$pid = 0;
|
||||
if ( $post_id < 0 )
|
||||
$pid = $post_id;
|
||||
@ -51,7 +49,29 @@ foreach ( $wp_upload_tabs as $t => $tab_array ) {
|
||||
}
|
||||
}
|
||||
|
||||
include_once('admin-header.php');
|
||||
if ( 'inline' == $style ) : ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
|
||||
<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — WordPress</title>
|
||||
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
|
||||
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<?php endif; ?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
|
||||
//]]>
|
||||
</script>
|
||||
<?php do_action('admin_print_scripts'); wp_upload_admin_head(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
else :
|
||||
add_action( 'admin_head', 'wp_upload_admin_head' );
|
||||
include_once('admin-header.php');
|
||||
endif;
|
||||
|
||||
echo "<ul id='upload-menu'>\n";
|
||||
foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check
|
||||
@ -95,5 +115,11 @@ call_user_func( $wp_upload_tabs[$tab][2] );
|
||||
|
||||
echo "</div>\n";
|
||||
|
||||
include_once('admin-footer.php');
|
||||
?>
|
||||
if ( 'inline' != $style ) :
|
||||
include_once('admin-footer.php');
|
||||
else : ?>
|
||||
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php endif; ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user