Index: trunk/phase3/includes/SpecialContributions.php |
— | — | @@ -192,14 +192,19 @@ |
193 | 193 | global $wgUser, $wgOut, $wgLang, $wgRequest; |
194 | 194 | |
195 | 195 | $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 | + |
196 | 201 | if ( !strlen( $target ) ) { |
197 | | - $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
| 202 | + $wgOut->addHTML( contributionsForm( '' ) ); |
198 | 203 | return; |
199 | 204 | } |
200 | 205 | |
201 | 206 | $nt = Title::newFromURL( $target ); |
202 | 207 | if ( !$nt ) { |
203 | | - $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
| 208 | + $wgOut->addHTML( contributionsForm( '' ) ); |
204 | 209 | return; |
205 | 210 | } |
206 | 211 | |
— | — | @@ -208,13 +213,14 @@ |
209 | 214 | list( $options['limit'], $options['offset']) = wfCheckLimits(); |
210 | 215 | $options['offset'] = $wgRequest->getVal( 'offset' ); |
211 | 216 | /* 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'] ) ) { |
213 | 218 | $options['offset'] = ''; |
| 219 | + } |
214 | 220 | |
215 | 221 | $title = SpecialPage::getTitleFor( 'Contributions' ); |
216 | 222 | $options['target'] = $target; |
217 | 223 | |
218 | | - $nt =& Title::makeTitle( NS_USER, $nt->getDBkey() ); |
| 224 | + $nt = Title::makeTitle( NS_USER, $nt->getDBkey() ); |
219 | 225 | $finder = new ContribsFinder( ( $target == 'newbies' ) ? 'newbies' : $nt->getText() ); |
220 | 226 | $finder->setLimit( $options['limit'] ); |
221 | 227 | $finder->setOffset( $options['offset'] ); |
— | — | @@ -373,27 +379,31 @@ |
374 | 380 | * @param $options Array: the options to be included. |
375 | 381 | */ |
376 | 382 | function contributionsForm( $options ) { |
377 | | - global $wgScript, $wgTitle; |
| 383 | + global $wgScript, $wgTitle, $wgRequest; |
378 | 384 | |
379 | 385 | $options['title'] = $wgTitle->getPrefixedText(); |
| 386 | + if (!isset($options['target'])) |
| 387 | + $options['target'] = ''; |
| 388 | + if (!isset($options['namespace'])) |
| 389 | + $options['namespace'] = 0; |
380 | 390 | |
381 | | - $f = "<form method='get' action=\"$wgScript\">\n"; |
| 391 | + $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
| 392 | + |
382 | 393 | foreach ( $options as $name => $value ) { |
383 | 394 | 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"; |
388 | 396 | } |
389 | 397 | |
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' ); |
398 | 408 | return $f; |
399 | 409 | } |
400 | 410 | |