Changeset 7689
- Timestamp:
- 04/15/2008 06:00:52 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
wp-admin/edit-form-advanced-tabs.php (added)
-
wp-admin/edit-form-advanced.php (modified) (1 diff)
-
wp-admin/images/loading.gif (added)
-
wp-admin/includes/template.php (modified) (2 diffs)
-
wp-admin/js/post.js (modified) (1 diff)
-
wp-admin/wp-admin.css (modified) (1 diff)
-
wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r7669 r7689 220 220 <div id="category-adder" class="wp-hidden-children"> 221 221 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> 222 <p id="category-add" class="wp-hidden-child"> 223 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> 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-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> 226 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 227 <span id="category-ajax-response"></span> 228 </p> 222 <p id="category-add" class="wp-hidden-child"></p> 229 223 </div> 230 224 231 225 <ul id="category-tabs"> 232 <li class="ui-tabs-selected"><a href="#categories- all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>233 <li class="wp-no-js-hidden"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>226 <li class="ui-tabs-selected"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 227 <li class="wp-no-js-hidden"><a id="category-tabs-all" href="edit-form-advanced-tabs.php?post=<?php echo $post_ID; ?>" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> 234 228 </ul> 235 229 236 230 <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 237 231 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 238 <?php $popular_ids = wp_popular_terms_checklist('category'); ?> 239 </ul> 240 </div> 241 242 <div id="categories-all" class="ui-tabs-panel"> 243 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 244 <?php dropdown_categories( 0, 0, $popular_ids ); ?> 232 <?php $popular_ids = wp_popular_terms_checklist('category'); // If we up the # here we have to do so in edit-form-advanced-tabs.php too ?> 245 233 </ul> 246 234 </div> -
trunk/wp-admin/includes/template.php
r7669 r7689 195 195 196 196 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) { 197 global $checked_categories; 198 wp_set_checked_post_categories( $default ); 197 199 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) ); 198 200 … … 205 207 <li id="<?php echo $id; ?>" class="popular-category"> 206 208 <label class="selectit" for="in-<?php echo $id; ?>"> 207 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />209 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" name="post_category[]" <?php checked( in_array( $category->term_id, $checked_categories ), true ); ?> /> 208 210 <?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?> 209 211 </label> -
trunk/wp-admin/js/post.js
r7669 r7689 101 101 102 102 // category tabs 103 var categoryTabs =jQuery('#category-tabs').tabs(); 104 105 // Ajax Cat 106 var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); 107 jQuery('#category-add-sumbit').click( function() { newCat.focus(); } ); 108 var newCatParent = false; 109 var newCatParentOption = false; 110 var noSyncChecks = false; // prophylactic. necessary? 111 var syncChecks = function() { 112 if ( noSyncChecks ) 113 return; 114 noSyncChecks = true; 115 var th = jQuery(this); 116 var c = th.is(':checked'); 117 var id = th.val().toString(); 118 jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); 119 noSyncChecks = false; 120 }; 121 var catAddBefore = function( s ) { 122 s.data += '&' + jQuery( '#categorychecklist :checked' ).serialize(); 123 return s; 124 }; 125 var catAddAfter = function( r, s ) { 126 if ( !newCatParent ) newCatParent = jQuery('#newcat_parent'); 127 if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' ); 128 jQuery(s.what + ' response_data', r).each( function() { 129 var t = jQuery(jQuery(this).text()); 130 t.find( 'label' ).each( function() { 103 var newCatFocus = false; 104 var categoryTabs =jQuery('#category-tabs').tabs( { 105 cache: true, 106 show: function(ui) { 107 if ( 'category-tabs-all' != ui.id ) { return; } // only do this for the all tab 108 var adder = jQuery('#category-add-hidden'); 109 110 if ( !adder.size() ) { return; } // we're already done 111 112 // Put HTML in proper place and set up the wp-lists etc 113 jQuery('#category-add').html( adder.remove().html() ); 114 115 // Ajax Cat 116 var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); 117 jQuery('#category-add-sumbit').click( function() { newCat.focus(); } ); 118 var newCatParent = false; 119 var newCatParentOption = false; 120 var noSyncChecks = false; // prophylactic. necessary? 121 var syncChecks = function() { 122 if ( noSyncChecks ) 123 return; 124 noSyncChecks = true; 131 125 var th = jQuery(this); 132 var val = th.find('input').val(); 133 var id = th.find('input')[0].id 134 jQuery('#' + id).change( syncChecks ); 135 if ( newCatParent.find( 'option[value=' + val + ']' ).size() ) 136 return; 137 var name = jQuery.trim( th.text() ); 138 var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 139 newCatParent.prepend( o ); 126 var c = th.is(':checked'); 127 var id = th.val().toString(); 128 jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); 129 noSyncChecks = false; 130 }; 131 var catAddBefore = function( s ) { 132 s.data += '&' + jQuery( '#categorychecklist :checked' ).serialize(); 133 return s; 134 }; 135 var catAddAfter = function( r, s ) { 136 if ( !newCatParent ) newCatParent = jQuery('#newcat_parent'); 137 if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' ); 138 jQuery(s.what + ' response_data', r).each( function() { 139 var t = jQuery(jQuery(this).text()); 140 t.find( 'label' ).each( function() { 141 var th = jQuery(this); 142 var val = th.find('input').val(); 143 var id = th.find('input')[0].id 144 jQuery('#' + id).change( syncChecks ); 145 if ( newCatParent.find( 'option[value=' + val + ']' ).size() ) 146 return; 147 var name = jQuery.trim( th.text() ); 148 var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 149 newCatParent.prepend( o ); 150 } ); 151 newCatParentOption.attr( 'selected', true ); 152 } ); 153 }; 154 jQuery('#categorychecklist').wpList( { 155 alt: '', 156 response: 'category-ajax-response', 157 addBefore: catAddBefore, 158 addAfter: catAddAfter 140 159 } ); 141 newCatParentOption.attr( 'selected', true ); 142 } ); 143 }; 144 jQuery('#categorychecklist').wpList( { 145 alt: '', 146 response: 'category-ajax-response', 147 addBefore: catAddBefore, 148 addAfter: catAddAfter 160 jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(); 161 162 if ( newCatFocus ) { 163 jQuery('#newcat').focus(); 164 newCatFocus = false; 165 } 166 } 149 167 } ); 168 150 169 jQuery('#category-add-toggle').click( function() { 151 170 jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' ); 152 categoryTabs.tabsClick( 1);171 categoryTabs.tabsClick( 2 ); 153 172 jQuery('#newcat').focus(); 173 newCatFocus = true; 154 174 return false; 155 175 } ); 156 jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();157 176 158 177 jQuery('.edit-timestamp').click(function () { -
trunk/wp-admin/wp-admin.css
r7662 r7689 1266 1266 } 1267 1267 1268 ul#category-tabs a { 1269 width: 100%; 1270 display: block; 1271 } 1272 1273 .ui-tabs-loading { 1274 outline: none; 1275 background: url(../images/loading.gif) no-repeat 0 50%; 1276 } 1277 1268 1278 #linkcategorydiv ul#category-tabs { 1269 1279 float: left; -
trunk/wp-includes/script-loader.php
r7682 r7689 145 145 'cancel' => __('Cancel'), 146 146 ) ); 147 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '2008041 1' );147 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080412' ); 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.