Ticket #24056: 24056.patch
File 24056.patch, 4.2 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
2117 2117 $right_handle_at = ! empty( $_GET['right_handle_at'] ) ? (int) $_GET['right_handle_at'] : 0; 2118 2118 $left_handle_at = ! empty( $_GET['left_handle_at'] ) ? (int) $_GET['left_handle_at'] : 0; 2119 2119 $single_revision_id = ! empty( $_GET['single_revision_id'] ) ? absint( $_GET['single_revision_id'] ) : 0; 2120 $pageSize = ! empty( $_GET['pageSize'] ) ? absint( $_GET['pageSize'] ) : -1; 2121 $page = ! empty( $_GET['page'] ) ? absint( $_GET['page'] ) : 1; 2120 2122 $compare_two_mode = (bool) $post_id; 2121 2123 2122 2124 // … … 2131 2133 if ( ! current_user_can( 'read_post', $post_id ) ) 2132 2134 continue; 2133 2135 2134 if ( ! $revisions = wp_get_post_revisions( $post_id ) )2136 if ( ! $revisions = wp_get_post_revisions( $post_id, array( 'posts_per_page' => $pageSize, 'paged' => $page ) ) ) 2135 2137 return; 2136 2138 2137 2139 $left_revision = get_post( $compare_to ); -
wp-admin/js/revisions.js
237 237 this.reloadLeft(); 238 238 this.reloadRight(); 239 239 }, 240 241 loadPage: function( page ) { 242 var self = this; 240 243 244 self.startRightModelLoading(); 245 246 self.revisions.reload({ 247 options: { 248 'showAutosaves': self.autosaves, 249 'showSplitView': self.showSplitView, 250 'numberposts' : 5, 251 'page' : page 252 }, 253 254 success: function() { 255 var revisionCount = self.revisions.length; 256 self.revisionView.model = self.revisions; 257 self.revisionView.render(); 258 self.loadDiffs( self.revisions ); 259 self.tickmarkView.model = self.revisions; 260 self.tickmarkView.render(); 261 self.slider.refresh({ 262 'max': revisionCount - 1, 263 'value': self.rightDiff - 1 264 }, true); 265 }, 266 267 error: function() { 268 self.stopRightModelLoading(); 269 } 270 }); 271 }, 272 241 273 disabledButtonCheck: function( val ) { 242 274 var maxVal = this.revisions.length - 1, 243 275 next = $( '#next' ), … … 540 572 // next and previous buttons, only available in compare one mode 541 573 events: { 542 574 'click #next': 'nextRevision', 543 'click #previous': 'previousRevision' 575 'click #previous': 'previousRevision', 576 'click .paginate': 'changePage' 544 577 }, 545 578 546 579 render: function() { … … 600 633 Diff.slider.refresh({ 601 634 value: Diff.rightDiff - 1 602 635 }, true ); 636 }, 637 638 changePage: function(e) { 639 $( '.paginate' ).removeClass( 'button-disabled' ); 640 $( e.currentTarget ).addClass( 'button-disabled' ); 641 642 Diff.loadPage( $( e.currentTarget ).data( 'id' ) ); 603 643 } 604 644 }); 605 645 … … 751 791 'showSplitView': true, 752 792 'rightHandleAt': 0, 753 793 'leftHandleAt': 0, 794 'pageSize' : revisions.model.settings.pageSize, 795 'page' : 1, 754 796 'nonce': revisions.model.settings.nonce 755 797 }); 756 798 }, … … 764 806 '&show_split_view=' + this.options.showSplitView + 765 807 '&right_handle_at=' + this.options.rightHandleAt + 766 808 '&left_handle_at=' + this.options.leftHandleAt + 809 '&pageSize=' + this.options.pageSize + 810 '&page=' + this.options.page + 767 811 '&nonce=' + this.options.nonce; 768 812 }, 769 813 -
wp-admin/revision.php
82 82 $settings = array( 83 83 'post_id' => $post->ID, 84 84 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), 85 'revision_id' => $revision_id 85 'revision_id' => $revision_id, 86 'pageSize' => 5 86 87 ); 87 88 88 89 wp_localize_script( 'revisions', 'wpRevisionsSettings', $settings ); … … 170 171 </div> 171 172 172 173 <div id="diff-slider" class="wp-slider"></div> 174 175 <div id="diff-paginate" style="text-align: center; margin: 5px 0 0 0;"> 176 <?php 177 $pages = count( wp_get_post_revisions( $post->ID ) ) / $settings['pageSize']; 178 for( $i = 1; $i <= $pages; $i++ ) 179 echo '<input class="button'.($i==1 ? ' button-disabled' : '').' paginate" type="button" value="'.$i.'" data-id="'.$i.'" />'; 180 ?> 181 </div> 173 182 </script> 174 183 175 184 <script id="tmpl-revision-ticks" type="text/html">