r53948 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53947‎ | r53948 | r53949 >
Date:15:53, 29 July 2009
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Add a nifty little search box to discussion pages for searching the threads on *that* page.
Modified paths:
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -219,6 +219,23 @@
220220 $this->doInlineEditForm();
221221 return false;
222222 }
 223+
 224+ // Search!
 225+ if ( $this->request->getCheck( 'lqt_search' ) ) {
 226+ $q = $this->request->getText( 'lqt_search' );
 227+ $q .= ' ondiscussionpage:'.$article->getID();
 228+
 229+ $params = array( 'search' => $q,
 230+ 'fulltext' => 1,
 231+ 'ns'.NS_LQT_THREAD => 1,
 232+ );
 233+
 234+ $t = SpecialPage::getTitleFor( 'Search' );
 235+ $url = $t->getLocalURL( wfArrayToCGI( $params ) );
 236+
 237+ $this->output->redirect( $url );
 238+
 239+ }
223240
224241 $this->showHeader();
225242
@@ -238,6 +255,8 @@
239256 $this->output->addHTML( Xml::tags( 'strong', null, $newThreadLink ) );
240257 }
241258
 259+ $this->showSearchBox();
 260+
242261 $pager = $this->getPager();
243262
244263 $threads = $this->getPageThreads( $pager );
@@ -262,6 +281,24 @@
263282 return false;
264283 }
265284
 285+ function showSearchBox() {
 286+ $html = '';
 287+ $html .= Xml::inputLabel( wfMsg('lqt-search-label'), 'lqt_search', 'lqt-search-box',
 288+ 60 );
 289+
 290+ $html .= ' ' . Xml::submitButton( wfMsg( 'lqt-search-button' ) );
 291+ $html .= Xml::hidden( 'title', $this->title->getPrefixedText() );
 292+ $html = Xml::tags( 'form',
 293+ array( 'action' => $this->title->getLocalURL(),
 294+ 'method' => 'get' ),
 295+ $html );
 296+
 297+ $html = Xml::fieldset( wfMsg('lqt-search-legend' ), $html,
 298+ array( 'class' => 'lqt-talkpage-search' ) );
 299+
 300+ $this->output->addHTML( $html );
 301+ }
 302+
266303 function getPager() {
267304 $showDeleted = $this->request->getBool( 'lqt_show_deleted_threads' );
268305 $showDeleted = $showDeleted && $this->user->isAllowed( 'deletedhistory' );
Index: trunk/extensions/LiquidThreads/lqt.css
@@ -578,3 +578,14 @@
579579 margin: 0;
580580 display: inline-block;
581581 }
 582+
 583+fieldset.lqt-talkpage-search {
 584+ width: auto;
 585+ text-align: center;
 586+ margin: 0.5em 15%;
 587+ padding: 1em;
 588+}
 589+
 590+fieldset.lqt-talkpage-search legend {
 591+ text-align: center;
 592+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r53962Commit i18n for r53948werdna19:13, 29 July 2009

Comments

#Comment by MarkAHershberger (talk | contribs)   20:47, 23 July 2010

I'm confused by the "ondiscussionpage:" parameter. It doesn't seem to be used anywhere else and causes the search to return no matches. Removing it makes search work against LQT pages. (tested on translatewiki)

#Comment by MarkAHershberger (talk | contribs)   20:47, 23 July 2010

I'm confused by the "ondiscussionpage:" parameter. It doesn't seem to be used anywhere else and causes the search to return no matches. Removing it makes search work against LQT pages. (tested on translatewiki)

#Comment by Werdna (talk | contribs)   02:27, 24 July 2010

It requires Lucene search to be installed.

#Comment by Werdna (talk | contribs)   17:54, 18 January 2011

Removing FIXME because nobody has cared about it for six months.

Status & tagging log