r23582 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23581‎ | r23582 | r23583 >
Date:05:20, 30 June 2007
Author:david
Status:old
Tags:
Comment:
history tab works
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -113,11 +113,11 @@
114114 static protected $occupied_titles = array();
115115
116116 /*************************
117 - * (1) linking to liquidthreads pages and
118 - * (2) figuring out what page you're on and what you need to do.
 117+ * (1) linking to liquidthreads pages and
 118+ * (2) figuring out what page you're on and what you need to do.
119119 *************************/
120120
121 - function queryStringFromArray( $vars ) {
 121+ static function queryStringFromArray( $vars ) {
122122 $q = '';
123123 if ( $vars && count( $vars ) != 0 ) {
124124 foreach( $vars as $name => $value )
@@ -140,6 +140,13 @@
141141 return $thread->root()->getTitle()->getFullUrl($query);
142142 }
143143
 144+ /* This is used for action=history so that the history tab works, which is
 145+ why we break the lqt_method paradigm. */
 146+ function permalinkUrlWithQuery( $thread, $query ) {
 147+ if ( is_array($query) ) $query = self::queryStringFromArray($query);
 148+ return $thread->root()->getTitle()->getFullUrl($query);
 149+ }
 150+
144151 function talkpageUrl( $title, $method = null, $operand = null ) {
145152 $query = $method ? "lqt_method=$method" : "";
146153 $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query;
@@ -379,11 +386,11 @@
380387 $commands = array( 'Edit' => $this->talkpageUrl( $this->title, 'edit', $thread ),
381388 'Reply' => $this->talkpageUrl( $this->title, 'reply', $thread ),
382389 'Permalink' => $this->permalinkUrl( $thread ) );
383 -
 390+/*
384391 if( !$thread->hasSuperthread() ) {
385392 $commands['History'] = $this->permalinkUrl($thread, 'history_listing');
386393 }
387 -
 394+*/
388395 foreach( $commands as $label => $href ) {
389396 $this->output->addHTML( wfOpenElement( 'li' ) );
390397 $this->output->addHTML( wfElement('a', array('href'=>$href), $label) );
@@ -734,9 +741,9 @@
735742 }
736743
737744 /**
738 - * Return a URL for the current page, including Title and query vars,
 745+ * Return a URL for the current page, including Title and query vars,
739746 * with the given replacements made.
740 - * @param $repls array( 'name'=>new_value, ... )
 747+ * @param $repls array( 'name'=>new_value, ... )
741748 */
742749 function queryReplace( $repls ) {
743750 $vs = $this->request->getValues();
@@ -748,7 +755,7 @@
749756 $rs[$k] = $vs[$k];
750757 }
751758 }
752 - return $this->title->getFullURL($this->queryStringFromArray($rs));
 759+ return $this->title->getFullURL(self::queryStringFromArray($rs));
753760 }
754761
755762 function clip( $vals, $min, $max ) {
@@ -846,6 +853,8 @@
847854 }
848855
849856 class ThreadPermalinkView extends LqtView {
 857+ protected $thread;
 858+
850859 function showThreadHeading( $thread ) {
851860 if ( $this->headerLevel == 1 ) {
852861 $this->output->setPageTitle( $thread->wikilink() );
@@ -855,7 +864,9 @@
856865 }
857866
858867 function show() {
 868+
859869 $t = Threads::withRoot( $this->article );
 870+ $this->thread = $t;
860871
861872 // TODO this is a holdover from the special page; not sure what's correct here.
862873 // we now have a real true $this->article that makes some sense.
@@ -880,9 +891,12 @@
881892
882893 if( $this->methodApplies('summarize') ) {
883894 $this->showSummarizeForm($t);
884 -
885 - } else if( $this->methodApplies('history_listing') ) {
 895+
 896+ /* breaking the lqt_method paradigm to make the history tab work. */
 897+ } else if( $this->request->getVal('action') === 'history') {
 898+ $this->showThreadHeading($t);
886899 $this->showHistoryListing($t);
 900+ return;
887901 }
888902
889903 $this->showThread($t);

Follow-up revisions

RevisionCommit summaryAuthorDate
r23583Merging r23572 through r23582 into apiedit branch.catrope08:42, 30 June 2007

Status & tagging log