Index: trunk/phase3/includes/SpecialAllpages.php |
— | — | @@ -231,8 +231,6 @@ |
232 | 232 | ) |
233 | 233 | ); |
234 | 234 | |
235 | | - ### FIXME: side link to previous |
236 | | - |
237 | 235 | $n = 0; |
238 | 236 | $out = '<table style="background: inherit;" border="0" width="100%">'; |
239 | 237 | |
— | — | @@ -263,15 +261,52 @@ |
264 | 262 | if ( $including ) { |
265 | 263 | $out2 = ''; |
266 | 264 | } else { |
| 265 | + |
| 266 | + # Get the last title from previous chunk |
| 267 | + $res_prev = $dbr->select( |
| 268 | + 'page', |
| 269 | + 'page_title', |
| 270 | + array( 'page_namespace' => $namespace, 'page_title < '.$dbr->addQuotes($from) ), |
| 271 | + $fname, |
| 272 | + array( 'ORDER BY' => 'page_title DESC', 'LIMIT' => $this->maxPerPage, 'OFFSET' => ($this->maxPerPage - 1 ) ) |
| 273 | + ); |
| 274 | + |
| 275 | + # Get first title of previous complete chunk |
| 276 | + if( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) { |
| 277 | + $pt = $dbr->fetchObject( $res_prev ); |
| 278 | + $prevTitle = Title::makeTitle( $namespace, $pt->page_title ); |
| 279 | + } else { |
| 280 | + # The previous chunk is not complete, need to link to the very first title |
| 281 | + # available in the database |
| 282 | + $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, array( 'LIMIT' => 1) ); |
| 283 | + |
| 284 | + # Show the previous link if it s not the current requested chunk |
| 285 | + if( $from != $reallyFirstPage_title ) { |
| 286 | + $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title ); |
| 287 | + } else { |
| 288 | + $prevTitle = null; |
| 289 | + } |
| 290 | + } |
| 291 | + |
267 | 292 | $nsForm = $this->namespaceForm ( $namespace, $from ); |
268 | 293 | $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
269 | 294 | $out2 .= '<tr valign="top"><td align="left">' . $nsForm; |
270 | 295 | $out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' . |
271 | 296 | $sk->makeKnownLink( $wgContLang->specialPage( "Allpages" ), |
272 | 297 | wfMsgHtml ( 'allpages' ) ); |
273 | | - if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { |
274 | | - $t = Title::MakeTitle( $s->page_namespace, $s->page_title ); |
275 | | - $self = SpecialPage::getTitleFor( 'Allpages' ); |
| 298 | + |
| 299 | + $self = SpecialPage::getTitleFor( 'Allpages' ); |
| 300 | + |
| 301 | + # Do we put a previous link ? |
| 302 | + if( isset( $prevTitle ) && $pt = $prevTitle->getText() ) { |
| 303 | + $q = 'from=' . $prevTitle->getPartialUrl() . ( $namespace ? '&namespace=' . $namespace : '' ); |
| 304 | + $prevLink = $sk->makeKnownLinkObj( $self, wfMsgHTML( 'prevpage', $pt ), $q ); |
| 305 | + $out2 .= ' | ' . $prevLink; |
| 306 | + } |
| 307 | + |
| 308 | + if( $n == $this->maxPerPage && $s = $dbr->fetchObject($res) ) { |
| 309 | + # $s is the first link of the next chunk |
| 310 | + $t = Title::MakeTitle($namespace, $s->page_title); |
276 | 311 | $q = 'from=' . $t->getPartialUrl() . ( $namespace ? '&namespace=' . $namespace : '' ); |
277 | 312 | $nextLink = $sk->makeKnownLinkObj( $self, wfMsgHtml( 'nextpage', $t->getText() ), $q ); |
278 | 313 | $out2 .= ' | ' . $nextLink; |
— | — | @@ -280,8 +315,15 @@ |
281 | 316 | } |
282 | 317 | |
283 | 318 | $wgOut->addHtml( $out2 . $out ); |
284 | | - if( isset( $nextLink ) ) |
285 | | - $wgOut->addHtml( '<p style="font-size: smaller; float: right;">' . $nextLink . '</p>' ); |
| 319 | + if( isset($prevLink) or isset($nextLink) ) { |
| 320 | + $wgOut->addHtml( '<hr/><p style="font-size: smaller; float: right;">' ); |
| 321 | + if( isset( $prevLink ) ) |
| 322 | + $wgOut->addHTML( $prevLink . ' | '); |
| 323 | + if( isset( $nextLink ) ) |
| 324 | + $wgOut->addHTML( $nextLink ); |
| 325 | + $wgOut->addHTML( '</p>' ); |
| 326 | + |
| 327 | + } |
286 | 328 | |
287 | 329 | } |
288 | 330 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -268,8 +268,8 @@ |
269 | 269 | Duplicated code merged into wfResetOutputBuffers() and wfClearOutputBuffers() |
270 | 270 | * Special:AllPages : 'next page' link now point to the first title of the next |
271 | 271 | chunk instead of pointing to the last title of current chunk. |
| 272 | +* (bug 4673) Special:AllPages : add a 'previous' link (new message 'prevpage') |
272 | 273 | |
273 | | - |
274 | 274 | == Languages updated == |
275 | 275 | |
276 | 276 | * Bishnupriya Manipuri (bpy) |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1525,6 +1525,7 @@ |
1526 | 1526 | |
1527 | 1527 | # Special:Allpages |
1528 | 1528 | 'nextpage' => 'Next page ($1)', |
| 1529 | +'prevpage' => 'Previous page ($1)', |
1529 | 1530 | 'allpagesfrom' => 'Display pages starting at:', |
1530 | 1531 | 'allarticles' => 'All articles', |
1531 | 1532 | 'allinnamespace' => 'All pages ($1 namespace)', |