<!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>[13535] trunk/wp-admin: Custom taxonomy support for inline edit.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13535">13535</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-03-01 15:48:01 +0000 (Mon, 01 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Custom taxonomy support for inline edit. Props prettyboymp. see <a href="http://trac.wordpress.org/ticket/9674">#9674</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjsinlineeditpostdevjs">trunk/wp-admin/js/inline-edit-post.dev.js</a></li>
<li><a href="#trunkwpadminjsinlineeditpostjs">trunk/wp-admin/js/inline-edit-post.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/includes/post.php        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx">
</span><span class="cx">         $post_IDs = array_map( 'intval', (array) $post_data['post'] );
</span><span class="cx">
</span><del>-        $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' );
</del><ins>+        $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky' );
</ins><span class="cx">         foreach ( $reset as $field ) {
</span><span class="cx">                 if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) )
</span><span class="cx">                         unset($post_data[$field]);
</span><span class="lines">@@ -266,10 +266,20 @@
</span><span class="cx">                 else
</span><span class="cx">                         unset($post_data['post_category']);
</span><span class="cx">         }
</span><del>-
-        if ( isset($post_data['tags_input']) ) {
-                $new_tags = preg_replace( '/\s*,\s*/', ',', rtrim( trim($post_data['tags_input']), ' ,' ) );
-                $new_tags = explode(',', $new_tags);
</del><ins>+        
+        $tax_input = array();
+        if ( isset($post_data['tax_input'])) {
+                foreach ( $post_data['tax_input'] as $tax_name => $terms ) {
+                        if ( empty($terms) )
+                                continue;
+                        $taxonomy = get_taxonomy( $tax_name );
+                        if ( $taxonomy->hierarchical )
+                                $tax_input[$tax_name] = array_map( 'absint', $terms );                        
+                        else {
+                                $tax_input[$tax_name] = preg_replace( '/\s*,\s*/', ',', rtrim( trim($terms), ' ,' ) );
+                                $tax_input[$tax_name] = explode(',', $tax_input[$tax_name]);
+                        }
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( isset($post_data['post_parent']) && ($parent = (int) $post_data['post_parent']) ) {
</span><span class="lines">@@ -300,15 +310,23 @@
</span><span class="cx">                         $locked[] = $post_ID;
</span><span class="cx">                         continue;
</span><span class="cx">                 }
</span><del>-
-                if ( isset($new_cats) ) {
</del><ins>+                
+                $tax_names = get_object_taxonomies( get_post($post_ID) );
+                
+                if ( isset($new_cats) && in_array( 'category', $tax_names ) ) {
</ins><span class="cx">                         $cats = (array) wp_get_post_categories($post_ID);
</span><span class="cx">                         $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
</span><span class="cx">                 }
</span><del>-
-                if ( isset($new_tags) ) {
-                        $tags = wp_get_post_tags($post_ID, array('fields' => 'names'));
-                        $post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) );
</del><ins>+                
+                foreach ( $tax_names as $tax_name ) {
+                        if( isset( $tax_input[$tax_name]) ) {
+                                $taxonomy = get_taxonomy( $tax_name );
+                                if( $taxonomy->hierarchical )
+                                        $terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'ids') );
+                                else
+                                        $terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'names') );
+                                $post_data['tax_input'][$tax_name] = array_merge( $terms, $tax_input[$tax_name] );
+                        }
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $post_data['ID'] = $post_ID;
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/includes/template.php        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -911,6 +911,20 @@
</span><span class="cx">         $post = get_default_post_to_edit( $screen->post_type );
</span><span class="cx">         $post_type_object = get_post_type_object( $screen->post_type );
</span><span class="cx">
</span><ins>+        $taxonomy_names = get_object_taxonomies( $screen->post_type );
+        $hierarchical_taxonomies = array();
+        $flat_taxonomies = array();
+        foreach ( $taxonomy_names as $taxonomy_name ) {
+                $taxonomy = get_taxonomy( $taxonomy_name);
+                
+                if( !$taxonomy->show_ui ) continue;
+                
+                if( $taxonomy->hierarchical )
+                        $hierarchical_taxonomies[] = $taxonomy;
+                else
+                        $flat_taxonomies[] = $taxonomy;
+        }
+        
</ins><span class="cx">         $columns = wp_manage_posts_columns($screen);
</span><span class="cx">         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
</span><span class="cx">         $col_count = count($columns) - count($hidden);
</span><span class="lines">@@ -1002,19 +1016,25 @@
</span><span class="cx">
</span><span class="cx">         </div></fieldset>
</span><span class="cx">
</span><del>-<?php if ( is_object_in_taxonomy($screen->post_type, 'category') && !$bulk ) : ?>
</del><ins>+<?php if ( count($hierarchical_taxonomies) && !$bulk ) : ?>
</ins><span class="cx">
</span><span class="cx">         <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
</span><del>-                <span class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?>
</del><ins>+        
+<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
+
+                <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->label) ?>
</ins><span class="cx">                         <span class="catshow"><?php _e('[more]'); ?></span>
</span><span class="cx">                         <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
</span><span class="cx">                 </span>
</span><del>-                <ul class="cat-checklist">
-                        <?php wp_category_checklist(); ?>
</del><ins>+                <ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist">
+                        <?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)) ?>
</ins><span class="cx">                 </ul>
</span><ins>+
+<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
+
</ins><span class="cx">         </div></fieldset>
</span><span class="cx">
</span><del>-<?php endif; // is_object_in_taxonomy($screen->post_type, 'category') && !$bulk ?>
</del><ins>+<?php endif; // count($hierarchical_taxonomies) && !$bulk ?>
</ins><span class="cx">
</span><span class="cx">         <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
</span><span class="cx">
</span><span class="lines">@@ -1058,15 +1078,19 @@
</span><span class="cx">
</span><span class="cx"> <?php endif; // $post_type_object->hierarchical ?>
</span><span class="cx">
</span><del>-<?php if ( is_object_in_taxonomy($screen->post_type, 'post_tag') && !$bulk ) : ?>
</del><ins>+<?php if ( count($flat_taxonomies) && !$bulk ) : ?>
</ins><span class="cx">
</span><ins>+<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
+
</ins><span class="cx">                 <label class="inline-edit-tags">
</span><del>-                        <span class="title"><?php _e( 'Tags' ); ?></span>
-                        <textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea>
</del><ins>+                        <span class="title"><?php echo esc_html($taxonomy->label) ?></span>
+                        <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea>
</ins><span class="cx">                 </label>
</span><span class="cx">
</span><del>-<?php endif; // is_object_in_taxonomy($screen->post_type, 'post_tag') && !$bulk ?>
</del><ins>+<?php endforeach; //$flat_taxonomies as $taxonomy ?>
</ins><span class="cx">
</span><ins>+<?php endif; // count($flat_taxonomies) && !$bulk ?>
+
</ins><span class="cx"> <?php if ( $bulk ) : ?>
</span><span class="cx">
</span><span class="cx">                 <div class="inline-edit-group">
</span><span class="lines">@@ -1225,13 +1249,17 @@
</span><span class="cx">         if ( $post_type_object->hierarchical )
</span><span class="cx">                 echo '<div class="menu_order">' . $post->menu_order . '</div>';
</span><span class="cx">
</span><del>-        if ( is_object_in_taxonomy($post->post_type, 'post_tag') )
-                echo '<div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div>';
</del><ins>+        $taxonomy_names = get_object_taxonomies( $post->post_type );
+        foreach ( $taxonomy_names as $taxonomy_name) {
+                $taxonomy = get_taxonomy( $taxonomy_name );
</ins><span class="cx">
</span><del>-        if ( is_object_in_taxonomy($post->post_type, 'post_tag') )
-                echo '<div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>';
</del><ins>+                if ( $taxonomy->hierarchical && $taxonomy->show_ui )
+                                echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '</div>';
+                elseif ( $taxonomy->show_ui )
+                        echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '</div>';
+        }
</ins><span class="cx">
</span><del>-        if ( $post->post_type == 'post' )
</del><ins>+        if ( !$post_type_object->hierarchical )
</ins><span class="cx">                 echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
</span><span class="cx">
</span><span class="cx">         echo '</div>';
</span></span></pre></div>
<a id="trunkwpadminjsinlineeditpostdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/inline-edit-post.dev.js (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/inline-edit-post.dev.js        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/js/inline-edit-post.dev.js        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -36,17 +36,13 @@
</span><span class="cx">                         $('#inline-edit label.inline-edit-tags').clone()
</span><span class="cx">                 );
</span><span class="cx">
</span><del>-                // categories expandable?
</del><ins>+                // hiearchical taxonomies expandable?
</ins><span class="cx">                 $('span.catshow').click(function() {
</span><del>-                        $('.inline-editor ul.cat-checklist').addClass("cat-hover");
-                        $('.inline-editor span.cathide').show();
-                        $(this).hide();
</del><ins>+                        $(this).hide().next().show().parent().next().addClass("cat-hover");
</ins><span class="cx">                 });
</span><span class="cx">
</span><span class="cx">                 $('span.cathide').click(function() {
</span><del>-                        $('.inline-editor ul.cat-checklist').removeClass("cat-hover");
-                        $('.inline-editor span.catshow').show();
-                        $(this).hide();
</del><ins>+                        $(this).hide().prev().show().parent().next().removeClass("cat-hover");
</ins><span class="cx">                 });
</span><span class="cx">
</span><span class="cx">                 $('select[name="_status"] option[value="future"]', bulkRow).remove();
</span><span class="lines">@@ -118,7 +114,6 @@
</span><span class="cx">
</span><span class="cx">                 fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
</span><span class="cx">                 if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
</span><del>-                if ( t.type == 'post' ) fields.push('tags_input');
</del><span class="cx">
</span><span class="cx">                 // add the new blank row
</span><span class="cx">                 editRow = $('#inline-edit').clone(true);
</span><span class="lines">@@ -146,9 +141,24 @@
</span><span class="cx">                 if ( $('.sticky', rowData).text() == 'sticky' )
</span><span class="cx">                         $('input[name="sticky"]', editRow).attr("checked", "checked");
</span><span class="cx">
</span><del>-                // categories
-                if ( cats = $('.post_category', rowData).text() )
-                        $('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
</del><ins>+                // hierarchical taxonomies
+                $('.post_category', rowData).each(function(){
+                        if( term_ids = $(this).text() )
+                        {
+                                taxname = $(this).attr('id').replace('_'+id, '');
+                                $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
+                        }
+                });
+                //flat taxonomies
+                $('.tags_input', rowData).each(function(){
+                        if( terms = $(this).text() )
+                        {
+                                taxname = $(this).attr('id').replace('_'+id, '');
+                                $('textarea.tax_input_'+taxname, editRow).val(terms);
+                                $('textarea.tax_input_'+taxname, editRow).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
+                        }
+                });
+                
</ins><span class="cx">
</span><span class="cx">                 // handle the post status
</span><span class="cx">                 status = $('._status', rowData).text();
</span><span class="lines">@@ -180,12 +190,6 @@
</span><span class="cx">                 $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
</span><span class="cx">                 $('.ptitle', editRow).focus();
</span><span class="cx">
</span><del>-                // enable autocomplete for tags
-                if ( t.type == 'post' ) {
-                        tax = 'post_tag';
-                        $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
-                }
-
</del><span class="cx">                 return false;
</span><span class="cx">         },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminjsinlineeditpostjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/inline-edit-post.js (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/inline-edit-post.js        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/js/inline-edit-post.js        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -1 +1 @@
</span><del>-(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("td",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});a("a.editinline").live("click",function(){inlineEditPost.edit(this);return false});a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(".inline-editor ul.cat-checklist").addClass("cat-hover");a(".inline-editor span.cathide").show();a(this).hide()});a("span.cathide").click(function(){a(".inline-editor ul.cat-checklist").removeClass("cat-hover");a(".inline-editor span.catshow").show();a(this).hide()});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},setBulk:function(){var e="",d=this.type,b,f=true;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(g){if(a(this).attr("checked")){f=false;var h=a(this).val(),c;c=a("#inline_"+h+" .post_title").text()||inlineEditL10n.notitle;e+='<div id="ttle'+h+'"><a id="_'+h+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+c+"</div>"}});if(f){return this.revert()}a("#bulk-titles").html(e);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').attr("checked","");a("#ttle"+c).remove()});if(d=="post"){b="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)=="object"){b=o.getId(b)}j=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(o.type=="page"){j.push("post_parent","menu_order","page_template")}if(o.type=="post"){j.push("tags_input")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(o.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(o.what+b).hide().after(d);g=a("#inline_"+b);if(!a(':input[name="post_author"] option[value='+a(".post_author",g).text()+"]",d).val()){a(':input[name="post_author"]',d).prepend('<option value="'+a(".post_author",g).text()+'">'+a("#"+o.type+"-"+b+" .author").text()+"</option>")}for(k=0;k<j.length;k++){a(':input[name="'+j[k]+'"]',d).val(a("."+j[k],g).text())}if(a(".comment_status",g).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",g).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",g).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}if(n=a(".post_category",g).text()){a("ul.cat-checklist :checkbox",d).val(n.split(","))}i=a("._status",g).text();if(i!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(i=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}h=a('select[name="post_parent"] option[value="'+b+'"]',d);if(h.length>0){m=h[0].className.split("-")[1];l=h;while(c){l=l.next("option");if(l.length==0){break}p=l[0].className.split("-")[1];if(p<=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();if(o.type=="post"){e="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+e,{delay:500,minchars:2,multiple:true,multipleSep:", "})}return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save",post_type:typenow,post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(f){a("table.widefat .inline-edit-save .waiting").hide();if(f){if(-1!=f.indexOf("<tr")){a(inlineEditPost.what+e).remove();a("#edit-"+e).before(f).remove();a(inlineEditPost.what+e).hide().fadeIn()}else{f=f.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+f+"</span>")}}else{a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+inlineEditL10n.error+"</span>")}},"html");return false},revert:function(){var b;if(b=a("table.widefat tr.inline-editor").attr("id")){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("td",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});a("a.editinline").live("click",function(){inlineEditPost.edit(this);return false});a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(this).hide().next().show().parent().next().addClass("cat-hover")});a("span.cathide").click(function(){a(this).hide().prev().show().parent().next().removeClass("cat-hover")});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},setBulk:function(){var e="",d=this.type,b,f=true;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(g){if(a(this).attr("checked")){f=false;var h=a(this).val(),c;c=a("#inline_"+h+" .post_title").text()||inlineEditL10n.notitle;e+='<div id="ttle'+h+'"><a id="_'+h+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+c+"</div>"}});if(f){return this.revert()}a("#bulk-titles").html(e);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').attr("checked","");a("#ttle"+c).remove()});if(d=="post"){b="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)=="object"){b=o.getId(b)}j=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(o.type=="page"){j.push("post_parent","menu_order","page_template")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(o.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(o.what+b).hide().after(d);g=a("#inline_"+b);if(!a(':input[name="post_author"] option[value='+a(".post_author",g).text()+"]",d).val()){a(':input[name="post_author"]',d).prepend('<option value="'+a(".post_author",g).text()+'">'+a("#"+o.type+"-"+b+" .author").text()+"</option>")}for(k=0;k<j.length;k++){a(':input[name="'+j[k]+'"]',d).val(a("."+j[k],g).text())}if(a(".comment_status",g).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",g).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",g).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}a(".post_category",g).each(function(){if(term_ids=a(this).text()){taxname=a(this).attr("id").replace("_"+b,"");a("ul."+taxname+"-checklist :checkbox",d).val(term_ids.split(","))}});a(".tags_input",g).each(function(){if(terms=a(this).text()){taxname=a(this).attr("id").replace("_"+b,"");a("textarea.tax_input_"+taxname,d).val(terms);a("textarea.tax_input_"+taxname,d).suggest("admin-ajax.php?action=ajax-tag-search&tax="+taxname,{delay:500,minchars:2,multiple:true,multipleSep:", "})}});i=a("._status",g).text();if(i!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(i=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}h=a('select[name="post_parent"] option[value="'+b+'"]',d);if(h.length>0){m=h[0].className.split("-")[1];l=h;while(c){l=l.next("option");if(l.length==0){break}p=l[0].className.split("-")[1];if(p<=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save",post_type:typenow,post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(f){a("table.widefat .inline-edit-save .waiting").hide();if(f){if(-1!=f.indexOf("<tr")){a(inlineEditPost.what+e).remove();a("#edit-"+e).before(f).remove();a(inlineEditPost.what+e).hide().fadeIn()}else{f=f.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+f+"</span>")}}else{a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+inlineEditL10n.error+"</span>")}},"html");return false},revert:function(){var b;if(b=a("table.widefat tr.inline-editor").attr("id")){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>