Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -113,11 +113,11 @@ |
114 | 114 | static protected $occupied_titles = array(); |
115 | 115 | |
116 | 116 | /************************* |
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. |
119 | 119 | *************************/ |
120 | 120 | |
121 | | - function queryStringFromArray( $vars ) { |
| 121 | + static function queryStringFromArray( $vars ) { |
122 | 122 | $q = ''; |
123 | 123 | if ( $vars && count( $vars ) != 0 ) { |
124 | 124 | foreach( $vars as $name => $value ) |
— | — | @@ -140,6 +140,13 @@ |
141 | 141 | return $thread->root()->getTitle()->getFullUrl($query); |
142 | 142 | } |
143 | 143 | |
| 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 | + |
144 | 151 | function talkpageUrl( $title, $method = null, $operand = null ) { |
145 | 152 | $query = $method ? "lqt_method=$method" : ""; |
146 | 153 | $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query; |
— | — | @@ -379,11 +386,11 @@ |
380 | 387 | $commands = array( 'Edit' => $this->talkpageUrl( $this->title, 'edit', $thread ), |
381 | 388 | 'Reply' => $this->talkpageUrl( $this->title, 'reply', $thread ), |
382 | 389 | 'Permalink' => $this->permalinkUrl( $thread ) ); |
383 | | - |
| 390 | +/* |
384 | 391 | if( !$thread->hasSuperthread() ) { |
385 | 392 | $commands['History'] = $this->permalinkUrl($thread, 'history_listing'); |
386 | 393 | } |
387 | | - |
| 394 | +*/ |
388 | 395 | foreach( $commands as $label => $href ) { |
389 | 396 | $this->output->addHTML( wfOpenElement( 'li' ) ); |
390 | 397 | $this->output->addHTML( wfElement('a', array('href'=>$href), $label) ); |
— | — | @@ -734,9 +741,9 @@ |
735 | 742 | } |
736 | 743 | |
737 | 744 | /** |
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, |
739 | 746 | * with the given replacements made. |
740 | | - * @param $repls array( 'name'=>new_value, ... ) |
| 747 | + * @param $repls array( 'name'=>new_value, ... ) |
741 | 748 | */ |
742 | 749 | function queryReplace( $repls ) { |
743 | 750 | $vs = $this->request->getValues(); |
— | — | @@ -748,7 +755,7 @@ |
749 | 756 | $rs[$k] = $vs[$k]; |
750 | 757 | } |
751 | 758 | } |
752 | | - return $this->title->getFullURL($this->queryStringFromArray($rs)); |
| 759 | + return $this->title->getFullURL(self::queryStringFromArray($rs)); |
753 | 760 | } |
754 | 761 | |
755 | 762 | function clip( $vals, $min, $max ) { |
— | — | @@ -846,6 +853,8 @@ |
847 | 854 | } |
848 | 855 | |
849 | 856 | class ThreadPermalinkView extends LqtView { |
| 857 | + protected $thread; |
| 858 | + |
850 | 859 | function showThreadHeading( $thread ) { |
851 | 860 | if ( $this->headerLevel == 1 ) { |
852 | 861 | $this->output->setPageTitle( $thread->wikilink() ); |
— | — | @@ -855,7 +864,9 @@ |
856 | 865 | } |
857 | 866 | |
858 | 867 | function show() { |
| 868 | + |
859 | 869 | $t = Threads::withRoot( $this->article ); |
| 870 | + $this->thread = $t; |
860 | 871 | |
861 | 872 | // TODO this is a holdover from the special page; not sure what's correct here. |
862 | 873 | // we now have a real true $this->article that makes some sense. |
— | — | @@ -880,9 +891,12 @@ |
881 | 892 | |
882 | 893 | if( $this->methodApplies('summarize') ) { |
883 | 894 | $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); |
886 | 899 | $this->showHistoryListing($t); |
| 900 | + return; |
887 | 901 | } |
888 | 902 | |
889 | 903 | $this->showThread($t); |