WordPress.org

Make WordPress Core

Changeset 13535


Ignore:
Timestamp:
03/01/10 15:48:01 (8 years ago)
Author:
ryan
Message:

Custom taxonomy support for inline edit. Props prettyboymp. see #9674

Location:
trunk/wp-admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r13489 r13535  
    255255    $post_IDs = array_map( 'intval', (array) $post_data['post'] ); 
    256256 
    257     $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' ); 
     257    $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky' ); 
    258258    foreach ( $reset as $field ) { 
    259259        if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) ) 
     
    267267            unset($post_data['post_category']); 
    268268    } 
    269  
    270     if ( isset($post_data['tags_input']) ) { 
    271         $new_tags = preg_replace( '/\s*,\s*/', ',', rtrim( trim($post_data['tags_input']), ' ,' ) ); 
    272         $new_tags = explode(',', $new_tags); 
     269     
     270    $tax_input = array(); 
     271    if ( isset($post_data['tax_input'])) { 
     272        foreach ( $post_data['tax_input'] as $tax_name => $terms ) { 
     273            if ( empty($terms) ) 
     274                continue; 
     275            $taxonomy = get_taxonomy( $tax_name ); 
     276            if ( $taxonomy->hierarchical ) 
     277                $tax_input[$tax_name] = array_map( 'absint', $terms );           
     278            else { 
     279                $tax_input[$tax_name] = preg_replace( '/\s*,\s*/', ',', rtrim( trim($terms), ' ,' ) ); 
     280                $tax_input[$tax_name] = explode(',', $tax_input[$tax_name]); 
     281            } 
     282        } 
    273283    } 
    274284 
     
    301311            continue; 
    302312        } 
    303  
    304         if ( isset($new_cats) ) { 
     313         
     314        $tax_names = get_object_taxonomies( get_post($post_ID) ); 
     315         
     316        if ( isset($new_cats) && in_array( 'category', $tax_names ) ) { 
    305317            $cats = (array) wp_get_post_categories($post_ID); 
    306318            $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); 
    307319        } 
    308  
    309         if ( isset($new_tags) ) { 
    310             $tags = wp_get_post_tags($post_ID, array('fields' => 'names')); 
    311             $post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) ); 
     320         
     321        foreach ( $tax_names as $tax_name ) { 
     322            if( isset( $tax_input[$tax_name])  ) { 
     323                $taxonomy = get_taxonomy( $tax_name ); 
     324                if( $taxonomy->hierarchical ) 
     325                    $terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'ids') ); 
     326                else 
     327                    $terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'names') ); 
     328                $post_data['tax_input'][$tax_name] = array_merge( $terms, $tax_input[$tax_name] ); 
     329            } 
    312330        } 
    313331 
  • trunk/wp-admin/includes/template.php

    r13510 r13535  
    912912    $post_type_object = get_post_type_object( $screen->post_type ); 
    913913 
     914    $taxonomy_names = get_object_taxonomies( $screen->post_type ); 
     915    $hierarchical_taxonomies = array(); 
     916    $flat_taxonomies = array(); 
     917    foreach ( $taxonomy_names as $taxonomy_name ) { 
     918        $taxonomy = get_taxonomy( $taxonomy_name); 
     919         
     920        if( !$taxonomy->show_ui ) continue; 
     921         
     922        if( $taxonomy->hierarchical ) 
     923            $hierarchical_taxonomies[] = $taxonomy; 
     924        else  
     925            $flat_taxonomies[] = $taxonomy; 
     926    } 
     927     
    914928    $columns = wp_manage_posts_columns($screen); 
    915929    $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) ); 
     
    10031017    </div></fieldset> 
    10041018 
    1005 <?php if ( is_object_in_taxonomy($screen->post_type, 'category') && !$bulk ) : ?> 
     1019<?php if ( count($hierarchical_taxonomies) && !$bulk ) : ?> 
    10061020 
    10071021    <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> 
    1008         <span class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?> 
     1022     
     1023<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> 
     1024 
     1025        <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->label) ?> 
    10091026            <span class="catshow"><?php _e('[more]'); ?></span> 
    10101027            <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span> 
    10111028        </span> 
    1012         <ul class="cat-checklist"> 
    1013             <?php wp_category_checklist(); ?> 
     1029        <ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist"> 
     1030            <?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)) ?> 
    10141031        </ul> 
     1032 
     1033<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?> 
     1034 
    10151035    </div></fieldset> 
    10161036 
    1017 <?php endif; // is_object_in_taxonomy($screen->post_type, 'category') && !$bulk ?> 
     1037<?php endif; // count($hierarchical_taxonomies) && !$bulk ?> 
    10181038 
    10191039    <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> 
     
    10591079<?php endif; // $post_type_object->hierarchical ?> 
    10601080 
    1061 <?php if ( is_object_in_taxonomy($screen->post_type, 'post_tag') && !$bulk ) : ?> 
     1081<?php if ( count($flat_taxonomies) && !$bulk ) : ?> 
     1082 
     1083<?php foreach ( $flat_taxonomies as $taxonomy ) : ?> 
    10621084 
    10631085        <label class="inline-edit-tags"> 
    1064             <span class="title"><?php _e( 'Tags' ); ?></span> 
    1065             <textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea> 
     1086            <span class="title"><?php echo esc_html($taxonomy->label) ?></span> 
     1087            <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea> 
    10661088        </label> 
    10671089 
    1068 <?php endif; // is_object_in_taxonomy($screen->post_type, 'post_tag') && !$bulk  ?> 
     1090<?php endforeach; //$flat_taxonomies as $taxonomy ?> 
     1091 
     1092<?php endif; // count($flat_taxonomies) && !$bulk  ?> 
    10691093 
    10701094<?php if ( $bulk ) : ?> 
     
    12261250        echo '<div class="menu_order">' . $post->menu_order . '</div>'; 
    12271251 
    1228     if ( is_object_in_taxonomy($post->post_type, 'post_tag') ) 
    1229         echo '<div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div>'; 
    1230  
    1231     if ( is_object_in_taxonomy($post->post_type, 'post_tag') ) 
    1232         echo '<div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>'; 
    1233  
    1234     if ( $post->post_type == 'post' ) 
     1252    $taxonomy_names = get_object_taxonomies( $post->post_type ); 
     1253    foreach ( $taxonomy_names as $taxonomy_name) { 
     1254        $taxonomy = get_taxonomy( $taxonomy_name ); 
     1255 
     1256        if ( $taxonomy->hierarchical && $taxonomy->show_ui ) 
     1257                echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '</div>'; 
     1258        elseif ( $taxonomy->show_ui ) 
     1259            echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '</div>'; 
     1260    } 
     1261 
     1262    if ( !$post_type_object->hierarchical ) 
    12351263        echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>'; 
    12361264 
  • trunk/wp-admin/js/inline-edit-post.dev.js

    r13292 r13535  
    3737        ); 
    3838 
    39         // categories expandable? 
     39        // hiearchical taxonomies expandable? 
    4040        $('span.catshow').click(function() { 
    41             $('.inline-editor ul.cat-checklist').addClass("cat-hover"); 
    42             $('.inline-editor span.cathide').show(); 
    43             $(this).hide(); 
     41            $(this).hide().next().show().parent().next().addClass("cat-hover"); 
    4442        }); 
    4543 
    4644        $('span.cathide').click(function() { 
    47             $('.inline-editor ul.cat-checklist').removeClass("cat-hover"); 
    48             $('.inline-editor span.catshow').show(); 
    49             $(this).hide(); 
     45            $(this).hide().prev().show().parent().next().removeClass("cat-hover"); 
    5046        }); 
    5147 
     
    119115        fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password']; 
    120116        if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template'); 
    121         if ( t.type == 'post' ) fields.push('tags_input'); 
    122117 
    123118        // add the new blank row 
     
    147142            $('input[name="sticky"]', editRow).attr("checked", "checked"); 
    148143 
    149         // categories 
    150         if ( cats = $('.post_category', rowData).text() ) 
    151             $('ul.cat-checklist :checkbox', editRow).val(cats.split(',')); 
     144        // hierarchical taxonomies 
     145        $('.post_category', rowData).each(function(){ 
     146            if( term_ids = $(this).text() ) 
     147            { 
     148                taxname = $(this).attr('id').replace('_'+id, ''); 
     149                $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(',')); 
     150            } 
     151        }); 
     152        //flat taxonomies 
     153        $('.tags_input', rowData).each(function(){ 
     154            if( terms = $(this).text() ) 
     155            { 
     156                taxname = $(this).attr('id').replace('_'+id, ''); 
     157                $('textarea.tax_input_'+taxname, editRow).val(terms); 
     158                $('textarea.tax_input_'+taxname, editRow).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 
     159            } 
     160        }); 
     161         
    152162 
    153163        // handle the post status 
     
    181191        $('.ptitle', editRow).focus(); 
    182192 
    183         // enable autocomplete for tags 
    184         if ( t.type == 'post' ) { 
    185             tax = 'post_tag'; 
    186             $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 
    187         } 
    188  
    189193        return false; 
    190194    }, 
  • trunk/wp-admin/js/inline-edit-post.js

    r13292 r13535  
    1 (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); 
     1(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); 
Note: See TracChangeset for help on using the changeset viewer.