Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -268,7 +268,7 @@ |
269 | 269 | |
270 | 270 | $( '#articleFeedbackv5-sort-arrow-' + id ).show(); |
271 | 271 | $( '#articleFeedbackv5-sort-arrow-' + id ).attr( |
272 | | - 'src', '/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/images/sort-' + dir + 'ending.png' |
| 272 | + 'src', mw.config.get('wgExtensionAssetsPath') + '/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/images/sort-' + dir + 'ending.png' |
273 | 273 | ); |
274 | 274 | $( '#articleFeedbackv5-special-sort-' + id).addClass( 'sort-active' ); |
275 | 275 | }; |
— | — | @@ -624,6 +624,11 @@ |
625 | 625 | $( '#articleFeedbackv5-feedback-count-total' ).text( data['articlefeedbackv5-view-feedback'].count ); |
626 | 626 | $.articleFeedbackv5special.listControls.continue = data['articlefeedbackv5-view-feedback'].continue; |
627 | 627 | $.articleFeedbackv5special.listControls.continueId = data['articlefeedbackv5-view-feedback'].continueid; |
| 628 | + if( data['articlefeedbackv5-view-feedback'].more ) { |
| 629 | + $( '#articleFeedbackv5-show-more').show(); |
| 630 | + } else { |
| 631 | + $( '#articleFeedbackv5-show-more').hide(); |
| 632 | + } |
628 | 633 | } else { |
629 | 634 | $( '#articleFeedbackv5-show-feedback' ).text( mw.msg( 'articlefeedbackv5-error-loading-feedback' ) ); |
630 | 635 | } |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -16,6 +16,7 @@ |
17 | 17 | class ApiViewFeedbackArticleFeedbackv5 extends ApiQueryBase { |
18 | 18 | private $continue = null; |
19 | 19 | private $continueId = null; |
| 20 | + private $showMore = false; |
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Constructor |
— | — | @@ -51,6 +52,7 @@ |
52 | 53 | |
53 | 54 | $result->addValue( $this->getModuleName(), 'length', $length ); |
54 | 55 | $result->addValue( $this->getModuleName(), 'count', $count ); |
| 56 | + $result->addValue( $this->getModuleName(), 'more', $this->showMore ); |
55 | 57 | if ( $this->continue !== null ) { |
56 | 58 | $result->addValue( $this->getModuleName(), 'continue', $this->continue ); |
57 | 59 | } |
— | — | @@ -125,7 +127,7 @@ |
126 | 128 | default: |
127 | 129 | $sortField = 'af_id'; |
128 | 130 | $order = "af_id $direction"; |
129 | | - $continueSql = "af_id < ".intVal( $continue ); |
| 131 | + $continueSql = "af_id $continueDirection ".intVal( $continue ); |
130 | 132 | break; |
131 | 133 | } |
132 | 134 | |
— | — | @@ -161,7 +163,7 @@ |
162 | 164 | $where, |
163 | 165 | __METHOD__, |
164 | 166 | array( |
165 | | - 'LIMIT' => $limit, |
| 167 | + 'LIMIT' => ($limit + 1), |
166 | 168 | 'ORDER BY' => $order |
167 | 169 | ), |
168 | 170 | array( |
— | — | @@ -178,15 +180,24 @@ |
179 | 181 | |
180 | 182 | foreach ( $id_query as $id ) { |
181 | 183 | $ids[] = $id->af_id; |
182 | | - $this->continue = $id->$sortField; |
183 | | - $this->continueId = $id->af_id; |
| 184 | + // Get the continue values from the last counted item. |
| 185 | + if( count( $ids ) == $limit ) { |
| 186 | + $this->continue = $id->$sortField; |
| 187 | + $this->continueId = $id->af_id; |
| 188 | + } |
184 | 189 | } |
185 | | - |
186 | 190 | |
187 | 191 | if ( !count( $ids ) ) { |
188 | 192 | return array(); |
189 | 193 | } |
190 | 194 | |
| 195 | + // Returned an extra row, meaning there's more to show. |
| 196 | + // Also, pop that extra one off, so we don't render it. |
| 197 | + if ( count( $ids ) > $limit ) { |
| 198 | + $this->showMore = true; |
| 199 | + array_pop( $ids ); |
| 200 | + } |
| 201 | + |
191 | 202 | $rows = $dbr->select( |
192 | 203 | array( 'aft_article_feedback', |
193 | 204 | 'rating' => 'aft_article_answer', |