Changeset 6798

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

Manage links redesign. Add link search.

Files:

Legend:

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

    r6797 r6798  
    1414    ); 
    1515 
    16 $post_status_label = __('Pages'); 
     16$post_status_label = __('Manage Pages'); 
    1717$post_status_q = ''; 
    1818if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { 
     
    6767 
    6868<p id="post-search"> 
    69     <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" /> 
     69    <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
    7070    <input type="submit" value="<?php _e( 'Search Pages' ); ?>" /> 
    7171</p> 
  • trunk/wp-admin/link-manager.php

    r6570 r6798  
    5959<div class="wrap"> 
    6060 
     61<form id="posts-filter" action="" method="get"> 
    6162<h2><?php _e('Manage Links'); ?></h2> 
    62 <p><a href="link-add.php"><?php _e('Add Link'); ?></a> | <a href="edit-link-categories.php"><?php _e('Link Categories'); ?></a> | <a href="link-import.php"><?php _e('Import Links'); ?></a></p> 
    63 <p><?php _e('Here you <a href="link-add.php">add links</a> to sites that you visit often and share them on your blog. When you have a list of links in your sidebar to other blogs, it&#8217;s called a &#8220;blogroll.&#8221;'); ?></p> 
    64 <form id="cats" method="get" action=""> 
    65 <p><?php 
     63 
     64<p id="post-search"> 
     65    <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     66    <input type="submit" value="<?php _e( 'Search Links' ); ?>" /> 
     67</p> 
     68 
     69<br style="clear:both;" /> 
     70 
     71<div class="tablenav"> 
     72 
     73<div style="float: left"> 
     74<input type="button" value="<?php _e('Delete'); ?>" name="deleteit" /> 
     75 
     76<?php 
    6677$categories = get_terms('link_category', "hide_empty=1"); 
    6778$select_cat = "<select name=\"cat_id\">\n"; 
    68 $select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n"; 
     79$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n"; 
    6980foreach ((array) $categories as $cat) 
    7081    $select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n"; 
     
    7283 
    7384$select_order = "<select name=\"order_by\">\n"; 
    74 $select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' .  __('Link ID') . "</option>\n"; 
    75 $select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' .  __('Name') . "</option>\n"; 
    76 $select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' .  __('Address') . "</option>\n"; 
    77 $select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' .  __('Rating') . "</option>\n"; 
     85$select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' .  __('Order by Link ID') . "</option>\n"; 
     86$select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' .  __('Order by Name') . "</option>\n"; 
     87$select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' .  __('Order by Address') . "</option>\n"; 
     88$select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' .  __('Order by Rating') . "</option>\n"; 
    7889$select_order .= "</select>\n"; 
    7990 
    80 printf(__('Currently showing %1$s links ordered by %2$s'), $select_cat, $select_order); 
    81 ?> 
    82 <input type="submit" name="action" value="<?php _e('Update &raquo;') ?>" /></p> 
     91echo $select_cat; 
     92echo $select_order; 
     93 
     94?> 
     95<input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button" /> 
     96 
     97</div> 
     98 
     99<br style="clear:both;" /> 
     100</div> 
    83101</form> 
     102 
     103<br style="clear:both;" /> 
     104 
    84105<?php 
    85106$link_columns = array( 
     
    89110    'rel'      => '<th style="text-align: center">' . __('rel') . '</th>', 
    90111    'visible'   => '<th style="text-align: center">' . __('Visible') . '</th>', 
    91     'action'   => '<th colspan="2" style="text-align: center">' . __('Action') . '</th>', 
    92112); 
    93113$link_columns = apply_filters('manage_link_columns', $link_columns); 
     
    97117if ( 'all' == $cat_id ) 
    98118    $cat_id = ''; 
    99 $links = get_bookmarks( "category=$cat_id&hide_invisible=0&orderby=$sqlorderby&hide_empty=0" ); 
     119$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0); 
     120if ( $_GET['s'] ) 
     121    $args['search'] = $_GET['s']; 
     122$links = get_bookmarks( $args ); 
    100123if ( $links ) { 
    101124?> 
     
    110133    <thead> 
    111134    <tr> 
     135    <th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th> 
    112136<?php foreach($link_columns as $column_display_name) { 
    113137    echo $column_display_name; 
    114138} ?> 
    115     <th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th> 
    116139    </tr> 
    117140    </thead> 
     
    133156        $style = ($i % 2) ? '' : ' class="alternate"'; 
    134157        ?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php 
     158        echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>'; 
    135159        foreach($link_columns as $column_name=>$column_display_name) { 
    136160            switch($column_name) { 
    137161                case 'name': 
    138                     ?><td><strong><?php echo $link->link_name; ?></strong><br /><?php 
     162                     
     163                    echo "<td><a href='link.php?link_id=$link->link_id&amp;action=edit' class='edit'>$link->link_name</a><br />"; 
    139164                    echo $link->link_description . "</td>"; 
    140165                    break; 
     
    163188                    ?><td align='center'><?php echo $visible; ?></td><?php 
    164189                    break; 
    165                 case 'action': 
    166                     echo "<td><a href='link.php?link_id=$link->link_id&amp;action=edit' class='edit'>" . __('Edit') . '</a></td>'; 
    167                     echo "<td><a href='" . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . "' class='delete:the-list:link-$link->link_id delete'>" . __('Delete') . '</a></td>'; 
    168                     break; 
    169190                default: 
    170191                    ?> 
     
    175196            } 
    176197        } 
    177         echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>'; 
    178198        echo "\n    </tr>\n"; 
    179199    } 
     
    184204<div id="ajax-response"></div> 
    185205 
    186 <p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links &raquo;') ?>" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p> 
    187206</form> 
    188207 
  • trunk/wp-includes/bookmark.php

    r6726 r6798  
    112112        'category_name' => '', 'hide_invisible' => 1, 
    113113        'show_updated' => 0, 'include' => '', 
    114         'exclude' => '' 
     114        'exclude' => '', 'search' => '' 
    115115    ); 
    116116 
     
    161161    } 
    162162 
     163    if ( ! empty($search) ) { 
     164        $search = like_escape($search); 
     165        $search = " AND ( (link_url LIKE '%$search%') OR (link_name LIKE '%$search%') OR (link_description LIKE '%$search%') ) "; 
     166    } 
     167 
    163168    $category_query = ''; 
    164169    $join = ''; 
     
    208213 
    209214    $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; 
    210     $query .= " $exclusions $inclusions"; 
     215    $query .= " $exclusions $inclusions $search"; 
    211216    $query .= " ORDER BY $orderby $order"; 
    212217    if ($limit != -1)