Robert Vogel has submitted this change and it was merged.
Change subject: NamespaceManager: Systemnamespaces can no longer be deleted
......................................................................
NamespaceManager: Systemnamespaces can no longer be deleted
When you try to delete a system namespace, the NamespaceManager will
reject this. This check somehow got lost in recent development, leading
to the possibility to delete all pages, e.g. in main namespace, with one
click. The check is now restored, plus checks are also done on the
server side now.
PatchSet 2: implemented CR
Change-Id: I2cce6ea0612b5001800fde65297760c505df6aad
---
M NamespaceManager/NamespaceManager.class.php
M NamespaceManager/includes/api/BSApiNamespaceTasks.php
M NamespaceManager/resources/BS.NamespaceManager/NamespaceRemoveDialog.js
M NamespaceManager/resources/BS.NamespaceManager/Panel.js
4 files changed, 19 insertions(+), 5 deletions(-)
Approvals:
Robert Vogel: Looks good to me, approved
jenkins-bot: Verified
diff --git a/NamespaceManager/NamespaceManager.class.php
b/NamespaceManager/NamespaceManager.class.php
index aeeb7a6..530844f 100644
--- a/NamespaceManager/NamespaceManager.class.php
+++ b/NamespaceManager/NamespaceManager.class.php
@@ -209,7 +209,7 @@
'label' => wfMessage(
'bs-namespacemanager-label-pagecount' )->plain()
),
array(
- 'name' => 'editable',
+ 'name' => 'isSystemNS',
'type' => 'boolean',
'label' => wfMessage(
'bs-namespacemanager-label-editable' )->plain(),
'hidden' => true,
diff --git a/NamespaceManager/includes/api/BSApiNamespaceTasks.php
b/NamespaceManager/includes/api/BSApiNamespaceTasks.php
index e54a78b..f912851 100644
--- a/NamespaceManager/includes/api/BSApiNamespaceTasks.php
+++ b/NamespaceManager/includes/api/BSApiNamespaceTasks.php
@@ -184,6 +184,11 @@
global $wgContLang;
$aUserNamespaces = NamespaceManager::getUserNamespaces( true );
+ if ( !isset( $aUserNamespaces[$iNS] ) ) {
+ $oResult->message = wfMessage(
'bs-namespacemanager-msgnoteditabledelete' )->plain();
+ return $oResult;
+ }
+
$aNamespacesToRemove = array( array( $iNS, 0 ) );
$sOriginalNamespace = $sNamespace = $aUserNamespaces[ $iNS ][
'name' ];
diff --git
a/NamespaceManager/resources/BS.NamespaceManager/NamespaceRemoveDialog.js
b/NamespaceManager/resources/BS.NamespaceManager/NamespaceRemoveDialog.js
index f35edfe..a057f10 100644
--- a/NamespaceManager/resources/BS.NamespaceManager/NamespaceRemoveDialog.js
+++ b/NamespaceManager/resources/BS.NamespaceManager/NamespaceRemoveDialog.js
@@ -25,7 +25,7 @@
items: [
{ boxLabel: mw.message(
'bs-namespacemanager-willdelete' ).text(), name: 'rb', inputValue: '0' },
{ boxLabel: mw.message(
'bs-namespacemanager-willmove' ).text(), name: 'rb', inputValue: '1' },
- { boxLabel: mw.message(
'bs-namespacemanager-willmovesuffix', msg ).text(), name: 'rb', inputValue: '2'
}
+ { boxLabel: mw.message(
'bs-namespacemanager-willmovesuffix', msg ).text(), name: 'rb', inputValue:
'2', checked: true }
]
});
this.items = [{
diff --git a/NamespaceManager/resources/BS.NamespaceManager/Panel.js
b/NamespaceManager/resources/BS.NamespaceManager/Panel.js
index f2d3328..9f945bf 100644
--- a/NamespaceManager/resources/BS.NamespaceManager/Panel.js
+++ b/NamespaceManager/resources/BS.NamespaceManager/Panel.js
@@ -65,6 +65,15 @@
}
return icon.format( 'bs-tick.png');
},
+ onGrdMainRowClick: function( oSender, iRowIndex, oEvent ) {
+ this.callParent( oSender, iRowIndex, oEvent );
+
+ var selectedRow =
this.grdMain.getSelectionModel().getSelection();
+ var isSystemNS = selectedRow[0].get( 'isSystemNS' );
+ if ( isSystemNS !== false ) {
+ this.btnRemove.disable();
+ }
+ },
onBtnAddClick: function( oButton, oEvent ) {
if ( !this.dlgNamespaceAdd ) {
this.dlgNamespaceAdd = Ext.create(
'BS.NamespaceManager.NamespaceDialog', {id:"bs-namespacemanager-add-dlg"} );
@@ -94,8 +103,8 @@
onBtnRemoveClick: function( oButton, oEvent ) {
this.active = 'remove';
var selectedRow =
this.grdMain.getSelectionModel().getSelection();
- var editable = selectedRow[0].get( 'editable' );
- if ( editable === false ) {
+ var isSystemNS = selectedRow[0].get( 'isSystemNS' );
+ if ( isSystemNS !== false ) {
bs.util.alert(
'NMfail',
{
@@ -169,7 +178,7 @@
getAdditionalSettings: function( data ) {
var filteredData = {};
for( var prop in data ) {
- if( $.inArray(prop, ['id', 'name', 'editable']) !== -1
) {
+ if( $.inArray(prop, ['id', 'name', 'isSystemNS']) !==
-1 ) {
continue;
}
filteredData[prop] = data[prop];
--
To view, visit https://gerrit.wikimedia.org/r/282136
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2cce6ea0612b5001800fde65297760c505df6aad
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits