r21395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21394‎ | r21395 | r21396 >
Date:21:18, 19 April 2007
Author:raymond
Status:old
Tags:
Comment:
reapply relevant parts of r20164, 20177, 20226
non-critical to database
Modified paths:
  • /trunk/phase3/includes/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialContributions.php
@@ -192,14 +192,19 @@
193193 global $wgUser, $wgOut, $wgLang, $wgRequest;
194194
195195 $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
 196+ $radiobox = $wgRequest->getVal( 'newbie' );
 197+
 198+ // check for radiobox
 199+ if ( $radiobox == 'contribs-newbie' ) $target = 'newbies';
 200+
196201 if ( !strlen( $target ) ) {
197 - $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 202+ $wgOut->addHTML( contributionsForm( '' ) );
198203 return;
199204 }
200205
201206 $nt = Title::newFromURL( $target );
202207 if ( !$nt ) {
203 - $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 208+ $wgOut->addHTML( contributionsForm( '' ) );
204209 return;
205210 }
206211
@@ -208,13 +213,14 @@
209214 list( $options['limit'], $options['offset']) = wfCheckLimits();
210215 $options['offset'] = $wgRequest->getVal( 'offset' );
211216 /* Offset must be an integral. */
212 - if ( !strlen( $options['offset'] ) || !preg_match( '/^[0-9]+$/', $options['offset'] ) )
 217+ if ( !strlen( $options['offset'] ) || !preg_match( '/^[0-9]+$/', $options['offset'] ) ) {
213218 $options['offset'] = '';
 219+ }
214220
215221 $title = SpecialPage::getTitleFor( 'Contributions' );
216222 $options['target'] = $target;
217223
218 - $nt =& Title::makeTitle( NS_USER, $nt->getDBkey() );
 224+ $nt = Title::makeTitle( NS_USER, $nt->getDBkey() );
219225 $finder = new ContribsFinder( ( $target == 'newbies' ) ? 'newbies' : $nt->getText() );
220226 $finder->setLimit( $options['limit'] );
221227 $finder->setOffset( $options['offset'] );
@@ -373,27 +379,31 @@
374380 * @param $options Array: the options to be included.
375381 */
376382 function contributionsForm( $options ) {
377 - global $wgScript, $wgTitle;
 383+ global $wgScript, $wgTitle, $wgRequest;
378384
379385 $options['title'] = $wgTitle->getPrefixedText();
 386+ if (!isset($options['target']))
 387+ $options['target'] = '';
 388+ if (!isset($options['namespace']))
 389+ $options['namespace'] = 0;
380390
381 - $f = "<form method='get' action=\"$wgScript\">\n";
 391+ $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
 392+
382393 foreach ( $options as $name => $value ) {
383394 if( $name === 'namespace') continue;
384 - $f .= "\t" . wfElement( 'input', array(
385 - 'name' => $name,
386 - 'type' => 'hidden',
387 - 'value' => $value ) ) . "\n";
 395+ $f .= "\t" . Xml::hidden( $name, $value ) . "\n";
388396 }
389397
390 - $f .= '<p>' . wfMsgHtml( 'namespace' ) . ' ' .
391 - HTMLnamespaceselector( $options['namespace'], '' ) .
392 - wfElement( 'input', array(
393 - 'type' => 'submit',
394 - 'value' => wfMsg( 'allpagessubmit' ) )
395 - ) .
396 - "</p></form>\n";
397 -
 398+ $f .= '<fieldset>' .
 399+ Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
 400+ Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parseinline' ) ), 'newbie' , 'contribs-newbie' , 'contribs-newbie', 'contribs-newbie' ) . '<br />' .
 401+ Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parseinline' ) ), 'newbie' , 'contribs-all', 'contribs-all', 'contribs-all' ) . ' ' .
 402+ Xml::input( 'target', 20, $options['target']) . ' '.
 403+ Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
 404+ Xml::namespaceSelector( $options['namespace'], '' ) .
 405+ Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
 406+ '</fieldset>' .
 407+ Xml::closeElement( 'form' );
398408 return $f;
399409 }
400410

Follow-up revisions

RevisionCommit summaryAuthorDate
r21407* some tweaks to r21395 to make Brion happy ;-)...raymond10:26, 20 April 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r20164* (bug 9009) Add username entry field to Special:Contributions...raymond13:25, 6 March 2007