Index: branches/liquidthreads/skins/monobook/main.css |
— | — | @@ -50,7 +50,11 @@ |
51 | 51 | background-color: #f0f0e3; |
52 | 52 | } |
53 | 53 | |
54 | | -.lqt_disabled_link { |
| 54 | +.lqt_newer_older { |
| 55 | + margin-right: 1em; |
| 56 | +} |
| 57 | +.lqt_newer_older_disabled { |
| 58 | + margin-right: 1em; |
55 | 59 | color: #999; |
56 | 60 | } |
57 | 61 | |
Index: branches/liquidthreads/extensions/LqtPages.php |
— | — | @@ -237,24 +237,6 @@ |
238 | 238 | $result .= "</select>"; |
239 | 239 | return $result; |
240 | 240 | } |
241 | | - |
242 | | - /** |
243 | | - * Return a URL for the current page, including Title and query vars, |
244 | | - * with the given replacements made. |
245 | | - * @param $repls array( 'name'=>new_value, ... ) |
246 | | - */ |
247 | | - function queryReplace( $repls ) { |
248 | | - $vs = $this->request->getValues(); |
249 | | - $rs = array(); |
250 | | - foreach ($vs as $k => $v) { |
251 | | - if ( array_key_exists( $k, $repls ) ) { |
252 | | - $rs[$k] = $repls[$k]; |
253 | | - } else { |
254 | | - $rs[$k] = $vs[$k]; |
255 | | - } |
256 | | - } |
257 | | - return $this->title->getFullURL(self::queryStringFromArray($rs)); |
258 | | - } |
259 | 241 | |
260 | 242 | function clip( $vals, $min, $max ) { |
261 | 243 | $res = array(); |
— | — | @@ -289,20 +271,20 @@ |
290 | 272 | $this->clip( array($oatte, $oatts, $natts, $natte), |
291 | 273 | 0, count($months)-1 ); |
292 | 274 | |
293 | | - $older = '<a href="' . $this->queryReplace(array( |
| 275 | + $older = '<a class="lqt_newer_older" href="' . $this->queryReplace(array( |
294 | 276 | 'lqt_archive_filter_by_date'=>'1', |
295 | 277 | 'lqt_archive_start' => $months[$os], |
296 | 278 | 'lqt_archive_end' => $months[$oe])) |
297 | 279 | . '">«older</a>'; |
298 | | - $newer = '<a href="' . $this->queryReplace(array( |
| 280 | + $newer = '<a class="lqt_newer_older" href="' . $this->queryReplace(array( |
299 | 281 | 'lqt_archive_filter_by_date'=>'1', |
300 | 282 | 'lqt_archive_start' => $months[$ns], |
301 | 283 | 'lqt_archive_end' => $months[$ne])) |
302 | 284 | . '">newer»</a>'; |
303 | 285 | } |
304 | 286 | else { |
305 | | - $older = '<span class="lqt_disabled_link" title="This link is disabled because you are viewing threads from all dates.">«older</span>'; |
306 | | - $newer = '<span class="lqt_disabled_link" title="This link is disabled because you are viewing threads from all dates.">newer»</span>'; |
| 287 | + $older = '<span class="lqt_newer_older_disabled" title="This link is disabled because you are viewing threads from all dates.">«older</span>'; |
| 288 | + $newer = '<span class="lqt_newer_older_disabled" title="This link is disabled because you are viewing threads from all dates.">newer»</span>'; |
307 | 289 | } |
308 | 290 | |
309 | 291 | $this->output->addHTML(<<<HTML |
— | — | @@ -565,14 +547,50 @@ |
566 | 548 | } |
567 | 549 | |
568 | 550 | function showHistoryListing($t) { |
569 | | - $revisions = new ThreadHistoryIterator($t, 10, 0); |
| 551 | + $revisions = new ThreadHistoryIterator($t, $this->perPage, $this->perPage * ($this->page - 1)); |
| 552 | + |
570 | 553 | $this->output->addHTML('<table>'); |
571 | 554 | foreach($revisions as $ht) { |
572 | 555 | $this->output->addHTML($this->rowForThread($ht)); |
573 | 556 | } |
574 | 557 | $this->output->addHTML('</table>'); |
| 558 | + |
| 559 | + |
| 560 | + if ( count($revisions) == 0 && $this->page == 1 ) { |
| 561 | + $this->output->addHTML('<p>This thread doesn\'t have any history revisions. That\'s pretty weird.'); |
| 562 | + } |
| 563 | + else if ( count($revisions) == 0 ) { |
| 564 | + // we could redirect to the previous page... yow. |
| 565 | + $this->output->addHTML('<p>You are beyond the number of pages of history that exist.'); |
| 566 | + } |
| 567 | + |
| 568 | + if( $this->page > 1 ) { |
| 569 | + $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace(array('lqt_hist_page'=>$this->page - 1)) . '">«newer</a>' ); |
| 570 | + } else { |
| 571 | + $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="This link is disabled because you are on the first page.">«newer</span>' ); |
| 572 | + } |
| 573 | + |
| 574 | + $is_last_page = false; |
| 575 | + foreach($revisions as $r) |
| 576 | + if( $r->changeType() == Threads::CHANGE_NEW_THREAD ) |
| 577 | + $is_last_page = true; |
| 578 | + if( $is_last_page ) { |
| 579 | + $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="This link is disabled because you are on the last page.">older»</span>' ); |
| 580 | + } else { |
| 581 | + $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace(array('lqt_hist_page'=>$this->page + 1)) . '">older»</a>' ); |
| 582 | + } |
575 | 583 | } |
| 584 | + |
| 585 | + function __construct(&$output, &$article, &$title, &$user, &$request) { |
| 586 | + parent::__construct($output, $article, $title, $user, $request); |
| 587 | + $this->loadParametersFromRequest(); |
| 588 | + } |
576 | 589 | |
| 590 | + function loadParametersFromRequest() { |
| 591 | + $this->perPage = $this->request->getInt('lqt_hist_per_page', 10); |
| 592 | + $this->page = $this->request->getInt('lqt_hist_page', 1); |
| 593 | + } |
| 594 | + |
577 | 595 | function show() { |
578 | 596 | global $wgHooks; |
579 | 597 | $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
Index: branches/liquidthreads/extensions/LqtBaseView.php |
— | — | @@ -231,6 +231,25 @@ |
232 | 232 | $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query; |
233 | 233 | return $title->getFullURL( $query ) . ($operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : ""); |
234 | 234 | } |
| 235 | + |
| 236 | + |
| 237 | + /** |
| 238 | + * Return a URL for the current page, including Title and query vars, |
| 239 | + * with the given replacements made. |
| 240 | + * @param $repls array( 'name'=>new_value, ... ) |
| 241 | + */ |
| 242 | + function queryReplace( $repls ) { |
| 243 | + $vs = $this->request->getValues(); |
| 244 | + $rs = array(); |
| 245 | + foreach ($vs as $k => $v) { |
| 246 | + if ( array_key_exists( $k, $repls ) ) { |
| 247 | + $rs[$k] = $repls[$k]; |
| 248 | + } else { |
| 249 | + $rs[$k] = $vs[$k]; |
| 250 | + } |
| 251 | + } |
| 252 | + return $this->title->getFullURL(self::queryStringFromArray($rs)); |
| 253 | + } |
235 | 254 | |
236 | 255 | /************************************************************* |
237 | 256 | * Editing methods (here be dragons) * |