WordPress.org

Make WordPress Core

Changeset 11676


Ignore:
Timestamp:
07/01/2009 08:12:39 AM (9 years ago)
Author:
azaozz
Message:

Use new jQuery methods when adding, editing and deleting tags with AJAX, fix warning when deleting tags, see #10239

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r11660 r11676  
    214214    break;
    215215case 'delete-tag' :
    216     check_ajax_referer( "delete-tag_$id" );
     216    $tag_id = (int) $_POST['tag_ID'];
     217    check_ajax_referer( "delete-tag_$tag_id" );
    217218    if ( !current_user_can( 'manage_categories' ) )
    218219        die('-1');
    219220
    220     if ( !empty($_POST['taxonomy']) )
    221         $taxonomy = $_POST['taxonomy'];
    222     else
    223         $taxonomy = 'post_tag';
    224 
    225     $tag = get_term( $id, $taxonomy );
     221    $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
     222
     223    $tag = get_term( $tag_id, $taxonomy );
    226224    if ( !$tag || is_wp_error( $tag ) )
    227225        die('1');
    228226
    229     if ( wp_delete_term($id, $taxonomy))
     227    if ( wp_delete_term($tag_id, $taxonomy))
    230228        die('1');
    231229    else
     
    528526        die('-1');
    529527
    530     if ( '' === trim($_POST['name']) ) {
    531         $x = new WP_Ajax_Response( array(
    532             'what' => 'tag',
    533             'id' => new WP_Error( 'name', __('You did not enter a tag name.') )
    534         ) );
    535         $x->send();
    536     }
    537 
    538     if ( !empty($_POST['taxonomy']) )
    539         $taxonomy = $_POST['taxonomy'];
    540     else
    541         $taxonomy = 'post_tag';
    542 
    543     $tag = wp_insert_term($_POST['name'], $taxonomy, $_POST );
    544 
    545     if ( is_wp_error($tag) ) {
    546         $x = new WP_Ajax_Response( array(
    547             'what' => 'tag',
    548             'id' => $tag
    549         ) );
    550         $x->send();
    551     }
    552 
    553     if ( !$tag || (!$tag = get_term( $tag['term_id'], $taxonomy )) )
    554         die('0');
    555 
    556     $tag_full_name = $tag->name;
    557     $tag_full_name = esc_attr($tag_full_name);
    558 
    559     $x = new WP_Ajax_Response( array(
    560         'what' => 'tag',
    561         'id' => $tag->term_id,
    562         'position' => '-1',
    563         'data' => _tag_row( $tag, '', $taxonomy ),
    564         'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag <a href="#%s">%s</a> added' ), "tag-$tag->term_id", $tag_full_name))
    565     ) );
    566     $x->send();
     528    $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
     529    $tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST );
     530
     531    if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) {
     532        echo '<div class="error"><p>' . __('An error has occured. Please reload the page and try again.') . '</p></div>';
     533        exit;
     534    }
     535
     536    echo _tag_row( $tag, '', $taxonomy );
     537    exit;
    567538    break;
    568539case 'get-tagcloud' :
     
    11491120            break;
    11501121        case 'tag' :
    1151             if ( !empty($_POST['taxonomy']) )
    1152                 $taxonomy = $_POST['taxonomy'];
    1153             else
    1154                 $taxonomy = 'post_tag';
     1122            $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
    11551123
    11561124            $tag = get_term( $id, $taxonomy );
     
    11631131                    die( __('Tag not updated.') );
    11641132
    1165                 echo _tag_row($tag);
     1133                echo _tag_row($tag, '', $taxonomy);
    11661134            } else {
    11671135                die( __('Tag not updated.') );
  • trunk/wp-admin/edit-tags.php

    r11481 r11676  
    3535        wp_die(__('Cheatin&#8217; uh?'));
    3636
    37     $ret = wp_insert_term($_POST['name'], $taxonomy, $_POST);
     37    $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST);
    3838    if ( $ret && !is_wp_error( $ret ) ) {
    3939        wp_redirect('edit-tags.php?message=1#addtag');
     
    156156<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    157157endif; ?>
     158<div id="ajax-response"></div>
    158159
    159160<form class="search-form" action="" method="get">
     
    275276<div class="form-wrap">
    276277<h3><?php _e('Add a New Tag'); ?></h3>
    277 <div id="ajax-response"></div>
    278 <form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">
    279 <input type="hidden" name="action" value="addtag" />
     278<form id="addtag" method="post" action="edit-tags.php" class="validate">
     279<input type="hidden" name="action" value="add-tag" />
    280280<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
    281 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?>
     281<?php wp_nonce_field('add-tag'); ?>
    282282
    283283<div class="form-field form-required">
    284     <label for="name"><?php _e('Tag name') ?></label>
    285     <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
     284    <label for="tag-name"><?php _e('Tag name') ?></label>
     285    <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    286286    <p><?php _e('The name is how the tag appears on your site.'); ?></p>
    287287</div>
     
    299299</div>
    300300
    301 <p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
     301<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
    302302<?php do_action('add_tag_form'); ?>
    303303</form></div>
  • trunk/wp-admin/includes/template.php

    r11555 r11676  
    664664                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    665665                    $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
    666                     $actions['delete'] = "<a class='delete:the-list:tag-$tag->term_id submitdelete' 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>";
     666                    $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>";
    667667                    $actions = apply_filters('tag_row_actions', $actions, $tag);
    668668                    $action_count = count($actions);
     
    731731    $count = 0;
    732732    foreach( $tags as $tag )
    733         $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"', $taxonomy );
     733        $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
    734734
    735735    // filter and send to screen
  • trunk/wp-admin/js/categories.dev.js

    r10522 r11676  
    11jQuery(document).ready(function($) {
    2     var options = false, addAfter, addAfter2, delBefore, delAfter;
     2    var options = false, addAfter, delBefore, delAfter;
    33    if ( document.forms['addcat'].category_parent )
    44        options = document.forms['addcat'].category_parent.options;
     
    1010        id = $('cat', r).attr('id');
    1111        options[options.length] = new Option(name, id);
    12 
    13         addAfter2( r, settings );
    14     }
    15 
    16     addAfter2 = function( x, r ) {
    17         var t = $(r.parsed.responses[0].data);
    18         if ( t.length == 1 )
    19             inlineEditTax.addEvents($(t.id));
    2012    }
    2113
     
    3729        $('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
    3830    else
    39         $('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
     31        $('#the-list').wpList({ delBefore: delBefore });
    4032
    4133    $('.delete a[class^="delete"]').click(function(){return false;});
  • trunk/wp-admin/js/categories.js

    r10522 r11676  
    1 jQuery(document).ready(function(d){var b=false,f,e,c,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}f=function(i,h){var g,j;g=d("<span>"+d("name",i).text()+"</span>").html();j=d("cat",i).attr("id");b[b.length]=new Option(g,j);e(i,h)};e=function(g,i){var h=d(i.parsed.responses[0].data);if(h.length==1){inlineEditTax.addEvents(d(h.id))}};a=function(h,g){var j=d("cat",h).attr("id"),i;for(i=0;i<b.length;i++){if(j==b[i].value){b[i]=null}}};c=function(g){if("undefined"!=showNotice){return showNotice.warn()?g:false}return g};if(b){d("#the-list").wpList({addAfter:f,delBefore:c,delAfter:a})}else{d("#the-list").wpList({addAfter:e,delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});
     1jQuery(document).ready(function(d){var b=false,e,c,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}e=function(h,g){var f,i;f=d("<span>"+d("name",h).text()+"</span>").html();i=d("cat",h).attr("id");b[b.length]=new Option(f,i)};a=function(g,f){var i=d("cat",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};c=function(f){if("undefined"!=showNotice){return showNotice.warn()?f:false}return f};if(b){d("#the-list").wpList({addAfter:e,delBefore:c,delAfter:a})}else{d("#the-list").wpList({delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});
  • trunk/wp-admin/js/common.dev.js

    r11538 r11676  
    1 var showNotice, adminMenu, columns;
     1var showNotice, adminMenu, columns, validateForm;
    22(function($){
    33// sidebar admin menu
     
    123123$(document).ready(function(){columns.init();});
    124124
     125validateForm = function( form ) {
     126    return !$( form ).find('.form-required').filter( function() { return $('input:visible', this).val() == ''; } ).addClass( 'form-invalid' ).change( function() { $(this).removeClass( 'form-invalid' ); } ).size();
     127}
     128
    125129})(jQuery);
    126130
  • trunk/wp-admin/js/common.js

    r11538 r11676  
    1 var showNotice,adminMenu,columns;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()})})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name="action"]').val()=="delete"||d('select[name="action2"]').val()=="delete"){return showNotice.warn()}});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
     1var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").change(function(){a(this).removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name="action"]').val()=="delete"||d('select[name="action2"]').val()=="delete"){return showNotice.warn()}});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
  • trunk/wp-admin/js/inline-edit-tax.dev.js

    r11450 r11676  
    99        t.what = '#'+t.type+'-';
    1010
    11         // get all editable rows
    12         t.rows = $('tr.iedit');
     11        $('.editinline').live('click', function(){
     12            inlineEditTax.edit(this);
     13            return false;
     14        });
    1315
    1416        // prepare the edit row
     
    1820        $('a.save', row).click(function() { return inlineEditTax.save(this); });
    1921        $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
    20 
    21         // add events
    22         t.addEvents(t.rows);
    2322
    2423        $('#posts-filter input[type="submit"]').click(function(e){
     
    3130        var t = this;
    3231        $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
    33     },
    34 
    35     addEvents : function(r) {
    36         r.each(function() {
    37             $(this).find('a.editinline').click(function() { inlineEditTax.edit(this); return false; });
    38         });
    3932    },
    4033
     
    7871        };
    7972
    80         fields = $('#edit-'+id+' :input').fieldSerialize();
     73        fields = $('#edit-'+id+' :input').serialize();
    8174        params = fields + '&' + $.param(params);
    8275
     
    9487                        $('#edit-'+id).before(r).remove();
    9588                        row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
    96                         row.hide();
    97 
    98                         inlineEditTax.addEvents(row);
    99                         row.fadeIn();
     89                        row.hide().fadeIn();
    10090                    } else
    10191                        $('#edit-'+id+' .inline-edit-save .error').html(r).show();
  • trunk/wp-admin/js/inline-edit-tax.js

    r10557 r11676  
    1 (function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("className").substr(5);b.what="#"+b.type+"-";b.rows=a("tr.iedit");c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});b.addEvents(b.rows);a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){a(this).find("a.editinline").click(function(){inlineEditTax.edit(this);return false})})},edit:function(d){var c=this,b;c.revert();if(typeof(d)=="object"){d=c.getId(d)}b=a("#inline-edit").clone(true),rowData=a("#inline_"+d);a("td",b).attr("colspan",a(".widefat:first thead th:visible").length);if(a(c.what+d).hasClass("alternate")){a(b).addClass("alternate")}a(c.what+d).hide().after(b);a(':input[name="name"]',b).val(a(".name",rowData).text());a(':input[name="slug"]',b).val(a(".slug",rowData).text());a(b).attr("id","edit-"+d).addClass("inline-editor").show();a(".ptitle",b).eq(0).focus();return false},save:function(e){var d,b,c=a('input[name="taxonomy"]').val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save-tax",tax_type:this.type,tax_ID:e,taxonomy:c};b=a("#edit-"+e+" :input").fieldSerialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(g){var h,f;a("table.widefat .inline-edit-save .waiting").hide();if(g){if(-1!=g.indexOf("<tr")){a(inlineEditTax.what+e).remove();f=a(g).attr("id");a("#edit-"+e).before(g).remove();h=f?a("#"+f):a(inlineEditTax.what+e);h.hide();inlineEditTax.addEvents(h);h.fadeIn()}else{a("#edit-"+e+" .inline-edit-save .error").html(g).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();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(){inlineEditTax.init()})})(jQuery);
     1(function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("className").substr(5);b.what="#"+b.type+"-";a(".editinline").live("click",function(){inlineEditTax.edit(this);return false});c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},edit:function(d){var c=this,b;c.revert();if(typeof(d)=="object"){d=c.getId(d)}b=a("#inline-edit").clone(true),rowData=a("#inline_"+d);a("td",b).attr("colspan",a(".widefat:first thead th:visible").length);if(a(c.what+d).hasClass("alternate")){a(b).addClass("alternate")}a(c.what+d).hide().after(b);a(':input[name="name"]',b).val(a(".name",rowData).text());a(':input[name="slug"]',b).val(a(".slug",rowData).text());a(b).attr("id","edit-"+d).addClass("inline-editor").show();a(".ptitle",b).eq(0).focus();return false},save:function(e){var d,b,c=a('input[name="taxonomy"]').val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save-tax",tax_type:this.type,tax_ID:e,taxonomy:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(g){var h,f;a("table.widefat .inline-edit-save .waiting").hide();if(g){if(-1!=g.indexOf("<tr")){a(inlineEditTax.what+e).remove();f=a(g).attr("id");a("#edit-"+e).before(g).remove();h=f?a("#"+f):a(inlineEditTax.what+e);h.hide().fadeIn()}else{a("#edit-"+e+" .inline-edit-save .error").html(g).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();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(){inlineEditTax.init()})})(jQuery);
  • trunk/wp-admin/js/tags.dev.js

    r11450 r11676  
    11jQuery(document).ready(function($) {
    2     var options = false, addAfter, addAfter2, delBefore, delAfter;
    32
    4     addAfter = function( r, settings ) {
    5         var name = $("<span>" + $('name', r).text() + "</span>").html(), id = $('tag', r).attr('id');
    6         options[options.length] = new Option(name, id);
    7     }
     3    $('.delete-tag').live('click', function(e){
     4        var t = $(this), tr = t.parents('tr'), r = true, data;
     5        if ( 'undefined' != showNotice )
     6            r = showNotice.warn();
     7        if ( r ) {
     8            data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag');
     9            $.post(ajaxurl, data, function(r){
     10                if ( '1' == r ) {
     11                    $('#ajax-response').empty();
     12                    tr.fadeOut('normal', function(){ tr.remove(); });
     13                } else if ( '-1' == r ) {
     14                    $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.noPerm + '</p></div>');
     15                    tr.children().css('backgroundColor', '');
     16                } else {
     17                    $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.broken + '</p></div>');
     18                    tr.children().css('backgroundColor', '');
     19                }
     20            });
     21            tr.children().css('backgroundColor', '#f33');
     22        }
     23        return false;
     24    });
    825
    9     addAfter2 = function( x, r ) {
    10         var t = $(r.parsed.responses[0].data);
    11         if ( t.length == 1 )
    12             inlineEditTax.addEvents($(t.id));
    13     }
     26    $('#submit').click(function(){
     27        var form = $(this).parents('form');
    1428
    15     delAfter = function( r, settings ) {
    16         var id = $('tag', r).attr('id'), o;
    17         for ( o = 0; o < options.length; o++ )
    18             if ( id == options[o].value )
    19                 options[o] = null;
    20     }
     29        if ( !validateForm( form ) )
     30            return false;
    2131
    22     delBefore = function(s) {
    23         s.data.taxonomy = $('input[name="taxonomy"]').val();
     32        $.post(ajaxurl, $('#addtag').serialize(), function(r){
     33            if ( r.indexOf('<div class="error"') === 0 ) {
     34                $('#ajax-response').append(r);
     35            } else {
     36                $('#ajax-response').empty();
     37                $('#the-list').prepend(r);
     38                $('input[type="text"]:visible, textarea:visible', form).val('');
     39            }
     40        });
    2441
    25         if ( 'undefined' != showNotice )
    26             return showNotice.warn() ? s : false;
     42        return false;
     43    });
    2744
    28         return s;
    29     }
    30 
    31     if ( options )
    32         $('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
    33     else
    34         $('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
    35 
    36     $('.delete a[class^="delete"]').click(function(){return false;});
    3745});
  • trunk/wp-admin/js/tags.js

    r10557 r11676  
    1 jQuery(document).ready(function(d){var b=false,f,e,c,a;f=function(i,h){var g=d("<span>"+d("name",i).text()+"</span>").html(),j=d("tag",i).attr("id");b[b.length]=new Option(g,j)};e=function(g,i){var h=d(i.parsed.responses[0].data);if(h.length==1){inlineEditTax.addEvents(d(h.id))}};a=function(h,g){var j=d("tag",h).attr("id"),i;for(i=0;i<b.length;i++){if(j==b[i].value){b[i]=null}}};c=function(g){g.data.taxonomy=d('input[name="taxonomy"]').val();if("undefined"!=showNotice){return showNotice.warn()?g:false}return g};if(b){d("#the-list").wpList({addAfter:f,delBefore:c,delAfter:a})}else{d("#the-list").wpList({addAfter:e,delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});
     1jQuery(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})});
  • trunk/wp-admin/wp-admin.css

    r11664 r11676  
    386386    text-decoration: none;
    387387    font-size: 11px !important;
    388     line-height: 16px;
     388    line-height: 14px;
    389389    padding: 2px 8px;
    390390    cursor: pointer;
     
    404404a.button-primary,
    405405a.button-secondary {
    406     line-height: 1.2em;
    407     -webkit-border-radius: 10px;
    408     padding: 4px 10px;
     406    line-height: 15px;
     407    padding: 3px 10px;
    409408    white-space: nowrap;
    410409}
     
    24172416.inline-edit-save img.waiting,
    24182417#commentstatusdiv img.waiting {
    2419     padding: 0 10px;
     2418    padding: 2px 10px 0;
    24202419    vertical-align: top;
    24212420}
  • trunk/wp-includes/script-loader.php

    r11674 r11676  
    6161    $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
    6262
    63     $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090609' );
     63    $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090623' );
    6464    $scripts->add_data( 'common', 'group', 1 );
    6565    $scripts->localize( 'common', 'commonL10n', array(
     
    217217        ) );
    218218
    219         $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090207' );
     219        $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090623' );
    220220        $scripts->add_data( 'admin-categories', 'group', 1 );
    221221
    222         $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090211' );
     222        $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery'), '20090623' );
    223223        $scripts->add_data( 'admin-tags', 'group', 1 );
     224        $scripts->localize( 'admin-tags', 'tagsl10n', array(
     225            'noPerm' => __('You do not have permission to do that.'),
     226            'broken' => __('An unidentified error has occurred.'),
     227            'l10n_print_after' => 'try{convertEntities(tagsl10n);}catch(e){};'
     228        ));
    224229
    225230        $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
     
    362367        ) );
    363368
    364         $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery-form' ), '20090211' );
     369        $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20090623' );
    365370        $scripts->add_data( 'inline-edit-tax', 'group', 1 );
    366371        $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
Note: See TracChangeset for help on using the changeset viewer.