Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5076
Preferences.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:18 PM
2014-11-21 22:18:13 (UTC+0)
Size
31 KB
Referenced Files
None
Subscribers
None
Preferences.diff
View Options
Index: Preferences.php
===================================================================
--- Preferences.php (revision 0)
+++ Preferences.php (revision 0)
@@ -0,0 +1,885 @@
+<?php
+
+class PreferencesTemplate extends QuickTemplate {
+ public function execute( &$form ) {
+ // Load the OutputPage object.
+ $wgOut = $this->data[ "References-OutputPage" ];
+
+ // The array does not need to be preset, this is just so developers
+ // can see exactly how the array turns out.
+ $html = array(
+ "header" => "",
+ "form" => "",
+ "userdata" => array(
+ "header" => "",
+ "userinformationpanel" => "",
+ "name-and-email" => "",
+ "nickname-language-password" => "",
+ "email" => "",
+ "footer" => "" ),
+ "quickbar" => "",
+ "skin" => "",
+ "math" => "",
+ "files" => "",
+ "date" => "",
+ "editing" => "",
+ "recentchanges" => "",
+ "watchlist" => "",
+ "search" => "",
+ "misc" => "",
+ "submit" => "",
+ "footer" => ""
+ );
+
+ // Set page names, disallow use JS, etc.
+ $this->setHeaders();
+
+ // Begin running internal functions, and save output to appropriate array key.
+ $html[ "header" ] = $this->Header();
+ $html[ "form" ] = $this->Form();
+
+ $html[ "userdata" ][ "header" ] = $this->UserData_Header();
+ $html[ "userdata" ][ "userinformationpanel" ] = $this->UserData_UserInformationPanel();
+ $html[ "userdata" ][ "name-and-email" ] = $this->UserData_NameandEmail();
+ $html[ "userdata" ][ "nickname-language-password" ] = $this->UserData_NicknameLanguagePassword();
+ $html[ "userdata" ][ "email" ] = $this->UserData_Email();
+ $html[ "userdata" ][ "footer" ] = $this->UserData_Footer();
+
+ $html[ "quickbar" ] = $this->Quickbar();
+ $html[ "skin" ] = $this->Skin();
+ $html[ "math" ] = $this->Math();
+ $html[ "files" ] = $this->Files();
+ $html[ "date" ] = $this->Date();
+ $html[ "editing" ] = $this->Editing();
+ $html[ "recentchanges" ] = $this->RecentChanges();
+ $html[ "watchlist" ] = $this->Watchlist();
+ $html[ "search" ] = $this->Search();
+ $html[ "misc" ] = $this->Misc();
+
+ $html[ "submit" ] = $this->SubmitButton();
+ $html[ "footer" ] = $this->Footer();
+
+ // Add any last minute extra inputs.
+ $html = $this->ExtraInputs( $html );
+
+ // Run hooks, passing whole form as an array, as well as passing the PreferencesForm object.
+ // Note: To add inputs, it is easier to just use PreferencesTemplate::addExtraInput() instead of changing
+ // $html itself.
+ if( !wfRunHooks( "PreferencesForm", array( &$form, &$this, &$html ) ) )
+ return false;
+
+ // Recursively implode and do an XML/UTF checkup before outputting.
+ $output = $this->RecursiveImplode( $html, "\n" );
+ if( !Xml::isWellFormed( $output ) )
+ return false;
+ $output = UtfNormal::cleanUp( $output );
+
+ $wgOut->addHTML( $output );
+ return true;
+ }
+
+ // Overloading set function to add some security.
+ // This way, all of the data keys will be put through htmlspecialchars().
+ // Just in case, though, the third parameter can be set to true to override this.
+ public function set( $name, $value, $hashtml ) {
+ if( $hashtml )
+ $this->data[ $name ] = $value;
+ elseif( is_array( $value ) ) {
+ foreach( $value as &$arrayvalue )
+ $arrayvalue = htmlspecialchars( $arrayvalue );
+ $this->data[ $name ] = $value;
+ } else {
+ $this->data[ $name ] = htmlspecialchars( $arrayvalue );
+ }
+ }
+
+ public function addExtraInput( $section, $type = "input", $label, $id, $name, $value = false, $size = false, $checked = false, $attribs = array() ) {
+ $this->data[ "extra-inputs" ][] = array(
+ "section" => $section,
+ "type" => $type,
+ "label" => $label,
+ "id" => $id,
+ "name" => $name,
+ "value" => $value,
+ "size" => $size,
+ "checked" => $checked,
+ "attribs" => $attribs );
+ }
+
+ private function RecursiveImplode( $array, $glue, $level = 0 ) {
+ if( !is_array( $array ) ) return $array;
+ foreach( $array as $key => &$value ) {
+ if( is_array( $value ) )
+ $value = $this->RecursiveImplode( $value, $glue, $level++ );
+ }
+ if( is_array( $glue ) )
+ return implode( $glue[ $level ], $array );
+ return implode( $glue, $array );
+ }
+
+ private function setHeaders() {
+ $wgOut =& $this->data[ 'References-OutputPage' ];
+
+ $wgOut->setPageTitle( $this->data[ 'page-title' ] );
+ $wgOut->setArticleRelated( false );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
+ $wgOut->addScriptFile( $this->data[ 'script-file' ] );
+ $wgOut->disallowUserJs();
+
+ return true;
+ }
+
+ private function Header() {
+ $html = "";
+
+ // Check if status is set. Then check if a status message is set.
+ if( array_key_exists( "status", $this->data ) && $status = $this->data[ 'status' ] ) {
+ if( array_key_exists( "status-$status", $this->data ) ) {
+ $html .= $this->data[ "status-$status" ];
+ } else {
+ throw new MWException( "Invalid status passed to PreferencesTemplate::execute." );
+ }
+ }
+
+ return $html;
+ }
+
+ private function Form() {
+ $html = Xml::openElement( 'form', array(
+ 'action' => $this->data[ "form-url" ],
+ 'method' => 'post',
+ 'id' => $this->data[ "form-id" ],
+ ) ) .
+ Xml::openElement( 'div', array( 'id' => $this->data[ "form-maindiv-id" ] ) );
+
+ return $html;
+ }
+
+ private function UserData_Header() {
+ $html =
+ Xml::fieldset( $this->data[ 'messages-userdata' ] ) .
+ Xml::openElement( 'table' ) .
+ $this->tableRow( Xml::element( 'h2', null, $this->data[ 'messages-userdata-header' ] ) );
+
+ return $html;
+ }
+
+ private function UserData_UserInformationPanel() {
+ $wgUser =& $this->data[ 'References-User' ];
+
+ $EffectiveUserGroups = $wgUser->getEffectiveGroups();
+ foreach( $EffectiveUserGroups as $group ) {
+ if( $group == "*" ) { continue; }
+ $temphtml[] = call_user_func( $this->data[ 'usereffectivegroups-function' ], $group );
+ } asort( $temphtml );
+
+ $html =
+ // Username and User ID
+ $this->tableRow( $this->data[ 'messages-username' ], htmlspecialchars( $wgUser->getName() ) ) .
+ $this->tableRow( $this->data[ 'messages-userid' ], htmlspecialchars( $wgUser->getId() ) ) .
+
+ // Effective User Groups
+ $this->tableRow(
+ wfMsgExt(
+ $this->data[ 'messages-!effectivegroups' ],
+ array( 'parseinline' ),
+ count( $temphtml ) ),
+ implode(
+ $this->data[ 'messages-commaseparator' ],
+ $temphtml ) . "<br />" . $this->data[ 'userinformationpanel-tool-links' ] ) .
+
+ // Edit Count
+ $this->tableRow(
+ $this->data[ 'messages-editcount' ],
+ $this->data[ 'userinformationpanel-editcount' ]
+ );
+
+ return $html;
+ }
+
+ private function UserData_NameandEmail() {
+ $html = "";
+ // Real name if allowed
+ if( isset( $this->data[ 'realname' ] ) && $this->data[ 'realname' ] ) {
+ $html .=
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-realname' ],
+ $this->data[ 'realname-fieldname' ] ),
+ Xml::input(
+ $this->data[ 'realname-fieldname' ],
+ $this->data[ 'realname-textboxsize' ],
+ $this->data[ 'realname' ],
+ array( 'id' => $this->data[ 'realname-id' ] ) ),
+ Xml::tags(
+ 'div',
+ array( 'class' => $this->data[ 'tips-class' ] ),
+ $this->data[ 'messages-realname-help' ] )
+ );
+ }
+
+ // Email if allowed
+ if( isset( $this->data[ 'email' ] ) && $this->data[ 'email' ] ) {
+ $html .=
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-email' ],
+ $this->data[ 'email-fieldname' ] ),
+ Xml::input(
+ $this->data[ 'email-fieldname' ],
+ $this->data[ 'email-textboxsize' ],
+ $this->data[ 'email' ],
+ array( 'id' => $this->data[ 'email-id' ] ) ),
+ Xml::tags(
+ 'div',
+ array( 'class' => $this->data[ 'tips-class' ] ),
+ $this->data[ 'messages-email-help' ] )
+ );
+ }
+
+ return $html;
+ }
+
+ private function UserData_NicknameLanguagePassword() {
+ $html = "";
+
+ // Detect nickname errors first.
+ if( array_key_exists( 'messages-badnickname', $this->data ) ) {
+ $InvalidSig = $this->tableRow(
+ ' ',
+ Xml::element(
+ 'span',
+ array( 'class' => $this->data[ 'error-class' ] ),
+ $this->data[ 'messages-badnickname' ] )
+ );
+ } else {
+ $InvalidSig = "";
+ }
+
+ // Adding nickname section
+ $html .=
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-nickname' ],
+ $this->data[ 'nickname-fieldname' ] ),
+ Xml::input(
+ $this->data[ 'nickname-fieldname' ],
+ $this->data[ 'nickname-textboxsize' ],
+ $this->data[ 'nickname' ],
+ array(
+ "id" => $this->data[ 'nickname-id' ],
+ "maxlength" => $this->data[ 'nickname-maxlength' ]
+ )
+ )
+ ) .
+
+ $InvalidSig .
+ $this->tableRow(
+ ' ',
+ $this->getToggle( $this->data[ 'toggles-fancysig' ] )
+ );
+
+ // Adding language section
+ $html .=
+ $this->tableRow(
+ $this->data[ 'language-label' ],
+ $this->data[ 'language-select' ]
+ );
+ if( array_key_exists( "language-allowconversion", $this->data ) && $this->data[ 'language-allowconversion' ] ) {
+ $LanguageVariants = "\n";
+ foreach( $this->data[ 'language-variants' ] as $code => $name ) {
+ $LanguageVariants .=
+ Xml::option(
+ "$code - $name",
+ $code,
+ ($code == $this->data[ 'language-uservariant' ] )
+ ) . "\n";
+ }
+
+ if( count( $this->data[ 'language-variants' ] ) > 1 ) {
+ $html .=
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-languagevariant' ],
+ $this->data[ 'language-variant-fieldname' ] ),
+ Xml::tags(
+ 'select',
+ array(
+ 'name' => $this->data[ 'language-variant-fieldname' ],
+ 'id' => $this->data[ 'language-variant-id' ] ),
+ $LanguageVariants
+ )
+ );
+ }
+ }
+
+ // Adding password section
+ if( array_key_exists( 'password', $this->data ) && $this->data[ 'password' ] ) {
+ $html .=
+ // Heading
+ $this->tableRow(
+ Xml::element(
+ 'h2',
+ NULL,
+ $this->data[ 'messages-changepassword' ]
+ ) ) .
+
+ // Old password
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-oldpassword' ],
+ $this->data[ 'password-old-fieldname' ] ),
+ Xml::password(
+ $this->data[ 'password-old-fieldname' ],
+ $this->data[ 'password-old-textboxsize' ],
+ $this->data[ 'password-old' ],
+ array( 'id' => $this->data[ 'password-old-id' ] ) )
+ ) .
+
+ // New password
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-newpassword' ],
+ $this->data[ 'password-new-fieldname' ] ),
+ Xml::password(
+ $this->data[ 'password-new-fieldname' ],
+ $this->data[ 'password-new-textboxsize' ],
+ $this->data[ 'password-new' ],
+ array( 'id' => $this->data[ 'password-new-id' ] ) )
+ ) .
+
+ // Retype password
+ $this->tableRow(
+ Xml::label(
+ $this->data[ 'messages-retypepassword' ],
+ $this->data[ 'password-retype-fieldname' ] ),
+ Xml::password(
+ $this->data[ 'password-retype-fieldname' ],
+ $this->data[ 'password-retype-textboxsize' ],
+ $this->data[ 'password-retype' ],
+ array( 'id' => $this->data[ 'password-retype-id' ] ) )
+ ) .
+
+ // Remember password
+ Xml::tags(
+ 'tr',
+ NULL,
+ Xml::tags(
+ 'td',
+ array( 'colspan' => '2' ),
+ $this->getToggle( $this->data[ 'toggles-rememberpassword' ] )
+ )
+ );
+ }
+
+ return $html;
+ }
+
+ private function UserData_Email() {
+ if( array_key_exists( 'email', $this->data ) || $this->data[ 'email' ] ) {
+ $MoreEmail = "";
+ if( array_key_exists( 'email-section-user', $this->data ) && $this->data[ 'email-section-user' ] ) {
+ // Should it be checked
+ if( !array_key_exists( 'email-section-flag1-checked', $this->data ) )
+ $this->data[ 'email-section-flag1-checked' ] = false;
+
+ // This array needs to be contructed beforehand, because if the
+ // checkbox is not disabled, the attribute cannot be set at all
+ $temphtml = array();
+ $temphtml[ 'value' ] = "1";
+ if( !array_key_exists( 'email-section-disabled', $this->data ) && $this->data[ 'email-section-disabled' ] )
+ $temphtml[ 'disabled' ] = "disabled";
+
+ $MoreEmail .=
+ Xml::check(
+ $this->data[ 'email-section-flag1-fieldname' ],
+ $this->data[ 'email-section-flag1-checked' ],
+ $temphtml
+ ) .
+ Xml::label(
+ $this->data[ 'messages-allowemail' ],
+ $this->data[ 'email-section-flag1-fieldname' ] ) .
+ $this->getToggle(
+ $this->data[ 'toggles-ccmeonemails' ],
+ '',
+ ( array_key_exists( 'email-section-disabled', $this->data ) ? (bool)$this->data[ 'email-section-disabled' ] : false )
+ );
+ }
+
+ $html = // Heading
+ $this->tableRow(
+ Xml::element(
+ 'h2',
+ NULL,
+ $this->data[ 'messages-email-section' ]
+ ) );
+
+ $Disabled = array_key_exists( 'email-section-disabled', $this->data ) ? (bool)$this->data[ 'email-section-disabled' ] : false;
+
+ // Actual Section
+ $html .= $this->tableRow(
+ $this->data[ 'messages-emailauthenticated' ] .
+ ( $this->data[ 'email-section-revealaddress' ] ?
+ $this->getToggle(
+ $this->data[ 'toggles-revealaddress' ],
+ false,
+ $Disabled )
+ : "" ) .
+ ( $this->data[ 'email-section-watchlist' ] ?
+ $this->getToggle(
+ $this->data[ 'toggles-emailwatchlist' ],
+ false,
+ $Disabled )
+ : "" ) .
+ ( $this->data[ 'email-section-talk' ] ?
+ $this->getToggle(
+ $this->data[ 'toggles-emailtalk' ],
+ false,
+ $Disabled )
+ : "" ) .
+ ( $this->data[ 'email-section-minor' ] ?
+ $this->getToggle(
+ $this->data[ 'toggles-emailminor' ],
+ false,
+ $Disabled )
+ : "" ) .
+ $MoreEmail
+ );
+ }
+
+ return $html;
+ }
+
+ private function UserData_Footer() {
+ return Xml::closeElement( 'table' ) .
+ Xml::closeElement( 'fieldset' );
+ }
+
+
+ private function Quickbar() {
+ $html = "";
+ if( $this->data[ 'skin' ] == 'cologneblue' || $this->data[ 'skin' ] == 'standard' ) {
+ $html .= Xml::fieldset( $this->data[ "messages-quickbarsettings" ] );
+ for( $i = 0; $i < count( $this->data[ "quickbar-settings" ] ); $i++ ) {
+ if( $I == $this->data[ 'quickbar' ] ) { $checked = true; }
+ else { $checked = false; }
+ $html .=
+ Xml::element( 'div' ) .
+ Xml::radio(
+ $this->data[ "quickbar-fieldname" ],
+ $i,
+ $checked ) .
+ Xml::label(
+ $this->data[ "quickbar-settings" ][ $i ],
+ $this->data[ "quickbar-fieldname" ] ) .
+ Xml::closeElement( 'div' );
+ }
+ $html .= Xml::closeElement( '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.
+ $html .= wfHidden( 'wpQuickbar', $this->data[ "quickbar" ] );
+ }
+
+ return $html;
+ }
+
+ private function Skin() {
+ $html = Xml::fieldset( $this->data[ 'messages-skin' ] );
+ foreach( $this->data[ "skin-names-valid" ] as $skinkey => &$skinname ) {
+ if( isset( $this->data[ "skin-names-all" ][ $skinkey ] ) )
+ $skinname = $this->data[ "skin-names-all" ][ $skinkey ];
+ } asort( $this->data[ "skin-names-valid" ] );
+
+ foreach( $this->data[ "skin-names-valid" ] as $skinkey => $skinname ) {
+ if( $skinkey == $this->data[ "skin-names-default" ] )
+ $skinname .= $this->data[ "messages-skindefault" ];
+
+ $html .=
+ Xml::radioLabel(
+ $skinname,
+ $this->data[ "skin-fieldname" ],
+ $skinkey,
+ $this->data[ "skin-id-prefix" ] . $skinkey,
+ ( $skinkey == $this->data[ "skin" ] )
+ );
+ }
+
+ $html .= Xml::closeElement( "fieldset" ) . "\n\n";
+ return $html;
+ }
+
+ private function Math() {
+ $html = "";
+ if( $this->data[ "math" ] ) {
+ $html .= Xml::fieldset( $this->data[ "messages-math" ] );
+ foreach( $this->data[ "math-options" ] as $mathkey => $mathname ) {
+ $html .=
+ Xml::element( 'div' ) .
+ Xml::radioLabel(
+ $this->data[ "messages-math-$mathname" ],
+ $this->data[ "math-fieldname" ],
+ $mathkey,
+ $this->data[ "math-id-prefix" ] . $skinkey,
+ ( $skinkey == $this->data[ "math" ] ) ) .
+ Xml::closeElement( 'div' ) . "\n";
+ }
+
+ $html .= Xml::closeElement( 'fieldset' ) . "\n\n";
+ }
+
+ return $html;
+ }
+
+ private function Files() {
+ $html = Xml::fieldset( $this->data[ "messages-files" ] );
+
+ $ImageLimitOptions = NULL;
+ foreach( $this->data[ "files-image-limits" ] as $filekey => $filevalue )
+ $ImageLimitOptions .=
+ Xml::option(
+ "{$filevalue[0]}x{$limits[1]}" . $this->data[ "messages-pixel" ],
+ $filekey,
+ $filekey == $this->data[ "files-image-size" ] );
+
+ $html .=
+ Xml::element( 'div' ) .
+ Xml::label(
+ $this->data[ "messages-image-maxsize" ],
+ $this->data[ "files-image-id" ] ) . " " .
+ Xml::element(
+ 'select',
+ array(
+ 'name' => $this->data[ "files-image-id" ],
+ 'id' => $this->data[ "files-image-id" ] )
+ ) . $ImageLimitOptions .
+ Xml::closeElement( 'div' ) . "\n";
+
+ $ImageThumbOptions = NULL;
+ foreach( $this->data[ "files-thumb-limits" ] as $fileskey => $filesvalue )
+ $ImageThumbOptions .=
+ Xml::option(
+ $filesvalue . $this->data[ "messages-pixel" ],
+ $fileskey,
+ $fileskey == $this->data[ "files-thumb-size" ]
+ );
+
+ $html .=
+ Xml::element( "div" ) .
+ Xml::label(
+ $this->data[ "messages-thumbsize" ],
+ $this->data[ "files-thumb-id" ] ) . " " .
+ Xml::element(
+ 'select',
+ array(
+ 'name' => $this->data[ "files-thumb-id" ],
+ 'id' => $this->data[ "files-thumb-id" ]
+ ) ) . $ImageThumbOptions .
+ Xml::closeElement( 'select' ) .
+ Xml::closeElement( 'div' ) . "\n" .
+ Xml::closeElement( 'fieldset' ) . "\n\n";
+
+ return $html;
+ }
+
+ private function Date() {
+ $wgLang =& $this->data[ 'References-Lang' ];
+ $html = "";
+
+ // Date Options
+ if( $this->data[ "date-options" ] ) {
+ $html .= Xml::fieldset( $this->data[ "messages-datetime" ] );
+
+ $IdCount = 0;
+ $Epoch = '20010115161234'; # Wikipedia day
+ foreach( $this->data[ "date-options" ] as $value ) {
+ $html .=
+ Xml::tags(
+ 'div',
+ NULL,
+ Xml::radioLabel(
+ ( $key == "default" ? $this->data[ "messages-defaultdate" ] : $wgLang->timeanddate( $epoch, false, $value ) ),
+ $this->data[ "date-fieldname" ],
+ $value,
+ $this->data[ "date-id-prefix" ] . $IdCount,
+ $value == $this->data[ "date" ] ) . "\n"
+ );
+ $IdCount++;
+ }
+
+ $html .= Xml::closeElement( 'fieldset' ) . "\n";
+ }
+
+ // Time
+ $ServerTime = $wgLang->time( $now = wfTimestampNow(), true );
+ $LocalTime = $wgLang->time( $now, false );
+ $html .=
+ Xml::openElement( 'fieldset' ) .
+ Xml::element(
+ 'legend',
+ NULL,
+ $this->data[ "messages-timezonelegend" ] ) .
+ Xml::openElement( 'table' ) .
+ $this->addRow(
+ $this->data[ "messages-servertime" ],
+ $ServerTime ) .
+ $this->addRow(
+ $this->data[ "messages-localtime" ],
+ $LocalTime ) .
+ $this->addRow(
+ Xml::label(
+ $this->data[ "messages-timezoneoffset" ],
+ $this->data[ "date-hourdiff-fieldname" ] ),
+ Xml::input(
+ $this->data[ "date-hourdiff-fieldname" ],
+ $this->data[ "date-hourdiff-textboxsize" ],
+ $this->data[ "date-hourdiff" ],
+ array( "id" => $this->data[ "date-hourdiff-fieldname" ] ) ) ) .
+ Xml::openElement( 'tr' ) .
+ Xml::element( 'td', NULL, '', false ) .
+ Xml::openElement( 'td', array( "class" => $this->data[ "date-submit-class" ] ) ) .
+ Xml::element(
+ 'input',
+ array(
+ 'type' => 'button',
+ 'value' => $this->data[ "messages-timezoneguess" ],
+ 'onclick' => $this->data[ "date-timezone-javascript" ],
+ 'id' => $this->data[ "date-timezone-id" ],
+ 'style' => $this->data[ "date-timezone-style" ]
+ )
+ ) .
+ Xml::closeElement( 'td' ) .
+ Xml::closeElement( 'tr' ) .
+ Xml::closeElement( 'table' ) .
+ Xml::tags(
+ 'div',
+ array( 'class' => $this->data[ "tips-class" ] ),
+ $this->data[ "messages-timezonetext" ] ) .
+ Xml::closeElement( 'fieldset' ) .
+ Xml::closeElement( 'fieldset' ) . "\n\n";
+
+ return $html;
+ }
+
+ private function Editing() {
+ return Xml::fieldset(
+ $this->data[ "messages-textboxsize" ],
+ Xml::openElement( 'div' ) .
+ $this->getToggles( array(
+ $this->data[ 'toggles-editsection' ],
+ $this->data[ 'toggles-editsectiononrightclick' ],
+ $this->data[ 'toggles-editondblclick' ],
+ $this->data[ 'toggles-editwidth' ],
+ $this->data[ 'toggles-previewonfirst' ],
+ $this->data[ 'toggles-previewontop' ],
+ $this->data[ 'toggles-minordefault' ],
+ $this->data[ 'toggles-externaleditor' ],
+ $this->data[ 'toggles-externaldiff' ],
+ $this->data[ "editing-livepreview" ] ? $this->data[ 'toggles-uselivepreview' ] : false,
+ $this->data[ 'toggles-forceeditsummary' ]
+ ) ) );
+ }
+
+ private function RecentChanges() {
+ return Xml::fieldset(
+ $this->data[ "messages-recentchanges" ],
+ Xml::openElement( 'table' ) .
+ Xml::openElement( 'tr' ) .
+ Xml::openElement( 'td' ) .
+ Xml::label(
+ $this->data[ "messages-rcdays" ],
+ $this->data[ "recentchanges-days-fieldname" ] ) .
+ Xml::closeElement( 'td' ) .
+ Xml::openElement( 'td' ) .
+ Xml::input(
+ $this->data[ "recentchanges-days-fieldname" ],
+ $this->data[ "recentchanges-days-textboxsize" ],
+ $this->data[ "recentchanges-days" ],
+ array( "id" => $this->data[ "recentchanges-days-id" ] ) ) .
+ Xml::closeElement( 'td' ) .
+ Xml::closeElement( 'tr' ) .
+ Xml::openElement( 'tr' ) .
+ Xml::openElement( 'td' ) .
+ Xml::label(
+ $this->data[ "messages-rccount" ],
+ $this->data[ "recentchanges-count-fieldname" ] ) .
+ Xml::closeElement( 'td' ) .
+ Xml::openElement( 'td' ) .
+ Xml::input(
+ $this->data[ "recentchanges-count-fieldname" ],
+ $this->data[ "recentchanges-count-textboxsize" ],
+ $this->data[ "recentchanges-count" ],
+ array( "id" => $this->data[ "recentchanges-count-id" ] ) ) .
+ Xml::closeElement( 'td' ) .
+ Xml::closeElement( 'tr' ) .
+ Xml::closeElement( 'table' ) . "<br />" .
+ $this->getToggles(
+ $this->data[ "toggles-hideminor" ],
+ $this->data[ "recentchanges-showwatchingusers" ] ? $this->data[ "toggles-shownumberswatching" ] : false,
+ $this->data[ "toggles-usenewrc" ] )
+ );
+ }
+
+ private function Watchlist() {
+ return Xml::fieldset(
+ $this->data[ "messages-watchlist" ],
+ Xml::inputLabel(
+ $this->data[ "messages-watchlistdays" ],
+ $this->data[ "watchlist-days-fieldname" ],
+ $this->data[ "watchlist-days-fieldname" ],
+ $this->data[ "watchlist-days-textboxsize" ],
+ $this->data[ "watchlist-days" ] ) . "<br /><br />" .
+ $this->getToggle( $this->data[ "toggles-extendwatchlist" ] ) .
+ Xml::inputLabel(
+ $this->data[ "messages-watchlistedits" ],
+ $this->data[ "watchlist-edits-fieldname" ],
+ $this->data[ "watchlist-edits-fieldname" ],
+ $this->data[ "watchlist-edits-textboxsize" ],
+ $this->data[ "watchlist-edits" ] ) . "<br /><br />" .
+ $this->getToggles( array(
+ $this->data[ "toggles-watchlist-hideown" ],
+ $this->data[ "toggles-watchlist-hidebots" ],
+ $this->data[ "toggles-watchlist-hideminor" ],
+ $this->data[ "watchlist-createpage" ] ? $this->data[ "toggles-watchlist-create" ] : false,
+ $this->data[ "watchlist-canedit" ] ? $this->data[ "toggles-watchlist-edit" ] : false,
+ $this->data[ "watchlist-canmove" ] ? $this->data[ "toggles-watchlist-move" ] : false,
+ $this->data[ "watchlist-candelete" ] ? $this->data[ "toggles-watchlist-delete" ] : false ) )
+ );
+ }
+
+ private function Search() {
+ return Xml::fieldset(
+ $this->data[ "messages-search-resultshead" ],
+ Xml::fieldset(
+ $this->data[ "messages-search-options" ],
+ Xml::openElement( 'table' ) .
+ ( $this->data[ "search-ajax" ] ?
+ $this->addRow(
+ Xml::checkLabel(
+ $this->data[ "messages-useajax" ],
+ $this->data[ "search-ajax-fieldname" ] ),
+ Xml::check(
+ $this->data[ "search-ajax-fieldname" ],
+ $this->data[ "search-ajax" ],
+ array( 'id' => $this->data[ "search-ajax-id" ] ) ) ) :
+ '' ) .
+ $this->addRow(
+ Xml::label(
+ $this->data[ "messages-search-resultsperpage" ],
+ $this->data[ "search-resultsperpage-fieldname" ] ),
+ Xml::input(
+ $this->data[ "search-resultsperpage-fieldname" ],
+ $this->data[ "search-resultsperpage-textboxsize" ],
+ $this->data[ "search-resultsperpage" ],
+ array( 'id' => $this->data[ "search-resultsperpage-fieldname" ] ) ) ) .
+ $this->addRow(
+ Xml::label(
+ $this->data[ "messages-search-contextlines" ],
+ $this->data[ "search-contextlines-fieldname" ] ),
+ Xml::input(
+ $this->data[ "search-contextlines-fieldname" ],
+ $this->data[ "search-contextlines-textboxsize" ],
+ $this->data[ "search-contextlines" ],
+ array( 'id' => $this->data[ "search-contextlines-fieldname" ] ) ) ) .
+ $this->addRow(
+ Xml::label(
+ $this->data[ "messages-search-contextchars" ],
+ $this->data[ "search-contextchars-fieldname" ] ),
+ Xml::input(
+ $this->data[ "search-contextchars-fieldname" ],
+ $this->data[ "search-contextchars-textboxsize" ],
+ $this->data[ "search-contextchars" ],
+ array( 'id' => $this->data[ "search-contextchars-fieldname" ] ) ) ) .
+ ( $this->data[ "search-suggest" ] ?
+ $this->addRow(
+ Xml::label(
+ $this->data[ "messages-search-suggest" ],
+ $this->data[ "search-suggest-fieldname" ] ),
+ Xml::check(
+ $this->data[ "search-suggest-fieldname" ],
+ $this->data[ "search-suggest-disable" ],
+ array( 'id' => $this->data[ "search-suggest-id" ] ) ) ) :
+ '' ) .
+ Xml::closeElement( 'table' )
+ )
+ );
+ }
+
+ private function Misc() {
+ $wgUser =& $this->data[ "References-User" ];
+ $DropDownList = new XmlSelect( $this->data[ "misc-underline-fieldname" ], $this->data[ "misc-underline-id" ], $wgUser->getOption( "underline" ) );
+ $DropDownList->addOption( $this->data[ "message-misc-underline-never" ], 0 );
+ $DropDownList->addOption( $this->data[ "message-misc-underline-always" ], 1 );
+ $DropDownList->addOption( $this->data[ "message-misc-underline-default" ], 2 );
+
+ return Xml::fieldset(
+ $this->data[ "messages-misc" ],
+ Xml::inputLabel(
+ $this->data[ "messages-misc-stubs" ],
+ $this->data[ "misc-stubs-fieldname" ],
+ $this->data[ "misc-stubs-fieldname" ],
+ $this->data[ "misc-stubs-textboxsize" ],
+ $this->data[ "misc-stubs" ] ) .
+ Xml::openElement( 'div' ) .
+ Xml::openElement( 'p' ) .
+ Xml::label(
+ $this->data[ "message-misc-underline-main" ],
+ $this->data[ "misc-underline-fieldname" ] ) .
+ $DropDownList->getHTML() .
+ Xml::closeElement( 'p' ) .
+ Xml::closeElement( 'div' ) .
+ $this->getToggles( $this->data[ "toggles-extra" ] )
+ );
+ }
+
+ private function SubmitButton() {
+ return Xml::openElement( 'div', array( 'id' => $this->data[ "submit-id" ] ) ) .
+ Xml::openElement( 'div' ) .
+ Xml::submitButton(
+ $this->data[ "messages-submit-save" ],
+ array(
+ 'name' => $this->data[ "submit-save-fieldname" ],
+ 'class' => $this->data[ "submit-save-class" ],
+ 'tooltip' => $this->data[ "submit-save-tooltip" ],
+ 'accesskey' => $this->data[ "submit-save-accesskey" ] ) ) .
+ Xml::submitButton(
+ $this->data[ "messages-submit-reset" ],
+ array( 'name' => $this->data[ "submit-reset-fieldname" ] ) ) .
+ Xml::closeElement( 'div' ) .
+ Xml::closeElement( 'div' );
+ }
+
+ private function Footer() {
+ return Xml::hidden( $this->data[ "submit-token-fieldname" ], $this->data[ "submit-token" ] ) .
+ Xml::closeElement( 'div' ) .
+ Xml::closeElement( 'form' ) . "\n" .
+ Xml::tags(
+ 'div',
+ array( 'class' => $this->data[ "footer-clearcache-class" ] ),
+ $this->data[ "footer-clearcache" ]
+ );
+ }
+
+ private function ExtraInputs( $html ) {
+ foreach( $this->data[ "extra-inputs" ] as $inputarray ) {
+ extract( $inputarray, EXTR_OVERWRITE );
+ switch( $type ) {
+ case "input":
+ $html[ $inputarray[ "section" ] ] .= Xml::inputLabel( $label, $name, $id, $size, $value, $attribs );
+ break;
+ case "checkbox":
+ $html[ $inputarray[ "section" ] ] .= Xml::checkLabel( $label, $name, $id, $checked, $attribs );
+ break;
+ case "password":
+ $html[ $inputarray[ "section" ] ] .= Xml::label( $label, $id ) . Xml::password( $name, $size, $value, $attribs );
+ break;
+ case "radio":
+ $html[ $inputarray[ "section" ] ] .= Xml::radioLabel( $label, $name, $value, $id, $checked, $attribs );
+ break;
+ case "hidden":
+ $html[ $inputarray[ "section" ] ] .= Xml::hidden( $name, $value, $attribs );
+ break;
+ }
+ } return $html;
+ }
+}
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4639
Default Alt Text
Preferences.diff (31 KB)
Attached To
Mode
T17235: Preferences Form Customization
Attached
Detach File
Event Timeline
Log In to Comment