Make WordPress Core


Ignore:
Timestamp:
10/09/2007 10:49:42 PM (17 years ago)
Author:
ryan
Message:

jquery for list manipulation. Round one, fight. Props mdawaffe. fixes #4805

File:
1 edited

Legend:

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

    r6154 r6213  
    44$title = __('Posts');
    55$parent_file = 'edit.php';
    6 wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
     6wp_enqueue_script( 'admin-posts' );
     7if ( 1 == $_GET['c'] )
     8    wp_enqueue_script( 'admin-comments' );
    79require_once('admin-header.php');
    810
    9 $_GET['m']   = (int) $_GET['m'];
    10 $_GET['cat'] = (int) $_GET['cat'];
    11 $post_stati  = array(   //  array( adj, noun )
    12             'publish' => array(__('Published'), __('Published posts')),
    13             'future' => array(__('Scheduled'), __('Scheduled posts')),
    14             'pending' => array(__('Pending Review'), __('Pending posts')),
    15             'draft' => array(__('Draft'), _c('Drafts|manage posts header')),
    16             'private' => array(__('Private'), __('Private posts'))
    17         );
    18 
    19 $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
    20 
    21 $post_status_q = '';
    22 $post_status_label = __('Posts');
    23 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
    24     $post_status_label = $post_stati[$_GET['post_status']][1];
    25     $post_status_q = '&post_status=' . $_GET['post_status'];
    26 }
     11add_filter( 'post_limits', $limit_filter = create_function( '$a', '$b = split(" ",$a); if ( !isset($b[2]) ) return $a; $start = intval(trim($b[1])) / 20 * 15; if ( !is_int($start) ) return $a; return "LIMIT $start, 20";' ) );
     12list($post_stati, $avail_post_stati) = wp_edit_posts_query();
     13$wp_query->max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra )
    2714?>
    2815
     
    3118<?php
    3219
    33 if ( 'pending' === $_GET['post_status'] ) {
    34     $order = 'ASC';
    35     $orderby = 'modified';
    36 } elseif ( 'draft' === $_GET['post_status'] ) {
    37     $order = 'DESC';
    38     $orderby = 'modified';
    39 } else {
    40     $order = 'DESC';
    41     $orderby = 'date';
    42 }
    43 
    44 wp("what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
    45 
    46 // define the columns to display, the syntax is 'internal name' => 'display name'
    47 $posts_columns = array();
    48 $posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>';
    49 if ( 'draft' === $_GET['post_status'] )
    50     $posts_columns['modified'] = __('Modified');
    51 elseif ( 'pending' === $_GET['post_status'] )
    52     $posts_columns['modified'] = __('Submitted');
    53 else
    54     $posts_columns['date'] = __('When');
    55 $posts_columns['title'] = __('Title');
    56 $posts_columns['categories'] = __('Categories');
    57 if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
    58     $posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>';
    59 $posts_columns['author'] = __('Author');
    60 
    61 $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
    62 
    63 // you can not edit these at the moment
    64 $posts_columns['control_view']   = '';
    65 $posts_columns['control_edit']   = '';
    66 $posts_columns['control_delete'] = '';
     20$posts_columns = wp_manage_posts_columns();
    6721
    6822?>
     
    155109    </fieldset>
    156110    <input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button" />
     111    <?php wp_nonce_field( 'add-post', '_ajax_nonce', false ); ?>
     112    <input type="button" id="get-extra-button" class="add:the-extra-list:searchform" style="display:none" />
    157113</form>
    158114
Note: See TracChangeset for help on using the changeset viewer.