Make WordPress Core


Ignore:
Timestamp:
07/30/2009 01:39:34 PM (17 years ago)
Author:
azaozz
Message:

Trash status updates for posts, pages, comments and attachments, props caesarsgrunt, see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-attachment-rows.php

    r11380 r11749  
    2929$posts_columns = get_column_headers('upload');
    3030$hidden = get_hidden_columns('upload');
    31 while (have_posts()) : the_post();
     31
     32while ( have_posts() ) : the_post();
     33
     34if ( $is_trash && $post->post_status != 'trash' )
     35        continue;
     36elseif ( !$is_trash && $post->post_status == 'trash' )
     37        continue;
     38
    3239$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
    3340global $current_user;
    3441$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
    3542$att_title = _draft_or_post_title();
    36 
    3743?>
    3844        <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
     
    6167                <td <?php echo $attributes ?>><?php
    6268                        if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
    63 ?>
    64 
     69                                if ( $is_trash ) echo $thumb;
     70                                else {
     71?>
    6572                                <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>">
    6673                                        <?php echo $thumb; ?>
     
    6875
    6976<?php                   }
     77                        }
    7078                ?></td>
    7179                <?php
     
    7583        case 'media':
    7684                ?>
    77                 <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
     85                <td <?php echo $attributes ?>><strong><?php if ( $is_trash ) echo $att_title; else { ?><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a><?php } ?></strong><br />
    7886                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
    7987                <p>
    8088                <?php
    8189                $actions = array();
    82                 if ( current_user_can('edit_post', $post->ID) )
    83                         $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
    84                 if ( current_user_can('delete_post', $post->ID) )
    85                         $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
    86                 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
     90                if ( $is_trash && current_user_can('delete_post', $post->ID) ) {
     91                        $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
     92                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
     93                } else {
     94                        if ( current_user_can('edit_post', $post->ID) )
     95                                $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
     96                        if ( current_user_can('delete_post', $post->ID) )
     97                                $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
     98                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
     99                }
    87100                $action_count = count($actions);
    88101                $i = 0;
Note: See TracChangeset for help on using the changeset viewer.