Make WordPress Core


Ignore:
Timestamp:
10/31/2007 03:53:32 AM (18 years ago)
Author:
ryan
Message:

AJAX for link category add and delete. Props mdawaffe. fixes #5291

File:
1 edited

Legend:

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

    r6118 r6299  
    55$parent_file = 'link-manager.php';
    66
    7 //wp_enqueue_script( 'admin-categories' );  TODO: Fix AJAX
     7wp_enqueue_script( 'admin-categories' );
    88require_once ('admin-header.php');
    99
     
    1414$messages[5] = __('Category not updated.');
    1515
    16 function link_cat_row($category) {
    17     global $class;
     16if (isset($_GET['message'])) : ?>
    1817
    19     if ( current_user_can( 'manage_categories' ) ) {
    20         $edit = "<a href='link-category.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
    21         $default_cat_id = (int) get_option( 'default_link_category' );
    22 
    23         if ( $category->term_id != $default_cat_id )
    24             $edit .= "<td><a href='" . wp_nonce_url( "link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_term_field( 'name', $default_cat_id,  'link_category' ))) . "' );\" class='delete'>".__( 'Delete' )."</a>";
    25         else
    26             $edit .= "<td style='text-align:center'>".__( "Default" );
    27     } else {
    28         $edit = '';
    29     }
    30 
    31     $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
    32 
    33     $category->count = number_format_i18n( $category->count );
    34     $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
    35     return "<tr id='cat-$category->term_id'$class>
    36         <th scope='row' style='text-align: center'>$category->term_id</th>
    37         <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>
    38         <td>$category->description</td>
    39         <td align='center'>$count</td>
    40         <td>$edit</td>\n\t</tr>\n";
    41 }
    42 ?>
    43 
    44 <?php if (isset($_GET['message'])) : ?>
    4518<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
    4619<?php endif; ?>
     
    6235    </tr>
    6336    </thead>
    64     <tbody id="the-list">
     37    <tbody id="the-list" class="list:link-cat">
    6538<?php
    6639$categories = get_terms( 'link_category', 'hide_empty=0' );
Note: See TracChangeset for help on using the changeset viewer.