Typo.
[lhc/web/wiklou.git] / includes / SpecialPreferences.php
index 05318a1..d26d31e 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 /**
  * Hold things related to displaying and saving user preferences.
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
  */
 
 /**
@@ -18,8 +17,7 @@ function wfSpecialPreferences() {
 /**
  * Preferences form handling
  * This object will show the preferences form and can save it as well.
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
  */
 class PreferencesForm {
        var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
@@ -170,7 +168,7 @@ class PreferencesForm {
 
        /**
         * Used to validate the user inputed timezone before saving it as
-        * 'timeciorrection', will return '00:00' if fed bogus data.
+        * 'timecorrection', will return '00:00' if fed bogus data.
         * Note: It's not a 100% correct implementation timezone-wise, it will
         * accept stuff like '14:30',
         * @access private
@@ -530,19 +528,19 @@ class PreferencesForm {
 
                $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('prefs-personal') . "</legend>\n<table>\n");
 
-               $wgOut->addHTML(
+               $userInformationHtml =
                        $this->addRow(
                                wfMsg( 'username'),
                                $wgUser->getName()
-                       )
-               );
-
-               $wgOut->addHTML(
+                       ) .
                        $this->addRow(
                                wfMsg( 'uid' ),
                                $wgUser->getID()
-                       )
-               );
+                       );
+               
+               if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
+                       $wgOut->addHtml( $userInformationHtml );
+               }
 
 
                if ($wgAllowRealName) {
@@ -838,7 +836,7 @@ class PreferencesForm {
 
                # Editing
                #
-               global $wgLivePreview, $wgUseRCPatrol;
+               global $wgLivePreview;
                $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
                        <div>' .
                                wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
@@ -881,8 +879,18 @@ class PreferencesForm {
                $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
                $wgOut->addHtml( '<br /><br />' );
 
-               $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots' ) ) );
-               $wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchdeletion' ) ) );
+               $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
+               
+               if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) )
+                       $wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
+               foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
+                       if( $wgUser->isAllowed( $action ) )
+                               $wgOut->addHtml( $this->getToggle( $toggle ) );
+               }
+               $this->mUsedToggles['watchcreations'] = true;
+               $this->mUsedToggles['watchdefault'] = true;
+               $this->mUsedToggles['watchmoves'] = true;
+               $this->mUsedToggles['watchdeletion'] = true;
                
                $wgOut->addHtml( '</fieldset>' );
 
@@ -916,14 +924,13 @@ class PreferencesForm {
                $s1 = $uopt == 1 ? ' selected="selected"' : '';
                $s2 = $uopt == 2 ? ' selected="selected"' : '';
                $wgOut->addHTML("
-<div class='toggle'><label for='wpOpunderline'>$msgUnderline</label>
+<div class='toggle'><p><label for='wpOpunderline'>$msgUnderline</label>
 <select name='wpOpunderline' id='wpOpunderline'>
 <option value=\"0\"$s0>$msgUnderlinenever</option>
 <option value=\"1\"$s1>$msgUnderlinealways</option>
 <option value=\"2\"$s2>$msgUnderlinedefault</option>
-</select>
-</div>
-");
+</select></p></div>");
+
                foreach ( $togs as $tname ) {
                        if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
                                $wgOut->addHTML( $this->getToggle( $tname ) );
@@ -932,11 +939,11 @@ class PreferencesForm {
                $wgOut->addHTML( '</fieldset>' );
 
                $token = $wgUser->editToken();
+               $skin = $wgUser->getSkin();
                $wgOut->addHTML( "
        <div id='prefsubmit'>
        <div>
-               <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . "\" accesskey=\"".
-               wfMsgHtml('accesskey-save')."\" title=\"".wfMsgHtml('tooltip-save')."\" />
+               <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . '"'.$skin->tooltipAndAccesskey('save')." />
                <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" />
        </div>