Changeset 9225
- Timestamp:
- 10/17/2008 09:44:22 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r9216 r9225 441 441 ) ); 442 442 } 443 $x->send(); 444 break; 445 case 'get-comments' : 446 check_ajax_referer( $action ); 447 448 $post_ID = (int) $_POST['post_ID']; 449 if ( !current_user_can( 'edit_post', $post_ID ) ) 450 die('-1'); 451 452 $start = isset($_POST['start']) ? intval($_POST['start']) : 0; 453 $num = isset($_POST['num']) ? intval($_POST['num']) : 10; 454 455 list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID ); 456 457 if ( !$comments ) 458 die('1'); 459 460 $comment_list_item = ''; 461 $x = new WP_Ajax_Response(); 462 foreach ( (array) $comments as $comment ) { 463 get_comment( $comment ); 464 ob_start(); 465 _wp_comment_row( $comment->comment_ID, 'single', false, false ); 466 $comment_list_item .= ob_get_contents(); 467 ob_end_clean(); 468 } 469 $x->add( array( 470 'what' => 'comments', 471 'data' => $comment_list_item 472 ) ); 443 473 $x->send(); 444 474 break; -
trunk/wp-admin/edit-form-advanced.php
r9221 r9225 342 342 <?php 343 343 344 if ( !$post_ID || $post_ID < 0 )344 if ( !$post_ID || $post_ID < 0 || 0 == $post->comment_count ) 345 345 return; 346 346 347 if ( !$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $post_ID) ) ) 348 return; 349 350 // Make sure comments, post, and post_author are cached 351 // update_comment_cache($comments); 352 ?> 353 354 <table class="widefat"> 347 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 348 ?> 349 350 <table class="widefat comments-box" style="display:none;"> 355 351 <thead> 356 352 <tr> … … 361 357 </thead> 362 358 <tbody id="the-comment-list" class="list:comment"> 363 <?php364 foreach ($comments as $comment)365 _wp_comment_row( $comment, 'single', false, false );366 ?>367 359 </tbody> 368 360 </table> 369 361 <p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get();return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p> 370 362 <?php 371 363 } -
trunk/wp-admin/js/edit-comments.js
r9219 r9225 154 154 t.o = '#comment-'+id; 155 155 156 $('#replyrow td').attr('colspan', $('.widefat t footth:visible').length);156 $('#replyrow td').attr('colspan', $('.widefat thead th:visible').length); 157 157 var editRow = $('#replyrow'), rowData = $('#inline-'+id); 158 158 var act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; -
trunk/wp-admin/js/post.js
r8988 r9225 203 203 } 204 204 }); 205 205 206 206 $('.edit-post-status').click(function() { 207 207 if ($('#post-status-select').is(":hidden")) { … … 217 217 $('#post-status-display').html($('#post_status :selected').text()); 218 218 $('.edit-post-status').show(); 219 220 return false; 221 }); 222 219 220 return false; 221 }); 222 223 223 $('.cancel-post-status').click(function() { 224 224 $('#post-status-select').slideUp("normal"); … … 226 226 $('#post-status-display').html($('#post_status :selected').text()); 227 227 $('.edit-post-status').show(); 228 228 229 229 return false; 230 230 }); 231 231 }); 232 233 (function($){ 234 commentsBox = { 235 st : 0, 236 237 get : function(id, nonce) { 238 var st = this.st; 239 this.st += 20; 240 241 $('.waiting').show(); 242 243 var data = { 244 'action' : 'get-comments', 245 'mode' : 'single', 246 '_ajax_nonce' : $('#add_comment_nonce').val(), 247 'post_ID' : $('#post_ID').val(), 248 'start' : st, 249 'num' : '20' 250 }; 251 252 $.post('admin-ajax.php', data, 253 function(r) { 254 var r = wpAjax.parseAjaxResponse(r); 255 $('#commentstatusdiv .widefat').show(); 256 $('.waiting').hide(); 257 258 if ( 'object' == typeof r && r.responses[0] ) { 259 $('#the-comment-list').append( r.responses[0].data ); 260 $('#the-comment-list .hide-if-no-js').removeClass('hide-if-no-js'); 261 262 theList = theExtraList = null; 263 $("a[className*=':']").unbind(); 264 setCommentsList(); 265 $('#show-comments').html(postL10n.showcomm); 266 return; 267 } else if ( 1 == r ) { 268 $('#show-comments').parent().html(postL10n.endcomm); 269 return; 270 } 271 272 $('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>'); 273 } 274 ); 275 276 return false; 277 } 278 } 279 280 })(jQuery); 281 -
trunk/wp-admin/wp-admin.css
r9224 r9225 1082 1082 .stuffbox .insidebox { 1083 1083 margin: 11px 0; 1084 } 1085 1086 #side-sortables .comments-box, 1087 #side-sortables #show-comments { 1088 display: none; 1084 1089 } 1085 1090 … … 1976 1981 1977 1982 #replysubmit img.waiting, 1978 .quick-edit-save img.waiting { 1983 .quick-edit-save img.waiting, 1984 #commentstatusdiv img.waiting { 1979 1985 padding: 0 10px; 1980 1986 vertical-align: top; -
trunk/wp-includes/script-loader.php
r9220 r9225 184 184 'cancel' => __('Cancel'), 185 185 'edit' => __('Edit'), 186 'showcomm' => __('Show more comments'), 187 'endcomm' => __('No more comments found.') 186 188 ) ); 187 189 $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox', 'settings-box'), '20080925' );
Note: See TracChangeset
for help on using the changeset viewer.