Ticket #13502: 13502.3.patch
| File 13502.3.patch, 7.9 KB (added by ocean90, 2 years ago) |
|---|
-
wp-includes/js/swfupload/handlers.dev.js
93 93 }); 94 94 95 95 // Bind AJAX to the new Delete button 96 jQuery('a.delete', item).click(function(){ 96 jQuery('a.delete-attachment', item).click(function(){ 97 97 98 // Tell the server to delete it. TODO: handle exceptions 98 99 jQuery.ajax({ 99 100 url: 'admin-ajax.php', … … 101 102 success: deleteSuccess, 102 103 error: deleteError, 103 104 id: fileObj.id, 105 data:{ 106 id : this.id.replace(/[^0-9]/g,''), 107 action : 'delete-attachment', 108 _ajax_nonce : this.href.replace(/^.*wpnonce=/,'') 109 } 110 }); 111 112 return false; 113 }); 114 115 // Bind AJAX to the new Trash button 116 jQuery('a.trash-attachment', item).click(function(){ 117 118 // Tell the server to trash it. TODO: handle exceptions 119 jQuery.ajax({ 120 url: 'admin-ajax.php', 121 type: 'post', 122 success: trashSuccess, 123 error: trashError, 124 id: fileObj.id, 104 125 data: { 105 126 id : this.id.replace(/[^0-9]/g, ''), 106 action : 'trash- post',127 action : 'trash-attachment', 107 128 _ajax_nonce : this.href.replace(/^.*wpnonce=/,'') 108 129 } 109 130 }); … … 119 140 id: fileObj.id, 120 141 data: { 121 142 id : this.id.replace(/[^0-9]/g,''), 122 action: 'untrash- post',143 action: 'untrash-attachment', 123 144 _ajax_nonce: this.href.replace(/^.*wpnonce=/,'') 124 145 }, 125 146 success: function(data, textStatus){ … … 176 197 } 177 198 178 199 // Vanish it. 200 jQuery('.filename:empty', item).remove(); 201 jQuery('.filename .title', item).css('font-weight','bold'); 202 jQuery('.filename', item).append(' <span class="deletednotice">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove(); 203 jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end() 204 .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50}) 205 .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()}) 206 .animate({backgroundColor:'#fff'}, 400) 207 .animate({height:0}, 800, null, function(){ 208 jQuery(this).remove(); 209 updateMediaForm(); 210 }); 211 212 return; 213 } 214 215 function trashSuccess(data, textStatus) { 216 if ( data == '-1' ) 217 return itemAjaxError(this.id, 'You do not have permission. Has your session expired?'); 218 if ( data == '0' ) 219 return itemAjaxError(this.id, 'Could not be trashed. Has it been trashed already?'); 220 221 var id = this.id, item = jQuery('#media-item-' + id); 222 223 // Decrement the counters. 224 if ( type = jQuery('#type-of-' + id).val() ) 225 jQuery('#' + type + '-counter').text( jQuery('#' + type + '-counter').text() - 1 ); 226 if ( item.hasClass('child-of-'+post_id) ) 227 jQuery('#attachments-count').text( jQuery('#attachments-count').text() - 1 ); 228 229 if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 0 ) { 230 jQuery('.toggle').toggle(); 231 jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden'); 232 } 233 234 // Vanish it. 179 235 jQuery('.toggle', item).toggle(); 180 236 jQuery('.slidetoggle', item).slideUp(200).siblings().removeClass('hidden'); 181 237 item.css( {backgroundColor:'#faa'} ).animate( {backgroundColor:'#f4f4f4'}, {queue:false, duration:500} ).addClass('undo'); 182 238 183 239 jQuery('.filename:empty', item).remove(); 184 240 jQuery('.filename .title', item).css('font-weight','bold'); 185 jQuery('.filename', item).append('<span class="trashnotice"> ' + swfuploadL10n. deleted + ' </span>').siblings('a.toggle').hide();241 jQuery('.filename', item).append('<span class="trashnotice"> ' + swfuploadL10n.trashed + ' </span>').siblings('a.toggle').hide(); 186 242 jQuery('.filename', item).append( jQuery('a.undo', item).removeClass('hidden') ); 187 243 jQuery('.menu_order_input', item).hide(); 188 244 … … 193 249 // TODO 194 250 } 195 251 252 function trashError(X, textStatus, errorThrown) { 253 // TODO 254 } 255 196 256 function updateMediaForm() { 197 257 var one = jQuery('form.type-form #media-items').children(), items = jQuery('#media-items').children(); 198 258 -
wp-includes/script-loader.php
234 234 'upload_stopped' => __('Upload stopped.'), 235 235 'dismiss' => __('Dismiss'), 236 236 'crunching' => __('Crunching…'), 237 'deleted' => __('moved to the trash.'), 237 'trashed' => __('moved to the trash.'), 238 'deleted' => __('deleted.'), 238 239 'error_uploading' => __('“%s” has failed to upload due to an error'), 239 240 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};', 240 241 ) ); -
wp-admin/admin-ajax.php
392 392 die('1'); 393 393 die('0'); 394 394 break; 395 case 'delete-attachment' : 395 396 case 'delete-post' : 396 397 check_ajax_referer( "{$action}_$id" ); 397 398 if ( !current_user_can( 'delete_post', $id ) ) … … 405 406 else 406 407 die('0'); 407 408 break; 409 case 'trash-attachment' : 410 case 'untrash-attachment' : 408 411 case 'trash-post' : 409 412 case 'untrash-post' : 410 413 check_ajax_referer( "{$action}_$id" ); … … 414 417 if ( !get_post( $id ) ) 415 418 die('1'); 416 419 417 if ( 'trash-post' == $action )420 if ( 'trash-post' == $action || 'trash-attachment' == $action ) 418 421 $done = wp_trash_post( $id ); 419 422 else 420 423 $done = wp_untrash_post( $id ); -
wp-admin/includes/media.php
1286 1286 $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false ); 1287 1287 if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { 1288 1288 if ( !EMPTY_TRASH_DAYS ) { 1289 $delete = "<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete '>" . __( 'Delete Permanently' ) . '</a>';1289 $delete = "<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete delete-attachment'>" . __( 'Delete Permanently' ) . '</a>'; 1290 1290 } elseif ( !MEDIA_TRASH ) { 1291 1291 $delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a> 1292 1292 <div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'>" . sprintf( __( 'You are about to delete <strong>%s</strong>.' ), $filename ) . " 1293 < a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>1294 <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . "</a> 1293 <p><a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='button delete-attachment'>" . __( 'Continue' ) . "</a> 1294 <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . "</a></p> 1295 1295 </div>"; 1296 1296 } else { 1297 $delete = "<a href='" . wp_nonce_url( "post.php?action=trash&post=$attachment_id", 'trash-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class=' delete'>" . __( 'Move to Trash' ) . "</a>1297 $delete = "<a href='" . wp_nonce_url( "post.php?action=trash&post=$attachment_id", 'trash-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='trash-attachment'>" . __( 'Move to Trash' ) . "</a> 1298 1298 <a href='" . wp_nonce_url( "post.php?action=untrash&post=$attachment_id", 'untrash-attachment_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . "</a>"; 1299 1299 } 1300 1300 } else {
