Index: branches/liquidthreads/extensions/LqtPages.php |
— | — | @@ -361,7 +361,15 @@ |
362 | 362 | $content_actions['delete']['href'] = |
363 | 363 | SpecialPage::getPage('Deletethread')->getTitle()->getFullURL() . '/' . |
364 | 364 | $this->thread->title()->getPrefixedURL(); |
365 | | - } |
| 365 | + } |
| 366 | + |
| 367 | + if( array_key_exists('history', $content_actions) ) { |
| 368 | + $content_actions['history']['href'] = $this->permalinkUrl( $this->thread, 'thread_history' ); |
| 369 | + if( $this->methodApplies('thread_history') ) { |
| 370 | + $content_actions['history']['class'] = 'selected'; |
| 371 | + } |
| 372 | + } |
| 373 | + |
366 | 374 | return true; |
367 | 375 | } |
368 | 376 | |
— | — | @@ -465,6 +473,34 @@ |
466 | 474 | } |
467 | 475 | } |
468 | 476 | |
| 477 | +class IndividualThreadHistoryView extends ThreadPermalinkView { |
| 478 | + function customizeTabs( $skintemplate, $content_actions ) { |
| 479 | + unset($content_actions['edit']); |
| 480 | + unset($content_actions['viewsource']); |
| 481 | + unset($content_actions['talk']); |
| 482 | + |
| 483 | + $content_actions['talk']['class'] = false; |
| 484 | + $content_actions['history']['class'] = 'selected'; |
| 485 | + |
| 486 | + return true; |
| 487 | + } |
| 488 | + |
| 489 | + function customizeSubtitle() { |
| 490 | + $threadhist = "<a href=\"{$this->permalinkUrl($this->thread, 'thread_history')}\">View history for the entire thread</a>"; |
| 491 | + $this->output->setSubtitle( $this->output->getSubtitle() . "<br />$threadhist" ); |
| 492 | + return true; |
| 493 | + } |
| 494 | + |
| 495 | + function show() { |
| 496 | + global $wgHooks; |
| 497 | + $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs'); |
| 498 | + |
| 499 | + $wgHooks['PageHistoryBeforeList'][] = array($this, 'customizeSubtitle'); |
| 500 | + |
| 501 | + return true; |
| 502 | + } |
| 503 | +} |
| 504 | + |
469 | 505 | class ThreadDiffView { |
470 | 506 | function customizeTabs( $skintemplate, $content_actions ) { |
471 | 507 | unset($content_actions['edit']); |
Index: branches/liquidthreads/extensions/LqtBaseView.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | 'TalkpageView' => 'TalkpageView', |
38 | 38 | 'ThreadHistoryListingView' => 'ThreadHistoryListingView', |
39 | 39 | 'ThreadHistoricalRevisionView' => 'ThreadHistoricalRevisionView', |
| 40 | + 'IndividualThreadHistoryView' => 'IndividualThreadHistoryView', |
40 | 41 | 'ThreadDiffView' => 'ThreadDiffView', |
41 | 42 | 'ThreadPermalinkView' => 'ThreadPermalinkView', |
42 | 43 | 'ThreadProtectionFormView' => 'ThreadProtectionFormView' |
— | — | @@ -72,18 +73,28 @@ |
73 | 74 | } |
74 | 75 | |
75 | 76 | static function threadPermalinkMain(&$output, &$article, &$title, &$user, &$request) { |
76 | | - /* breaking the lqt_method paradigm to make the history tab work. |
77 | | - (just changing the href doesn't make the highlighting correct.) */ |
| 77 | + |
78 | 78 | $action = $request->getVal('action'); |
79 | | - if( $action == 'history' ) { |
| 79 | + $lqt_method = $request->getVal('lqt_method'); |
| 80 | + |
| 81 | + if( $lqt_method == 'thread_history' ) { |
80 | 82 | $viewname = self::$views['ThreadHistoryListingView']; |
81 | | - } else if ( $action == 'protect' || $action == 'unprotect' ) { |
| 83 | + } |
| 84 | + else if ( $lqt_method == 'diff' ) { // this clause and the next must be in this order. |
| 85 | + $viewname = self::$views['ThreadDiffView']; |
| 86 | + } |
| 87 | + else if ( $action == 'history' |
| 88 | + || $request->getVal('diff', null) !== null |
| 89 | + || $request->getVal('oldid', null) !== null ) { |
| 90 | + $viewname = self::$views['IndividualThreadHistoryView']; |
| 91 | + } |
| 92 | + else if ( $action == 'protect' || $action == 'unprotect' ) { |
82 | 93 | $viewname = self::$views['ThreadProtectionFormView']; |
83 | | - } else if ( $request->getVal('lqt_method') == 'diff' ) { |
84 | | - $viewname = self::$views['ThreadDiffView']; |
85 | | - } else if ( $request->getVal('lqt_oldid', null) !== null ) { |
| 94 | + } |
| 95 | + else if ( $request->getVal('lqt_oldid', null) !== null ) { |
86 | 96 | $viewname = self::$views['ThreadHistoricalRevisionView']; |
87 | | - } else { |
| 97 | + } |
| 98 | + else { |
88 | 99 | $viewname = self::$views['ThreadPermalinkView']; |
89 | 100 | } |
90 | 101 | $view = new $viewname( $output, $article, $title, $user, $request ); |
— | — | @@ -462,21 +473,19 @@ |
463 | 474 | $commands[] = array( 'label' => $user_can_edit ? wfMsg('edit') : wfMsg('viewsource'), |
464 | 475 | 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ), |
465 | 476 | 'enabled' => true ); |
| 477 | + |
| 478 | + $commands[] = array( 'label' => wfMsg('history_short'), |
| 479 | + 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'), |
| 480 | + 'enabled' => true ); |
466 | 481 | |
467 | | - $commands[] = array( 'label' => wfMsg('lqt_reply'), |
468 | | - 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ), |
469 | | - 'enabled' => $user_can_edit ); |
470 | | - |
471 | 482 | $commands[] = array( 'label' => wfMsg('lqt_permalink'), |
472 | 483 | 'href' => $this->permalinkUrl( $thread ), |
473 | 484 | 'enabled' => true ); |
| 485 | + |
| 486 | + $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg('lqt_reply') . '</b>', |
| 487 | + 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ), |
| 488 | + 'enabled' => $user_can_edit ); |
474 | 489 | |
475 | | - if( !$thread->hasSuperthread() ) { |
476 | | - $commands[] = array( 'label' => wfMsg('history_short'), |
477 | | - 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'), |
478 | | - 'enabled' => true ); |
479 | | - } |
480 | | - |
481 | 490 | if ( in_array('delete', $this->user->getRights()) ) { |
482 | 491 | $delete_url = SpecialPage::getPage('Deletethread')->getTitle()->getFullURL() |
483 | 492 | . '/' . $thread->title()->getPrefixedURL(); |