pretty delete animation, fix squashed icons and use 80x60 thumbs, add rel attrs to attachment links inserted from uploader. Props andy. see #5911

git-svn-id: http://svn.automattic.com/wordpress/trunk@7466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-21 23:21:27 +00:00
parent 1e11a54317
commit 6de702f183
5 changed files with 18 additions and 12 deletions

View File

@ -43,7 +43,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'icon':
?>
<td class="media-icon"><?php echo wp_get_attachment_link($post->ID, array(60, 40), false, true); ?></td>
<td class="media-icon"><?php echo wp_get_attachment_link($post->ID, array(80, 60), false, true); ?></td>
<?php
// TODO
break;

View File

@ -50,7 +50,7 @@ function the_media_upload_tabs() {
function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
$html = get_image_tag($id, $alt, $title, $align, $rel, $size);
$html = get_image_tag($id, $alt, $title, $align, $size);
$rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
@ -246,8 +246,11 @@ function media_upload_form_handler() {
$send_id = (int) array_shift($keys);
$attachment = $_POST['attachments'][$send_id];
$html = $attachment['post_title'];
if ( !empty($attachment['url']) )
$html = "<a href='{$attachment['url']}'>$html</a>";
if ( !empty($attachment['url']) ) {
if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
$rel = " rel='attachment wp-att-".attribute_escape($send_id)."'";
$html = "<a href='{$attachment['url']}'$rel>$html</a>";
}
$html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
return media_send_to_editor($html);
}
@ -527,7 +530,7 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) {
else
$size = 'medium';
return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size);
return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, true, $size);
}
return $html;

View File

@ -502,8 +502,8 @@ td.media-icon {
}
td.media-icon img {
max-width: 60px;
max-height: 40px;
max-width: 80px;
max-height: 60px;
}
#update-nag, .plugin-update {

View File

@ -91,13 +91,16 @@ function deleteSuccess(data, textStatus) {
jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
}
// Vanish it.
jQuery('#media-item-' + this.id + ' .filename:empty').remove();
jQuery('#media-item-' + this.id + ' .filename').append(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove();
jQuery('#media-item-' + this.id + ' .describe').slideUp(500, function(){jQuery(this).parents('.media-item').slideUp(1500,function(){jQuery(this).remove();updateMediaForm();})}).end.remove();
jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
.animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
.animate({minHeight:0,height:36,}, 400, null, function(){jQuery(this).children('.describe').remove()})
.animate({backgroundColor:'#fff'}, 400)
.animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
return;
// Vanish it.
item.slideToggle(300,function(){jQuery(this).remove();if(jQuery('.media-item').length==0)jQuery('.insert-gallery').hide();updateMediaForm();});
}
function deleteError(X, textStatus, errorThrown) {

View File

@ -91,12 +91,12 @@ function image_downsize($id, $size = 'medium') {
}
// return an <img src /> tag for the given image attachment, scaling it down if requested
function get_image_tag($id, $alt, $title, $align, $rel = false, $size='medium') {
function get_image_tag($id, $alt, $title, $align, $size='medium') {
list( $img_src, $width, $height ) = image_downsize($id, $size);
$hwstring = image_hwstring($width, $height);
$html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />';
$html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id.'" />';
$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );