| Index: branches/RL2/extensions/Gadgets/GadgetHooks.php |
| — | — | @@ -40,29 +40,29 @@ |
| 41 | 41 | $repo = new LocalGadgetRepo( array() ); |
| 42 | 42 | |
| 43 | 43 | $gadgets = $repo->getGadgetNames(); |
| 44 | | - $sections = array(); // array( section => array( desc => name ) ) |
| | 44 | + $categories = array(); // array( category => array( desc => name ) ) |
| 45 | 45 | $default = array(); // array of Gadget names |
| 46 | 46 | foreach ( $gadgets as $name ) { |
| 47 | 47 | $gadget = $repo->getGadget( $name ); |
| 48 | 48 | if ( !$gadget->isAllowed( $user ) || $gadget->isHidden() ) { |
| 49 | 49 | continue; |
| 50 | 50 | } |
| 51 | | - $section = $gadget->getSection(); |
| | 51 | + $category = $gadget->getCategory(); |
| 52 | 52 | |
| 53 | | - // Add the Gadget to the right section |
| | 53 | + // Add the Gadget to the right category |
| 54 | 54 | $description = wfMessage( $gadget->getDescriptionMsg() )->parse(); |
| 55 | | - $sections[$section][$description] = $name; |
| | 55 | + $categories[$category][$description] = $name; |
| 56 | 56 | // Add the Gadget to the default list if enabled |
| 57 | 57 | if ( $gadget->isEnabledForUser( $user ) ) { |
| 58 | 58 | $default[] = $name; |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | | - $options = array(); // array( desc1 => name1, section1 => array( desc2 => name2 ) ) |
| 63 | | - foreach ( $sections as $section => $gadgets ) { |
| 64 | | - if ( $section !== '' ) { |
| 65 | | - $sectionMsg = wfMsgExt( "gadget-section-$section", 'parseinline' ); |
| 66 | | - $options[$sectionMsg] = $gadgets; |
| | 62 | + $options = array(); // array( desc1 => name1, category1 => array( desc2 => name2 ) ) |
| | 63 | + foreach ( $categories as $category => $gadgets ) { |
| | 64 | + if ( $category !== '' ) { |
| | 65 | + $categoryMsg = wfMsgExt( "gadgetcategory-$category", 'parseinline' ); |
| | 66 | + $options[$categoryMsg] = $gadgets; |
| 67 | 67 | } else { |
| 68 | 68 | $options += $gadgets; |
| 69 | 69 | } |
| Index: branches/RL2/extensions/Gadgets/backend/Gadget.php |
| — | — | @@ -13,8 +13,10 @@ |
| 14 | 14 | * "hidden": false, |
| 15 | 15 | * // Whether this gadget is shared |
| 16 | 16 | * "shared": true, |
| 17 | | - * // The key of the section this gadget belongs to. The section title message key is gadgetsection-$section-title |
| 18 | | - * "section": "key of gadget section", |
| | 17 | + * // The key of the category this gadget belongs to |
| | 18 | + * // Interface message is "gadgetcategory-{category}" |
| | 19 | + * // If this is an empty string, the gadget is uncategorized |
| | 20 | + * "category": "maintenance-tools" |
| 19 | 21 | * }, |
| 20 | 22 | * "module": { |
| 21 | 23 | * // Scripts and styles are pages in NS_GADGET |
| — | — | @@ -126,11 +128,11 @@ |
| 127 | 129 | } |
| 128 | 130 | |
| 129 | 131 | /** |
| 130 | | - * Get the section (also called category) this gadget is in. |
| 131 | | - * @return string Section key or empty string if not in any section |
| | 132 | + * Get the name of the category this gadget is in. |
| | 133 | + * @return string Category key or empty string if not in any category |
| 132 | 134 | */ |
| 133 | | - public function getSection() { |
| 134 | | - return $this->settings['section']; |
| | 135 | + public function getCategory() { |
| | 136 | + return $this->settings['category']; |
| 135 | 137 | } |
| 136 | 138 | |
| 137 | 139 | /** |
| Index: branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php |
| — | — | @@ -90,7 +90,7 @@ |
| 91 | 91 | $row['desc-raw'] = $row['desc'] = wfMessage( $g->getDescriptionMsg() )->plain(); |
| 92 | 92 | } |
| 93 | 93 | if ( isset( $this->props['category'] ) ) { |
| 94 | | - $row['category'] = $g->getSection(); // TODO: clean up category vs. section mess in favor category |
| | 94 | + $row['category'] = $g->getCategory(); |
| 95 | 95 | } |
| 96 | 96 | if ( isset( $this->props['resourceloader'] ) /*&& $g->supportsResourceLoader()*/ ) { |
| 97 | 97 | // Everything supports resourceloader now :D |
| — | — | @@ -132,7 +132,7 @@ |
| 133 | 133 | && ( !$this->listAllowed || $gadget->isAllowed( $wgUser ) ) |
| 134 | 134 | && ( !$this->listEnabled || $gadget->isEnabled( $wgUser ) ) |
| 135 | 135 | && ( !$this->listShared || $gadget->isShared() ) |
| 136 | | - && ( !$this->categories || isset( $this->categories[$g->getSection()] ) ); |
| | 136 | + && ( !$this->categories || isset( $this->categories[$g->getCategory()] ) ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public function getAllowedParams() { |
| Index: branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php |
| — | — | @@ -52,10 +52,10 @@ |
| 53 | 53 | } |
| 54 | 54 | if ( $category !== "" ) { |
| 55 | 55 | if ( isset( $this->props['desc'] ) ) { |
| 56 | | - $row['desc'] = wfMessage( "gadget-section-$category" )->parse(); |
| | 56 | + $row['desc'] = wfMessage( "gadgetcategory-$category" )->parse(); |
| 57 | 57 | } |
| 58 | 58 | if ( isset( $this->props['desc-raw'] ) ) { |
| 59 | | - $row['desc-raw'] = wfMessage( "gadget-section-$category" )->plain(); |
| | 59 | + $row['desc-raw'] = wfMessage( "gadgetcategory-$category" )->plain(); |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | if ( isset( $this->props['members'] ) ) { |