- /* see if there are multiple language variants to choose from*/
- if(!$wgDisableLangConversion) {
- $variants = $wgContLang->getVariants();
- $variantArray = array();
-
- $languages = Language::getLanguageNames( true );
- foreach($variants as $v) {
- $v = str_replace( '_', '-', strtolower($v));
- if( array_key_exists( $v, $languages ) ) {
- // If it doesn't have a name, we'll pretend it doesn't exist
- $variantArray[$v] = $languages[$v];
- }
- }
-
- $options = "\n";
- foreach( $variantArray as $code => $name ) {
- $selected = ($code == $this->mUserVariant);
- $options .= Xml::option( "$code - $name", $code, $selected ) . "\n";
- }
-
- if(count($variantArray) > 1) {
- $wgOut->addHtml(
- $this->tableRow(
- Xml::label( wfMsg( 'yourvariant' ), 'wpUserVariant' ),
- Xml::tags( 'select',
- array( 'name' => 'wpUserVariant', 'id' => 'wpUserVariant' ),
- $options
- )
- )
- );
- }
-
- if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
- $wgOut->addHtml(
- Xml::tags( 'tr', null,
- Xml::tags( 'td', array( 'colspan' => '2' ),
- $this->getToggle( "noconvertlink" )
- )
- )
- );
- }
- }
-
- # Password
- if( $wgAuth->allowPasswordChange() ) {
- $wgOut->addHTML(
- $this->tableRow( Xml::element( 'h2', null, wfMsg( 'changepassword' ) ) ) .
- $this->tableRow(
- Xml::label( wfMsg( 'oldpassword' ), 'wpOldpass' ),
- Xml::password( 'wpOldpass', 25, $this->mOldpass, array( 'id' => 'wpOldpass' ) )
- ) .
- $this->tableRow(
- Xml::label( wfMsg( 'newpassword' ), 'wpNewpass' ),
- Xml::password( 'wpNewpass', 25, $this->mNewpass, array( 'id' => 'wpNewpass' ) )
- ) .
- $this->tableRow(
- Xml::label( wfMsg( 'retypenew' ), 'wpRetypePass' ),
- Xml::password( 'wpRetypePass', 25, $this->mRetypePass, array( 'id' => 'wpRetypePass' ) )
- )
- );
- if( $wgCookieExpiration > 0 ){
- $wgOut->addHTML(
- Xml::tags( 'tr', null,
- Xml::tags( 'td', array( 'colspan' => '2' ),
- $this->getToggle( "rememberpassword" )
- )
- )
- );
- } else {
- $this->mUsedToggles['rememberpassword'] = true;
- }
- }
-
- # <FIXME>
- # Enotif
- if ( $wgEnableEmail ) {
-
- $moreEmail = '';
- if ($wgEnableUserEmail) {
- // fixme -- the "allowemail" pseudotoggle is a hacked-together
- // inversion for the "disableemail" preference.
- $emf = wfMsg( 'allowemail' );
- $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
- $moreEmail =
- "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" .
- $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs );
- }
-
-
- $wgOut->addHTML(
- $this->tableRow( Xml::element( 'h2', null, wfMsg( 'email' ) ) ) .
- $this->tableRow(
- $emailauthenticated.
- $enotifrevealaddr.
- $enotifwatchlistpages.
- $enotifusertalkpages.
- $enotifminoredits.
- $moreEmail
- )
- );
- }
- # </FIXME>
-
- $wgOut->addHTML(
- Xml::closeElement( 'table' ) .
- Xml::closeElement( 'fieldset' )
- );
-
-
- # Quickbar
- #
- if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
- $wgOut->addHtml( "<fieldset>\n<legend>" . wfMsg( 'qbsettings' ) . "</legend>\n" );
- for ( $i = 0; $i < count( $qbs ); ++$i ) {
- if ( $i == $this->mQuickbar ) { $checked = ' checked="checked"'; }
- else { $checked = ""; }
- $wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
- }
- $wgOut->addHtml( "</fieldset>\n\n" );
- } else {
- # Need to output a hidden option even if the relevant skin is not in use,
- # otherwise the preference will get reset to 0 on submit
- $wgOut->addHtml( wfHidden( 'wpQuickbar', $this->mQuickbar ) );
- }
-
- # Skin
- #
- $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
- $mptitle = Title::newMainPage();
- $previewtext = wfMsg('skin-preview');
- # Only show members of Skin::getSkinNames() rather than
- # $skinNames (skins is all skin names from Language.php)
- $validSkinNames = Skin::getUsableSkins();
- # Sort by UI skin name. First though need to update validSkinNames as sometimes
- # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
- foreach ($validSkinNames as $skinkey => & $skinname ) {
- if ( isset( $skinNames[$skinkey] ) ) {
- $skinname = $skinNames[$skinkey];
- }
- }
- asort($validSkinNames);
- foreach ($validSkinNames as $skinkey => $sn ) {
- $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
-
- $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
- $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
- if( $skinkey == $wgDefaultSkin )
- $sn .= ' (' . wfMsg( 'default' ) . ')';
- $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
- }
- $wgOut->addHTML( "</fieldset>\n\n" );
-
- # Math
- #
- global $wgUseTeX;
- if( $wgUseTeX ) {
- $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
- foreach ( $mathopts as $k => $v ) {
- $checked = ($k == $this->mMath);
- $wgOut->addHTML(
- Xml::openElement( 'div' ) .
- Xml::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
- Xml::closeElement( 'div' ) . "\n"
- );
- }
- $wgOut->addHTML( "</fieldset>\n\n" );
- }
-
- # Files
- #
- $wgOut->addHTML(
- "<fieldset>\n" . Xml::element( 'legend', null, wfMsg( 'files' ) ) . "\n"
- );
-
- $imageLimitOptions = null;
- foreach ( $wgImageLimits as $index => $limits ) {
- $selected = ($index == $this->mImageSize);
- $imageLimitOptions .= Xml::option( "{$limits[0]}×{$limits[1]}" .
- wfMsg('unit-pixel'), $index, $selected );
- }
-
- $imageSizeId = 'wpImageSize';
- $wgOut->addHTML(
- "<div>" . Xml::label( wfMsg('imagemaxsize'), $imageSizeId ) . " " .
- Xml::openElement( 'select', array( 'name' => $imageSizeId, 'id' => $imageSizeId ) ) .
- $imageLimitOptions .
- Xml::closeElement( 'select' ) . "</div>\n"
- );
-
- $imageThumbOptions = null;
- foreach ( $wgThumbLimits as $index => $size ) {
- $selected = ($index == $this->mThumbSize);
- $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index,
- $selected);
- }
-
- $thumbSizeId = 'wpThumbSize';
- $wgOut->addHTML(
- "<div>" . Xml::label( wfMsg('thumbsize'), $thumbSizeId ) . " " .
- Xml::openElement( 'select', array( 'name' => $thumbSizeId, 'id' => $thumbSizeId ) ) .
- $imageThumbOptions .
- Xml::closeElement( 'select' ) . "</div>\n"
- );
-
- $wgOut->addHTML( "</fieldset>\n\n" );
-
- # Date format
- #
- # Date/Time
- #
-
- $wgOut->addHTML(
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n"
- );
-
- if ($dateopts) {
- $wgOut->addHTML(
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'dateformat' ) ) . "\n"
- );
- $idCnt = 0;
- $epoch = '20010115161234'; # Wikipedia day
- foreach( $dateopts as $key ) {
- if( $key == 'default' ) {
- $formatted = wfMsg( 'datedefault' );
- } else {
- $formatted = $wgLang->timeanddate( $epoch, false, $key );
- }
- $wgOut->addHTML(
- Xml::tags( 'div', null,
- Xml::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate )
- ) . "\n"
- );
- $idCnt++;
- }
- $wgOut->addHTML( Xml::closeElement( 'fieldset' ) . "\n" );
- }
-
- $nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
- $nowserver = $wgLang->time( $now, false );
-
- $wgOut->addHTML(
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'timezonelegend' ) ) .
- Xml::openElement( 'table' ) .
- $this->addRow( wfMsg( 'servertime' ), $nowserver ) .
- $this->addRow( wfMsg( 'localtime' ), $nowlocal ) .
- $this->addRow(
- Xml::label( wfMsg( 'timezoneoffset' ), 'wpHourDiff' ),
- Xml::input( 'wpHourDiff', 6, $this->mHourDiff, array( 'id' => 'wpHourDiff' ) ) ) .
- "<tr>
- <td></td>
- <td class='mw-submit'>" .
- Xml::element( 'input',
- array( 'type' => 'button',
- 'value' => wfMsg( 'guesstimezone' ),
- 'onclick' => 'javascript:guessTimezone()',
- 'id' => 'guesstimezonebutton',
- 'style' => 'display:none;' ) ) .
- "</td>
- </tr>" .
- Xml::closeElement( 'table' ) .
- Xml::tags( 'div', array( 'class' => 'prefsectiontip' ), wfMsgExt( 'timezonetext', 'parseinline' ) ).
- Xml::closeElement( 'fieldset' ) .
- Xml::closeElement( 'fieldset' ) . "\n\n"
- );
-
- # Editing
- #
- global $wgLivePreview;
- $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
- <div>' .
- wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
- ' ' .
- wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
- "</div>" .
- $this->getToggles( array(
- 'editsection',
- 'editsectiononrightclick',
- 'editondblclick',
- 'editwidth',
- 'showtoolbar',
- 'previewonfirst',
- 'previewontop',
- 'minordefault',
- 'externaleditor',
- 'externaldiff',
- $wgLivePreview ? 'uselivepreview' : false,
- 'forceeditsummary',
- ) ) . '</fieldset>'
- );
-
- # Recent changes
- $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'prefs-rc' ) . '</legend>' );
-
- $rc = '<table><tr>';
- $rc .= '<td>' . Xml::label( wfMsg( 'recentchangesdays' ), 'wpRecentDays' ) . '</td>';
- $rc .= '<td>' . Xml::input( 'wpRecentDays', 3, $this->mRecentDays, array( 'id' => 'wpRecentDays' ) ) . '</td>';
- $rc .= '</tr><tr>';
- $rc .= '<td>' . Xml::label( wfMsg( 'recentchangescount' ), 'wpRecent' ) . '</td>';
- $rc .= '<td>' . Xml::input( 'wpRecent', 3, $this->mRecent, array( 'id' => 'wpRecent' ) ) . '</td>';
- $rc .= '</tr></table>';
- $wgOut->addHtml( $rc );
-
- $wgOut->addHtml( '<br />' );
-
- $toggles[] = 'hideminor';
- if( $wgRCShowWatchingUsers )
- $toggles[] = 'shownumberswatching';
- $toggles[] = 'usenewrc';
- $wgOut->addHtml( $this->getToggles( $toggles ) );
-
- $wgOut->addHtml( '</fieldset>' );
-
- # Watchlist
- $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'prefs-watchlist' ) . '</legend>' );
-
- $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-days' ), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays ) );
- $wgOut->addHtml( '<br /><br />' );
-
- $wgOut->addHtml( $this->getToggle( 'extendwatchlist' ) );
- $wgOut->addHtml( wfInputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) );
- $wgOut->addHtml( '<br /><br />' );
-
- $wgOut->addHtml( $this->getToggles( array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown', 'watchlisthideanons', 'watchlisthideliu' ) ) );
-
- 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>' );
-
- # Search
- $mwsuggest = $wgEnableMWSuggest ?
- $this->addRow(
- Xml::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ),
- Xml::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest, array( 'id' => 'wpDisableMWSuggest' ) )
- ) : '';
- $wgOut->addHTML(
- // Elements for the search tab itself
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'searchresultshead' ) ) .
- // Elements for the search options in the search tab
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'prefs-searchoptions' ) ) .
- Xml::openElement( 'table' ) .
- $this->addRow(
- Xml::label( wfMsg( 'resultsperpage' ), 'wpSearch' ),
- Xml::input( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
- ) .
- $this->addRow(
- Xml::label( wfMsg( 'contextlines' ), 'wpSearchLines' ),
- Xml::input( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) )
- ) .
- $this->addRow(
- Xml::label( wfMsg( 'contextchars' ), 'wpSearchChars' ),
- Xml::input( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) )
- ) .
- $mwsuggest .
- Xml::closeElement( 'table' ) .
- Xml::closeElement( 'fieldset' ) .
- // Elements for the namespace options in the search tab
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'prefs-namespaces' ) ) .
- wfMsgExt( 'defaultns', array( 'parse' ) ) .
- $ps .
- Xml::closeElement( 'fieldset' ) .
- // End of the search tab
- Xml::closeElement( 'fieldset' )
- );
-
- # Misc
- #
- $wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
- $wgOut->addHtml( '<label for="wpStubs">' . wfMsg( 'stub-threshold' ) . '</label> ' );
- $wgOut->addHtml( Xml::input( 'wpStubs', 6, $this->mStubs, array( 'id' => 'wpStubs' ) ) );
- $msgUnderline = htmlspecialchars( wfMsg ( 'tog-underline' ) );
- $msgUnderlinenever = htmlspecialchars( wfMsg ( 'underline-never' ) );
- $msgUnderlinealways = htmlspecialchars( wfMsg ( 'underline-always' ) );
- $msgUnderlinedefault = htmlspecialchars( wfMsg ( 'underline-default' ) );
- $uopt = $wgUser->getOption("underline");
- $s0 = $uopt == 0 ? ' selected="selected"' : '';
- $s1 = $uopt == 1 ? ' selected="selected"' : '';
- $s2 = $uopt == 2 ? ' selected="selected"' : '';
- $wgOut->addHTML("
-<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></p></div>");
-
- foreach ( $togs as $tname ) {
- if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
- $wgOut->addHTML( $this->getToggle( $tname ) );
- }
- }
- $wgOut->addHTML( '</fieldset>' );
-
- wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );