r26330 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26329‎ | r26330 | r26331 >
Date:22:23, 2 October 2007
Author:david
Status:old
Tags:
Comment:
Comment-level history. Same restrictions apply to the diff view as the existing diffs, but otherwise everything seems to work. Rearranged footer links.
Modified paths:
  • /branches/liquidthreads/extensions/LqtBaseView.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtPages.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtPages.php
@@ -361,7 +361,15 @@
362362 $content_actions['delete']['href'] =
363363 SpecialPage::getPage('Deletethread')->getTitle()->getFullURL() . '/' .
364364 $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+
366374 return true;
367375 }
368376
@@ -465,6 +473,34 @@
466474 }
467475 }
468476
 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+
469505 class ThreadDiffView {
470506 function customizeTabs( $skintemplate, $content_actions ) {
471507 unset($content_actions['edit']);
Index: branches/liquidthreads/extensions/LqtBaseView.php
@@ -36,6 +36,7 @@
3737 'TalkpageView' => 'TalkpageView',
3838 'ThreadHistoryListingView' => 'ThreadHistoryListingView',
3939 'ThreadHistoricalRevisionView' => 'ThreadHistoricalRevisionView',
 40+ 'IndividualThreadHistoryView' => 'IndividualThreadHistoryView',
4041 'ThreadDiffView' => 'ThreadDiffView',
4142 'ThreadPermalinkView' => 'ThreadPermalinkView',
4243 'ThreadProtectionFormView' => 'ThreadProtectionFormView'
@@ -72,18 +73,28 @@
7374 }
7475
7576 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+
7878 $action = $request->getVal('action');
79 - if( $action == 'history' ) {
 79+ $lqt_method = $request->getVal('lqt_method');
 80+
 81+ if( $lqt_method == 'thread_history' ) {
8082 $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' ) {
8293 $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 ) {
8696 $viewname = self::$views['ThreadHistoricalRevisionView'];
87 - } else {
 97+ }
 98+ else {
8899 $viewname = self::$views['ThreadPermalinkView'];
89100 }
90101 $view = new $viewname( $output, $article, $title, $user, $request );
@@ -462,21 +473,19 @@
463474 $commands[] = array( 'label' => $user_can_edit ? wfMsg('edit') : wfMsg('viewsource'),
464475 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ),
465476 'enabled' => true );
 477+
 478+ $commands[] = array( 'label' => wfMsg('history_short'),
 479+ 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'),
 480+ 'enabled' => true );
466481
467 - $commands[] = array( 'label' => wfMsg('lqt_reply'),
468 - 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ),
469 - 'enabled' => $user_can_edit );
470 -
471482 $commands[] = array( 'label' => wfMsg('lqt_permalink'),
472483 'href' => $this->permalinkUrl( $thread ),
473484 '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 );
474489
475 - if( !$thread->hasSuperthread() ) {
476 - $commands[] = array( 'label' => wfMsg('history_short'),
477 - 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'),
478 - 'enabled' => true );
479 - }
480 -
481490 if ( in_array('delete', $this->user->getRights()) ) {
482491 $delete_url = SpecialPage::getPage('Deletethread')->getTitle()->getFullURL()
483492 . '/' . $thread->title()->getPrefixedURL();

Status & tagging log