Changeset 6799

Show
Ignore:
Timestamp:
02/12/08 09:02:02 (9 months ago)
Author:
ryan
Message:

Manage categories redesign. Add categories search.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/categories.php

    r6213 r6799  
    8585 
    8686<div class="wrap"> 
     87<form id="posts-filter" action="" method="get"> 
    8788<?php if ( current_user_can('manage_categories') ) : ?> 
    88     <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> 
     89    <h2><?php printf(__('Manage Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> 
    8990<?php else : ?> 
    90     <h2><?php _e('Categories') ?> </h2> 
     91    <h2><?php _e('Manage Categories') ?> </h2> 
    9192<?php endif; ?> 
     93 
     94<p id="post-search"> 
     95    <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     96    <input type="submit" value="<?php _e( 'Search Categories' ); ?>" /> 
     97</p> 
     98 
     99<br style="clear:both;" /> 
     100 
     101<div class="tablenav"> 
     102 
     103<div style="float: left"> 
     104<input type="button" value="<?php _e('Delete'); ?>" name="deleteit" /> 
     105</div> 
     106 
     107<br style="clear:both;" /> 
     108</div> 
     109</form> 
     110 
     111<br style="clear:both;" /> 
     112 
    92113<table class="widefat"> 
    93114    <thead> 
    94115    <tr> 
    95         <th scope="col" style="text-align: center"><?php _e('ID') ?></th> 
     116        <th scope="col"><div style="text-align: center"><input type="checkbox" name="TODO" /></div></th> 
    96117        <th scope="col"><?php _e('Name') ?></th> 
    97118        <th scope="col"><?php _e('Description') ?></th> 
    98119        <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th> 
    99         <th colspan="2" style="text-align: center"><?php _e('Action') ?></th> 
    100120    </tr> 
    101121    </thead> 
  • trunk/wp-admin/includes/template.php

    r6797 r6799  
    77// Dandy new recursive multiple category stuff. 
    88function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { 
    9     if ( !$categories ) 
    10         $categories = get_categories( 'hide_empty=0' ); 
     9    if ( !$categories ) { 
     10        $args = array('hide_empty' => 0); 
     11        if ( !empty($_GET['s']) ) 
     12            $args['search'] = $_GET['s']; 
     13        $categories = get_categories( $args ); 
     14    } 
    1115 
    1216    $children = _get_term_hierarchy('category'); 
     
    3943    $pad = str_repeat( '&#8212; ', $level ); 
    4044    if ( current_user_can( 'manage_categories' ) ) { 
    41         $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>"; 
     45        $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->term_id'>". ( $name_override ? $name_override : $pad . ' ' . $category->name ) ."</a>"; 
    4246        $default_cat_id = (int) get_option( 'default_category' ); 
    43  
    44         if ( $category->term_id != $default_cat_id ) 
    45             $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' )."</a>"; 
    46         else 
    47             $edit .= "<td style='text-align:center'>".__( "Default" ); 
    48     } else 
    49         $edit = ''; 
     47    } else { 
     48        $edit = ( $name_override ? $name_override : $pad . ' ' . $category->name ); 
     49    } 
    5050 
    5151    $class = " class='alternate'" == $class ? '' : " class='alternate'"; 
     
    5454    $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count; 
    5555    $output = "<tr id='cat-$category->term_id'$class> 
    56         <th scope='row' style='text-align: center'>$category->term_id</th> 
    57         <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td> 
     56        <th scope='row' style='text-align: center'><input type='checkbox' name='delete[]' value='$category->term_id' /></th> 
     57        <td>$edit</td> 
    5858        <td>$category->description</td> 
    59         <td align='center'>$posts_count</td> 
    60         <td>$edit</td>\n\t</tr>\n"; 
     59        <td align='center'>$posts_count</td>\n\t</tr>\n"; 
    6160 
    6261    return apply_filters('cat_row', $output); 
  • trunk/wp-admin/link-manager.php

    r6798 r6799  
    118118    $cat_id = ''; 
    119119$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0); 
    120 if ( $_GET['s']
     120if ( !empty($_GET['s'])
    121121    $args['search'] = $_GET['s']; 
    122122$links = get_bookmarks( $args ); 
  • trunk/wp-includes/taxonomy.php

    r6738 r6799  
    526526        'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 
    527527        'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 
    528         'pad_counts' => false, 'offset' => ''); 
     528        'pad_counts' => false, 'offset' => '', 'search' => ''); 
    529529    $args = wp_parse_args( $args, $defaults ); 
    530530    $args['number'] = absint( $args['number'] ); 
     
    635635    } else 
    636636        $number = ''; 
     637 
     638    if ( !empty($search) ) { 
     639        $search = like_escape($search); 
     640        $where .= " AND (t.name LIKE '%$search%')"; 
     641    } 
    637642 
    638643    if ( 'all' == $fields )