r40345 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40344‎ | r40345 | r40346 >
Date:22:32, 2 September 2008
Author:david
Status:old
Tags:
Comment:
Deleted threads now completely hidden by default; can be shown using checkbox.
Modified paths:
  • /trunk/extensions/LiquidThreads/LqtBaseView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtPages.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt.css
@@ -447,13 +447,10 @@
448448 font-size:85%;
449449 float:right;
450450 }
451 -.lqt_sorting_order {
 451+.lqt_view_options input {
 452+ /* This doesn't cascade for some reason. */
452453 font-size:85%;
453454 }
454455 .lqt_go_sort {
455 - font-size:85%;
456456 font-weight:bold;
457457 }
458 -.lqt_remember_sort {
459 - font-size:85%;
460 -}
Index: trunk/extensions/LiquidThreads/LqtPages.php
@@ -114,58 +114,57 @@
115115 }
116116 }
117117
118 - function show() {
119 - global $wgHooks, $wgUser;
120 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
 118+ function showTalkpageViewOptions($article) {
 119+ // TODO WTF who wrote this?
121120
122 - $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() );
123 - self::addJSandCSS();
124 - $article = new Article( $this->title );
125 -
126121 if( $this->methodApplies('talkpage_sort_order') ) {
127 - global $wgRequest;
128 - $remember_sort_checked = $wgRequest->getVal('lqt_remember_sort') ? 'checked ' : '';
129 - $wgUser->setOption('lqt_sort_order', $this->sort_order);
130 - $wgUser->saveSettings();
 122+ $remember_sort_checked = $this->request->getBool('lqt_remember_sort') ? 'checked ' : '';
 123+ $this->user->setOption('lqt_sort_order', $this->sort_order);
 124+ $this->user->saveSettings();
131125 } else {
132126 $remember_sort_checked = '';
133 - }
 127+ }
134128
135 - global $wgRequest;
136 - if( $this->methodApplies('talkpage_new_thread') ) {
137 - $this->showNewThreadForm();
138 - } else {
139 -
140 - // Only show sort controls if there is stuff to be sorted
141 - if($article->exists()) {
142 - $nc_sort = $this->sort_order==LQT_NEWEST_CHANGES ? ' selected' : '';
143 - $nt_sort = $this->sort_order==LQT_NEWEST_THREADS ? ' selected' : '';
144 - $ot_sort = $this->sort_order==LQT_OLDEST_THREADS ? ' selected' : '';
145 - $newest_changes = wfMsg('lqt_sort_newest_changes');
146 - $newest_threads = wfMsg('lqt_sort_newest_threads');
147 - $oldest_threads = wfMsg('lqt_sort_oldest_threads');
148 - $lqt_remember_sort = wfMsg('lqt_remember_sort') ;
149 - $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order');
150 - $lqt_sorting_order = wfMsg('lqt_sorting_order');
151 - $lqt_sort_newest_changes = wfMsg('lqt_sort_newest_changes');
152 - $lqt_sort_newest_threads = wfMsg('lqt_sort_newest_threads');
153 - $lqt_sort_oldest_threads = wfMsg('lqt_sort_oldest_threads');
154 - $go=wfMsg('go');
155 - if($wgUser->isLoggedIn()) {
156 - $remember_sort =
157 - <<<HTML
 129+ if($article->exists()) {
 130+ $nc_sort = $this->sort_order==LQT_NEWEST_CHANGES ? ' selected' : '';
 131+ $nt_sort = $this->sort_order==LQT_NEWEST_THREADS ? ' selected' : '';
 132+ $ot_sort = $this->sort_order==LQT_OLDEST_THREADS ? ' selected' : '';
 133+ $newest_changes = wfMsg('lqt_sort_newest_changes');
 134+ $newest_threads = wfMsg('lqt_sort_newest_threads');
 135+ $oldest_threads = wfMsg('lqt_sort_oldest_threads');
 136+ $lqt_remember_sort = wfMsg('lqt_remember_sort') ;
 137+ $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order');
 138+ $lqt_sorting_order = wfMsg('lqt_sorting_order');
 139+ $lqt_sort_newest_changes = wfMsg('lqt_sort_newest_changes');
 140+ $lqt_sort_newest_threads = wfMsg('lqt_sort_newest_threads');
 141+ $lqt_sort_oldest_threads = wfMsg('lqt_sort_oldest_threads');
 142+ $go=wfMsg('go');
 143+ if($this->user->isLoggedIn()) {
 144+ $remember_sort =
 145+ <<<HTML
158146 <br />
159147 <label for="lqt_remember_sort_checkbox">
160 -<input id="lqt_remember_sort_checkbox" name="lqt_remember_sort" type="checkbox" value="1" $remember_sort_checked class="lqt_remember_sort" />
 148+<input id="lqt_remember_sort_checkbox" name="lqt_remember_sort" type="checkbox" value="1" $remember_sort_checked />
161149 $lqt_remember_sort</label>
162150 HTML;
163 - } else {
164 - $remember_sort = '';
165 - }
166 - $this->openDiv('lqt_view_options');
167 - $this->output->addHTML(
168 -
169 - <<<HTML
 151+ } else {
 152+ $remember_sort = '';
 153+ }
 154+ if ( in_array('deletedhistory', $this->user->getRights()) ) {
 155+ $show_deleted_checked = $this->request->getBool('lqt_show_deleted_threads') ? 'checked ' : '';
 156+ $show_deleted = <<<HTML
 157+<br />
 158+<label for="lqt_show_deleted_threads_checkbox">
 159+<input id="lqt_show_deleted_threads_checkbox" name="lqt_show_deleted_threads" type="checkbox" value="1" $show_deleted_checked />
 160+Show deleted threads</label>
 161+HTML;
 162+ } else {
 163+ $show_deleted = "";
 164+ }
 165+ $this->openDiv('lqt_view_options');
 166+ $this->output->addHTML(
 167+
 168+ <<<HTML
170169 <form name="lqt_sort" action="$form_action_url" method="post">$lqt_sorting_order
171170 <select name="lqt_order" class="lqt_sort_select">
172171 <option value="nc"$nc_sort>$lqt_sort_newest_changes</option>
@@ -173,12 +172,29 @@
174173 <option value="ot"$ot_sort>$lqt_sort_oldest_threads</option>
175174 </select>
176175 $remember_sort
 176+$show_deleted
177177 <input name="submitsort" type="submit" value="$go" class="lqt_go_sort"/>
178178 </form>
179179 HTML
180 - );
181 - $this->closeDiv();
182 - }
 180+ );
 181+ $this->closeDiv();
 182+ }
 183+
 184+ }
 185+
 186+ function show() {
 187+ global $wgHooks;
 188+ $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
 189+
 190+ $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() );
 191+ self::addJSandCSS();
 192+ $article = new Article( $this->title );
 193+
 194+ global $wgRequest; // TODO
 195+ if( $this->methodApplies('talkpage_new_thread') ) {
 196+ $this->showNewThreadForm();
 197+ } else {
 198+ $this->showTalkpageViewOptions($article);
183199 $url = $this->talkpageUrl( $this->title, 'talkpage_new_thread' );
184200 $this->output->addHTML("<strong><a class=\"lqt_start_discussion\" href=\"$url\">".wfMsg('lqt_new_thread')."</a></strong>");
185201 }
Index: trunk/extensions/LiquidThreads/LqtBaseView.php
@@ -861,6 +861,10 @@
862862 function showThread( $thread ) {
863863 global $wgLang; # TODO global.
864864
 865+ if ( $thread->type() == Threads::TYPE_DELETED
 866+ && ! $this->request->getBool('lqt_show_deleted_threads') )
 867+ return;
 868+
865869 if( $this->lastUnindentedSuperthread ) {
866870 $tmp = $this->lastUnindentedSuperthread;
867871 $msg = wfMsg('lqt_in_response_to',