* Allow extensions to modify the user creation form by calling addInputItem();
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Fri, 27 Jun 2008 19:45:24 +0000 (19:45 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Fri, 27 Jun 2008 19:45:24 +0000 (19:45 +0000)
RELEASE-NOTES
includes/templates/Userlogin.php

index d8a7a58..87cb4b5 100644 (file)
@@ -171,7 +171,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bugs 4832, 9481, 12890) Special:Recentchangeslinked now has all options that
   are in Special:Recentchanges
 * Allow an $error message to be passed to ArticleDelete hook
-  
+* Allow extensions to modify the user creation form by calling addInputItem();
 === Bug fixes in 1.13 ===
 
 * (bug 10677) Add link to the file description page on the shared repository
index 4a2078c..deeeb27 100644 (file)
@@ -97,6 +97,15 @@ class UserloginTemplate extends QuickTemplate {
  * @ingroup Templates
  */
 class UsercreateTemplate extends QuickTemplate {
+       function addInputItem( $name, $value, $type, $msg ) {
+               $this->data['extraInput'][] = array(
+                       'name' => $name,
+                       'value' => $value,
+                       'type' => $type,
+                       'msg' => $msg,
+               );
+       }
+       
        function execute() {
                if( $this->data['message'] ) {
 ?>
@@ -197,15 +206,57 @@ class UsercreateTemplate extends QuickTemplate {
                                        /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
                        </td>
                </tr>
+<?php
+               $tabIndex = 8;
+               if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
+                       foreach ( $this->data['extraInput'] as $inputItem ) { ?>
+               <tr>
+                       <?php 
+                               if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
+                                       ?><td class="mw-label"><label for="<?php 
+                                       echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
+                                       $this->msgWiki( $inputItem['msg'] ) ?></label><?php
+                               } else {
+                                       ?><td><?php
+                               }
+                       ?></td>
+                       <td class="mw-input">
+                               <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
+                               echo htmlspecialchars( $inputItem['name'] ); ?>"
+                                       tabindex="<?php echo $tabIndex++; ?>"
+                                       value="<?php 
+                               if ( $inputItem['type'] != 'checkbox' ) {
+                                       echo htmlspecialchars( $inputItem['value'] );
+                               } else {
+                                       echo '1';
+                               }                                       
+                                       ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
+                                       <?php 
+                               if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
+                                       echo 'checked="checked"'; 
+                                       ?> /> <?php 
+                                       if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
+                                               ?>
+                               <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
+                                       $this->msg( $inputItem['msg'] ) ?></label><?php
+                                       }
+                               ?>
+                       </td>
+               </tr>
+<?php                          
+                               
+                       }
+               }
+?>
                <tr>
                        <td></td>
                        <td class="mw-submit">
                                <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
-                                       tabindex="8"
+                                       tabindex="<?php echo $tabIndex++; ?>"
                                        value="<?php $this->msg('createaccount') ?>" />
                                <?php if( $this->data['createemail'] ) { ?>
                                <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
-                                       tabindex="9"
+                                       tabindex="<?php echo $tabIndex++; ?>"
                                        value="<?php $this->msg('createaccountmail') ?>" />
                                <?php } ?>
                        </td>