Changeset 7720
- Timestamp:
- 04/17/2008 07:32:38 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 5 edited
-
wp-admin/edit-form-advanced-tabs.php (deleted)
-
wp-admin/edit-form-advanced.php (modified) (1 diff)
-
wp-admin/images/loading.gif (deleted)
-
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
r7708 r7720 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"></p> 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> 223 229 </div> 224 230 225 231 <ul id="category-tabs"> 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>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> 228 234 </ul> 229 235 230 236 <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 231 237 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 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 ?> 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 ); ?> 233 245 </ul> 234 246 </div> -
trunk/wp-admin/includes/template.php
r7719 r7720 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 );199 197 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) ); 200 198 … … 207 205 <li id="<?php echo $id; ?>" class="popular-category"> 208 206 <label class="selectit" for="in-<?php echo $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 ); ?>/>207 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" /> 210 208 <?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?> 211 209 </label> -
trunk/wp-admin/js/post.js
r7689 r7720 101 101 102 102 // category tabs 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'); 103 var categoryTabs =jQuery('#category-tabs').tabs(); 109 104 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 ) 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() { 131 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() ) 123 136 return; 124 noSyncChecks = true; 125 var th = jQuery(this); 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 137 var name = jQuery.trim( th.text() ); 138 var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 139 newCatParent.prepend( o ); 159 140 } ); 160 jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(); 161 162 if ( newCatFocus ) { 163 jQuery('#newcat').focus(); 164 newCatFocus = false; 165 } 166 } 141 newCatParentOption.attr( 'selected', true ); 142 } ); 143 }; 144 jQuery('#categorychecklist').wpList( { 145 alt: '', 146 response: 'category-ajax-response', 147 addBefore: catAddBefore, 148 addAfter: catAddAfter 167 149 } ); 168 169 150 jQuery('#category-add-toggle').click( function() { 170 151 jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' ); 171 categoryTabs.tabsClick( 2);152 categoryTabs.tabsClick( 1 ); 172 153 jQuery('#newcat').focus(); 173 newCatFocus = true;174 154 return false; 175 155 } ); 156 jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(); 176 157 177 158 jQuery('.edit-timestamp').click(function () { -
trunk/wp-admin/wp-admin.css
r7705 r7720 1270 1270 } 1271 1271 1272 ul#category-tabs a {1273 width: 100%;1274 display: block;1275 }1276 1277 .ui-tabs-loading {1278 outline: none;1279 background: url(../images/loading.gif) no-repeat 0 50%;1280 }1281 1282 1272 #linkcategorydiv ul#category-tabs { 1283 1273 float: left; -
trunk/wp-includes/script-loader.php
r7710 r7720 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 2' );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.