http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95751
Revision: 95751
Author: catrope
Date: 2011-08-30 10:19:23 +0000 (Tue, 30 Aug 2011)
Log Message:
-----------
RL2: Rename 'section' to 'category' throughout, except in SpecialGadgets
(broken), the tests (broken) and SpecialGadgetManager (which Timo is rewriting)
Modified Paths:
--------------
branches/RL2/extensions/Gadgets/GadgetHooks.php
branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php
branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php
branches/RL2/extensions/Gadgets/backend/Gadget.php
Modified: branches/RL2/extensions/Gadgets/GadgetHooks.php
===================================================================
--- branches/RL2/extensions/Gadgets/GadgetHooks.php 2011-08-30 10:08:33 UTC
(rev 95750)
+++ branches/RL2/extensions/Gadgets/GadgetHooks.php 2011-08-30 10:19:23 UTC
(rev 95751)
@@ -40,29 +40,29 @@
$repo = new LocalGadgetRepo( array() );
$gadgets = $repo->getGadgetNames();
- $sections = array(); // array( section => array( desc => name )
)
+ $categories = array(); // array( category => array( desc =>
name ) )
$default = array(); // array of Gadget names
foreach ( $gadgets as $name ) {
$gadget = $repo->getGadget( $name );
if ( !$gadget->isAllowed( $user ) ||
$gadget->isHidden() ) {
continue;
}
- $section = $gadget->getSection();
+ $category = $gadget->getCategory();
- // Add the Gadget to the right section
+ // Add the Gadget to the right category
$description = wfMessage( $gadget->getDescriptionMsg()
)->parse();
- $sections[$section][$description] = $name;
+ $categories[$category][$description] = $name;
// Add the Gadget to the default list if enabled
if ( $gadget->isEnabledForUser( $user ) ) {
$default[] = $name;
}
}
- $options = array(); // array( desc1 => name1, section1 =>
array( desc2 => name2 ) )
- foreach ( $sections as $section => $gadgets ) {
- if ( $section !== '' ) {
- $sectionMsg = wfMsgExt(
"gadget-section-$section", 'parseinline' );
- $options[$sectionMsg] = $gadgets;
+ $options = array(); // array( desc1 => name1, category1 =>
array( desc2 => name2 ) )
+ foreach ( $categories as $category => $gadgets ) {
+ if ( $category !== '' ) {
+ $categoryMsg = wfMsgExt(
"gadgetcategory-$category", 'parseinline' );
+ $options[$categoryMsg] = $gadgets;
} else {
$options += $gadgets;
}
Modified: branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php
===================================================================
--- branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php
2011-08-30 10:08:33 UTC (rev 95750)
+++ branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php
2011-08-30 10:19:23 UTC (rev 95751)
@@ -52,10 +52,10 @@
}
if ( $category !== "" ) {
if ( isset( $this->props['desc'] ) ) {
- $row['desc'] = wfMessage(
"gadget-section-$category" )->parse();
+ $row['desc'] = wfMessage(
"gadgetcategory-$category" )->parse();
}
if ( isset( $this->props['desc-raw'] )
) {
- $row['desc-raw'] = wfMessage(
"gadget-section-$category" )->plain();
+ $row['desc-raw'] = wfMessage(
"gadgetcategory-$category" )->plain();
}
}
if ( isset( $this->props['members'] ) ) {
Modified: branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php
===================================================================
--- branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php 2011-08-30
10:08:33 UTC (rev 95750)
+++ branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php 2011-08-30
10:19:23 UTC (rev 95751)
@@ -90,7 +90,7 @@
$row['desc-raw'] = $row['desc'] = wfMessage(
$g->getDescriptionMsg() )->plain();
}
if ( isset( $this->props['category'] ) ) {
- $row['category'] = $g->getSection(); // TODO:
clean up category vs. section mess in favor category
+ $row['category'] = $g->getCategory();
}
if ( isset( $this->props['resourceloader'] ) /*&&
$g->supportsResourceLoader()*/ ) {
// Everything supports resourceloader now :D
@@ -132,7 +132,7 @@
&& ( !$this->listAllowed || $gadget->isAllowed( $wgUser
) )
&& ( !$this->listEnabled || $gadget->isEnabled( $wgUser
) )
&& ( !$this->listShared || $gadget->isShared() )
- && ( !$this->categories || isset(
$this->categories[$g->getSection()] ) );
+ && ( !$this->categories || isset(
$this->categories[$g->getCategory()] ) );
}
public function getAllowedParams() {
Modified: branches/RL2/extensions/Gadgets/backend/Gadget.php
===================================================================
--- branches/RL2/extensions/Gadgets/backend/Gadget.php 2011-08-30 10:08:33 UTC
(rev 95750)
+++ branches/RL2/extensions/Gadgets/backend/Gadget.php 2011-08-30 10:19:23 UTC
(rev 95751)
@@ -13,8 +13,10 @@
* "hidden": false,
* // Whether this gadget is shared
* "shared": true,
- * // The key of the section this gadget belongs to. The section title
message key is gadgetsection-$section-title
- * "section": "key of gadget section",
+ * // The key of the category this gadget belongs to
+ * // Interface message is "gadgetcategory-{category}"
+ * // If this is an empty string, the gadget is uncategorized
+ * "category": "maintenance-tools"
* },
* "module": {
* // Scripts and styles are pages in NS_GADGET
@@ -126,11 +128,11 @@
}
/**
- * Get the section (also called category) this gadget is in.
- * @return string Section key or empty string if not in any section
+ * Get the name of the category this gadget is in.
+ * @return string Category key or empty string if not in any category
*/
- public function getSection() {
- return $this->settings['section'];
+ public function getCategory() {
+ return $this->settings['category'];
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs