mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 00:01:27 +01:00
Uploader improvements from mdawaffe. fixes #3191
git-svn-id: http://svn.automattic.com/wordpress/trunk@4312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8e5ef54f14
commit
66f5d2c2da
@ -47,13 +47,19 @@ function wp_upload_display( $dims = false, $href = '' ) {
|
||||
function wp_upload_view() {
|
||||
global $style, $post_id;
|
||||
$id = get_the_ID();
|
||||
$attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
|
||||
?>
|
||||
<div id="upload-file">
|
||||
<div id="file-title">
|
||||
<h2><a href="<?php the_guid(); ?>" title="Direct link to this file"><?php the_title(); ?></a></h2>
|
||||
<h2><?php if ( !isset($attachment_data['width']) )
|
||||
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
|
||||
the_title();
|
||||
if ( !isset($attachment_data['width']) )
|
||||
echo '</a>';
|
||||
?></h2>
|
||||
<span><?php
|
||||
echo '[ ';
|
||||
echo '<a href="' . get_permalink() . '" title="' . ('Permalink to the blog page for this file') . '">' . __('page link') . '</a>';
|
||||
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'edit' ), 1 ) . '" title="' . __('Edit this file') . '">' . __('edit') . '</a>';
|
||||
echo ' | ';
|
||||
@ -61,8 +67,12 @@ function wp_upload_view() {
|
||||
echo ' ]'; ?></span>
|
||||
</div>
|
||||
|
||||
<div id="upload-file-view" class="left">
|
||||
<?php echo wp_upload_display( array(171, 128) ); ?>
|
||||
<div id="upload-file-view" class="alignleft">
|
||||
<?php if ( isset($attachment_data['width']) )
|
||||
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
|
||||
echo wp_upload_display( array(171, 128) );
|
||||
if ( isset($attachment_data['width']) )
|
||||
echo '</a>'; ?>
|
||||
</div>
|
||||
<?php the_attachment_links( $id ); ?>
|
||||
</div>
|
||||
@ -78,21 +88,31 @@ function wp_upload_form() {
|
||||
<?php
|
||||
if ( $id ) :
|
||||
$attachment = get_post_to_edit( $id );
|
||||
$attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
|
||||
?>
|
||||
<div id="file-title">
|
||||
<h2><a href="<?php the_guid(); ?>" title="Direct link to this file"><?php the_title(); ?></a></h2>
|
||||
<h2><?php if ( !isset($attachment_data['width']) )
|
||||
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
|
||||
the_title();
|
||||
if ( !isset($attachment_data['width']) )
|
||||
echo '</a>';
|
||||
?></h2>
|
||||
<span><?php
|
||||
echo '[ ';
|
||||
echo '<a href="' . get_permalink() . '" title="' . ('Permalink to the blog page for this file') . '">' . __('page link') . '</a>';
|
||||
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '" title="' . __('View options for this file') . '">' . __('options') . '</a>';
|
||||
echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '">' . __('options') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . wp_specialchars( remove_query_arg( array('action','ID') ), 1 ) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
|
||||
echo ' ]'; ?></span>
|
||||
</div>
|
||||
|
||||
<div id="upload-file-view" class="left">
|
||||
<?php echo wp_upload_display( array(171, 128) ); ?>
|
||||
<div id="upload-file-view" class="alignleft">
|
||||
<?php if ( isset($attachment_data['width']) )
|
||||
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
|
||||
echo wp_upload_display( array(171, 128) );
|
||||
if ( isset($attachment_data['width']) )
|
||||
echo '</a>'; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<table>
|
||||
@ -121,7 +141,7 @@ function wp_upload_form() {
|
||||
<input type="hidden" name="ID" value="<?php echo $id; ?>" />
|
||||
<?php endif; ?>
|
||||
<?php wp_nonce_field( 'inlineuploading' ); ?>
|
||||
<div id="submit">
|
||||
<div class="submit">
|
||||
<input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?>" />
|
||||
<?php if ( $id ) : ?>
|
||||
<input type="submit" name="delete" class="delete" value="<?php _e('Delete'); ?>" />
|
||||
@ -293,7 +313,7 @@ function wp_upload_tab_browse() {
|
||||
|
||||
echo "\t<li id='file-";
|
||||
the_ID();
|
||||
echo "' class='left'>\n";
|
||||
echo "' class='alignleft'>\n";
|
||||
echo wp_upload_display( array(128,128), $href );
|
||||
echo "\t</li>\n";
|
||||
endwhile;
|
||||
|
@ -62,11 +62,12 @@ addLoadEvent( function() {
|
||||
|
||||
h += "<div id='upload-file'>"
|
||||
h += "<div id='file-title'>"
|
||||
h += "<h2><a href='" + this.currentImage.src + "' title='Direct Link to this file'>" + this.currentImage.title + "</a></h2>";
|
||||
h += "<span>[ ";
|
||||
h += "<a href='" + this.currentImage.page + "' title='Permalink to the blog page for this file'>page link</a>"
|
||||
h += ' | ';
|
||||
h += "<a href='#' onclick='theFileList.editView(" + id + ")' title='Edit this file'>edit</a>"
|
||||
if ( !this.currentImage.thumb )
|
||||
h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
|
||||
else
|
||||
h += "<h2>" + this.currentImage.title + "</h2>";
|
||||
h += "<span>[ ";
|
||||
h += "<a href='#' onclick='theFileList.editView(" + id + ")'>edit</a>"
|
||||
h += ' | ';
|
||||
if ( this.ID ) {
|
||||
var params = $H(this.params);
|
||||
@ -78,29 +79,31 @@ addLoadEvent( function() {
|
||||
}
|
||||
h += " ]</span>";
|
||||
h += '</div>'
|
||||
h += "<div id='upload-file-view' class='left'>";
|
||||
h += "<div id='upload-file-view' class='alignleft'>";
|
||||
if ( this.currentImage.thumb )
|
||||
h += "<img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
|
||||
h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>";
|
||||
else
|
||||
h += ' ';
|
||||
h += "</div>";
|
||||
|
||||
h += "<form name='uploadoptions' id='uploadoptions' class='left'>";
|
||||
h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
|
||||
h += "<table>";
|
||||
if ( this.currentImage.thumb ) {
|
||||
h += "<input type='radio' name='display' value='thumb' checked='checked'>Display thumbnail</input><br />";
|
||||
h += "<input type='radio' name='display' value='full'>Display full-sized image</input><br /><br />";
|
||||
h += "<tr><th style='padding-bottom:.5em'>Show</th><td style='padding-bottom:.5em'>";
|
||||
h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> thumbnail</label><br />";
|
||||
h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> full size</label>";
|
||||
h += "</td></tr>";
|
||||
}
|
||||
|
||||
if ( this.currentImage.thumb ) {
|
||||
h += "<input type='radio' name='link' value='none' checked='checked'>Do not link to this file</input><br />";
|
||||
h += "<input type='radio' name='link' value='file'>Link directly to this file</input><br />";
|
||||
h += "<input type='radio' name='link' value='page'>Link to this file's blog page</input><br />";
|
||||
} else {
|
||||
h += "<input type='radio' name='link' value='file'>Link directly to this file</input><br />";
|
||||
h += "<input type='radio' name='link' value='page' checked='checked'>Link to this file's blog page</input><br />";
|
||||
}
|
||||
h += "<tr><th>Link</th><td>";
|
||||
h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> file</label><br />";
|
||||
h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> page</label><br />";
|
||||
h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> none</label>";
|
||||
h += "</td></tr>";
|
||||
|
||||
h += "<input type='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='Send to editor' />";
|
||||
h += "<tr><td colspan='2'>";
|
||||
h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='Send to editor »' />";
|
||||
h += "</td></tr></table>";
|
||||
h += "</form>";
|
||||
|
||||
h += "</div>";
|
||||
@ -116,11 +119,12 @@ addLoadEvent( function() {
|
||||
|
||||
h += "<form id='upload-file' method='post' action='upload.php?style=inline&tab=upload&post_id=" + this.postID + "'>";
|
||||
h += "<div id='file-title'>"
|
||||
h += "<h2><a href='" + this.currentImage.src + "' title='Direct Link to this file'>" + this.currentImage.title + "</a></h2>";
|
||||
h += "<span>[ ";
|
||||
h += "<a href='" + this.currentImage.page + "' title='Permalink to the blog page for this file'>page link</a>"
|
||||
h += ' | ';
|
||||
h += "<a href='#' onclick='theFileList.imageView(" + id + ")' title='View options for this file'>options</a>"
|
||||
if ( !this.currentImage.thumb )
|
||||
h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
|
||||
else
|
||||
h += "<h2>" + this.currentImage.title + "</h2>";
|
||||
h += "<span>[ ";
|
||||
h += "<a href='#' onclick='theFileList.imageView(" + id + ")'>options</a>"
|
||||
h += ' | ';
|
||||
if ( this.ID ) {
|
||||
var params = $H(this.params);
|
||||
@ -132,9 +136,9 @@ addLoadEvent( function() {
|
||||
}
|
||||
h += " ]</span>";
|
||||
h += '</div>'
|
||||
h += "<div id='upload-file-view' class='left'>";
|
||||
h += "<div id='upload-file-view' class='alignleft'>";
|
||||
if ( this.currentImage.thumb )
|
||||
h += "<img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
|
||||
h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>";
|
||||
else
|
||||
h += ' ';
|
||||
h += "</div>";
|
||||
@ -151,7 +155,7 @@ addLoadEvent( function() {
|
||||
h += "<input type='hidden' name='action' id='action-value' value='save' />";
|
||||
h += "<input type='hidden' name='ID' value='" + id + "' />";
|
||||
h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
|
||||
h += "<div id='submit'><input type='submit' value='Save' />";
|
||||
h += "<div class='submit'><input type='submit' value='Save' />";
|
||||
h += "<input type='button' name='delete' class='delete' value='Delete' onclick='theFileList.deleteFile(" + id + ");' />";
|
||||
h += "</div></td></tr></table></form>";
|
||||
|
||||
|
@ -7,24 +7,14 @@ body { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
|
||||
border-left: 2px solid #448abd;
|
||||
}
|
||||
|
||||
#file-title { margin: 0 15px 0 0; }
|
||||
#upload-file-view { 0 15px 0 0 }
|
||||
|
||||
#file-title { margin: 0 15px .2em 0; }
|
||||
|
||||
h2 { margin: 0 0 0 .2em; }
|
||||
|
||||
#upload-files li { margin: 0 15px 15px 0; }
|
||||
|
||||
th { text-align: right; }
|
||||
table { float: right; }
|
||||
|
||||
.left, table { float: right; }
|
||||
|
||||
.right, #the-attachment-links { float: left; }
|
||||
|
||||
#submit input, #submit input:focus {
|
||||
border-left: 0;
|
||||
border-right-color: #ccc;
|
||||
}
|
||||
|
||||
#submit input:active {
|
||||
border-left: 0;
|
||||
border-right-color: #999;
|
||||
}
|
||||
#the-attachment-links { float: left; }
|
||||
|
@ -59,10 +59,14 @@ body { background: #dfe8f1; }
|
||||
background: #dfe8f1;
|
||||
}
|
||||
|
||||
#upload-file-view { padding: 0 15px; }
|
||||
form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; }
|
||||
|
||||
form#upload-file div.submit input { width: auto; }
|
||||
|
||||
#upload-file-view { padding: 0 0 0 15px; }
|
||||
|
||||
#file-title {
|
||||
margin: 0 0 0 15px;
|
||||
margin: 0 0 .2em 15px;
|
||||
padding: 0;
|
||||
display: block;
|
||||
}
|
||||
@ -72,6 +76,7 @@ h2 {
|
||||
padding: 0;
|
||||
display: inline;
|
||||
border: none;
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
font-size: 1.4em;
|
||||
line-height: 1.4em;
|
||||
@ -105,9 +110,7 @@ h2 {
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
#upload-files a.file-link img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
#upload-files a.file-link img { vertical-align: middle; }
|
||||
|
||||
#the-attachment-links { float: right; }
|
||||
|
||||
@ -116,49 +119,17 @@ h2 {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
form table { float: none; }
|
||||
form table { float: none; padding: 0 15px; }
|
||||
|
||||
table {
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding: 0 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.left { float: left; }
|
||||
|
||||
.right { float: right; }
|
||||
|
||||
.center { text-align: center; }
|
||||
|
||||
th { text-align: left; }
|
||||
th { vertical-align: text-top; }
|
||||
|
||||
tr, td, th {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#submit {
|
||||
margin: 1px;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
#submit input, #submit input:focus {
|
||||
background: url( images/fade-butt.png );
|
||||
border: 3px double #999;
|
||||
border-left-color: #ccc;
|
||||
border-top-color: #ccc;
|
||||
color: #333;
|
||||
padding: 0.25em;
|
||||
}
|
||||
|
||||
#submit input:active {
|
||||
background: #f4f4f4;
|
||||
border: 3px double #ccc;
|
||||
border-left-color: #999;
|
||||
border-top-color: #999;
|
||||
}
|
||||
|
||||
#submit input.delete:hover {
|
||||
background: #ce0000;
|
||||
color: #fff;
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the curr
|
||||
}
|
||||
}
|
||||
|
||||
echo "\t<li class='$class left'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n";
|
||||
echo "\t<li class='$class alignleft'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n";
|
||||
}
|
||||
unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class);
|
||||
echo "</ul>\n\n";
|
||||
|
||||
echo "<div id='upload-content'>\n";
|
||||
echo "<div id='upload-content' class='$tab'>\n";
|
||||
|
||||
call_user_func( $wp_upload_tabs[$tab][2] );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user