Media handling updates from andy. fixes #5874
git-svn-id: http://svn.automattic.com/wordpress/trunk@6876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
function uploadLoadedMultimedia() {
|
||||
jQuery("#html-upload-ui").empty();
|
||||
}
|
||||
|
||||
function fileDialogStart() {
|
||||
jQuery("#media-upload-error").empty();
|
||||
}
|
||||
@@ -42,7 +46,13 @@ function uploadSuccessMultimedia(fileObj, serverData) {
|
||||
jQuery('#multimedia-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
|
||||
|
||||
// Bind AJAX to the new Delete button
|
||||
jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/del/,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();});return false;});
|
||||
jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/[^0-9]/g,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();});return false;});
|
||||
|
||||
// Open this item if it says to start open
|
||||
jQuery('#multimedia-item-' + fileObj.id + ' .startopen')
|
||||
.removeClass('startopen')
|
||||
.slideToggle(500)
|
||||
.parent().eq(0).children('.toggle').toggle();
|
||||
}
|
||||
|
||||
function uploadCompleteMultimedia(fileObj) {
|
||||
|
||||
@@ -366,13 +366,16 @@ function the_attachment_link($id = 0, $fullsize = false, $max_dims = false) {
|
||||
echo get_the_attachment_link($id, $fullsize, $max_dims);
|
||||
}
|
||||
|
||||
function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false) {
|
||||
function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
|
||||
$id = (int) $id;
|
||||
$_post = & get_post($id);
|
||||
|
||||
if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
|
||||
return __('Missing Attachment');
|
||||
|
||||
if ( $permalink )
|
||||
$url = get_attachment_link($_post->ID);
|
||||
|
||||
$post_title = attribute_escape($_post->post_title);
|
||||
|
||||
$innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
|
||||
|
||||
Reference in New Issue
Block a user