r21380 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21379‎ | r21380 | r21381 >
Date:14:38, 19 April 2007
Author:brion
Status:old
Tags:
Comment:
Revert Special:Log to r20745 with non-ugly form
Modified paths:
  • /trunk/phase3/includes/SpecialLog.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialLog.php
@@ -36,7 +36,7 @@
3737 }
3838
3939 /**
40 - * @todo document (needs one-sentence top-level class description)
 40+ *
4141 * @addtogroup SpecialPage
4242 */
4343 class LogReader {
@@ -128,7 +128,7 @@
129129 }
130130 $this->title =& $title;
131131 $this->pattern = $pattern;
132 - $ns = intval( $title->getNamespace() );
 132+ $ns = $title->getNamespace();
133133 if ( $pattern && !$wgMiserMode ) {
134134 $safetitle = $this->db->escapeLike( $title->getDBkey() ); // use escapeLike to avoid expensive search patterns like 't%st%'
135135 $this->whereClauses[] = "log_namespace=$ns AND log_title LIKE '$safetitle%'";
@@ -218,7 +218,7 @@
219219 }
220220
221221 /**
222 - * @todo document (needs one-sentence top-level class description)
 222+ *
223223 * @addtogroup SpecialPage
224224 */
225225 class LogViewer {
@@ -347,12 +347,12 @@
348348 if ( $s->log_type == 'move' && isset( $paramArray[0] ) ) {
349349 $destTitle = Title::newFromText( $paramArray[0] );
350350 if ( $destTitle ) {
351 - $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
 351+ $reviewlink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
352352 wfMsg( 'revertmove' ),
353353 'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
354354 '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
355355 '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
356 - '&wpMovetalk=0' ) . ')';
 356+ '&wpMovetalk=0' );
357357 }
358358 // show undelete link
359359 } elseif ( $s->log_action == 'delete' && $wgUser->isAllowed( 'delete' ) ) {
@@ -401,28 +401,19 @@
402402 */
403403 function showOptions( &$out ) {
404404 global $wgScript, $wgMiserMode;
 405+ $action = htmlspecialchars( $wgScript );
405406 $title = SpecialPage::getTitleFor( 'Log' );
406 - $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
407 - $form .= Xml::hidden( 'title', $title->getPrefixedDBkey() );
408 - $form .= '<fieldset><legend>' . wfMsgHtml( 'log-search-legend' ) . '</legend>';
409 - $form .= '<table>';
410 - # Log selection
411 - $form .= '<tr><td>&nbsp;</td><td>' . $this->getTypeMenu() . '</td></tr>';
412 - $form .= '<tr><td>' . Xml::label( wfMsg( 'specialloguserlabel' ), 'user' ) . '</td>';
413 - # User filter
414 - $form .= '<td>' . Xml::input( 'user', 30, $this->reader->queryUser(), array( 'id' => 'user' ) ) . '</td></tr>';
415 - # Title filter
416 - $form .= '<tr><td>' . Xml::label( wfMsg( 'speciallogtitlelabel' ), 'page' ) . '</td>';
417 - $form .= '<td>' . Xml::input( 'page', 30, $this->reader->queryTitle(), array( 'id' => 'page' ) ) . '</td></tr>';
418 - # Title "wildcard" checkbox (if enabled)
419 - if( !$wgMiserMode ) {
420 - $form .= '<tr><td>&nbsp;</td><td>' . Xml::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $this->reader->queryPattern() ) . '</td></tr>';
421 - }
422 - $form .= '<tr><td>&nbsp;</td><td>' . Xml::submitButton( wfMsg( 'log-search-submit' ) ) . '</td></tr>';
423 - $form .= '</table>';
424 - $form .= '</fieldset>';
425 - $form .= '</form>';
426 - $out->addHtml( $form );
 407+ $special = htmlspecialchars( $title->getPrefixedDBkey() );
 408+ $out->addHTML( "<form action=\"$action\" method=\"get\">\n" .
 409+ '<fieldset>' .
 410+ Xml::element( 'legend', array(), wfMsg( 'log' ) ) .
 411+ Xml::hidden( 'title', $special ) . "\n" .
 412+ $this->getTypeMenu() . "\n" .
 413+ $this->getUserInput() . "\n" .
 414+ $this->getTitleInput() . "\n" .
 415+ (!$wgMiserMode?($this->getTitlePattern()."\n"):"") .
 416+ Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
 417+ "</fieldset></form>" );
427418 }
428419
429420 /**
@@ -455,6 +446,33 @@
456447 }
457448
458449 /**
 450+ * @return string Formatted HTML
 451+ * @private
 452+ */
 453+ function getUserInput() {
 454+ $user = $this->reader->queryUser();
 455+ return Xml::inputLabel( wfMsg( 'specialloguserlabel' ), 'user', 'user', 12, $user );
 456+ }
 457+
 458+ /**
 459+ * @return string Formatted HTML
 460+ * @private
 461+ */
 462+ function getTitleInput() {
 463+ $title = $this->reader->queryTitle();
 464+ return Xml::inputLabel( wfMsg( 'speciallogtitlelabel' ), 'page', 'page', 20, $title );
 465+ }
 466+
 467+ /**
 468+ * @return boolean Checkbox
 469+ * @private
 470+ */
 471+ function getTitlePattern() {
 472+ $pattern = $this->reader->queryPattern();
 473+ return Xml::checkLabel( wfMsg( 'title-pattern' ), 'pattern', 'pattern', $pattern );
 474+ }
 475+
 476+ /**
459477 * @param OutputPage &$out where to send output
460478 * @private
461479 */

Follow-up revisions

RevisionCommit summaryAuthorDate
r40241Removed 'log-search-legend' and 'log-search-submit'. Introduced in r20746 and...siebrand19:19, 29 August 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r20745another miser-mode target...midom19:01, 27 March 2007