Changeset 6713

Show
Ignore:
Timestamp:
02/02/08 20:31:56 (7 months ago)
Author:
ryan
Message:

Fix edit link form categories a bit. AJAX add still needs work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-form-advanced.php

    r6712 r6713  
    211211<div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 
    212212    <ul id="categorychecklist-pop" class="categorychecklist form-no-clear"> 
    213         <?php wp_popular_categories_checklist(); ?> 
     213        <?php wp_popular_terms_checklist('category'); ?> 
    214214    </ul> 
    215215</div> 
  • trunk/wp-admin/edit-link-form.php

    r6695 r6713  
    7171<div id="category-adder" class="wp-hidden-children"> 
    7272    <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> 
    73     <p id="category-add" class="wp-hidden-child"> 
     73    <p id="link-category-add" class="wp-hidden-child"> 
    7474        <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" /> 
    75         <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?> 
    7675        <input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" /> 
    7776        <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> 
     
    9392<div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 
    9493    <ul id="categorychecklist-pop" class="categorychecklist form-no-clear"> 
    95         <?php wp_popular_categories_checklist(); ?> 
     94        <?php wp_popular_terms_checklist('link_category'); ?> 
    9695    </ul> 
    9796</div> 
  • trunk/wp-admin/includes/template.php

    r6680 r6713  
    188188} 
    189189 
    190 function wp_popular_categories_checklist( $default = 0, $number = 10 ) { 
    191     $categories = get_categories( array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) ); 
     190function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) { 
     191    $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) ); 
    192192 
    193193    foreach ( (array) $categories as $category ) { 
  • trunk/wp-admin/js/link.js

    r6695 r6713  
    99    var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); 
    1010    jQuery('#category-add-sumbit').click( function() { newCat.focus(); } ); 
    11     var newCatParent = false; 
    12     var newCatParentOption = false; 
    1311    var noSyncChecks = false; // prophylactic. necessary? 
    1412    var syncChecks = function() { 
     
    2321    }; 
    2422    var catAddAfter = function( r, s ) { 
    25         if ( !newCatParent ) newCatParent = jQuery('#newcat_parent'); 
    26         if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' ); 
    2723        jQuery(s.what + ' response_data', r).each( function() { 
    2824            var t = jQuery(jQuery(this).text()); 
     
    3228                var id = th.find('input')[0].id 
    3329                jQuery('#' + id).change( syncChecks ); 
    34                 if ( newCatParent.find( 'option[value=' + val + ']' ).size() ) 
    35                     return; 
    3630                var name = jQuery.trim( th.text() ); 
    3731                var o = jQuery( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name ); 
    38                 newCatParent.prepend( o ); 
    3932            } ); 
    40             newCatParentOption.attr( 'selected', true ); 
    4133        } ); 
    4234    }; 
  • trunk/wp-admin/js/postbox.js

    r6675 r6713  
    66function save_postboxes_state() { 
    77    var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); 
    8     jQuery.post(postL10n.requestFile, { 
     8    jQuery.post(postboxL10n.requestFile, { 
    99        action: 'closed-postboxes', 
    1010        closed: closed, 
  • trunk/wp-admin/wp-admin.css

    r6705 r6713  
    13661366} 
    13671367 
     1368#linkcategorydiv #category-adder { 
     1369    margin-left: 120px; 
     1370    padding: 4px 0; 
     1371} 
     1372 
     1373#linkcategorydiv ul#category-tabs { 
     1374    float: left; 
     1375    width: 120px; 
     1376    text-align: right; 
     1377    /* Negative margin for the sake of those without JS: all tabs display */ 
     1378    margin: 0 -120px 0 0; 
     1379    padding: 0; 
     1380} 
     1381 
     1382#linkcategorydiv ul { 
     1383    list-style: none; 
     1384    padding: 0; 
     1385    margin: 0; 
     1386} 
     1387 
     1388#linkcategorydiv ul.categorychecklist ul { 
     1389    margin-left: 18px; 
     1390} 
     1391 
    13681392/* Global classes */ 
    13691393.wp-hidden-children .wp-hidden-child { display: none; } 
  • trunk/wp-includes/script-loader.php

    r6695 r6713  
    133133            $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' ); 
    134134            $this->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' ); 
     135            $this->localize( 'postbox', 'postboxL10n', array( 
     136                'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 
     137            ) ); 
    135138            $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox'), '20080128' ); 
    136139            $this->localize( 'post', 'postL10n', array(