Changeset 7670
- Timestamp:
- 04/14/2008 07:31:46 PM (18 years ago)
- Location:
- branches/2.5
- Files:
-
- 5 edited
-
wp-admin/edit-form-advanced.php (modified) (3 diffs)
-
wp-admin/includes/template.php (modified) (4 diffs)
-
wp-admin/js/post.js (modified) (3 diffs)
-
wp-includes/js/wp-lists.js (modified) (1 diff)
-
wp-includes/script-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/wp-admin/edit-form-advanced.php
r7544 r7670 1 <?php1 <?php 2 2 $action = isset($action)? $action : ''; 3 3 if ( isset($_GET['message']) ) … … 223 223 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> 224 224 <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 225 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category divbutton" value="<?php _e( 'Add' ); ?>" tabindex="3" />225 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> 226 226 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 227 227 <span id="category-ajax-response"></span> … … 234 234 </ul> 235 235 236 <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 237 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 238 <?php $popular_ids = wp_popular_terms_checklist('category'); ?> 239 </ul> 240 </div> 241 236 242 <div id="categories-all" class="ui-tabs-panel"> 237 243 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 238 <?php dropdown_categories(); ?> 239 </ul> 240 </div> 241 242 <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 243 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 244 <?php wp_popular_terms_checklist('category'); ?> 244 <?php dropdown_categories( 0, 0, $popular_ids ); ?> 245 245 </ul> 246 246 </div> -
branches/2.5/wp-admin/includes/template.php
r7596 r7670 176 176 } 177 177 178 function write_nested_categories( $categories ) {178 function write_nested_categories( $categories, $popular_ids = array() ) { 179 179 foreach ( $categories as $category ) { 180 echo "\n", '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), '</label>'; 180 $class = in_array( $category['cat_ID'], $popular_ids ) ? ' class="popular-category"' : ''; 181 echo "\n", "<li id='category-$category[cat_ID]'$class>", '<label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), '</label>'; 181 182 182 183 if ( $category['children'] ) { … … 189 190 } 190 191 191 function dropdown_categories( $default = 0, $parent = 0 ) {192 write_nested_categories( get_nested_categories( $default, $parent ) );192 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) { 193 write_nested_categories( get_nested_categories( $default, $parent ), $popular_ids ); 193 194 } 194 195 … … 196 197 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) ); 197 198 199 $popular_ids = array(); 198 200 foreach ( (array) $categories as $category ) { 201 $popular_ids[] = $category->term_id; 199 202 $id = "popular-category-$category->term_id"; 200 203 ?> 201 204 202 <li id="<?php echo $id; ?>" >205 <li id="<?php echo $id; ?>" class="popular-category"> 203 206 <label class="selectit" for="in-<?php echo $id; ?>"> 204 207 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" /> … … 209 212 <?php 210 213 } 214 return $popular_ids; 211 215 } 212 216 -
branches/2.5/wp-admin/js/post.js
r7529 r7670 119 119 noSyncChecks = false; 120 120 }; 121 var catAddBefore = function( s ) { 122 s.data += '&' + jQuery( '#categorychecklist :checked' ).serialize(); 123 return s; 124 }; 121 125 var catAddAfter = function( r, s ) { 122 126 if ( !newCatParent ) newCatParent = jQuery('#newcat_parent'); … … 141 145 alt: '', 142 146 response: 'category-ajax-response', 147 addBefore: catAddBefore, 143 148 addAfter: catAddAfter 144 149 } ); … … 149 154 return false; 150 155 } ); 151 jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();156 jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(); 152 157 153 158 jQuery('.edit-timestamp').click(function () { -
branches/2.5/wp-includes/js/wp-lists.js
r7468 r7670 314 314 var c = wpList.parseClass(this,'add')[2] || addEl.id; 315 315 if ( !c ) { return; } 316 var forms = []; var ins = []; 316 var forms = []; var ins = []; // this is all really inefficient 317 317 $('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() { 318 318 ins.push(this); 319 $.merge(forms,$(this).parents('form'));320 forms = $.unique(forms);319 var f = $(this).parents('form:first').get(0); 320 if ( $.inArray(f,forms) < 0 ) { forms.push(f); } 321 321 } ); 322 322 $(forms).submit( function() { -
branches/2.5/wp-includes/script-loader.php
r7621 r7670 58 58 ) ); 59 59 60 $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080 322' );60 $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080411' ); 61 61 $this->localize( 'wp-lists', 'wpListL10n', array( 62 62 'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php' … … 145 145 'cancel' => __('Cancel'), 146 146 ) ); 147 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080 322' );147 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080411' ); 148 148 $this->localize( 'post', 'postL10n', array( 149 149 'tagsUsed' => __('Tags used on this post:'),
Note: See TracChangeset
for help on using the changeset viewer.