<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12818] trunk: Merge Categories/Hierarchical taxonomies into edit-tags.php.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12818">12818</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-01-24 11:00:27 +0000 (Sun, 24 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge Categories/Hierarchical taxonomies into edit-tags.php. See <a href="http://trac.wordpress.org/ticket/11838">#11838</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmineditlinkcategoriesphp">trunk/wp-admin/edit-link-categories.php</a></li>
<li><a href="#trunkwpadminedittagformphp">trunk/wp-admin/edit-tag-form.php</a></li>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadminincludestaxonomyphp">trunk/wp-admin/includes/taxonomy.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjstagsdevjs">trunk/wp-admin/js/tags.dev.js</a></li>
<li><a href="#trunkwpadminjstagsjs">trunk/wp-admin/js/tags.js</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/admin-ajax.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -610,7 +610,19 @@
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        echo _tag_row( $tag, '', $taxonomy );
</del><ins>+        $level = 0;
+        $tag_full_name = false;
+        if ( is_taxonomy_hierarchical($taxonomy) ) {
+                $tag_full_name = $tag->name;
+                $_tag = $tag;
+                while ( $_tag->parent ) {
+                        $_tag = get_term( $_tag->parent, $taxonomy );
+                        $tag_full_name = $_tag->name . ' &#8212; ' . $tag_full_name;
+                        $level++;
+                }
+                $tag_full_name = esc_attr($tag_full_name);        
+        }
+        echo _tag_row( $tag, $level, $tag_full_name, $taxonomy );
</ins><span class="cx">         exit;
</span><span class="cx">         break;
</span><span class="cx"> case 'get-tagcloud' :
</span><span class="lines">@@ -1210,7 +1222,7 @@
</span><span class="cx">                                 if ( !$tag || is_wp_error( $tag ) )
</span><span class="cx">                                         die( __('Tag not updated.') );
</span><span class="cx">
</span><del>-                                echo _tag_row($tag, '', $taxonomy);
</del><ins>+                                echo _tag_row($tag, 0, '', $taxonomy);
</ins><span class="cx">                         } else {
</span><span class="cx">                                 die( __('Tag not updated.') );
</span><span class="cx">                         }
</span></span></pre></div>
<a id="trunkwpadmineditlinkcategoriesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-link-categories.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-link-categories.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/edit-link-categories.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -226,5 +226,5 @@
</span><span class="cx"> </div><!-- /col-container -->
</span><span class="cx"> </div><!-- /wrap -->
</span><span class="cx">
</span><del>-<?php inline_edit_term_row('edit-link-categories'); ?>
</del><ins>+<?php inline_edit_term_row('edit-link-categories', 'link_category'); ?>
</ins><span class="cx"> <?php include('admin-footer.php'); ?>
</span></span></pre></div>
<a id="trunkwpadminedittagformphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tag-form.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tag-form.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/edit-tag-form.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -39,13 +39,22 @@
</span><span class="cx">                 <tr class="form-field">
</span><span class="cx">                         <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
</span><span class="cx">                         <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
</span><del>- <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
</del><ins>+                        <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
</ins><span class="cx">                 </tr>
</span><span class="cx"> <?php } ?>
</span><ins>+<?php if ( is_taxonomy_hierarchical($taxonomy) ) { ?>
</ins><span class="cx">                 <tr class="form-field">
</span><ins>+                        <th scope="row" valign="top"><label for="parent"><?php _e('Category Parent') ?></label></th>
+                        <td>
+                                <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
+                                <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
+                        </td>
+                </tr>
+<?php } ?>
+                <tr class="form-field">
</ins><span class="cx">                         <th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
</span><span class="cx">                         <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
</span><del>- <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
</del><ins>+                        <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
</ins><span class="cx">                 </tr>
</span><span class="cx">                 <?php do_action('edit_tag_form_fields', $tag); ?>
</span><span class="cx">         </table>
</span></span></pre></div>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/edit-tags.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx">
</span><span class="cx">         $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST);
</span><span class="cx">         if ( $ret && !is_wp_error( $ret ) ) {
</span><del>-                wp_redirect('edit-tags.php?message=1#addtag');
</del><ins>+                wp_redirect("edit-tags.php?taxonomy=$taxonomy&amp;message=1#addtag");
</ins><span class="cx">         } else {
</span><del>-                wp_redirect('edit-tags.php?message=4#addtag');
</del><ins>+                wp_redirect("edit-tags.php?taxonomy=$taxonomy&amp;message=4#addtag");
</ins><span class="cx">         }
</span><span class="cx">         exit;
</span><span class="cx"> break;
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">
</span><span class="cx">         wp_delete_term( $tag_ID, $taxonomy);
</span><span class="cx">
</span><del>-        $location = 'edit-tags.php';
</del><ins>+        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
</ins><span class="cx">         if ( $referer = wp_get_referer() ) {
</span><span class="cx">                 if ( false !== strpos($referer, 'edit-tags.php') )
</span><span class="cx">                         $location = $referer;
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">                 wp_delete_term( $tag_ID, $taxonomy);
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $location = 'edit-tags.php';
</del><ins>+        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
</ins><span class="cx">         if ( $referer = wp_get_referer() ) {
</span><span class="cx">                 if ( false !== strpos($referer, 'edit-tags.php') )
</span><span class="cx">                         $location = $referer;
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">
</span><span class="cx">         $ret = wp_update_term($tag_ID, $taxonomy, $_POST);
</span><span class="cx">
</span><del>-        $location = 'edit-tags.php';
</del><ins>+        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
</ins><span class="cx">         if ( $referer = wp_get_original_referer() ) {
</span><span class="cx">                 if ( false !== strpos($referer, 'edit-tags.php') )
</span><span class="cx">                         $location = $referer;
</span><span class="lines">@@ -200,10 +200,13 @@
</span><span class="cx"> $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
</span><span class="cx"> $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
</span><span class="cx">
</span><del>-if ( !empty($_GET['s']) )
-        $total_terms = count( get_terms( $taxonomy, array( 'search' => trim(stripslashes($_GET['s'])), 'number' => 0, 'hide_empty' => 0 ) ) );
-else
</del><ins>+if ( !empty($_GET['s']) ) {
+        $searchterms = trim(stripslashes($_GET['s']));
+        $total_terms = count( get_terms( $taxonomy, array( 'search' => $searchterms, 'number' => 0, 'hide_empty' => 0 ) ) );
+} else {
+        $searchterms = '';
</ins><span class="cx">         $total_terms = wp_count_terms($taxonomy);
</span><ins>+}
</ins><span class="cx">
</span><span class="cx"> $page_links = paginate_links( array(
</span><span class="cx">         'base' => add_query_arg( 'pagenum', '%#%' ),
</span><span class="lines">@@ -248,8 +251,6 @@
</span><span class="cx">         <tbody id="the-list" class="list:tag">
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
-
</del><span class="cx"> $count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
</span><span class="cx"> ?>
</span><span class="cx">         </tbody>
</span><span class="lines">@@ -312,7 +313,14 @@
</span><span class="cx">         <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
</span><span class="cx"> </div>
</span><span class="cx"> <?php } ?>
</span><ins>+<?php if ( is_taxonomy_hierarchical($taxonomy) ) { ?>
</ins><span class="cx"> <div class="form-field">
</span><ins>+        <label for="category_parent"><?php _e('Category Parent') ?></label>
+        <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
+        <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
+</div>
+<?php } ?>
+<div class="form-field">
</ins><span class="cx">         <label for="description"><?php _e('Description') ?></label>
</span><span class="cx">         <textarea name="description" id="description" rows="5" cols="40"></textarea>
</span><span class="cx">         <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
</span><span class="lines">@@ -329,7 +337,7 @@
</span><span class="cx"> </div><!-- /col-container -->
</span><span class="cx"> </div><!-- /wrap -->
</span><span class="cx">
</span><del>-<?php inline_edit_term_row('edit-tags'); ?>
</del><ins>+<?php inline_edit_term_row('edit-tags', $taxonomy); ?>
</ins><span class="cx">
</span><span class="cx"> <?php
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkwpadminincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/taxonomy.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/taxonomy.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/includes/taxonomy.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">                                 $cat_ids[] = $id;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ($post_id)
</del><ins>+        if ( $post_id )
</ins><span class="cx">                 wp_set_post_categories($post_id, $cat_ids);
</span><span class="cx">
</span><span class="cx">         return $cat_ids;
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/includes/template.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -205,15 +205,15 @@
</span><span class="cx"> *
</span><span class="cx"> * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
</span><span class="cx"> *
</span><del>- * @param string $type "tag", "category" or "link-category"
</del><ins>+ * @param string $type "edit-tags", "categoried" or "edit-link-categories"
+ * @param string $taxonomy The taxonomy of the row.
</ins><span class="cx"> * @return
</span><span class="cx"> */
</span><del>-function inline_edit_term_row($type) {
</del><ins>+function inline_edit_term_row($type, $taxonomy) {
</ins><span class="cx">
</span><span class="cx">         if ( ! current_user_can( 'manage_categories' ) )
</span><span class="cx">                 return;
</span><span class="cx">
</span><del>-        $is_tag = $type == 'edit-tags';
</del><span class="cx">         $columns = get_column_headers($type);
</span><span class="cx">         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
</span><span class="cx">         $col_count = count($columns) - count($hidden);
</span><span class="lines">@@ -236,14 +236,13 @@
</span><span class="cx">                         </label>
</span><span class="cx"> <?php } ?>
</span><span class="cx">
</span><del>-<?php if ( 'category' == $type ) : ?>
-
</del><ins>+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
</ins><span class="cx">                         <label>
</span><span class="cx">                                 <span class="title"><?php _e( 'Parent' ); ?></span>
</span><del>-                                <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('None'))); ?>
</del><ins>+                                <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'taxonomy' => $taxonomy, 'show_option_none' => __('None'))); ?>
</ins><span class="cx">                         </label>
</span><span class="cx">
</span><del>-<?php endif; // $type ?>
</del><ins>+<?php endif; // $hierarchical ?>
</ins><span class="cx">
</span><span class="cx">                 </div></fieldset>
</span><span class="cx">
</span><span class="lines">@@ -254,14 +253,14 @@
</span><span class="cx">         foreach ( $columns as $column_name => $column_display_name ) {
</span><span class="cx">                 if ( isset( $core_columns[$column_name] ) )
</span><span class="cx">                         continue;
</span><del>-                do_action( 'quick_edit_custom_box', $column_name, $type );
</del><ins>+                do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> ?>
</span><span class="cx">
</span><span class="cx">         <p class="inline-edit-save submit">
</span><span class="cx">                 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
</span><del>-                <?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?>
</del><ins>+                <?php $update_text = ( 'post_tag' == $taxonomy ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?>
</ins><span class="cx">                 <a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
</span><span class="cx">                 <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
</span><span class="cx">                 <span class="error" style="display:none;"></span>
</span><span class="lines">@@ -671,12 +670,18 @@
</span><span class="cx"> * @param unknown_type $class
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><del>-function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
</del><ins>+function _tag_row( $tag, $level, $class = '', $taxonomy = 'post_tag' ) {
</ins><span class="cx">                 $count = number_format_i18n( $tag->count );
</span><del>-                $tagsel = ($taxonomy == 'post_tag' ? 'tag' : $taxonomy);
</del><ins>+                if ( 'post_tag' == $taxonomy )
+                        $tagsel = 'tag';
+                elseif ( 'category' == $taxonomy )
+                        $tagsel = 'category_name';
+                else
+                        $tagsel = $taxonomy;
</ins><span class="cx">                 $count = ( $count > 0 ) ? "<a href='edit.php?$tagsel=$tag->slug'>$count</a>" : $count;
</span><span class="cx">
</span><del>-                $name = apply_filters( 'term_name', $tag->name );
</del><ins>+                $pad = str_repeat( '&#8212; ', max(0, $level) );
+                $name = apply_filters( 'term_name', $pad . ' ' . $tag->name );
</ins><span class="cx">                 $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
</span><span class="cx">                 $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id";
</span><span class="cx">                 $out = '';
</span><span class="lines">@@ -694,15 +699,22 @@
</span><span class="cx">
</span><span class="cx">                         switch ($column_name) {
</span><span class="cx">                                 case 'cb':
</span><del>-                                        $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
</del><ins>+                                        if ( $tag->term_id != get_option('default_' . $taxonomy) )
+                                                $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
+                                        else
+                                                $out .= '<th scope="row" class="check-column">&nbsp;</th>';
</ins><span class="cx">                                         break;
</span><span class="cx">                                 case 'name':
</span><span class="cx">                                         $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $name)) . '">' . $name . '</a></strong><br />';
</span><span class="cx">                                         $actions = array();
</span><span class="cx">                                         $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
</span><span class="cx">                                         $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
</span><del>-                                        $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
</del><ins>+                                        if ( $tag->term_id != get_option('default_' . $taxonomy) )
+                                                $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
+
</ins><span class="cx">                                         $actions = apply_filters('tag_row_actions', $actions, $tag);
</span><ins>+                                        $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);
+
</ins><span class="cx">                                         $action_count = count($actions);
</span><span class="cx">                                         $i = 0;
</span><span class="cx">                                         $out .= '<div class="row-actions">';
</span><span class="lines">@@ -714,7 +726,8 @@
</span><span class="cx">                                         $out .= '</div>';
</span><span class="cx">                                         $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
</span><span class="cx">                                         $out .= '<div class="name">' . $qe_data->name . '</div>';
</span><del>-                                        $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div></div></td>';
</del><ins>+                                        $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
+                                        $out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';
</ins><span class="cx">                                         break;
</span><span class="cx">                                 case 'description':
</span><span class="cx">                                         $out .= "<td $attributes>$tag->description</td>";
</span><span class="lines">@@ -758,23 +771,85 @@
</span><span class="cx">
</span><span class="cx">         $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
</span><span class="cx">
</span><del>-        if ( !empty( $searchterms ) ) {
</del><ins>+        if ( !empty( $searchterms ) )
</ins><span class="cx">                 $args['search'] = $searchterms;
</span><del>-        }
</del><span class="cx">
</span><del>-        $tags = get_terms( $taxonomy, $args );
-
</del><span class="cx">         // convert it to table rows
</span><span class="cx">         $out = '';
</span><span class="cx">         $count = 0;
</span><del>-        foreach( $tags as $tag )
-                $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
</del><ins>+        if ( is_taxonomy_hierarchical($taxonomy) ) {
+                // We'll need the full set of terms then.
+                $args['number'] = $args['offset'] = 0;
</ins><span class="cx">
</span><ins>+                $terms = get_terms( $taxonomy, $args );
+                if ( !empty( $searchterms ) ) // Ignore children on searches.
+                        $children = array();
+                else
+                        $children = _get_term_hierarchy($taxonomy);
+
+                // Some funky recursion to get the job done is contained within, Skip it for non-hierarchical taxonomies for performance sake
+                $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
+        } else {
+                $terms = get_terms( $taxonomy, $args );
+                foreach( $terms as $term )
+                        $out .= _tag_row( $term, 0, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
+        }
+
</ins><span class="cx">         // filter and send to screen
</span><span class="cx">         echo $out;
</span><span class="cx">         return $count;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
+
+        $start = ($page - 1) * $per_page;
+        $end = $start + $per_page;
+
+        $output = '';
+        foreach ( $terms as $key => $term ) {
+
+                if ( $count >= $end )
+                        break;
+
+                if ( $term->parent != $parent && empty($_GET['s']) )
+                        continue;
+
+                // If the page starts in a subtree, print the parents.
+                if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {
+                        $my_parents = $parent_ids = array();
+                        $p = $term->parent;
+                        while ( $p ) {
+                                $my_parent = get_term( $p, $taxonomy );
+                                $my_parents[] = $my_parent;
+                                $p = $my_parent->parent;
+                                if ( in_array($p, $parent_ids) ) // Prevent parent loops.
+                                        break;
+                                $parent_ids[] = $p;
+                        }
+                        unset($parent_ids);
+
+                        $num_parents = count($my_parents);
+                        $count -= $num_parents; // Do not include parents in the per-page count, This is due to paging issues with unknown numbers of rows.
+                        while ( $my_parent = array_pop($my_parents) ) {
+                                $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
+                                $num_parents--;
+                        }
+                }
+
+                if ( $count >= $start )
+                        $output .= "\t" . _tag_row( $term, $level, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
+                else
+                        ++$count;
+
+                unset($terms[$key]);
+
+                if ( isset($children[$term->term_id]) )
+                        $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );
+        }
+
+        return $output;
+}
+
</ins><span class="cx"> // define the columns to display, the syntax is 'internal name' => 'display name'
</span><span class="cx"> /**
</span><span class="cx"> * {@internal Missing Short Description}}
</span></span></pre></div>
<a id="trunkwpadminjstagsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/tags.dev.js (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/tags.dev.js        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/js/tags.dev.js        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -34,7 +34,11 @@
</span><span class="cx">                                 $('#ajax-response').append(r);
</span><span class="cx">                         } else {
</span><span class="cx">                                 $('#ajax-response').empty();
</span><del>-                                $('#the-list').prepend(r);
</del><ins>+                                var parent = form.find('select#parent').val();
+                                if ( parent > 0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
+                                        $('#the-list #tag-' + parent).after(r);
+                                else
+                                        $('#the-list').prepend(r);
</ins><span class="cx">                                 $('input[type="text"]:visible, textarea:visible', form).val('');
</span><span class="cx">                         }
</span><span class="cx">                 });
</span><span class="lines">@@ -42,4 +46,4 @@
</span><span class="cx">                 return false;
</span><span class="cx">         });
</span><span class="cx">
</span><del>-});
</del><ins>+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjstagsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/tags.js (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/tags.js        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/js/tags.js        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -1 +1 @@
</span><del>-jQuery(document).ready(function(a){a(".delete-tag").live("click",function(g){var b=a(this),f=b.parents("tr"),c=true,d;if("undefined"!=showNotice){c=showNotice.warn()}if(c){d=b.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag");a.post(ajaxurl,d,function(e){if("1"==e){a("#ajax-response").empty();f.fadeOut("normal",function(){f.remove()})}else{if("-1"==e){a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.noPerm+"</p></div>");f.children().css("backgroundColor","")}else{a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.broken+"</p></div>");f.children().css("backgroundColor","")}}});f.children().css("backgroundColor","#f33")}return false});a("#submit").click(function(){var b=a(this).parents("form");if(!validateForm(b)){return false}a.post(ajaxurl,a("#addtag").serialize(),function(c){if(c.indexOf('<div class="error"')===0){a("#ajax-response").append(c)}else{a("#ajax-response").empty();a("#the-list").prepend(c);a('input[type="text"]:visible, textarea:visible',b).val("")}});return false})});
</del><span class="cx">\ No newline at end of file
</span><ins>+jQuery(document).ready(function($){$(".delete-tag").live("click",function(e){var t=$(this),tr=t.parents("tr"),r=true,data;if("undefined"!=showNotice){r=showNotice.warn()}if(r){data=t.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag");$.post(ajaxurl,data,function(r){if("1"==r){$("#ajax-response").empty();tr.fadeOut("normal",function(){tr.remove()})}else{if("-1"==r){$("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.noPerm+"</p></div>");tr.children().css("backgroundColor","")}else{$("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.broken+"</p></div>");tr.children().css("backgroundColor","")}}});tr.children().css("backgroundColor","#f33")}return false});$("#submit").click(function(){var form=$(this).parents("form");if(!validateForm(form)){return false}$.post(ajaxurl,$("#addtag").serialize(),function(r){if(r.indexOf('<div class="error"')===0){$("#ajax-response").append(r)}else{$("#ajax-response").empty();var parent=form.find("select#parent").val();if(parent>0&&$("#tag-"+parent).length>0){$("#the-list #tag-"+parent).after(r)}else{$("#the-list").prepend(r)}$('input[type="text"]:visible, textarea:visible',form).val("")}});return false})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/menu.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -50,11 +50,7 @@
</span><span class="cx">                 if ( ! in_array('post', (array) $tax->object_type, true) )
</span><span class="cx">                         continue;
</span><span class="cx">
</span><del>-                if ( $tax->hierarchical )
-                        $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'categories.php?taxonomy=' . $tax->name );
-                else
-                        $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax->name );
-                ++$i;
</del><ins>+                $submenu['edit.php'][$i++] = array( esc_attr($tax->label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax->name );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
</span><span class="lines">@@ -90,11 +86,7 @@
</span><span class="cx">                 if ( ! in_array($ptype, (array) $tax->object_type, true) )
</span><span class="cx">                         continue;
</span><span class="cx">
</span><del>-                if ( $tax->hierarchical )
-                        $submenu["edit.php?post_type=$ptype"][$i] = array( esc_attr($tax->label), 'manage_categories', "categories.php?taxonomy=$tax->name&amp;post_type=$ptype" );
-                else
-                        $submenu["edit.php?post_type=$ptype"][$i] = array( esc_attr($tax->label), 'manage_categories', "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
-                ++$i;
</del><ins>+                $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr($tax->label), 'manage_categories', "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> unset($ptype, $ptype_obj);
</span></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-includes/taxonomy.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -786,13 +786,13 @@
</span><span class="cx">
</span><span class="cx">         // don't limit the query results when we have to descend the family tree
</span><span class="cx">         if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) {
</span><del>-                if( $offset )
</del><ins>+                if ( $offset )
</ins><span class="cx">                         $limit = 'LIMIT ' . $offset . ',' . $number;
</span><span class="cx">                 else
</span><span class="cx">                         $limit = 'LIMIT ' . $number;
</span><del>-
-        } else
</del><ins>+        } else {
</ins><span class="cx">                 $limit = '';
</span><ins>+        }
</ins><span class="cx">
</span><span class="cx">         if ( !empty($search) ) {
</span><span class="cx">                 $search = like_escape($search);
</span><span class="lines">@@ -2446,4 +2446,5 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> ?>
</span></span></pre>
</div>
</div>
</body>
</html>