$this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
$this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
$this->mUseAjaxSearch = $request->getCheck( 'wpUseAjaxSearch' );
+ $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' );
$this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
$this->mPosted &&
$wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
$wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
$wgUser->setOption( 'ajaxsearch', $this->mUseAjaxSearch );
+ $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest );
# Set search namespace options
foreach( $this->mSearchNs as $i => $value ) {
$this->mUnderline = $wgUser->getOption( 'underline' );
$this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' );
$this->mUseAjaxSearch = $wgUser->getBoolOption( 'ajaxsearch' );
+ $this->mDisableMWSuggest = $wgUser->getBoolOption( 'disablesuggest' );
$togs = User::getToggles();
foreach ( $togs as $tname ) {
}
function addRow($td1, $td2) {
- return "<tr><td align='right'>$td1</td><td align='left'>$td2</td></tr>";
+ return "<tr><td class='mw-label'>$td1</td><td class='mw-input'>$td2</td></tr>";
}
/**
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
- global $wgEmailConfirmToEdit, $wgAjaxSearch;
+ global $wgEmailConfirmToEdit, $wgAjaxSearch, $wgEnableMWSuggest;
$wgOut->setPageTitle( wfMsg( 'preferences' ) );
$wgOut->setArticleRelated( false );
$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>";
+ "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" .
+ $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs );
}
$enotifwatchlistpages.
$enotifusertalkpages.
$enotifminoredits.
- $moreEmail.
- $this->getToggle( 'ccmeonemails' )
+ $moreEmail
)
);
}
# Date/Time
#
- $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'datetime' ) . "</legend>\n" );
+ $wgOut->addHTML(
+ Xml::openElement( 'fieldset' ) .
+ Xml::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n"
+ );
if ($dateopts) {
- $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'dateformat' ) . "</legend>\n" );
+ $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 = wfMsgHtml( 'datedefault' );
+ $formatted = wfMsg( 'datedefault' );
} else {
- $formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) );
+ $formatted = $wgLang->timeanddate( $epoch, false, $key );
}
- ($key == $this->mDate) ? $checked = ' checked="checked"' : $checked = '';
- $wgOut->addHTML( "<div><input type='radio' name=\"wpDate\" id=\"wpDate$idCnt\" ".
- "value=\"$key\"$checked /> <label for=\"wpDate$idCnt\">$formatted</label></div>\n" );
+ $wgOut->addHTML(
+ Xml::tags( 'div', null,
+ Xml::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate )
+ ) . "\n"
+ );
$idCnt++;
}
- $wgOut->addHTML( "</fieldset>\n" );
+ $wgOut->addHTML( Xml::closeElement( 'fieldset' ) . "\n" );
}
$nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
$nowserver = $wgLang->time( $now, false );
- $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'timezonelegend' ). '</legend><table>' .
+ $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(
- '<label for="wpHourDiff">' . wfMsg( 'timezoneoffset' ) . '</label>',
- "<input type='text' name='wpHourDiff' id='wpHourDiff' value=\"" . htmlspecialchars( $this->mHourDiff ) . "\" size='6' />"
- ) . "<tr><td colspan='2'>
- <input type='button' value=\"" . wfMsg( 'guesstimezone' ) ."\"
- onclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' />
- </td></tr></table><div class='prefsectiontip'>ยน" . wfMsg( 'timezonetext' ) . "</div></fieldset>
- </fieldset>\n\n" );
+ 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::element( 'div', array( 'class' => 'prefsectiontip' ), wfMsg( 'timezonetext' ) ).
+ Xml::closeElement( 'fieldset' ) .
+ Xml::closeElement( 'fieldset' ) . "\n\n"
+ );
# Editing
#
# Search
$ajaxsearch = $wgAjaxSearch ?
$this->addRow(
- wfLabel( wfMsg( 'useajaxsearch' ), 'wpUseAjaxSearch' ),
- wfCheck( 'wpUseAjaxSearch', $this->mUseAjaxSearch, array( 'id' => 'wpUseAjaxSearch' ) )
+ Xml::label( wfMsg( 'useajaxsearch' ), 'wpUseAjaxSearch' ),
+ Xml::check( 'wpUseAjaxSearch', $this->mUseAjaxSearch, array( 'id' => 'wpUseAjaxSearch' ) )
+ ) : '';
+ $mwsuggest = $wgEnableMWSuggest ?
+ $this->addRow(
+ Xml::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ),
+ Xml::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest, array( 'id' => 'wpDisableMWSuggest' ) )
) : '';
- $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'searchresultshead' ) . '</legend><table>' .
+ $wgOut->addHTML(
+ Xml::openElement( 'fieldset' ) .
+ Xml::element( 'legend', null, wfMsg( 'searchresultshead' ) ) .
+ Xml::openElement( 'table' ) .
$ajaxsearch .
$this->addRow(
- wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ),
- wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
+ Xml::label( wfMsg( 'resultsperpage' ), 'wpSearch' ),
+ Xml::input( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
) .
$this->addRow(
- wfLabel( wfMsg( 'contextlines' ), 'wpSearchLines' ),
- wfInput( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) )
+ Xml::label( wfMsg( 'contextlines' ), 'wpSearchLines' ),
+ Xml::input( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) )
) .
$this->addRow(
- wfLabel( wfMsg( 'contextchars' ), 'wpSearchChars' ),
- wfInput( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) )
+ Xml::label( wfMsg( 'contextchars' ), 'wpSearchChars' ),
+ Xml::input( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) )
) .
- "</table><fieldset><legend>" . wfMsg( 'defaultns' ) . "</legend>$ps</fieldset></fieldset>" );
+ $mwsuggest .
+ Xml::closeElement( 'table' ) .
+ Xml::openElement( 'fieldset' ) .
+ Xml::element( 'legend', null, wfMsg( 'defaultns' ) ) .
+ $ps .
+ Xml::closeElement( 'fieldset' ) .
+ Xml::closeElement( 'fieldset' )
+ );
# Misc
#