Revert "Add a MediaWiki preference for enabling ULS IME"
This reverts commit 6ae0fe3e44.
The commit was duplicating the preferences in 2 places
making the syncing hard.
As per discussion with Pau, we will try alternate approach.
Bug: 48642
Change-Id: I5c97838ed875364dc35b66a3d6c33d9975b5107e
This commit is contained in:
committed by
Nikerabbit
parent
eb99c5139d
commit
2174740bb6
@@ -295,20 +295,10 @@ class UniversalLanguageSelectorHooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function onGetPreferences( $user, &$preferences ) {
|
public static function onGetPreferences( $user, &$preferences ) {
|
||||||
// The detailed preferences for different layouts.
|
|
||||||
// Saved as JSON and modifiable through the ULS screens.
|
|
||||||
$preferences['uls-preferences'] = array(
|
$preferences['uls-preferences'] = array(
|
||||||
'type' => 'api',
|
'type' => 'api',
|
||||||
);
|
);
|
||||||
|
|
||||||
// A checkbox in the general MediaWiki preferences screen
|
|
||||||
// to enable or disable IME in ULS
|
|
||||||
$preferences['uls-ime-enable'] = array(
|
|
||||||
'type' => 'toggle',
|
|
||||||
'label-message' => 'uls-ime-enable-preferences-label',
|
|
||||||
'section' => 'editing/advancedediting', // under 'Advanced options' section of 'Editing' tab
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ $messages['en'] = array(
|
|||||||
'uls-desc' => 'Gives the user several ways to select a language and to adjust language settings',
|
'uls-desc' => 'Gives the user several ways to select a language and to adjust language settings',
|
||||||
|
|
||||||
'uls-plang-title-languages' => 'Languages',
|
'uls-plang-title-languages' => 'Languages',
|
||||||
'uls-ime-enable-preferences-label' => 'Enable input methods',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Message documentation (Message documentation)
|
/** Message documentation (Message documentation)
|
||||||
@@ -43,7 +42,6 @@ $messages['qqq'] = array(
|
|||||||
'uls-plang-title-languages' => 'A title for the are in the sidebar in which the interlanguage links are supposed to appear.
|
'uls-plang-title-languages' => 'A title for the are in the sidebar in which the interlanguage links are supposed to appear.
|
||||||
This title is shown when there are no interlanguage links there, but an icon that enables the ULS is shown.
|
This title is shown when there are no interlanguage links there, but an icon that enables the ULS is shown.
|
||||||
{{Identical|Language}}',
|
{{Identical|Language}}',
|
||||||
'uls-ime-enable-preferences-label' => 'Used as a label for the checkbox in {{msg-mw|Preferences}} page.',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Arabic (العربية)
|
/** Arabic (العربية)
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ $wgHooks['UserGetLanguageObject'][] = 'UniversalLanguageSelectorHooks::getLangua
|
|||||||
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec';
|
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec';
|
||||||
|
|
||||||
$wgDefaultUserOptions['uls-preferences'] = '';
|
$wgDefaultUserOptions['uls-preferences'] = '';
|
||||||
$wgDefaultUserOptions['uls-ime-enable'] = 1;
|
|
||||||
$wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences';
|
$wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences';
|
||||||
|
|
||||||
$wgExtensionFunctions[] = function() {
|
$wgExtensionFunctions[] = function() {
|
||||||
|
|||||||
@@ -104,7 +104,6 @@
|
|||||||
|
|
||||||
ULSPreferences = function () {
|
ULSPreferences = function () {
|
||||||
this.preferenceName = 'uls-preferences';
|
this.preferenceName = 'uls-preferences';
|
||||||
this.imeEnablePreferenceName = 'uls-ime-enable',
|
|
||||||
this.username = mw.user.getName();
|
this.username = mw.user.getName();
|
||||||
this.isAnon = mw.user.isAnon();
|
this.isAnon = mw.user.isAnon();
|
||||||
this.preferences = null;
|
this.preferences = null;
|
||||||
@@ -116,30 +115,13 @@
|
|||||||
* Initialize
|
* Initialize
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
var options,
|
|
||||||
ulsImeEnable = mw.user.options.get( this.imeEnablePreferenceName );
|
|
||||||
|
|
||||||
if ( this.isAnon ) {
|
if ( this.isAnon ) {
|
||||||
this.preferences = $.jStorage.get( this.preferenceName );
|
this.preferences = $.jStorage.get( this.preferenceName );
|
||||||
} else {
|
} else {
|
||||||
options = mw.user.options.get( this.preferenceName );
|
var options = mw.user.options.get( this.preferenceName );
|
||||||
this.preferences = $.parseJSON( options );
|
this.preferences = $.parseJSON( options );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preferences = this.preferences || {};
|
this.preferences = this.preferences || {};
|
||||||
|
|
||||||
if ( this.preferences.ime === undefined ) {
|
|
||||||
this.preferences.ime = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ulsImeEnable === undefined ) {
|
|
||||||
this.preferences.ime.enable = mw.config.get( 'wgULSIMEEnabled' );
|
|
||||||
} else if ( ulsImeEnable === 1 || ulsImeEnable === '1' ) {
|
|
||||||
this.preferences.ime.enable = true;
|
|
||||||
} else {
|
|
||||||
this.preferences.ime.enable = false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,9 +149,7 @@
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
save: function ( callback ) {
|
save: function ( callback ) {
|
||||||
var ulsPreferences = this,
|
var ulsPreferences = this;
|
||||||
successFunction,
|
|
||||||
failFunction;
|
|
||||||
|
|
||||||
callback = callback || $.noop;
|
callback = callback || $.noop;
|
||||||
if ( this.isAnon ) {
|
if ( this.isAnon ) {
|
||||||
@@ -178,36 +158,16 @@
|
|||||||
callback.call( this, true );
|
callback.call( this, true );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
successFunction = function () {
|
|
||||||
callback.call( this, true );
|
|
||||||
};
|
|
||||||
failFunction = function () {
|
|
||||||
callback.call( this, false );
|
|
||||||
};
|
|
||||||
|
|
||||||
// Logged in user. Use MW APIs to change preferences
|
// Logged in user. Use MW APIs to change preferences
|
||||||
saveOptionsWithToken( {
|
saveOptionsWithToken( {
|
||||||
action: 'options',
|
action: 'options',
|
||||||
optionname: ulsPreferences.preferenceName,
|
optionname: ulsPreferences.preferenceName,
|
||||||
optionvalue: $.toJSON( ulsPreferences.preferences )
|
optionvalue: $.toJSON( ulsPreferences.preferences )
|
||||||
},
|
}, function () {
|
||||||
successFunction,
|
callback.call( this, true );
|
||||||
failFunction
|
}, function () {
|
||||||
);
|
callback.call( this, false );
|
||||||
|
} );
|
||||||
if ( ulsPreferences.preferences.ime !== undefined &&
|
|
||||||
ulsPreferences.preferences.ime.enable !== undefined
|
|
||||||
) {
|
|
||||||
// Logged in user. Use MW APIs to change preferences
|
|
||||||
saveOptionsWithToken( {
|
|
||||||
action: 'options',
|
|
||||||
optionname: ulsPreferences.imeEnablePreferenceName,
|
|
||||||
optionvalue: ulsPreferences.preferences.ime.enable ? '1' : ''
|
|
||||||
},
|
|
||||||
successFunction,
|
|
||||||
failFunction
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user