jenkins-bot has submitted this change and it was merged.
Change subject: Using mw.config.get/set to access JavaScript vars
......................................................................
Using mw.config.get/set to access JavaScript vars
Accessing global JavaScript variables directly has long been deprecated.
This patch adds the usage of 'mw.config.get/set'.
Change-Id: If50770231152b304cc58e0d89cc68483c25532fd
---
M ArticleInfo/resources/bluespice.articleInfo.js
M CSyntaxHighlight/CSyntaxHighlight.class.php
M ContextMenu/resources/bluespice.contextmenu.js
M Dashboards/resources/BS.Dashboards/DashboardPanel.js
M Dashboards/resources/BS.Dashboards/PortletCatalog.js
M ExtendedSearch/resources/bluespice.extendedSearch.focus.js
M PermissionManager/resources/BS.PermissionManager/tree/Groups.js
M ResponsibleEditors/ResponsibleEditors.setup.php
M Review/resources/bluespice.review.js
M SaferEdit/resources/bluespice.SaferEdit.editmode.js
M SaferEdit/resources/bluespice.SaferEdit.general.js
M VisualEditor/doc/legacy/bluespice.visualEditor.js
M WantedArticle/resources/bluespice.wantedArticle.js
M WhoIsOnline/resources/bluespice.whoIsOnline.js
14 files changed, 59 insertions(+), 46 deletions(-)
Approvals:
Robert Vogel: Looks good to me, approved
Tweichart: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/ArticleInfo/resources/bluespice.articleInfo.js
b/ArticleInfo/resources/bluespice.articleInfo.js
index 5b4f077..c540387 100644
--- a/ArticleInfo/resources/bluespice.articleInfo.js
+++ b/ArticleInfo/resources/bluespice.articleInfo.js
@@ -27,7 +27,7 @@
BsArticleInfo.updateLastEdited();
}
- BsArticleInfo.checkRevisionInterval =
bsArticleInfoCheckRevisionInterval*1000;
+ BsArticleInfo.checkRevisionInterval = mw.config.get(
'bsArticleInfoCheckRevisionInterval' ) * 1000;
if( BsArticleInfo.checkRevisionInterval < 1000 ) return;
if ( mw.config.get( "wgCurRevisionId" ) < 1 ) {
return;
diff --git a/CSyntaxHighlight/CSyntaxHighlight.class.php
b/CSyntaxHighlight/CSyntaxHighlight.class.php
index 544061f..75b8a14 100644
--- a/CSyntaxHighlight/CSyntaxHighlight.class.php
+++ b/CSyntaxHighlight/CSyntaxHighlight.class.php
@@ -170,9 +170,9 @@
$aScriptBlock[] = 'SyntaxHighlighter.autoloader( ';
$aScriptBlock[] = implode( ",\n", $aAutoloaderParams );
$aScriptBlock[] = ');';
- $aScriptBlock[] = 'SyntaxHighlighter.defaults["toolbar"] =
bsCSyntaxHighlightToolbar;';
- $aScriptBlock[] = 'SyntaxHighlighter.defaults["auto-links"] =
bsCSyntaxHighlightAutoLinks;';
- $aScriptBlock[] = 'SyntaxHighlighter.defaults["gutter"] =
bsCSyntaxHighlightGutter;';
+ $aScriptBlock[] = 'SyntaxHighlighter.defaults["toolbar"] =
mw.config.get( "bsCSyntaxHighlightToolbar" );';
+ $aScriptBlock[] = 'SyntaxHighlighter.defaults["auto-links"] =
mw.config.get( "bsCSyntaxHighlightAutoLinks" );';
+ $aScriptBlock[] = 'SyntaxHighlighter.defaults["gutter"] =
mw.config.get( "bsCSyntaxHighlightGutter" );';
$aScriptBlock[] = 'SyntaxHighlighter.all();';
$aScriptBlock[] = '});';
$aScriptBlock[] = '</script>';
diff --git a/ContextMenu/resources/bluespice.contextmenu.js
b/ContextMenu/resources/bluespice.contextmenu.js
index 9bde3a2..2a84605 100644
--- a/ContextMenu/resources/bluespice.contextmenu.js
+++ b/ContextMenu/resources/bluespice.contextmenu.js
@@ -73,7 +73,7 @@
var username = anchor.data('bs-username');
- if( bsUserCanSendMail && anchor.data('bs-user-has-email') ) {
+ if( mw.config.get( 'bsUserCanSendMail' ) &&
anchor.data('bs-user-has-email') ) {
items.push({
text:
mw.message('bs-contextmenu-user-mail').plain(),
href: bs.util.wikiGetlink(
diff --git a/Dashboards/resources/BS.Dashboards/DashboardPanel.js
b/Dashboards/resources/BS.Dashboards/DashboardPanel.js
index b872caa..5045319 100644
--- a/Dashboards/resources/BS.Dashboards/DashboardPanel.js
+++ b/Dashboards/resources/BS.Dashboards/DashboardPanel.js
@@ -3,7 +3,7 @@
//Custom Settings
saveConfigBackend: {
- rs: bsPortalConfigSavebackend,
+ rs: mw.config.get( 'bsPortalConfigSavebackend' ),
additionalArgs: []
},
cmPortlets: false,
diff --git a/Dashboards/resources/BS.Dashboards/PortletCatalog.js
b/Dashboards/resources/BS.Dashboards/PortletCatalog.js
index 1534dd9..b9b537a 100644
--- a/Dashboards/resources/BS.Dashboards/PortletCatalog.js
+++ b/Dashboards/resources/BS.Dashboards/PortletCatalog.js
@@ -7,7 +7,7 @@
afterInitComponent: function() {
//this.buttons = []; //We don't need buttons as we use drag and
drop
- if ( bsPortalConfigLocation === 'AdminDashboard' ) {
+ if ( mw.config.get( 'bsPortalConfigLocation' ) ===
'AdminDashboard' ) {
this.ajaxDispatcherUrl =
'Dashboards::getAdminDashboardConfig';
} else {
this.ajaxDispatcherUrl =
'Dashboards::getUserDashboardConfig';
diff --git a/ExtendedSearch/resources/bluespice.extendedSearch.focus.js
b/ExtendedSearch/resources/bluespice.extendedSearch.focus.js
index 016fb64..462e23f 100644
--- a/ExtendedSearch/resources/bluespice.extendedSearch.focus.js
+++ b/ExtendedSearch/resources/bluespice.extendedSearch.focus.js
@@ -11,6 +11,7 @@
* @filesource
*/
mw.loader.using( 'ext.bluespice.extendedsearch.form', function() {
+ var bsExtendedSearchSetFocus = mw.config.get(
'bsExtendedSearchSetFocus' );
if ( typeof bsExtendedSearchSetFocus === "boolean" ) {
//$(document).scrollTop(): prevent loosing last scroll position
on history back
if ( mw.config.get( "wgIsArticle" ) === true &&
bsExtendedSearchSetFocus === true && $( document ).scrollTop() < 1 ) {
diff --git a/PermissionManager/resources/BS.PermissionManager/tree/Groups.js
b/PermissionManager/resources/BS.PermissionManager/tree/Groups.js
index 77f5562..b536687 100644
--- a/PermissionManager/resources/BS.PermissionManager/tree/Groups.js
+++ b/PermissionManager/resources/BS.PermissionManager/tree/Groups.js
@@ -34,7 +34,7 @@
this.store = new Ext.data.TreeStore({
storeId: 'bs-pm-group-tree',
model: 'BS.PermissionManager.model.Group',
- root: bsPermissionManagerGroupsTree
+ root: mw.config.get( 'bsPermissionManagerGroupsTree' )
});
this.callParent(arguments);
}
diff --git a/ResponsibleEditors/ResponsibleEditors.setup.php
b/ResponsibleEditors/ResponsibleEditors.setup.php
index a73e190..e23e5d4 100644
--- a/ResponsibleEditors/ResponsibleEditors.setup.php
+++ b/ResponsibleEditors/ResponsibleEditors.setup.php
@@ -11,6 +11,8 @@
$GLOBALS['wgAutoloadClasses']['ResponsibleEditors'] = __DIR__ .
'/ResponsibleEditors.class.php';
$wgAutoloadClasses['BsResponsibleEditor'] = __DIR__ .
'/includes/BsResponsibleEditor.php';
$wgAutoloadClasses['SpecialResponsibleEditors'] = __DIR__ .
'/includes/specials/SpecialResponsibleEditors.class.php';
+$wgAutoloadClasses['ApiResponsibleEditorsStore'] = __DIR__ .
'/includes/api/ApiResponsibleEditorsStore.class.php';
+$wgAutoloadClasses['ApiResponsibleEditorsTasks'] = __DIR__ .
'/includes/api/ApiResponsibleEditorsTasks.class.php';
$wgSpecialPages['ResponsibleEditors'] = 'SpecialResponsibleEditors';
@@ -22,7 +24,7 @@
$wgResourceModules['ext.bluespice.responsibleEditors.styles'] = array(
'styles' => 'bluespice.responsibleEditors.css',
-) + $aResourceModuleTemplate;;
+) + $aResourceModuleTemplate;
$wgResourceModules['ext.bluespice.responsibleEditors'] = array(
'scripts' => 'bluespice.responsibleEditors.js',
diff --git a/Review/resources/bluespice.review.js
b/Review/resources/bluespice.review.js
index c8b94ce..1aac0fd 100644
--- a/Review/resources/bluespice.review.js
+++ b/Review/resources/bluespice.review.js
@@ -16,7 +16,7 @@
*/
(function(mw, $, bs, undefined){
-
+
//Wire up content action link
$('#ca-review').find('a').on( 'click', function( e ) {
e.preventDefault();
@@ -27,11 +27,12 @@
BS.Review.Dialog.on( 'ok', function( btn, data ){
window.location.reload();
});
-
- var data = {
+
+ var data = {
page_id: mw.config.get('wgArticleId'),
steps: []
};
+ var bsReview = mw.config.get( 'bsReview' );
if( typeof bsReview != 'undefined' ) {
data = bsReview;
}
@@ -43,7 +44,7 @@
return false;
});
-
+
//Wire up accept/decline links
$(document).on('click', 'a#bs-review-ok', function() {
$.ajax({
diff --git a/SaferEdit/resources/bluespice.SaferEdit.editmode.js
b/SaferEdit/resources/bluespice.SaferEdit.editmode.js
index 3f72f07..fccc07f 100644
--- a/SaferEdit/resources/bluespice.SaferEdit.editmode.js
+++ b/SaferEdit/resources/bluespice.SaferEdit.editmode.js
@@ -19,7 +19,7 @@
* Time between two intermediate saves
* @var integer time in seconds
*/
- interval: bsSaferEditInterval * 1000,
+ interval: mw.config.get( 'bsSaferEditInterval' ) * 1000,
/**
* Pointer to javascript timeout callback, needed to cancel timeout
when changes are saved
* @var pointer javascript timeout callback
@@ -103,7 +103,7 @@
'SaferEditSave',
0,
[{
- section: bsSaferEditEditSection,
+ section: mw.config.get(
'bsSaferEditEditSection' ),
bUnsavedChanges:
BsSaferEditEditMode.hasUnsavedChanges( )
}],
BsSaferEditEditMode.startSaving
diff --git a/SaferEdit/resources/bluespice.SaferEdit.general.js
b/SaferEdit/resources/bluespice.SaferEdit.general.js
index c9648d4..60a0b04 100644
--- a/SaferEdit/resources/bluespice.SaferEdit.general.js
+++ b/SaferEdit/resources/bluespice.SaferEdit.general.js
@@ -26,7 +26,7 @@
* Conducts neccessary preparations of edit form and starts
intermediate saving
*/
init: function() {
- this.interval = bsSaferEditInterval * 1000;
+ this.interval = mw.config.get( 'bsSaferEditInterval' ) * 1000;
if ( this.interval < 1000 || $( '#bs-statebar' ).length < 1 ) {
return;
diff --git a/VisualEditor/doc/legacy/bluespice.visualEditor.js
b/VisualEditor/doc/legacy/bluespice.visualEditor.js
index b5aac14..3e90c9c 100644
--- a/VisualEditor/doc/legacy/bluespice.visualEditor.js
+++ b/VisualEditor/doc/legacy/bluespice.visualEditor.js
@@ -41,21 +41,22 @@
$('#edit_button').click(function(){
toggleEditorMode('wpTextbox1');
});
-
- for( plugin in bsVisualEditorTinyMCEPlugins ) {
+
+ var bsVisualEditorTinyMCEPlugins = mw.config.get(
'bsVisualEditorTinyMCEPlugins' );
+ for( var plugin in bsVisualEditorTinyMCEPlugins ) {
tinyMCE.PluginManager.load(
plugin,
mw.config.get('wgScriptPath') +
bsVisualEditorTinyMCEPlugins[plugin]
);
}
- // merge(extends/overwrites) standard config with overwrite config
- // if a property of the first object is itself an object or array,
- // it will be completely overwritten by a property with the same key
+ // merge(extends/overwrites) standard config with overwrite config
+ // if a property of the first object is itself an object or array,
+ // it will be completely overwritten by a property with the same key
// in the second object.
var temp = {};
var currentSiteCSS = [];
- //We collect the CSS Links from this document and set them as
content_css
+ //We collect the CSS Links from this document and set them as
content_css
//for TinyMCE
$('link[rel=stylesheet]').each(function(){
var cssBaseURL = '';
@@ -64,26 +65,33 @@
if( cssUrl.startsWith( '/' ) ) cssBaseURL =
mw.config.get('wgServer');
currentSiteCSS.push( cssBaseURL + cssUrl );
});
- bsVisualEditorConfigStandard.content_css = currentSiteCSS.join(',')
+
+ var bsVisualEditorConfigStandard = mw.config.get(
'bsVisualEditorConfigStandard' );
+ var bsVisualEditorConfigOverwrite = mw.config.get(
'bsVisualEditorConfigOverwrite' );
+ var bsVisualEditorTinyMCETableStyles = mw.config.get(
'bsVisualEditorTinyMCETableStyles' );
+
+ bsVisualEditorConfigStandard.content_css = currentSiteCSS.join(',');
bsVisualEditorConfigStandard.table_styles =
bsVisualEditorTinyMCETableStyles;
var lang = mw.user.options.get('language');
- lang = lang == 'de-formal' ? 'de': lang;
+ lang = lang === 'de-formal' ? 'de': lang;
bsVisualEditorConfigStandard.language = lang;
$.extend(true, temp, bsVisualEditorConfigStandard,
bsVisualEditorConfigOverwrite);
bsVisualEditorConfigOverwrite = temp;
-
+
//We need to set the baseURL to alow lazy loading of tinyMCE plugins
tinymce.baseURL =
mw.config.get('wgScriptPath')+'/extensions/BlueSpiceExtensions/VisualEditor/resources/tiny_mce';
- if( bsVisualEditorConfigOverwrite && (bsVisualEditorUseLimited ||
bsVisualEditorUseForceLimited) ) {
- tinymce.init(bsVisualEditorConfigOverwrite);
- bsVisualEditorGuiMode = 'bn';
+ var bsVisualEditorUseLimited = mw.config.get(
'bsVisualEditorUseLimited' );
+ var bsVisualEditorUseForceLimited = mw.config.get(
'bsVisualEditorUseForceLimited' );
+ if( bsVisualEditorConfigOverwrite && ( bsVisualEditorUseLimited ||
bsVisualEditorUseForceLimited ) ) {
+ tinymce.init( bsVisualEditorConfigOverwrite );
+ mw.config.set( 'bsVisualEditorGuiMode', 'bn' );
} else {
- tinymce.init(bsVisualEditorConfigStandard);
- bsVisualEditorGuiMode = 'tm';
+ tinymce.init( bsVisualEditorConfigStandard );
+ mw.config.set( 'bsVisualEditorGuiMode', 'tm' );
}
- if(bsVisualEditorConfigOverwrite) {
- bsVisualEditorGuiSwitchable = true;
+ if( bsVisualEditorConfigOverwrite ) {
+ mw.config.set( 'bsVisualEditorGuiSwitchable', true );
}
});
/**
@@ -131,18 +139,18 @@
* Switches betwenn full and reduced mode of the editor.
*/
toggleGuiMode = function() {
- if(bsVisualEditorGuiSwitchable) {
+ if( mw.config.get( 'bsVisualEditorGuiSwitchable' ) ) {
tinymce.execCommand('mceRemoveControl', false, 'wpTextbox1');
if(document.getElementById('toolbar'))
{document.getElementById('toolbar').style.display = "block";}
if(document.getElementById('hw-toolbar'))
{document.getElementById('hw-toolbar').style.display = "block";}
VisualEditorMode = false;
- if(bsVisualEditorGuiMode == 'bn') {
- tinymce.init(bsVisualEditorConfigStandard);
- bsVisualEditorGuiMode = 'tm';
+ if( mw.config.get( 'bsVisualEditorGuiMode' ) === 'bn') {
+ tinymce.init( mw.config.get(
'bsVisualEditorConfigStandard' ) );
+ mw.config.set( 'bsVisualEditorGuiMode', 'tm' );
}
else {
- tinymce.init(bsVisualEditorConfigOverwrite);
- bsVisualEditorGuiMode = 'bn';
+ tinymce.init( mw.config.get(
'bsVisualEditorConfigOverwrite' ) );
+ mw.config.set( 'bsVisualEditorGuiMode', 'bn' );
}
tinymce.execCommand('mceAddControl', false, 'wpTextbox1');
if(document.getElementById('toolbar'))
{document.getElementById('toolbar').style.display = "none";}
@@ -155,7 +163,7 @@
}
BsVisualEditor = {
- //Init loadMask and loadMaskTask with minimal stub objects to avoid
code
+ //Init loadMask and loadMaskTask with minimal stub objects to avoid code
//breaking in case of IE8 runtime error
loadMask: {
show: function() {},
@@ -171,7 +179,7 @@
if (bsVisualEditorUse == true) {
setTimeout("startEditor()", 100);
}
-
+
//TODO: User TinyMCE LoadMask:
http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setProgressState
},
@@ -179,21 +187,21 @@
* Starts the editor, but only after toolbars are rendered.
*/
startEditor: function() {
-
+
},
-
+
/**
* Actually displays the editor and removes the toolbars.
*/
toggleEditorMode: function(sEditorID) {
-
+
},
/**
* Switches betwenn full and reduced mode of the editor.
*/
toggleGuiMode: function() {
-
+
}
}
diff --git a/WantedArticle/resources/bluespice.wantedArticle.js
b/WantedArticle/resources/bluespice.wantedArticle.js
index 7f04705..dd2521a 100644
--- a/WantedArticle/resources/bluespice.wantedArticle.js
+++ b/WantedArticle/resources/bluespice.wantedArticle.js
@@ -100,6 +100,7 @@
}
var aFoundChars = [];
+ var bsForbiddenCharsInArticleTitle = mw.config.get(
'bsForbiddenCharsInArticleTitle' );
for ( var i=0; i < bsForbiddenCharsInArticleTitle.length; i++ )
{
if ( sArticleTitle.indexOf(
bsForbiddenCharsInArticleTitle [i] ) != -1 ) {
aFoundChars.push( '"' +
bsForbiddenCharsInArticleTitle [i] + '"' );
diff --git a/WhoIsOnline/resources/bluespice.whoIsOnline.js
b/WhoIsOnline/resources/bluespice.whoIsOnline.js
index 2bd714b..c0717dc 100644
--- a/WhoIsOnline/resources/bluespice.whoIsOnline.js
+++ b/WhoIsOnline/resources/bluespice.whoIsOnline.js
@@ -13,8 +13,8 @@
interval: 0,
limit: 0,
init: function() {
- BsWhoIsOnline.interval = bsWhoIsOnlineInterval*1000;
- BsWhoIsOnline.limit = bsWhoIsOnlineLimitCount;
+ BsWhoIsOnline.interval = mw.config.get( 'bsWhoIsOnlineInterval'
) * 1000;
+ BsWhoIsOnline.limit = mw.config.get( 'bsWhoIsOnlineLimitCount'
);
if(BsWhoIsOnline.interval < 1) return;
BSPing.registerListener('WhoIsOnline', BsWhoIsOnline.interval,
[], BsWhoIsOnline.pingListener);
--
To view, visit https://gerrit.wikimedia.org/r/239031
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If50770231152b304cc58e0d89cc68483c25532fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: Tweichart <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits