jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/362179 )
Change subject: NamespaceManager: Disable deleting and renaming Talk namespaces
......................................................................
NamespaceManager: Disable deleting and renaming Talk namespaces
Disabled deleting of Talk namespaces.
Disabled editing the name of Talk namespace
When user changes the name of Talk namespace its changed to normal NS and
new talk namespace for it is created, which deletes original talk
namespace
Wasnt able to remove "delete" action from the row when NS cannot be
removed. Tried using listeners on column, focus, render events on grid,
and renderer on column but nothing works. Everywhere html for both buttons
is alredy created and can only be changed through some regex
match-and-remove, which i think is too hacky, and also "delete" action has
no particular id, so even regexing wouldnt be easy.
Added disabling of toolbar delete button on Talk NS and error message when
clicking on delete action in the row
Change-Id: I7aab6e528476b44cd17d19c0c2ebc8dd9eb6bf94
ERM: #6450
---
M NamespaceManager/extension.json
M NamespaceManager/i18n/de.json
M NamespaceManager/i18n/en.json
M NamespaceManager/i18n/qqq.json
M NamespaceManager/includes/api/BSApiNamespaceTasks.php
M NamespaceManager/includes/specials/SpecialNamespaceManager.class.php
M NamespaceManager/resources/BS.NamespaceManager/NamespaceDialog.js
M NamespaceManager/resources/BS.NamespaceManager/Panel.js
8 files changed, 78 insertions(+), 14 deletions(-)
Approvals:
Mglaser: Looks good to me, approved
jenkins-bot: Verified
diff --git a/NamespaceManager/extension.json b/NamespaceManager/extension.json
index c7f2c53..dd8ac14 100644
--- a/NamespaceManager/extension.json
+++ b/NamespaceManager/extension.json
@@ -69,7 +69,9 @@
"bs-namespacemanager-pagepresent",
"bs-namespacemanager-label-editable",
"bs-ns_main",
- "bs-from-something"
+ "bs-from-something",
+ "bs-namespacemanager-label-istalk",
+ "bs-namespacemanager-nodeletetalk"
]
}
},
diff --git a/NamespaceManager/i18n/de.json b/NamespaceManager/i18n/de.json
index a04fc59..aa45fd4 100644
--- a/NamespaceManager/i18n/de.json
+++ b/NamespaceManager/i18n/de.json
@@ -52,5 +52,7 @@
"apihelp-bs-namespace-tasks-description": "Ermöglicht die
Namensraumkonfiguration zu verändern.",
"apihelp-bs-namespace-tasks-summary": "Erlaubt die Veränderung der
Namensraumkonfiguration.",
"action-namespacemanager-viewspecialpage": "die Spezialseite zur
Namensraumverwaltung anzusehen",
- "namespacemanager": "Namensraumverwaltung"
+ "namespacemanager": "Namensraumverwaltung",
+ "bs-namespacemanager-nodeletetalk": "Es ist nicht möglich, einen
Diskussionsnamensraum zu löschen.",
+ "bs-namespacemanager-label-istalk": "Diskussion"
}
diff --git a/NamespaceManager/i18n/en.json b/NamespaceManager/i18n/en.json
index 26d0f85..01af77a 100644
--- a/NamespaceManager/i18n/en.json
+++ b/NamespaceManager/i18n/en.json
@@ -49,5 +49,7 @@
"apihelp-bs-namespace-tasks-description": "Allows modification of the
namespace configuration.",
"apihelp-bs-namespace-tasks-summary": "Allows modification of the
namespace configuration.",
"action-namespacemanager-viewspecialpage": "view specialpage of
namespace manager",
- "namespacemanager": "Namespace manager"
+ "namespacemanager": "Namespace manager",
+ "bs-namespacemanager-nodeletetalk": "Talk namespace cannot be deleted",
+ "bs-namespacemanager-label-istalk": "Talk"
}
\ No newline at end of file
diff --git a/NamespaceManager/i18n/qqq.json b/NamespaceManager/i18n/qqq.json
index 42d785f..b9dac58 100644
--- a/NamespaceManager/i18n/qqq.json
+++ b/NamespaceManager/i18n/qqq.json
@@ -52,5 +52,7 @@
"apihelp-bs-namespace-tasks-description": "Describes the API endpoint
that allows manipulation of the namespace
configuration.\n{{doc-apihelp-description|bs-namespace-tasks}}",
"apihelp-bs-namespace-tasks-summary": "Describes the API endpoint that
allows manipulation of the namespace
configuration.\n{{doc-apihelp-summary|bs-namespace-tasks}}",
"action-namespacemanager-viewspecialpage": "label for permission denied
page, show user which page have been
blocked\n{{doc-action|namespacemanager-viewspecialpage}}",
- "namespacemanager": "name of special page"
+ "namespacemanager": "name of special page",
+ "bs-namespacemanager-nodeletetalk": "Error message shown when a user
tries to delete a talk namespace",
+ "bs-namespacemanager-label-istalk": "Label for column in the grid that
shows if namespace is a talk namespace"
}
diff --git a/NamespaceManager/includes/api/BSApiNamespaceTasks.php
b/NamespaceManager/includes/api/BSApiNamespaceTasks.php
index 360dc62..7ec9db0 100644
--- a/NamespaceManager/includes/api/BSApiNamespaceTasks.php
+++ b/NamespaceManager/includes/api/BSApiNamespaceTasks.php
@@ -272,11 +272,14 @@
$aNamespacesToRemove = array( array( $iNS, 0 ) );
$sOriginalNamespace = $sNamespace = $aUserNamespaces[ $iNS ][
'name' ];
- if ( !strstr( $sNamespace, '_'.$wgContLang->getNsText( NS_TALK
) ) ) {
- if ( isset( $aUserNamespaces[ ($iNS + 1) ] ) && strstr(
$aUserNamespaces[ ($iNS + 1) ][ 'name' ], '_'.$wgContLang->getNsText( NS_TALK )
) ) {
- $aNamespacesToRemove[] = array( ($iNS + 1), 1 );
- $sNamespace = $aUserNamespaces[ ($iNS + 1) ][
'name' ];
- }
+ if ( strstr( $sNamespace, '_'.$wgContLang->getNsText( NS_TALK )
) ) {
+ $oResult->message = wfMessage(
'bs-namespacemanager-nodeletetalk' )->plain();
+ return $oResult;
+ }
+
+ if ( isset( $aUserNamespaces[ ($iNS + 1) ] ) && strstr(
$aUserNamespaces[ ($iNS + 1) ][ 'name' ], '_'.$wgContLang->getNsText( NS_TALK )
) ) {
+ $aNamespacesToRemove[] = array( ($iNS + 1), 1 );
+ $sNamespace = $aUserNamespaces[ ($iNS + 1) ][ 'name' ];
}
$bErrors = false;
diff --git
a/NamespaceManager/includes/specials/SpecialNamespaceManager.class.php
b/NamespaceManager/includes/specials/SpecialNamespaceManager.class.php
index fd718f4..1e5de33 100644
--- a/NamespaceManager/includes/specials/SpecialNamespaceManager.class.php
+++ b/NamespaceManager/includes/specials/SpecialNamespaceManager.class.php
@@ -55,6 +55,16 @@
),
),
array(
+ 'name' => 'isTalkNS',
+ 'type' => 'boolean',
+ 'label' => wfMessage(
'bs-namespacemanager-label-istalk' )->plain(),
+ 'hidden' => true,
+ 'sortable' => true,
+ 'filter' => array(
+ 'type' => 'bool'
+ ),
+ ),
+ array(
'name' => 'subpages',
'type' => 'boolean',
'label' => wfMessage(
'bs-namespacemanager-label-subpages' )->plain(),
diff --git a/NamespaceManager/resources/BS.NamespaceManager/NamespaceDialog.js
b/NamespaceManager/resources/BS.NamespaceManager/NamespaceDialog.js
index 9e58ea9..db7c33a 100644
--- a/NamespaceManager/resources/BS.NamespaceManager/NamespaceDialog.js
+++ b/NamespaceManager/resources/BS.NamespaceManager/NamespaceDialog.js
@@ -38,6 +38,9 @@
if( fieldDef.type !== 'boolean' || fieldDef.name ===
'isSystemNS' ) {
continue;
}
+ if( fieldDef.name === 'isTalkNS' ) {
+ continue;
+ }
var cbControl = Ext.create( 'Ext.form.field.Checkbox',
{
boxLabel: fieldDef.label,
name: 'cb-'+fieldDef.name
@@ -58,12 +61,11 @@
},
setData: function( obj ) {
this.currentData = obj;
-
- if(!this.currentData.isSystemNS) {
- this.tfNamespaceName.enable();
+ if( this.currentData.isSystemNS || this.currentData.isTalkNS ) {
+ this.tfNamespaceName.disable();
}
else {
- this.tfNamespaceName.disable();
+ this.tfNamespaceName.enable();
}
this.tfNamespaceName.setValue( this.currentData.name );
diff --git a/NamespaceManager/resources/BS.NamespaceManager/Panel.js
b/NamespaceManager/resources/BS.NamespaceManager/Panel.js
index cdd61dc..e306cad 100644
--- a/NamespaceManager/resources/BS.NamespaceManager/Panel.js
+++ b/NamespaceManager/resources/BS.NamespaceManager/Panel.js
@@ -61,6 +61,34 @@
this.colMainConf.columns = columns;
this.callParent( arguments );
},
+ makeRowActions: function() {
+ if( this.opPermitted( 'delete' ) ) {
+ this.colMainConf.actions.unshift({
+ glyph: true, //Needed to have the
"BS.override.grid.column.Action" render an <span> instead of an <img>,
+ tooltip: mw.message( 'bs-extjs-delete'
).plain(),
+ handler: this.onActionRemoveClick,
+ getClass: function( value, meta, record ) {
+ if( record.get( 'isTalkNS' ) ||
record.get( 'isSystemNS' ) ) {
+ return "x-hide-display";
+ }
+ return "bs-extjs-actioncolumn-icon
bs-icon-cross destructive";
+ },
+ scope: this
+ });
+ }
+
+ if( this.opPermitted( 'update' ) ) {
+ this.colMainConf.actions.unshift({
+ iconCls: 'bs-extjs-actioncolumn-icon
bs-icon-wrench progressive',
+ glyph: true,
+ tooltip: mw.message( 'bs-extjs-edit' ).plain(),
+ handler: this.onActionEditClick,
+ scope: this
+ });
+ }
+
+ return this.colMainConf.actions;
+ },
renderIcon: function( value ) {
//TODO: make CSS class icon
var icon = '<img src="' + mw.config.get( "wgScriptPath" ) +
'/extensions/BlueSpiceFoundation/resources/bluespice/images/{0}"/>';
@@ -82,7 +110,9 @@
var selectedRow =
this.grdMain.getSelectionModel().getSelection();
var isSystemNS = selectedRow[0].get( 'isSystemNS' );
- if ( isSystemNS !== false ) {
+ var isTalkNS = selectedRow[0].get( 'isTalkNS' );
+
+ if ( isSystemNS !== false || isTalkNS !== false ) {
this.btnRemove.disable();
}
},
@@ -116,6 +146,7 @@
this.active = 'remove';
var selectedRow =
this.grdMain.getSelectionModel().getSelection();
var isSystemNS = selectedRow[0].get( 'isSystemNS' );
+ var isTalkNS = selectedRow[0].get( 'isTalkNS' );
if ( isSystemNS !== false ) {
bs.util.alert(
'NMfail',
@@ -126,6 +157,16 @@
);
return;
}
+ if ( isTalkNS !== false ) {
+ bs.util.alert(
+ 'NMfail',
+ {
+ textMsg:
'bs-namespacemanager-nodeletetalk',
+ titleMsg: 'bs-extjs-title-warning'
+ }
+ );
+ return;
+ }
if ( !this.dlgNamespaceRemove ) {
this.dlgNamespaceRemove = Ext.create(
'BS.NamespaceManager.NamespaceRemoveDialog',
--
To view, visit https://gerrit.wikimedia.org/r/362179
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7aab6e528476b44cd17d19c0c2ebc8dd9eb6bf94
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Raimond Spekking <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits