Inline uploader tweaks from mdawaffe. fixes #3360

git-svn-id: http://svn.automattic.com/wordpress/trunk@4466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-11-14 23:18:20 +00:00
parent 39dbda930c
commit bc46166de6
7 changed files with 60 additions and 35 deletions

View File

@ -358,14 +358,15 @@ add_action( 'upload_files_browse-all', 'wp_upload_tab_browse_action' );
function wp_upload_admin_head() { function wp_upload_admin_head() {
global $wp_locale; global $wp_locale;
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload.css?version=' . get_bloginfo('version') . "' type='text/css' />\n"; echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload.css?version=' . get_bloginfo('version') . "a' type='text/css' />\n";
if ( 'rtl' == $wp_locale->text_direction ) if ( 'rtl' == $wp_locale->text_direction )
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload-rtl.css?version=' . get_bloginfo('version') . "' type='text/css' />\n"; echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload-rtl.css?version=' . get_bloginfo('version') . "a' type='text/css' />\n";
if ( 'inline' == @$_GET['style'] ) { if ( 'inline' == @$_GET['style'] ) {
echo "<style type='text/css'>\n"; echo "<style type='text/css' media='screen'>\n";
echo "\tbody { height: 15em; overflow: hidden; }\n"; echo "\t#upload-menu { position: absolute; z-index: 2; }\n";
echo "\t#upload-content { overflow-y: auto; }\n"; echo "\tbody > #upload-menu { position: fixed; }\n";
echo "\t#upload-file { position: absolute; }\n"; echo "\t#upload-content { top: 2em; }\n";
echo "\t#upload-file { position: absolute; top: 15px; }\n";
echo "</style>"; echo "</style>";
} }
} }

View File

@ -74,7 +74,7 @@ addLoadEvent( function() {
params.action = ''; params.action = '';
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>"; h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>";
} else { } else {
h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files' class='back'>&laquo; Back</a>"; h += "<a href='#' onclick='return theFileList.cancelView();' title='Browse your files' class='back'>&laquo; Back</a>";
} }
h += "<div id='file-title'>" h += "<div id='file-title'>"
if ( !this.currentImage.isImage ) if ( !this.currentImage.isImage )
@ -82,7 +82,7 @@ addLoadEvent( function() {
else else
h += "<h2>" + this.currentImage.title + "</h2>"; h += "<h2>" + this.currentImage.title + "</h2>";
h += " &#8212; <span>"; h += " &#8212; <span>";
h += "<a href='#' onclick='theFileList.editView(" + id + ")'>Edit</a>" h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>Edit</a>"
h += "</span>"; h += "</span>";
h += '</div>' h += '</div>'
h += "<div id='upload-file-view' class='alignleft'>"; h += "<div id='upload-file-view' class='alignleft'>";
@ -136,7 +136,7 @@ addLoadEvent( function() {
params.action = ''; params.action = '';
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>"; h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>";
} else { } else {
h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files' class='back'>&laquo; Back</a>"; h += "<a href='#' onclick='return theFileList.cancelView();' title='Browse your files' class='back'>&laquo; Back</a>";
} }
h += "<div id='file-title'>" h += "<div id='file-title'>"
if ( !this.currentImage.isImage ) if ( !this.currentImage.isImage )
@ -144,7 +144,7 @@ addLoadEvent( function() {
else else
h += "<h2>" + this.currentImage.title + "</h2>"; h += "<h2>" + this.currentImage.title + "</h2>";
h += " &#8212; <span>"; h += " &#8212; <span>";
h += "<a href='#' onclick='theFileList.imageView(" + id + ")'>Insert</a>" h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>Insert</a>"
h += "</span>"; h += "</span>";
h += '</div>' h += '</div>'
h += "<div id='upload-file-view' class='alignleft'>"; h += "<div id='upload-file-view' class='alignleft'>";

View File

@ -1,5 +1,16 @@
#upload-menu li a.upload-tab-link {
float: right;
margin: 0 .75em 0 0;
}
table { float: right; } table { float: right; }
#upload-menu li #current-tab-nav {
float: right;
padding: 5px 0 0 5px;
margin-right: -5px;
}
#upload-file th, #the-attachment-links textarea { text-align: left; } #upload-file th, #the-attachment-links textarea { text-align: left; }
h2 { margin: 0 0 0 .2em; } h2 { margin: 0 0 0 .2em; }
@ -9,12 +20,11 @@ h2 { margin: 0 0 0 .2em; }
#upload-file-view { padding: 0 75px 0 0; } #upload-file-view { padding: 0 75px 0 0; }
#upload-menu li { #upload-menu li {
margin: 0 .75em 0 0;
display: block; display: block;
float: right; float: right;
} }
#upload-menu .current div { #upload-menu li.current {
border-right: 0; border-right: 0;
border-left: 2px solid #448abd; border-left: 2px solid #448abd;
} }

View File

@ -3,45 +3,60 @@ body { background: #f9fcfe; }
.upload-file-data { display: none; } .upload-file-data { display: none; }
#upload-menu { #upload-menu {
background: #247fab; border-top: 2em solid #247fab;
margin: 0px; margin: 0;
padding: 0; padding: 0;
height: 0;
list-style: none; list-style: none;
height: 2em;
border-bottom: 1px solid #448abd;
width: 100%; width: 100%;
} }
#upload-menu li { margin: 0 0 0 .75em; } body > #upload-menu { border-bottom: 7px solid #fff; }
#upload-menu li div { #upload-menu li {
padding: 5px; margin: 0;
position: relative;
top: -2em;
padding-bottom: 5px;
border: none;
border-top: 3px solid #247fab; border-top: 3px solid #247fab;
} }
#upload-menu li a { #upload-menu li a.upload-tab-link {
margin-left: 0.75em;
padding: 5px 5px 0;
display: block;
float: left;
height: 100%;
text-decoration: none; text-decoration: none;
border-bottom: none; border-bottom: none;
color: #fff; color: #fff;
} }
#upload-menu li span a.page-numbers { color: #00019b; } #upload-menu li.current {
#upload-menu .current div {
background: #f9fcfe;
border-right: 2px solid #448abd; border-right: 2px solid #448abd;
color: #000; color: #000;
} }
#upload-menu .current div a, #upload-menu div:hover a { #upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
color: #000;
}
#upload-menu div:hover {
background: #f9fcfe; background: #f9fcfe;
color: #000; color: #000;
} }
#upload-menu li #current-tab-nav {
float: left;
padding: 5px 5px 0 0;
margin-left: -5px;
}
#upload-menu li span .page-numbers {
padding: 0;
border: none;
}
#upload-menu li span a.page-numbers { color: #00019b; }
#upload-menu li span a.page-numbers:hover { text-decoration: underline; }
#upload-content { #upload-content {
position: relative; position: relative;
clear: both; clear: both;

View File

@ -35,7 +35,7 @@ if ( $pid ) {
$wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() )); $wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() ));
if ( !function_exists($wp_upload_tabs[$tab][2]) ) { if ( !is_callable($wp_upload_tabs[$tab][2]) ) {
$to_tab = isset($wp_upload_tabs['upload']) ? 'upload' : 'browse-all'; $to_tab = isset($wp_upload_tabs['upload']) ? 'upload' : 'browse-all';
wp_redirect( add_query_arg( 'tab', $to_tab ) ); wp_redirect( add_query_arg( 'tab', $to_tab ) );
exit; exit;
@ -76,12 +76,12 @@ endif;
echo "<ul id='upload-menu'>\n"; echo "<ul id='upload-menu'>\n";
foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check
$class = 'upload-tab';
$href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') ); $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
if ( isset($tab_array[4]) && is_array($tab_array[4]) ) if ( isset($tab_array[4]) && is_array($tab_array[4]) )
add_query_arg( $tab_array[4], $href ); add_query_arg( $tab_array[4], $href );
$_href = wp_specialchars( $href, 1 ); $_href = wp_specialchars( $href, 1 );
$page_links = ''; $page_links = '';
$class = 'upload-tab alignleft';
if ( $tab == $t ) { if ( $tab == $t ) {
$class .= ' current'; $class .= ' current';
if ( $tab_array[3] ) { if ( $tab_array[3] ) {
@ -105,7 +105,7 @@ foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the curr
} }
} }
echo "\t<li class='$class alignleft'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n"; echo "\t<li class='$class'><a href='$_href' class='upload-tab-link' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</li>\n";
} }
unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class); unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class);
echo "</ul>\n\n"; echo "</ul>\n\n";

View File

@ -206,9 +206,8 @@ textarea, input, select {
border-style: none; border-style: none;
padding: 0px; padding: 0px;
margin-bottom: 16px; margin-bottom: 16px;
height: 17em; height: 18em;
width: 100%; width: 100%;
/* overflow-y: hidden;*/
} }
form#upload th { form#upload th {

View File

@ -29,7 +29,7 @@ class WP_Scripts {
$this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' ); $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' );
$this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '3684' ); $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '3684' );
$this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' );
$this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '4461' ); $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '4466' );
} }
} }