Index: trunk/extensions/Translate/specials/SpecialTranslate.php |
— | — | @@ -195,7 +195,7 @@ |
196 | 196 | |
197 | 197 | // These are used, in the $$g black magic below. Do not remove! |
198 | 198 | $task = $this->taskSelector(); |
199 | | - $group = $this->groupSelector(); |
| 199 | + $group = TranslateUtils::groupSelector( $this->group )->getHTML(); |
200 | 200 | $language = $this->languageSelector(); |
201 | 201 | $limit = $this->limitSelector(); |
202 | 202 | |
— | — | @@ -242,20 +242,6 @@ |
243 | 243 | |
244 | 244 | /* Selectors ahead */ |
245 | 245 | |
246 | | - protected function groupSelector() { |
247 | | - $groups = MessageGroups::getAllGroups(); |
248 | | - $selector = new XmlSelect( 'group', 'group' ); |
249 | | - $selector->setDefault( $this->options['group'] ); |
250 | | - |
251 | | - foreach ( $groups as $id => $class ) { |
252 | | - if ( MessageGroups::getGroup( $id )->exists() ) { |
253 | | - $selector->addOption( $class->getLabel(), $id ); |
254 | | - } |
255 | | - } |
256 | | - |
257 | | - return $selector->getHTML(); |
258 | | - } |
259 | | - |
260 | 246 | protected function taskSelector( $pageTranslation = false ) { |
261 | 247 | $selector = new XmlSelect( 'task', 'task' ); |
262 | 248 | $selector->setDefault( $this->options['task'] ); |
Index: trunk/extensions/Translate/specials/SpecialMessageGroupStats.php |
— | — | @@ -52,20 +52,6 @@ |
53 | 53 | return ''; |
54 | 54 | } |
55 | 55 | |
56 | | - /// @todo duplicated code |
57 | | - protected function groupSelector( $default ) { |
58 | | - $groups = MessageGroups::getAllGroups(); |
59 | | - $selector = new XmlSelect( 'group', 'group', $default ); |
60 | | - |
61 | | - foreach ( $groups as $id => $class ) { |
62 | | - if ( MessageGroups::getGroup( $id )->exists() ) { |
63 | | - $selector->addOption( $class->getLabel(), $id ); |
64 | | - } |
65 | | - } |
66 | | - |
67 | | - return $selector->getHTML(); |
68 | | - } |
69 | | - |
70 | 56 | /// Overwriten from SpecialLanguageStats |
71 | 57 | function getform() { |
72 | 58 | global $wgScript; |
— | — | @@ -83,7 +69,7 @@ |
84 | 70 | $out .= Xml::label( wfMsg( 'translate-mgs-group' ), 'group' ); |
85 | 71 | $out .= Html::closeElement( 'td' ); |
86 | 72 | $out .= Html::openElement( 'td', array( 'class' => 'mw-input' ) ); |
87 | | - $out .= $this->groupSelector( $this->target ); |
| 73 | + $out .= TranslateUtils::groupSelector( $this->target )->getHTML(); |
88 | 74 | $out .= Html::closeElement( 'td' ); |
89 | 75 | $out .= Html::closeElement( 'tr' ); |
90 | 76 | |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -218,9 +218,6 @@ |
219 | 219 | return $selector->getHTML(); |
220 | 220 | } |
221 | 221 | |
222 | | - /// \array Cached message index. |
223 | | - static $mi = null; |
224 | | - |
225 | 222 | /** |
226 | 223 | * Returns the primary group message belongs to. |
227 | 224 | * @param $namespace \int |
— | — | @@ -321,4 +318,17 @@ |
322 | 319 | return "$dir/$filename"; |
323 | 320 | } |
324 | 321 | |
| 322 | + public static function groupSelector( $default = false ) { |
| 323 | + $groups = MessageGroups::getAllGroups(); |
| 324 | + $selector = new XmlSelect( 'group', 'group', $default ); |
| 325 | + |
| 326 | + foreach ( $groups as $id => $class ) { |
| 327 | + if ( MessageGroups::getGroup( $id )->exists() ) { |
| 328 | + $selector->addOption( $class->getLabel(), $id ); |
| 329 | + } |
| 330 | + } |
| 331 | + |
| 332 | + return $selector; |
| 333 | + } |
| 334 | + |
325 | 335 | } |