Ticket #15981: garyc40-15981.patch
| File garyc40-15981.patch, 8.7 KB (added by , 15 years ago) |
|---|
-
wp-admin/js/edit-comments.dev.js
diff --git wp-admin/js/edit-comments.dev.js wp-admin/js/edit-comments.dev.js index 177dc86..0dbc0a6 100644
commentReply = { 278 278 279 279 this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || ''; 280 280 281 $(listTable).bind(' beforeChangePage', function(){281 $(listTable).bind('forceUpdateRow', function(){ 282 282 commentReply.close(); 283 283 }); 284 284 }, … … commentReply = { 297 297 }, 298 298 299 299 revert : function() { 300 300 listTable.is_editing(false); 301 301 302 if ( $('#the-comment-list #replyrow').length < 1 ) 302 303 return false; 303 304 … … commentReply = { 310 311 311 312 close : function() { 312 313 var c; 313 314 listTable.is_editing(false); 314 315 if ( this.cid ) { 315 316 c = $('#comment-' + this.cid); 316 317 … … commentReply = { 337 338 var t = this, editRow, rowData, act, h, c = $('#comment-' + id); 338 339 t.close(); 339 340 t.cid = id; 341 listTable.is_editing(true); 340 342 341 343 editRow = $('#replyrow'); 342 344 rowData = $('#inline-'+id); -
wp-admin/js/inline-edit-post.dev.js
diff --git wp-admin/js/inline-edit-post.dev.js wp-admin/js/inline-edit-post.dev.js index 1a257c6..dc041a1 100644
inlineEditPost = { 78 78 if ( $('form#posts-filter tr.inline-editor').length > 0 ) 79 79 t.revert(); 80 80 }); 81 82 $(listTable).bind('forceUpdateRow', function(){ 83 inlineEditPost.revert(); 84 }); 81 85 }, 82 86 83 87 toggle : function(el){ … … inlineEditPost = { 88 92 setBulk : function(){ 89 93 var te = '', type = this.type, tax, c = true; 90 94 this.revert(); 91 95 listTable.is_editing(true); 96 92 97 $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length); 93 98 $('table.widefat tbody').prepend( $('#bulk-edit') ); 94 99 $('#bulk-edit').addClass('inline-editor').show(); … … inlineEditPost = { 124 129 edit : function(id) { 125 130 var t = this, fields, editRow, rowData, cats, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, tax; 126 131 t.revert(); 127 132 listTable.is_editing(true); 133 128 134 if ( typeof(id) == 'object' ) 129 135 id = t.getId(id); 130 136 … … inlineEditPost = { 257 263 258 264 revert : function(){ 259 265 var id = $('table.widefat tr.inline-editor').attr('id'); 260 266 listTable.is_editing(false); 261 267 if ( id ) { 262 268 $('table.widefat .inline-edit-save .waiting').hide(); 263 269 -
wp-admin/js/list-table.dev.js
diff --git wp-admin/js/list-table.dev.js wp-admin/js/list-table.dev.js index 7d94ad2..19395ac 100644
window.listTable = { 36 36 if ( this.loading ) 37 37 return false; 38 38 39 var different = false, data = {} ;39 var different = false, data = {}, order, orderby, sorted, defaultOrder; 40 40 41 41 $.each(args, function(key, val) { 42 if ( val != $.query.GET(key) ) { 42 if ( val != $.query.GET(key) ) { 43 43 $.query.SET(key, val); 44 44 different = true; 45 45 } … … window.listTable = { 61 61 }); 62 62 63 63 this._callback = callback; 64 64 65 65 this.fetch_list( 66 66 data, 67 67 $.proxy(this, 'handle_success'), 68 68 $.proxy(this, 'handle_error') 69 69 ); 70 71 this.confirm_editing(); 70 72 71 73 return true; 72 74 }, 75 76 confirm_editing : function() { 77 if (this.is_editing()) { 78 this.force_update_rows = confirm(listTableL10n.warn_update_rows); 79 if (this.force_update_rows) { 80 $(this).trigger('forceUpdateRow'); 81 if (this.response_cache) { 82 this.handle_success(this.response_cache); 83 this.response_cache = false; 84 } 85 if (this.sortable_cache) { 86 this.sortable_cache.find('a').click(); 87 this.sortable_cache = false; 88 } 89 this.force_update_rows = false; 90 } else { 91 this.stop_loading(); 92 } 93 } 94 }, 73 95 74 96 fetch_list: function(data, success_callback, error_callback) { 75 97 data = $.extend(data, { … … window.listTable = { 86 108 error: error_callback 87 109 }); 88 110 }, 111 112 is_editing : function(val) { 113 if (typeof val == 'undefined') { 114 return this.is_editing._i || false; 115 } else { 116 this.is_editing._i = val; 117 118 if (val) { 119 this.stop_loading(); 120 } 121 } 122 }, 89 123 90 124 handle_success: function(response) { 91 125 if ( 'object' != typeof response ) { 92 126 this.handle_error(); 93 127 } else { 94 128 this.stop_loading(); 129 130 if ( ! this.is_editing() || this.force_update_rows ) { 131 $('div.updated, div.error').not('.persistent, .inline').remove(); 95 132 96 $('div.updated, div.error').not('.persistent, .inline').remove();133 this.$tbody.html(response.rows); 97 134 98 this.$tbody.html(response.rows); 135 $('.displaying-num').html(response.total_items_i18n); 136 $('.total-pages').html(response.total_pages_i18n); 99 137 100 $('.displaying-num').html(response.total_items_i18n); 101 $('.total-pages').html(response.total_pages_i18n); 138 this.set_total_pages(response.total_pages); 102 139 103 this.set_total_pages(response.total_pages);140 $('.current-page').val($.query.GET('paged')); 104 141 105 $('.current-page').val($.query.GET('paged'));142 $('th.column-cb :input').attr('checked', false); 106 143 107 $('th.column-cb :input').attr('checked', false); 144 if ( history.replaceState ) { 145 history.replaceState({}, '', location.pathname + $.query); 146 } 108 147 109 if ( history.replaceState ) { 110 history.replaceState({}, '', location.pathname + $.query); 148 if ( this._callback ) 149 this._callback(); 150 151 this.response_cache = false; 152 } else { 153 this.response_cache = response; 111 154 } 112 113 if ( this._callback )114 this._callback();115 155 } 116 156 }, 117 157 … … listTable.init(); 192 232 return false; 193 233 }); 194 234 235 function get_initial_order($el) { 236 return $.query.load( $el.find('a').attr('href') ).get('order'); 237 } 238 195 239 // sortable columns 196 240 $('th.sortable a, th.sorted a').click(function() { 197 198 function get_initial_order($el) { 199 return $.query.load( $el.find('a').attr('href') ).get('order'); 200 } 201 202 var $link = $(this), 203 $th = $link.parent('th'), 204 thIndex = $th.index(), 205 orderby = $.query.load( $link.attr('href') ).get('orderby'), 206 order; 207 208 // th should include both headers in thead and tfoot 209 $th = $th.closest('table').find('thead th:eq(' + thIndex + '), tfoot th:eq(' + thIndex + ')'); 210 211 if ( orderby == $.query.get('orderby') ) { 212 // changing the direction 213 order = ( 'asc' == $.query.get('order') ) ? 'desc' : 'asc'; 214 } else { 215 // changing the parameter 216 order = get_initial_order($th); 217 218 var $old_th = $('th.sorted'); 219 if ( $old_th.length ) { 220 $old_th.removeClass('sorted').addClass('sortable'); 221 $old_th.removeClass('desc').removeClass('asc').addClass( 222 'asc' == get_initial_order( $old_th ) ? 'desc' : 'asc' 223 ); 241 if (! listTable.is_editing()) { 242 var $link = $(this), 243 $th = $link.parent('th'), 244 thIndex = $th.index(), 245 orderby = $.query.load( $link.attr('href') ).get('orderby'), 246 order; 247 248 // th should include both headers in thead and tfoot 249 $th = $th.closest('table').find('thead th:eq(' + thIndex + '), tfoot th:eq(' + thIndex + ')'); 250 251 if ( orderby == $.query.get('orderby') ) { 252 // changing the direction 253 order = ( 'asc' == $.query.get('order') ) ? 'desc' : 'asc'; 254 } else { 255 // changing the parameter 256 order = get_initial_order($th); 257 258 var $old_th = $('th.sorted'); 259 if ( $old_th.length ) { 260 $old_th.removeClass('sorted').addClass('sortable'); 261 $old_th.removeClass('desc').removeClass('asc').addClass( 262 'asc' == get_initial_order( $old_th ) ? 'desc' : 'asc' 263 ); 264 } 265 266 $th.removeClass('sortable').addClass('sorted'); 224 267 } 225 268 226 $th.removeClass('sortable').addClass('sorted'); 269 $th.removeClass('desc').removeClass('asc').addClass(order); 270 listTable.update_rows({'orderby' : orderby, 'order' : order}, true); 271 listTable.sortable_cache = false; 272 } else { 273 listTable.sortable_cache = $(this).parents('th'); 274 listTable.confirm_editing(); 227 275 } 228 229 $th.removeClass('desc').removeClass('asc').addClass(order);230 231 listTable.update_rows({'orderby': orderby, 'order': order}, true);232 233 276 return false; 234 277 }); 235 278 -
wp-includes/script-loader.php
diff --git wp-includes/script-loader.php wp-includes/script-loader.php index 706fd0a..e825e18 100644
function wp_default_scripts( &$scripts ) { 309 309 $scripts->localize( 'list-table', 'listTableL10n', array( 310 310 'error' => __('An error has occurred while loading the items.'), 311 311 'search' => __('Search results for “%s”'), 312 'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};' 312 'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};', 313 'warn_update_rows' => __("The changes you made will be lost if you proceed. 'Cancel' to stop, 'OK' to continue."), 313 314 ) ); 314 315 315 316 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101223' );