Make WordPress Core

Changeset 8901


Ignore:
Timestamp:
09/16/2008 04:24:28 AM (16 years ago)
Author:
azaozz
Message:

Reattaching of orphan attachments and choose post/page ajaxed search box

Location:
trunk/wp-admin
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r8858 r8901  
    751751    die('1');
    752752    break;
     753case 'find_posts':
     754    check_ajax_referer( 'find-posts' );
     755
     756    if ( empty($_POST['ps']) )
     757        exit;
     758
     759    $what = isset($_POST['pages']) ? 'page' : 'post';
     760    $s = stripslashes($_POST['ps']);
     761    preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
     762    $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
     763
     764    $searchand = $search = '';
     765    foreach( (array) $search_terms as $term) {
     766        $term = addslashes_gpc($term);
     767        $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))";
     768        $searchand = ' AND ';
     769    }
     770    $term = $wpdb->escape($s);
     771    if ( count($search_terms) > 1 && $search_terms[0] != $s )
     772        $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";
     773
     774    $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date_gmt DESC LIMIT 50" );
     775
     776    if ( ! $posts )
     777        exit( __('No posts found.') );
     778
     779    $html = '<table class="widefat"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Time').'</th><th>'.__('Status').'</th></tr></thead><tbody>';
     780    foreach ( $posts as $post ) {
     781
     782        switch ( $post->post_status ) {
     783            case 'publish' :
     784            case 'private' :
     785                $stat = __('Published');
     786                break;
     787            case 'future' :
     788                $stat = __('Scheduled');
     789                break;
     790            case 'pending' :
     791                $stat = __('Pending Review');
     792                break;
     793            case 'draft' :
     794                $stat = __('Unpublished');
     795                break;
     796        }
     797       
     798        if ( '0000-00-00 00:00:00' == $post->post_date ) {
     799            $time = '';
     800        } else {
     801            $time = mysql2date(__('Y/m/d'), $post->post_date);
     802        }
     803
     804        $html .= '<tr class="found-posts"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="'.$post->ID.'"></td>';
     805        $html .= '<td><label for="found-'.$post->ID.'">'.wp_specialchars($post->post_title, true).'</label></td><td>'.wp_specialchars($time, true).'</td><td>'.wp_specialchars($stat, true).'</td></tr>'."\n\n";
     806    }
     807    $html .= '</tbody></table>';
     808
     809    $x = new WP_Ajax_Response();
     810    $x->add( array(
     811        'what' => $what,
     812        'data' => $html
     813    ));
     814    $x->send();
     815
     816    break;
    753817default :
    754818    do_action( 'wp_ajax_' . $_POST['action'] );
  • trunk/wp-admin/css/colors-classic.css

    r8889 r8901  
    11
    2 #sidemenu-bg {
     2#sidemenu-bg,
     3.find-box-search {
    34    background-color: #14568A;
    45    border-color: #c6d9e9;
     
    1314}
    1415
    15 body, .form-table .pre {
     16body,
     17.form-table .pre,
     18.find-box-inside {
    1619    background-color: #fff;
    1720    color: #333;
     
    302305}
    303306
    304 .widefat thead, .thead {
     307.widefat thead,
     308.thead,
     309.find-box-head {
    305310    background-color: #464646;
    306311    color: #d7d7d7;
     
    826831}
    827832
    828 #plugin-information .fyi ul {
     833#plugin-information .fyi ul,
     834.find-box {
    829835    background-color: #eaf3fa;
    830836}
  • trunk/wp-admin/css/colors-fresh.css

    r8889 r8901  
    11
    2 #sidemenu-bg {
     2#sidemenu-bg,
     3.find-box-search {
    34    background-color: #e4f2fd;
    45    border-color: #c6d9e9;
     
    1314}
    1415
    15 body, .form-table .pre {
     16body,
     17.form-table .pre,
     18.find-box-inside {
    1619    background-color: #fff;
    1720    color: #333;
     
    297300}
    298301
    299 .widefat thead, .thead, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small {
     302.widefat thead,
     303.thead,
     304h3.dashboard-widget-title,
     305h3.dashboard-widget-title span,
     306h3.dashboard-widget-title small,
     307.find-box-head {
    300308    background-color: #464646;
    301309    color: #d7d7d7;
     
    809817}
    810818
    811 #plugin-information .fyi ul {
     819#plugin-information .fyi ul,
     820.find-box {
    812821    background-color: #eaf3fa;
    813822}
  • trunk/wp-admin/edit-attachment-rows.php

    r8895 r8901  
    6767    case 'cb':
    6868        ?>
    69         <th scope="row" <?php echo $attributes ?>><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
     69        <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
    7070        <?php
    7171        break;
    7272
    7373    case 'icon':
    74         $attributes = 'class="post-title column-title"' . $style;
    75         ?>
    76         <td class="media-icon"><?php
     74        $attributes = 'class="column-icon media-icon"' . $style;
     75        ?>
     76        <td <?php echo $attributes ?>><?php
    7777            if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
    7878?>
     
    105105            echo "<span class='$action'>$link$sep</span>";
    106106        }
     107        ?></p></td>
     108        <?php
    107109        break;
    108110
  • trunk/wp-admin/includes/template.php

    r8895 r8901  
    20082008}
    20092009
     2010function find_posts_div($found_action = '') {
    20102011?>
     2012    <div id="find-posts" class="find-box" style="display:none;">
     2013        <div id="find-posts-head" class="find-box-head"><?php _e('Find Posts or Pages'); ?></div>
     2014        <div class="find-box-inside">
     2015            <div class="find-box-search">
     2016                <?php if ( $found_action ) { ?>
     2017                    <input type="hidden" name="found_action" value="<?php echo $found_action; ?>" />
     2018                <?php } ?>
     2019               
     2020                <input type="hidden" name="affected" id="affected" value="" />
     2021                <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
     2022                <label class="hidden" for="find-posts-input"><?php _e( 'Search' ); ?></label>
     2023                <input type="text" id="find-posts-input" class="search-input" name="ps" value="" />
     2024                <input type="button" onclick="findPosts.send();" value="<?php _e( 'Search' ); ?>" class="button" /><br />
     2025
     2026                <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
     2027                <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
     2028                <input type="radio" name="find-posts-what" id="find-posts-pages" value="pages" />
     2029                <label for="find-posts-pages"><?php _e( 'Pages' ); ?></label>
     2030            </div>
     2031            <div id="find-posts-response"></div>
     2032        </div>
     2033        <div class="find-box-buttons">
     2034            <input type="button" class="button" onclick="findPosts.close();" value="<?php _e('Close'); ?>" />
     2035            <input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" />
     2036        </div>
     2037    </div>
     2038    <script type="text/javascript">
     2039    (function($){
     2040        findPosts = {
     2041            open : function(af_name, af_val) {
     2042                var st = document.documentElement.scrollTop || $(document).scrollTop();
     2043
     2044                if ( af_name && af_val )
     2045                    $('#affected').attr('name', af_name).val(af_val);
     2046
     2047                $('#find-posts').show().draggable({
     2048                    handle: '#find-posts-head'
     2049                }).resizable({
     2050                    handles: 'all',
     2051                    minHeight: 150,
     2052                    minWidth: 280
     2053                }).css({'top':st+'px','left':'50%','marginLeft':'-200px'});
     2054               
     2055                $('.ui-resizable-handle').css({
     2056                    'backgroundColor': '#e5e5e5'
     2057                });
     2058               
     2059                $('.ui-resizable-se').css({
     2060                    'border': '0 none',
     2061                    'width': '15px',
     2062                    'height': '16px',
     2063                    'background': 'transparent url(images/se.png) no-repeat scroll 0 0'
     2064                });
     2065               
     2066                $('#find-posts-input').focus().keyup(function(e){
     2067                    if (e.which == 27) findPosts.close(); // close on Escape
     2068                });
     2069               
     2070                return false;
     2071            },
     2072           
     2073            close : function() {
     2074                $('#find-posts-response').html('');
     2075                $('#find-posts').draggable('destroy').resizable('destroy').hide();
     2076            },
     2077           
     2078            send : function() {
     2079                var post = {};
     2080
     2081                post['ps'] = $('#find-posts-input').val();
     2082                post['action'] = 'find_posts';
     2083                post['_ajax_nonce'] = $('#_ajax_nonce').val();
     2084               
     2085                if ( $('#find-posts-pages:checked').val() )
     2086                    post['pages'] = 1;
     2087                else
     2088                    post['posts'] = 1;
     2089       
     2090                $.ajax({
     2091                    type : 'POST',
     2092                    url : '<?php echo admin_url('admin-ajax.php'); ?>',
     2093                    data : post,
     2094                    success : function(x) { findPosts.show(x); },
     2095                    error : function(r) { findPosts.error(r); }
     2096                });
     2097            },
     2098           
     2099            show : function(x) {
     2100
     2101                if ( typeof(x) == 'string' ) {
     2102                    this.error({'responseText': x});
     2103                    return;
     2104                }
     2105
     2106                var r = wpAjax.parseAjaxResponse(x);
     2107
     2108                if ( r.errors )
     2109                    this.error({'responseText': wpAjax.broken});
     2110       
     2111                r = r.responses[0];
     2112                $('#find-posts-response').html(r.data);
     2113            },
     2114           
     2115            error : function(r) {
     2116                var er = r.statusText;
     2117
     2118                if ( r.responseText )
     2119                    er = r.responseText.replace( /<.[^<>]*?>/g, '' );
     2120       
     2121                if ( er )
     2122                    $('#find-posts-response').html(er);
     2123            }
     2124        };
     2125       
     2126        $(document).ready(function(){
     2127            $('#find-posts-submit').click(function(e) {
     2128                if ( '' == $('#find-posts-response').html() )
     2129                    e.preventDefault();
     2130            });
     2131        });
     2132    })(jQuery);
     2133    </script>
     2134<?php
     2135}
     2136
     2137?>
  • trunk/wp-admin/media.php

    r8645 r8901  
    6868
    6969    wp_enqueue_script( 'wp-ajax-response' );
    70     wp_admin_css( 'media' );
     70//  wp_admin_css( 'media' );
    7171
    7272
  • trunk/wp-admin/upload.php

    r8894 r8901  
    1111add_thickbox();
    1212wp_enqueue_script( 'media-upload' );
     13wp_enqueue_script( 'wp-ajax-response' );
     14wp_enqueue_script( 'jquery-ui-draggable' );
     15wp_enqueue_script( 'jquery-ui-resizable' );
    1316
    1417if (!current_user_can('upload_files'))
    1518    wp_die(__('You do not have permission to upload files.'));
    1619
    17 // Handle bulk deletes
    18 if ( isset($_GET['action']) && isset($_GET['media']) ) {
     20if ( isset($_GET['find_detached'] ) ) {
     21    check_admin_referer('bulk-media');
     22
     23    if ( ! current_user_can('edit_posts') )
     24        wp_die( __('You are not allowed to scan for lost attachments.') );
     25
     26    $all_posts = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'post' OR post_type = 'page'");
     27    $all_att = $wpdb->get_results("SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'attachment'");
     28
     29    $lost = array();
     30    foreach ( (array) $all_att as $att ) {
     31        if ( $att->post_parent > 0 && ! in_array($att->post_parent, $all_posts) )
     32            $lost[] = $att->ID;
     33    }
     34    $_GET['detached'] = 1;
     35
     36} elseif ( isset($_GET['found_post_id']) && isset($_GET['media']) ) {
     37    check_admin_referer('bulk-media');
     38
     39    if ( ! ( $parent_id = (int) $_GET['found_post_id'] ) )
     40        return;
     41
     42    $parent = &get_post($parent_id);
     43    if ( !current_user_can('edit_post', $parent_id) )
     44        wp_die( __('You are not allowed to edit this post.') );
     45
     46    $attach = array();
     47    foreach( (array) $_GET['media'] as $att_id ) {
     48        $att_id = (int) $att_id;
     49
     50        if ( !current_user_can('edit_post', $att_id) )
     51            continue;
     52
     53        $attach[] = $att_id;
     54    }
     55
     56    if ( ! empty($attach) ) {
     57        $attach = implode(',', $attach);
     58        $attached = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ($attach)", $parent_id) );
     59
     60        $message = sprintf( __ngettext('Added %1$s attachment to <strong>%2$s</strong>', 'Added %1$s attachments to <strong>%2$s</strong>', $attached, apply_filters( "the_title", $parent->post_title ) ) , $attached, apply_filters( "the_title", $parent->post_title ) );
     61    }
     62
     63    $_GET['detached'] = 1;
     64
     65} elseif ( isset($_GET['action']) && isset($_GET['media']) ) {
    1966    check_admin_referer('bulk-media');
    2067    if ( $_GET['action'] == 'delete' ) {
     
    5198wp_enqueue_script('media');
    5299
    53 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
     100if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 )
     101    $_GET['paged'] = 1;
     102
     103if ( isset($_GET['detached']) ) {
     104
     105    if ( isset($lost) ) {
     106        $start = ( $_GET['paged'] - 1 ) * 50;
     107        $page_links_total = ceil(count($lost) / 50);
     108        $lost = implode(',', $lost);
     109
     110        $orphans = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN ($lost) LIMIT $start, 50" );
     111    } else {
     112        $start = ( $_GET['paged'] - 1 ) * 25;
     113        $orphans = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent < 1 LIMIT $start, 25" );
     114        $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / 25);
     115    }
     116
     117    $post_mime_types = array(
     118                'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
     119                'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
     120                'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
     121            );
     122    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
     123
     124    $avail_post_mime_types = get_available_post_mime_types('attachment');
     125
     126    if ( isset($_GET['post_mime_type']) && !array_intersect( (array) $_GET['post_mime_type'], array_keys($post_mime_types) ) )
     127        unset($_GET['post_mime_type']);
     128
     129} else {
     130    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
     131}
    54132
    55133if ( is_singular() ) {
     
    58136}
    59137
    60 require_once('admin-header.php');
    61 
    62 if ( !isset( $_GET['paged'] ) )
    63     $_GET['paged'] = 1;
    64 
    65 ?>
     138require_once('admin-header.php'); ?>
    66139
    67140<form class="search-form" action="" method="get">
     
    90163
    91164<h2><?php
    92 if ( is_singular() ) {
    93     printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
     165if ( isset($_GET['detached']) ) {
     166    _e('Unattached Media');
     167} elseif ( is_singular() ) {
     168    printf( __('Comments on %s'), apply_filters("the_title", $post->post_title) );
    94169} else {
    95170    $post_mime_type_label = _c('Media|manage media header');
     
    97172        $post_mime_type_label = $post_mime_types[$_GET['post_mime_type']][1];
    98173    //TODO: Unreachable code: $post_listing_pageable is undefined, Similar code in edit.php
    99     //if ( $post_listing_pageable && !is_archive() && !is_search() ) 
     174    //if ( $post_listing_pageable && !is_archive() && !is_search() )
    100175    //  $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_mime_type_label) : sprintf(__('Latest %s'), $post_mime_type_label);
    101176    //else
     
    128203    foreach ( $reals as $real )
    129204        $num_posts[$type] += $_num_posts[$real];
    130 $class = empty($_GET['post_mime_type']) ? ' class="current"' : '';
     205
     206$class = empty($_GET['post_mime_type']) && ! isset($_GET['detached']) ? ' class="current"' : '';
    131207$type_links[] = "<li><a href=\"upload.php\"$class>".__('All Types')."</a>";
    132208foreach ( $post_mime_types as $mime_type => $label ) {
     
    142218    sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
    143219}
     220$class = isset($_GET['detached']) ? ' class="current"' : '';
     221$type_links[] = '<li><a href="upload.php?detached=1"' . $class . '>' . __('Unattached') . '</a>';
     222
    144223echo implode(' | </li>', $type_links) . '</li>';
    145224unset($type_links);
     
    156235$messages[2] = __('Media deleted.');
    157236
    158 if (isset($_GET['message'])) : ?>
    159 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
     237if ( isset($_GET['message']) && (int) $_GET['message'] )
     238    $message = $messages[$_GET['message']];
     239
     240if ( $message ) { ?>
     241<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
    160242<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    161 endif;
     243}
    162244?>
    163245
     
    167249
    168250<?php
     251if ( ! isset($page_links_total) )
     252    $page_links_total =  $wp_query->max_num_pages;
     253
    169254$page_links = paginate_links( array(
    170255    'base' => add_query_arg( 'paged', '%#%' ),
    171256    'format' => '',
    172     'total' => $wp_query->max_num_pages,
     257    'total' => $page_links_total,
    173258    'current' => $_GET['paged']
    174259));
     
    179264
    180265<div class="alignleft">
    181 <select name="action">
     266<select name="action" id="select-action">
    182267<option value="" selected><?php _e('Actions'); ?></option>
    183268<option value="delete"><?php _e('Delete'); ?></option>
     269<?php if ( isset($orphans) ) { ?>
     270<option value="attach"><?php _e('Attach to a post'); ?></option>
     271<?php } ?>
    184272</select>
    185 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     273<input type="submit" id="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
    186274<?php wp_nonce_field('bulk-media'); ?>
    187275<?php
    188276
    189 if ( !is_singular() ) :
     277if ( ! is_singular() && ! isset($_GET['detached']) ) {
    190278    $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
    191279
     
    218306<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
    219307
    220 <?php endif; // is_singular ?>
     308<?php } // ! is_singular ?>
     309
     310<?php if ( isset($_GET['detached']) ) { ?>
     311    <input type="submit" id="find_detached" name="find_detached" value="<?php _e('Scan for lost attachments'); ?>" class="button-secondary" />
     312<?php } ?>
    221313
    222314</div>
     
    226318
    227319<br class="clear" />
    228 
    229 <?php include( 'edit-attachment-rows.php' ); ?>
    230 
    231320<?php wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); ?>
     321
     322<?php if ( isset($orphans) ) { ?>
     323<table class="widefat">
     324<thead>
     325<tr>
     326    <th scope="col" class="check-column"><input type="checkbox" /></th>
     327    <th scope="col"></th>
     328    <th scope="col"><?php echo _c('Media|media column header'); ?></th>
     329    <th scope="col"><?php echo _c('Date Added|media column header'); ?></th>
     330</tr>
     331</thead>
     332
     333<tbody id="the-list" class="list:post">
     334<?php
     335    if ( $orphans ) {
     336        foreach ( $orphans as $post ) {
     337            $class = 'alternate' == $class ? '' : 'alternate';
     338            $att_title = empty($post->post_title) ? __('(no title)') : wp_specialchars( apply_filters('the_title', $post->post_title) );
     339?>
     340    <tr id='post-<?php echo $post->ID; ?>' class='<?php echo $class; ?>' valign="top">
     341        <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php echo $post->ID; ?>" /></th>
     342
     343        <td class="media-icon"><?php
     344        if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) { ?>
     345            <a href="media.php?action=edit&amp;attachment_id=<?php echo $post->ID; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $thumb; ?></a>
     346<?php   } ?></td>
     347
     348        <td><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
     349        <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
     350
     351        <p>
     352        <?php
     353        $actions = array();
     354        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
     355        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(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>";
     356        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
     357        $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;">'.__('Attach').'</a>';
     358        $action_count = count($actions);
     359        $i = 0;
     360        foreach ( $actions as $action => $link ) {
     361            ++$i;
     362            ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
     363            echo "<span class='$action'>$link$sep</span>";
     364        } ?>
     365        </p></td>
     366
     367<?php   if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
     368            $t_time = $h_time = __('Unpublished');
     369        } else {
     370            $t_time = get_the_time(__('Y/m/d g:i:s A'));
     371            $m_time = $post->post_date;
     372            $time = get_post_time( 'G', true );
     373            if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
     374                if ( $t_diff < 0 )
     375                    $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
     376                else
     377                    $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
     378            } else {
     379                $h_time = mysql2date(__('Y/m/d'), $m_time);
     380            }
     381        } ?>
     382        <td><?php echo $h_time ?></td>
     383    </tr>
     384<?php   }
     385
     386    } else { ?>
     387    <tr><td colspan="5"><?php _e('No posts found.') ?></td></tr>
     388<?php } ?>
     389</tbody>
     390</table>
     391<script type="text/javascript">
     392    (function($){
     393        $('#submit').click(function(e) {
     394            if ( 'attach' == $('#select-action').val() ) {
     395                e.preventDefault();
     396                findPosts.open();
     397            }
     398        });
     399    })(jQuery);
     400</script>
     401<?php find_posts_div();
     402
     403} else {
     404    include( 'edit-attachment-rows.php' );
     405} ?>
    232406
    233407</form>
     
    285459</div>
    286460
    287 <?php 
     461<?php
    288462
    289463include('admin-footer.php');
  • trunk/wp-admin/wp-admin.css

    r8889 r8901  
    569569    vertical-align: middle;
    570570    text-align: center;
     571    width: 80px;
    571572}
    572573
     
    22572258    vertical-align: middle;
    22582259}
     2260
     2261/* Media library */
     2262#wpbody-content .media-item-info tr {
     2263    background-color: transparent;
     2264}
     2265
     2266#wpbody-content .filename {
     2267    margin-left: 10px;
     2268}
     2269
     2270#wpbody-content .media-item .thumbnail {
     2271    max-height:128px;
     2272    max-width:128px;
     2273}
     2274
     2275#wpbody-content .media-upload-form label {
     2276    display: block;
     2277    font-size: 13px;
     2278    font-weight: bold;
     2279    margin: 0.5em;
     2280}
     2281
     2282abbr.required {
     2283    border: medium none;
     2284    text-decoration: none;
     2285}
     2286
     2287#wpbody-content .media-single input[type="text"],
     2288#wpbody-content .media-single textarea {
     2289    width: 460px;
     2290}
     2291
     2292#wpbody-content .media-upload-form p.help {
     2293    margin: 0;
     2294    padding: 0;
     2295}
     2296
     2297/* find posts */
     2298.find-box {
     2299    width: 400px;
     2300    height: 250px;
     2301    overflow: hidden;
     2302    padding: 33px 5px 50px;
     2303    position: absolute;
     2304    z-index: 1000;
     2305}
     2306
     2307.find-box-head {
     2308    cursor: move;
     2309    font-weight: bold;
     2310    height: 2em;
     2311    line-height: 2em;
     2312    padding: 1px 12px;
     2313    position: absolute;
     2314    top: 5px;
     2315    width: 100%;
     2316}
     2317
     2318.find-box-inside {
     2319    overflow: auto;
     2320    width: 100%;
     2321    height: 100%;
     2322}
     2323
     2324.find-box-search {
     2325    padding: 12px;
     2326    border-width: 1px;
     2327    border-style: none none solid;
     2328}
     2329
     2330#find-posts-response {
     2331    margin: 8px 0;
     2332    padding: 0 1px;
     2333}
     2334
     2335#find-posts-response table {
     2336    width: 100%;
     2337}
     2338
     2339#find-posts-response .found-radio {
     2340    padding: 8px 0 0 8px;
     2341    width: 15px;
     2342}
     2343
     2344.find-box-buttons {
     2345    bottom: 12px;
     2346    left: 12px;
     2347    position: absolute;
     2348}
     2349
     2350.find-box-search label {
     2351    padding-right: 6px;
     2352}
Note: See TracChangeset for help on using the changeset viewer.