Skip to content

Commit

Permalink
Remove all instances of "Trash" from the UI when Trash is disabled, r…
Browse files Browse the repository at this point in the history
…eplace trash actions with "Delete permanently", props caesarsgrunt, see #4529

git-svn-id: http://svn.automattic.com/wordpress/trunk@12162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
azaozz committed Nov 10, 2009
1 parent 1c24715 commit fb1bb44
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 73 deletions.
2 changes: 1 addition & 1 deletion wp-admin/css/colors-classic.css

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions wp-admin/css/colors-classic.dev.css
Expand Up @@ -398,8 +398,7 @@ div.dashboard-widget-submit input:hover,
.plugins a.delete:hover,
#all-plugins-table .plugins a.delete:hover,
#search-plugins-table .plugins a.delete:hover,
.submitbox .submitdelete,
a.delete {
.submitbox .submitdelete {
color: #f00;
border-bottom-color: #f00;
}
Expand Down Expand Up @@ -634,7 +633,10 @@ tr.inactive + tr.plugin-update-tr .plugin-update {
color: #d98500;
}

#the-comment-list .delete a {
table.widefat .delete a,
table.widefat .trash a,
#dashboard_recent_comments .delete a,
#dashboard_recent_comments .trash a {
color: #bc0b0b;
}

Expand Down Expand Up @@ -732,7 +734,10 @@ div#media-upload-error,
.file-error,
abbr.required,
.widget-control-remove:hover,
.delete a:hover {
table.widefat .delete a:hover,
table.widefat .trash a:hover,
#dashboard_recent_comments .delete a:hover,
#dashboard_recent_comments .trash a:hover {
color: #f00;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/colors-fresh.css

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions wp-admin/css/colors-fresh.dev.css
Expand Up @@ -394,8 +394,7 @@ div.dashboard-widget-submit input:hover,
.plugins a.delete:hover,
#all-plugins-table .plugins a.delete:hover,
#search-plugins-table .plugins a.delete:hover,
.submitbox .submitdelete,
a.delete {
.submitbox .submitdelete {
color: #f00;
border-bottom-color: #f00;
}
Expand Down Expand Up @@ -629,7 +628,10 @@ tr.inactive + tr.plugin-update-tr .plugin-update {
color: #d98500;
}

#the-comment-list .delete a {
table.widefat .delete a,
table.widefat .trash a,
#dashboard_recent_comments .delete a,
#dashboard_recent_comments .trash a {
color: #bc0b0b;
}

Expand Down Expand Up @@ -731,7 +733,10 @@ div#media-upload-error,
.file-error,
abbr.required,
.widget-control-remove:hover,
.delete a:hover {
table.widefat .delete a:hover,
table.widefat .trash a:hover,
#dashboard_recent_comments .delete a:hover,
#dashboard_recent_comments .trash a:hover {
color: #f00;
}

Expand Down
18 changes: 9 additions & 9 deletions wp-admin/edit-attachment-rows.php
Expand Up @@ -89,18 +89,18 @@
<p>
<?php
$actions = array();
if ( $is_trash ) {
if ( current_user_can('delete_post', $post->ID) ) {
if ( current_user_can('edit_post', $post->ID) && !$is_trash )
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
if ( current_user_can('delete_post', $post->ID) ) {
if ( $is_trash )
$actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
}
} else {
if ( current_user_can('edit_post', $post->ID) )
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
if ( current_user_can('delete_post', $post->ID) )
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
if ( $is_trash || !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
}
if ( !$is_trash )
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
$action_count = count($actions);
$i = 0;
echo '<div class="row-actions">';
Expand Down
9 changes: 7 additions & 2 deletions wp-admin/edit-comments.php
Expand Up @@ -163,9 +163,14 @@
'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
);

if ( !EMPTY_TRASH_DAYS )
unset($stati['trash']);

$link = 'edit-comments.php';
if ( !empty($comment_type) && 'all' != $comment_type )
$link = add_query_arg( 'comment_type', $comment_type, $link );

foreach ( $stati as $status => $label ) {
$class = '';

Expand Down Expand Up @@ -275,7 +280,7 @@
<?php if ( 'trash' == $comment_status ): ?>
<option value="untrash"><?php _e('Restore'); ?></option>
<?php endif; ?>
<?php if ( 'trash' == $comment_status || 'spam' == $comment_status ): ?>
<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php else: ?>
<option value="trash"><?php _e('Move to Trash'); ?></option>
Expand Down Expand Up @@ -371,7 +376,7 @@
<?php if ( 'trash' == $comment_status ): ?>
<option value="untrash"><?php _e('Restore'); ?></option>
<?php endif; ?>
<?php if ( 'trash' == $comment_status || 'spam' == $comment_status ): ?>
<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php else: ?>
<option value="trash"><?php _e('Move to Trash'); ?></option>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-form-comment.php
Expand Up @@ -68,7 +68,7 @@

<div id="major-publishing-actions">
<div id="delete-action">
<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=trashcomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . __('Move to Trash') . "</a>\n"; ?>
<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=" . ( !EMPTY_TRASH_DAYS ? 'deletecomment' : 'trashcomment' ) . "&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . ( !EMPTY_TRASH_DAYS ? __('Delete Permanently') : __('Move to Trash') ) . "</a>\n"; ?>
</div>
<div id="publishing-action">
<input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" />
Expand Down
11 changes: 9 additions & 2 deletions wp-admin/edit-pages.php
Expand Up @@ -114,6 +114,9 @@
'trash' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page'))
);

if ( !EMPTY_TRASH_DAYS )
unset($post_stati['trash']);

$post_stati = apply_filters('page_stati', $post_stati);

$query = array('post_type' => 'page', 'orderby' => 'menu_order title',
Expand Down Expand Up @@ -255,9 +258,11 @@
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<?php if ( $is_trash ) { ?>
<option value="untrash"><?php _e('Restore'); ?></option>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="edit"><?php _e('Edit'); ?></option>
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="trash"><?php _e('Move to Trash'); ?></option>
<?php } ?>
</select>
Expand Down Expand Up @@ -302,9 +307,11 @@
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<?php if ( $is_trash ) { ?>
<option value="untrash"><?php _e('Restore'); ?></option>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="edit"><?php _e('Edit'); ?></option>
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="trash"><?php _e('Move to Trash'); ?></option>
<?php } ?>
</select>
Expand Down
8 changes: 6 additions & 2 deletions wp-admin/edit.php
Expand Up @@ -254,9 +254,11 @@
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<?php if ( $is_trash ) { ?>
<option value="untrash"><?php _e('Restore'); ?></option>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="edit"><?php _e('Edit'); ?></option>
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="trash"><?php _e('Move to Trash'); ?></option>
<?php } ?>
</select>
Expand Down Expand Up @@ -342,9 +344,11 @@
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<?php if ( $is_trash ) { ?>
<option value="untrash"><?php _e('Restore'); ?></option>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="edit"><?php _e('Edit'); ?></option>
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
<option value="delete"><?php _e('Delete Permanently'); ?></option>
<?php } else { ?>
<option value="trash"><?php _e('Move to Trash'); ?></option>
<?php } ?>
</select>
Expand Down
6 changes: 5 additions & 1 deletion wp-admin/includes/dashboard.php
Expand Up @@ -540,13 +540,17 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
$spam_url = esc_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );

$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-t vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
if ( !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
else
$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';

$actions = apply_filters( 'comment_row_actions', $actions, $comment );

Expand Down
13 changes: 9 additions & 4 deletions wp-admin/includes/media.php
Expand Up @@ -1201,12 +1201,17 @@ function get_media_item( $attachment_id, $args = null ) {
'extra_rows' => array(),
);

$trash_href = wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id);
$untrash_href = wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id);
if ( $send )
$send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";
if ( $delete )
$delete = current_user_can('delete_post', $attachment_id) ? "<a href=\"$trash_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"$untrash_href\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo?') . "</a>" : "";
if ( $delete && current_user_can('delete_post', $attachment_id) ) {
if ( !EMPTY_TRASH_DAYS )
$delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete Permanently') . "</a>";
else
$delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo?') . "</a>";
} else {
$delete = '';
}

if ( 'image' == $type && current_theme_supports( 'post-thumbnails' ) && get_post_image_id($_GET['post_id']) != $attachment_id )
$thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";

Expand Down
14 changes: 10 additions & 4 deletions wp-admin/includes/meta-boxes.php
Expand Up @@ -184,10 +184,16 @@ function post_submit_meta_box($post) {
<?php do_action('post_submitbox_start'); ?>
<div id="delete-action">
<?php
if ( current_user_can("delete_${post_type}", $post->ID) ) { ?>
<?php $delete_url = add_query_arg( array('action'=>'trash', 'post'=>$post->ID) ); ?>
<a class="submitdelete deletion<?php if ( 'edit' != $action ) { echo " hidden"; } ?>" href="<?php echo wp_nonce_url($delete_url, "trash-${post_type}_" . $post->ID); ?>"><?php _e('Move to Trash'); ?></a>
<?php } ?>
if ( current_user_can("delete_${post_type}", $post->ID) ) {
if ( !EMPTY_TRASH_DAYS ) {
$delete_url = wp_nonce_url( add_query_arg( array('action' => 'delete', 'post' => $post->ID) ), "delete-${post_type}_{$post->ID}" );
$delete_text = __('Delete Permanently');
} else {
$delete_url = wp_nonce_url( add_query_arg( array('action' => 'trash', 'post' => $post->ID) ), "trash-${post_type}_{$post->ID}" );
$delete_text = __('Move to Trash');
} ?>
<a class="submitdelete deletion<?php if ( 'edit' != $action ) { echo " hidden"; } ?>" href="<?php echo $delete_url; ?>"><?php echo $delete_text; ?></a><?php
} ?>
</div>

<div id="publishing-action">
Expand Down

0 comments on commit fb1bb44

Please sign in to comment.