r36758 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36757‎ | r36758 | r36759 >
Date:19:45, 27 June 2008
Author:btongminh
Status:old
Tags:
Comment:
* Allow extensions to modify the user creation form by calling addInputItem();
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/templates/Userlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/templates/Userlogin.php
@@ -97,6 +97,15 @@
9898 * @ingroup Templates
9999 */
100100 class UsercreateTemplate extends QuickTemplate {
 101+ function addInputItem( $name, $value, $type, $msg ) {
 102+ $this->data['extraInput'][] = array(
 103+ 'name' => $name,
 104+ 'value' => $value,
 105+ 'type' => $type,
 106+ 'msg' => $msg,
 107+ );
 108+ }
 109+
101110 function execute() {
102111 if( $this->data['message'] ) {
103112 ?>
@@ -197,15 +206,57 @@
198207 /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
199208 </td>
200209 </tr>
 210+<?php
 211+ $tabIndex = 8;
 212+ if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
 213+ foreach ( $this->data['extraInput'] as $inputItem ) { ?>
201214 <tr>
 215+ <?php
 216+ if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
 217+ ?><td class="mw-label"><label for="<?php
 218+ echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
 219+ $this->msgWiki( $inputItem['msg'] ) ?></label><?php
 220+ } else {
 221+ ?><td><?php
 222+ }
 223+ ?></td>
 224+ <td class="mw-input">
 225+ <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
 226+ echo htmlspecialchars( $inputItem['name'] ); ?>"
 227+ tabindex="<?php echo $tabIndex++; ?>"
 228+ value="<?php
 229+ if ( $inputItem['type'] != 'checkbox' ) {
 230+ echo htmlspecialchars( $inputItem['value'] );
 231+ } else {
 232+ echo '1';
 233+ }
 234+ ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
 235+ <?php
 236+ if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
 237+ echo 'checked="checked"';
 238+ ?> /> <?php
 239+ if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
 240+ ?>
 241+ <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
 242+ $this->msg( $inputItem['msg'] ) ?></label><?php
 243+ }
 244+ ?>
 245+ </td>
 246+ </tr>
 247+<?php
 248+
 249+ }
 250+ }
 251+?>
 252+ <tr>
202253 <td></td>
203254 <td class="mw-submit">
204255 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
205 - tabindex="8"
 256+ tabindex="<?php echo $tabIndex++; ?>"
206257 value="<?php $this->msg('createaccount') ?>" />
207258 <?php if( $this->data['createemail'] ) { ?>
208259 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
209 - tabindex="9"
 260+ tabindex="<?php echo $tabIndex++; ?>"
210261 value="<?php $this->msg('createaccountmail') ?>" />
211262 <?php } ?>
212263 </td>
Index: trunk/phase3/RELEASE-NOTES
@@ -171,7 +171,8 @@
172172 * (bugs 4832, 9481, 12890) Special:Recentchangeslinked now has all options that
173173 are in Special:Recentchanges
174174 * Allow an $error message to be passed to ArticleDelete hook
175 -
 175+* Allow extensions to modify the user creation form by calling addInputItem();
 176+
176177 === Bug fixes in 1.13 ===
177178
178179 * (bug 10677) Add link to the file description page on the shared repository

Status & tagging log