More preferences improvements:
authorTom Gilder <tomgilder@users.mediawiki.org>
Tue, 11 Oct 2005 23:11:33 +0000 (23:11 +0000)
committerTom Gilder <tomgilder@users.mediawiki.org>
Tue, 11 Oct 2005 23:11:33 +0000 (23:11 +0000)
  * Change tabs onmousedown
  * RTL fixes
  * Properly disable email options
  * more!

RELEASE-NOTES
includes/SpecialPreferences.php
languages/Language.php
skins/common/wikibits.js
skins/monobook/main.css
skins/monobook/rtl.css

index f0461f4..7307e61 100644 (file)
@@ -143,6 +143,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * (bug 3163) Full translation of LanguageBr
 * (bug 3617) Update for portuguese language (pt)
 * Namespaces hacks on LanguagePl
+* New preferences design and reorganisation
 
 
 === Caveats ===
index e0fe296..d00265b 100644 (file)
@@ -51,7 +51,7 @@ class PreferencesForm {
                $this->mDate = $request->getVal( 'wpDate' );
                $this->mUserEmail = $request->getVal( 'wpUserEmail' );
                $this->mRealName = $wgAllowRealName ? $request->getVal( 'wpRealName' ) : '';
-               $this->mEmailFlag = $request->getCheck( 'wpEmailFlag' ) ? 1 : 0;
+               $this->mEmailFlag = $request->getCheck( 'wpEmailFlag' ) ? 0 : 1;
                $this->mNick = $request->getVal( 'wpNick' );
                $this->mUserLanguage = $request->getVal( 'wpUserLanguage' );
                $this->mUserVariant = $request->getVal( 'wpUserVariant' );
@@ -385,15 +385,16 @@ class PreferencesForm {
        }
 
 
-       function getToggle( $tname, $trailer = false) {
+       function getToggle( $tname, $trailer = false, $disabled = false ) {
                global $wgUser, $wgLang;
 
                $this->mUsedToggles[$tname] = true;
                $ttext = $wgLang->getUserToggle( $tname );
 
                $checked = $wgUser->getOption( $tname ) == 1 ? ' checked="checked"' : '';
+               $disabled = $disabled ? ' disabled="disabled"' : '';
                $trailer = $trailer ? $trailer : '';
-               return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked />" .
+               return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked$disabled />" .
                        " <span class='toggletext'><label for=\"$tname\">$ttext</label>$trailer</span></div>\n";
        }
 
@@ -463,13 +464,16 @@ class PreferencesForm {
                $this->mUserEmail = htmlspecialchars( $this->mUserEmail );
                $this->mRealName = htmlspecialchars( $this->mRealName );
                $this->mNick = htmlspecialchars( $this->mNick );
-               if ( $this->mEmailFlag ) { $emfc = 'checked="checked"'; }
+               if ( !$this->mEmailFlag ) { $emfc = 'checked="checked"'; }
                else { $emfc = ''; }
 
+
                if ($wgEmailAuthentication && ($this->mUserEmail != '') ) {
                        if( $wgUser->getEmailAuthenticationTimestamp() ) {
                                $emailauthenticated = wfMsg('emailauthenticated',$wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true ) ).'<br />';
+                               $disableEmailPrefs = false;
                        } else {
+                               $disableEmailPrefs = true;
                                $skin = $wgUser->getSkin();
                                $emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
                                        $skin->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Confirmemail' ),
@@ -477,6 +481,7 @@ class PreferencesForm {
                        }
                } else {
                        $emailauthenticated = '';
+                       $disableEmailPrefs = false;
                }
 
                if ($this->mUserEmail == '') {
@@ -485,10 +490,10 @@ class PreferencesForm {
 
                $ps = $this->namespacesCheckboxes();
 
-               $enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages' ) : '';
-               $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages' ) : '';
-               $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits' ) : '';
-               $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr' ) : '';
+               $enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages', false, $disableEmailPrefs ) : '';
+               $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
+               $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
+               $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
                $prefs_help_email_enotif = ( $wgEnotifWatchlist || $wgEnotifUserTalk) ? ' ' . wfMsg('prefs-help-email-enotif') : '';
                $prefs_help_realname = '';
 
@@ -520,24 +525,24 @@ class PreferencesForm {
                if ($wgAllowRealName) {
                        $wgOut->addHTML(
                                $this->addRow(
-                                       wfMsg('yourrealname'),
-                                       "<input type='text' name='wpRealName' value=\"{$this->mRealName}\" size='25' />"
+                                       '<label for="wpRealName">' . wfMsg('yourrealname') . '</label>',
+                                       "<input type='text' name='wpRealName' id='wpRealName' value=\"{$this->mRealName}\" size='25' />"
                                )
                        );
                }
                if ($wgEnableEmail) {
                        $wgOut->addHTML(
                                $this->addRow(
-                                       wfMsg( 'youremail' ),
-                                       "<input type='text' name='wpUserEmail' value=\"{$this->mUserEmail}\" size='25' />"
+                                       '<label for="wpUserEmail">' . wfMsg( 'youremail' ) . '</label>',
+                                       "<input type='text' name='wpUserEmail' id='wpUserEmail' value=\"{$this->mUserEmail}\" size='25' />"
                                )
                        );
                }
 
                $wgOut->addHTML(
                        $this->addRow(
-                               wfMsg( 'yournick' ),
-                               "<input type='text' name='wpNick' value=\"{$this->mNick}\" size='25' />"
+                               '<label for="wpNick">' . wfMsg( 'yournick' ) . '</label>',
+                               "<input type='text' name='wpNick' id='wpNick' value=\"{$this->mNick}\" size='25' />"
                        ) .
                        # FIXME: The <input> part should be where the &nbsp; is, getToggle() needs
                        # to be changed to out return its output in two parts. -ævar
@@ -564,7 +569,12 @@ class PreferencesForm {
                                $selbox .= "<option value=\"$code\"$sel>$code - $name</option>\n";
                        }
                }
-               $wgOut->addHTML( $this->addRow( wfMsg('yourlanguage'), "<select name='wpUserLanguage'>$selbox</select>" ));
+               $wgOut->addHTML(
+                       $this->addRow(
+                               '<label for="wpUserLanguage">' . wfMsg('yourlanguage') . '</label>',
+                               "<select name='wpUserLanguage' id='wpUserLanguage'>$selbox</select>"
+                       )
+               );
 
                /* see if there are multiple language variants to choose from*/
                if(!$wgDisableLangConversion) {
@@ -614,11 +624,12 @@ class PreferencesForm {
                                 $enotifwatchlistpages.
                                 $enotifusertalkpages.
                                 $enotifminoredits );
-                        if ($wgEnableUserEmail) {
-                               $emf = wfMsg( 'emailflag' );
-                                $wgOut->addHTML(
-                                "<div><input type='checkbox' $emfc value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label></div>" );
-                        }
+                       if ($wgEnableUserEmail) {
+                       $emf = wfMsg( 'emailflag' );
+                               $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
+                               $wgOut->addHTML(
+                               "<div><input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label></div>" );
+                       }
 
                        $wgOut->addHTML( '</fieldset>' );
                 }
index 937b1e0..bb12d1a 100644 (file)
@@ -892,7 +892,7 @@ $2 List redirects &nbsp; Search for $3 $9",
 'timezoneoffset' => 'Offset¹',
 'servertime'   => 'Server time',
 'guesstimezone' => 'Fill in from browser',
-'emailflag'            => 'Disable email from other users',
+'emailflag'            => 'Enable email from other users',
 'defaultns'            => 'Search in these namespaces by default:',
 'default'              => 'default',
 'files'                        => 'Files',
index f324e89..8773df9 100644 (file)
@@ -141,7 +141,7 @@ function tabbedprefs() {
         if(i == 0) li.className = 'selected';
         var a =  document.createElement('a');
         a.href = '#' + sections[i].secid;
-        a.onclick = uncoversection;
+        a.onmousedown = a.onclick = uncoversection;
         a.appendChild(document.createTextNode(sections[i].text));
         a.secid = sections[i].secid;
         li.appendChild(a);
index 98220bf..ffabcd0 100644 (file)
@@ -914,6 +914,7 @@ head:first-child+body #footer li { white-space: nowrap; }
     margin: 0;
     padding: 0;
     width: 100%;
+    clear: both;
 }
 #preftoc li {
     margin: 1px -2px 1px 2px;
@@ -957,12 +958,12 @@ head:first-child+body #footer li { white-space: nowrap; }
 }
 #prefcontrol {
     padding-top: 2em;
-    clear: left;
+    clear: both;
 }
 #preferences {
     margin: 0;
     border: 1px solid #aaa;
-    clear: left;
+    clear: both;
     padding: 1.5em;
     background-color: #F9F9F9;
 }
@@ -990,10 +991,12 @@ div.prefsectiontip {
     margin-top: 0;
     background-color: #FFC1C1;
     padding: .2em .7em;
-    clear: left;
+    clear: both;
 }
 .btnSavePrefs {
     font-weight: bold;
+    padding-left: .3em;
+    padding-right: .3em;
 }
 
 .preferences-save-success {
index fbd1976..92bbf3e 100644 (file)
@@ -190,16 +190,21 @@ li#pt-login {
 * html #column-one { right: 0; }
 
 /* js pref toc */
-#preftoc { float: right; }
-/* workaround for moz bug, displayed bullets on left side */
-#preftoc li { list-style: none; }
-#prefcontrol { float: right; }
-fieldset.prefsection,
-fieldset.operaprefsection { 
-    margin-left: 0 !important;
-    margin-right: 15em;
+
+#preftoc {
+    margin-right: 1em;
+}
+
+.preferences-save-success, #preftoc li, .prefsection fieldset {
+    float: right;
 }
 
+.prefsection {
+    padding-right: 2em;
+}
+
+/* workaround for moz bug, displayed bullets on left side */
+
 #toc ul {
     text-align: right;
 }