Cboltz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/51851
Change subject: [Bug 38374] option to disallow selecting the top-level category
......................................................................
[Bug 38374] option to disallow selecting the top-level category
(new config option $wgSelectCategoryToplevelAllowed)
Change-Id: I60d66b9401451cf1e566020d28cb78fa7854512a
---
M CHANGELOG
M SelectCategory.php
M SelectCategory_body.php
3 files changed, 12 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SelectCategory
refs/changes/51/51851/1
diff --git a/CHANGELOG b/CHANGELOG
index 0fa2889..bc94815 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
Changes since the last release:
+ - [Bug 38374] option to disallow selecting the top-level category
+ (new config option $wgSelectCategoryToplevelAllowed)
- [Bug 24911] $wgSelectCategoryRoot ignored on Special:Upload
* v0.8.2 - 2013-02-28
diff --git a/SelectCategory.php b/SelectCategory.php
index 7d43d60..fd2b13a 100644
--- a/SelectCategory.php
+++ b/SelectCategory.php
@@ -60,6 +60,10 @@
# $wgSelectCategoryEnableSubpages - if the extension should be active on
subpages or not (true, as subpages are disabled by default)
if( !isset( $wgSelectCategoryEnableSubpages ) )
$wgSelectCategoryEnableSubpages = true;
+# $wgSelectCategoryToplevelAllowed - should the toplevel category be allowed
for selection (false will hide the checkbox for it)
+# Note: if you set this to false, articles in the toplevel category will be
removed from this category on next edit
+if( !isset( $wgSelectCategoryToplevelAllowed ) )
$wgSelectCategoryToplevelAllowed = true;
+
## Register extension setup hook and credits:
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
diff --git a/SelectCategory_body.php b/SelectCategory_body.php
index 14b5c96..b192f21 100644
--- a/SelectCategory_body.php
+++ b/SelectCategory_body.php
@@ -28,6 +28,7 @@
# Register CSS file for our select box
global $wgOut, $wgUser, $wgExtensionAssetsPath;
global $wgSelectCategoryMaxLevel;
+ global $wgSelectCategoryToplevelAllowed;
$wgOut->addExtensionStyle(
"{$wgExtensionAssetsPath}/SelectCategory/SelectCategory.css" );
$wgOut->addExtensionStyle(
"{$wgExtensionAssetsPath}/SelectCategory/jquery.treeview.css" );
@@ -106,7 +107,11 @@
$catName = str_replace( '_', ' ', $category );
$title = Title::newFromText( $category,
NS_CATEGORY );
# Output the actual checkboxes, indented
- $pageObj->$place .= '<li' . $open . '><input
type="checkbox" name="SelectCategoryList[]" value="'.$category.'"
class="checkbox" '.$checked.' />'.$skin->link( $title, $catName )."\n";
+ $pageObj->$place .= '<li' . $open . '>';
+ if ($level > 0 ||
$wgSelectCategoryToplevelAllowed) {
+ $pageObj->$place .= '<input
type="checkbox" name="SelectCategoryList[]" value="'.$category.'"
class="checkbox" '.$checked.' />';
+ }
+ $pageObj->$place .= $skin->link( $title,
$catName )."\n";
# set id for next level
$level_id = 'sc_'.$cat;
--
To view, visit https://gerrit.wikimedia.org/r/51851
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I60d66b9401451cf1e566020d28cb78fa7854512a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SelectCategory
Gerrit-Branch: master
Gerrit-Owner: Cboltz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits