Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -108,6 +108,8 @@ |
109 | 109 | $wgHooks['ArticleSaveComplete'][] = 'TranslateEditAddons::onSave'; |
110 | 110 | $wgHooks['Translate:newTranslation'][] = 'TranslateEditAddons::updateTransverTag'; |
111 | 111 | |
| 112 | +$wgHooks['SkinTemplateNavigation::SpecialPage'][] = 'SpecialTranslate::tabify'; |
| 113 | + |
112 | 114 | // Custom preferences |
113 | 115 | $wgDefaultUserOptions['translate'] = 0; |
114 | 116 | $wgDefaultUserOptions['translate-editlangs'] = 'default'; |
— | — | @@ -196,6 +198,11 @@ |
197 | 199 | ), |
198 | 200 | ) + $resourcePaths; |
199 | 201 | |
| 202 | +$wgResourceModules['ext.translate.tabgroup'] = array( |
| 203 | + 'styles' => 'resources/ext.translate.tabgroup.css', |
| 204 | + 'position' => 'top', |
| 205 | +) + $resourcePaths; |
| 206 | + |
200 | 207 | $wgResourceModules['ext.translate.quickedit'] = array( |
201 | 208 | 'scripts' => 'resources/ext.translate.quickedit.js', |
202 | 209 | 'styles' => 'resources/ext.translate.quickedit.css', |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -21,22 +21,23 @@ |
22 | 22 | Click the message group name to view a list of untranslated messages.', |
23 | 23 | 'translate-grouplisting-empty' => 'No message groups have been configured for translation.', |
24 | 24 | |
25 | | - 'translate-task-view' => 'View all messages from', |
26 | | - 'translate-task-untranslated' => 'View all untranslated messages from', |
27 | | - 'translate-task-optional' => 'View optional messages from', |
28 | | - 'translate-task-suggestions' => 'View messages with suggestions from translation memory', |
29 | | - 'translate-task-untranslatedoptional' => 'View untranslated optional messages from', |
30 | | - 'translate-task-problematic' => 'View messages that have problems', |
31 | | - 'translate-task-review' => 'Review changes to', |
32 | | - 'translate-task-acceptqueue' => 'Accept translations in', |
33 | | - 'translate-task-reviewall' => 'Review all translated messages in', |
34 | | - 'translate-task-export' => 'Export translations', |
35 | | - 'translate-task-export-to-file' => 'Export translations to file', |
36 | | - 'translate-task-export-as-po' => 'Export translations for off-line translation', |
37 | | - 'translate-task-export-to-xliff' => 'Export translations in Xliff format', |
| 25 | + 'translate-taskui-view' => 'Show all messages', |
| 26 | + 'translate-taskui-untranslated' => 'Show untranslated messages', |
| 27 | + 'translate-taskui-optional' => 'Show optional messages', |
| 28 | + 'translate-taskui-suggestions' => 'Show messages with suggestions from translation memory', |
| 29 | + 'translate-taskui-acceptqueue' => 'Only messages I can accept', |
| 30 | + 'translate-taskui-reviewall' => 'Review all translations', |
| 31 | + 'translate-taskui-export-to-file' => 'Export in native format', |
| 32 | + 'translate-taskui-export-as-po' => 'Export for off-line translation', |
38 | 33 | |
| 34 | + 'translate-taction-translate' => 'Translate', |
| 35 | + 'translate-taction-proofread' => 'Proofread', |
| 36 | + 'translate-taction-lstats' => 'Language statistics', |
| 37 | + 'translate-taction-mstats' => 'Message group statistics', |
| 38 | + 'translate-taction-export' => 'Export', |
| 39 | + 'translate-taction-disabled' => 'This action is disabled on this wiki.', |
| 40 | + |
39 | 41 | 'translate-page-no-such-language' => 'Specified language was invalid.', |
40 | | - 'translate-page-no-such-task' => 'Specified task was invalid.', |
41 | 42 | 'translate-page-no-such-group' => 'Specified group was invalid.', |
42 | 43 | |
43 | 44 | 'translate-page-disabled' => "Translations to this language in this group have been disabled. |
— | — | @@ -45,7 +46,6 @@ |
46 | 47 | ''$1''", |
47 | 48 | |
48 | 49 | 'translate-page-settings-legend' => 'Settings', |
49 | | - 'translate-page-task' => 'I want to', |
50 | 50 | 'translate-page-group' => 'Group', |
51 | 51 | 'translate-page-language' => 'Language', |
52 | 52 | 'translate-page-limit' => 'Limit', |
Index: trunk/extensions/Translate/specials/SpecialTranslate.php |
— | — | @@ -57,8 +57,6 @@ |
58 | 58 | |
59 | 59 | $this->setup( $parameters ); |
60 | 60 | |
61 | | - $errors = array(); |
62 | | - |
63 | 61 | if ( $this->options['group'] === '' ) { |
64 | 62 | TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Translation_example' ); |
65 | 63 | $this->groupInformation(); |
— | — | @@ -66,19 +64,14 @@ |
67 | 65 | } |
68 | 66 | |
69 | 67 | $codes = Language::getLanguageNames( false ); |
70 | | - |
| 68 | + $errors = array(); |
71 | 69 | if ( !$this->options['language'] || !isset( $codes[$this->options['language']] ) ) { |
72 | | - $errors['language'] = wfMsgExt( 'translate-page-no-such-language', array( 'parse' ) ); |
| 70 | + $errors['language'] = wfMessage( 'translate-page-no-such-language' )->text(); |
73 | 71 | $this->options['language'] = $this->defaults['language']; |
74 | 72 | } |
75 | 73 | |
76 | | - if ( !$this->task instanceof TranslateTask ) { |
77 | | - $errors['task'] = wfMsgExt( 'translate-page-no-such-task', array( 'parse' ) ); |
78 | | - $this->options['task'] = $this->defaults['task']; |
79 | | - } |
80 | | - |
81 | 74 | if ( !$this->group instanceof MessageGroup ) { |
82 | | - $errors['group'] = wfMsgExt( 'translate-page-no-such-group', array( 'parse' ) ); |
| 75 | + $errors['group'] = wfMessage( 'translate-page-no-such-group' )->text(); |
83 | 76 | $this->options['group'] = $this->defaults['group']; |
84 | 77 | } |
85 | 78 | |
— | — | @@ -113,6 +106,9 @@ |
114 | 107 | ); |
115 | 108 | |
116 | 109 | // Initialise and get output. |
| 110 | + if ( !$this->task ) { |
| 111 | + return; |
| 112 | + } |
117 | 113 | $this->task->init( $this->group, $taskOptions ); |
118 | 114 | $output = $this->task->execute(); |
119 | 115 | |
— | — | @@ -154,6 +150,8 @@ |
155 | 151 | |
156 | 152 | if ( $this->paging['count'] === 0 ) { |
157 | 153 | $wgOut->addHTML( $description . $links ); |
| 154 | + } elseif( $this->paging['count'] === $this->paging['total'] ) { |
| 155 | + $wgOut->addHTML( $description . $output . $links ); |
158 | 156 | } else { |
159 | 157 | $wgOut->addHTML( $description . $links . $output . $links ); |
160 | 158 | } |
— | — | @@ -164,6 +162,7 @@ |
165 | 163 | global $wgUser, $wgRequest; |
166 | 164 | |
167 | 165 | $defaults = array( |
| 166 | + /* str */ 'taction' => 'translate', |
168 | 167 | /* str */ 'task' => 'untranslated', |
169 | 168 | /* str */ 'sort' => 'normal', |
170 | 169 | /* str */ 'language' => $wgUser->getOption( 'language' ), |
— | — | @@ -208,6 +207,19 @@ |
209 | 208 | wfAppendToArrayIfNotDefault( $v, $r, $defaults, $nondefaults ); |
210 | 209 | } |
211 | 210 | |
| 211 | + // Fix defaults based on what we got |
| 212 | + if ( isset( $nondefaults['taction'] ) ) { |
| 213 | + if ( $nondefaults['taction'] === 'proofread' ) { |
| 214 | + if ( $wgUser->isAllowed( 'translate-messagereview' ) ) { |
| 215 | + $defaults['task'] = 'acceptqueue'; |
| 216 | + } else { |
| 217 | + $defaults['task'] = 'reviewall'; |
| 218 | + } |
| 219 | + } elseif( $nondefaults['taction'] === 'export' ) { |
| 220 | + $defaults['task'] = ''; |
| 221 | + } |
| 222 | + } |
| 223 | + |
212 | 224 | $this->defaults = $defaults; |
213 | 225 | $this->nondefaults = $nondefaults; |
214 | 226 | $this->options = $nondefaults + $defaults; |
— | — | @@ -221,35 +233,51 @@ |
222 | 234 | } |
223 | 235 | |
224 | 236 | protected function settingsForm( $errors ) { |
225 | | - global $wgScript; |
| 237 | + global $wgScript, $wgUser; |
| 238 | + $user = $wgUser; |
226 | 239 | |
227 | | - // These are used, in the $$g black magic below. Do not remove! |
228 | | - $task = $this->taskSelector(); |
229 | | - $group = $this->groupSelector(); |
230 | | - $language = $this->languageSelector(); |
231 | | - $limit = $this->limitSelector(); |
| 240 | + $taction = $this->options['taction']; |
232 | 241 | |
233 | | - $button = Xml::submitButton( wfMsg( 'translate-submit' ) ); |
| 242 | + $selectors = array( |
| 243 | + 'group' => $this->groupSelector(), |
| 244 | + 'language' => $this->languageSelector(), |
| 245 | + 'limit' => $this->limitSelector(), |
| 246 | + ); |
234 | 247 | |
| 248 | + if ( $taction === 'export' ) { |
| 249 | + unset( $selectors['limit'] ); |
| 250 | + } |
| 251 | + |
235 | 252 | $options = array(); |
236 | | - |
237 | | - foreach ( array( 'task', 'group', 'language', 'limit' ) as $g ) { |
| 253 | + foreach ( $selectors as $g => $selector ) { |
238 | 254 | $options[] = self::optionRow( |
239 | | - Xml::tags( 'label', array( 'for' => $g ), wfMsgExt( 'translate-page-' . $g, 'escapenoentities' ) ), |
240 | | - $$g, |
| 255 | + wfMessage( 'translate-page-' . $g )->escaped(), |
| 256 | + $selector, |
241 | 257 | array_key_exists( $g, $errors ) ? $errors[$g] : null |
242 | 258 | ); |
243 | 259 | } |
244 | 260 | |
| 261 | + if ( $taction === 'proofread' ) { |
| 262 | + $extra = $this->taskLinks( array( 'acceptqueue', 'reviewall' ) ); |
| 263 | + } elseif ( $taction === 'translate' ) { |
| 264 | + $extra = $this->taskLinks( array( 'untranslated', 'view', 'optional', 'suggestions' ) ); |
| 265 | + } elseif ( $taction === 'export' ) { |
| 266 | + $extra = $this->taskLinks( array( 'export-as-po', 'export-to-file' ) ); |
| 267 | + } else { |
| 268 | + $extra = ''; |
| 269 | + } |
| 270 | + |
| 271 | + $nonEssential = Html::rawElement( 'span', array( 'class' => 'mw-sp-translate-nonessential' ), implode( "", $options ) ); |
| 272 | + |
| 273 | + $button = Xml::submitButton( wfMsg( 'translate-submit' ) ); |
| 274 | + |
245 | 275 | $form = |
246 | 276 | Html::openElement( 'fieldset', array( 'class' => 'mw-sp-translate-settings' ) ) . |
247 | 277 | Html::element( 'legend', null, wfMsg( 'translate-page-settings-legend' ) ) . |
248 | 278 | Html::openElement( 'form', array( 'action' => $wgScript, 'method' => 'get' ) ) . |
249 | 279 | Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . |
250 | | - Html::openElement( 'table' ) . |
251 | | - implode( "", $options ) . |
252 | | - self::optionRow( $button, ' ' ) . |
253 | | - Html::closeElement( 'table' ) . |
| 280 | + Html::hidden( 'taction', $this->options['taction'] ) . |
| 281 | + "$nonEssential\n$extra\n$button\n" . |
254 | 282 | Html::closeElement( 'form' ) . |
255 | 283 | Html::closeElement( 'fieldset' ); |
256 | 284 | return $form; |
— | — | @@ -263,29 +291,58 @@ |
264 | 292 | */ |
265 | 293 | private static function optionRow( $label, $option, $error = null ) { |
266 | 294 | return |
267 | | - Html::openElement( 'tr' ) . |
268 | | - Html::rawElement( 'td', null, $label ) . |
269 | | - Html::rawElement( 'td', null, $option ) . |
270 | | - ( $error ? Html::rawElement( 'td', array( 'class' => 'mw-sp-translate-error' ), $error ) : '' ) . |
271 | | - Html::closeElement( 'tr' ); |
| 295 | + "<label>$label $option</label>" . |
| 296 | + ( $error ? Html::rawElement( 'span', array( 'class' => 'mw-sp-translate-error' ), $error ) : '' ) . ' '; |
272 | 297 | } |
273 | 298 | |
274 | | - /* Selectors ahead */ |
275 | | - |
276 | | - protected function taskSelector( $pageTranslation = false ) { |
| 299 | + protected function taskLinks( $tasks ) { |
277 | 300 | global $wgUser; |
278 | | - $selector = new XmlSelect( 'task', 'task' ); |
279 | | - $selector->setDefault( $this->options['task'] ); |
| 301 | + $user = $wgUser; |
280 | 302 | |
281 | | - $isPageTranslation = $this->group instanceof WikiPageMessageGroup; |
282 | | - foreach ( TranslateTasks::getTasks( $isPageTranslation ) as $id ) { |
283 | | - if ( TranslateTasks::getTask( $id )->isAllowedFor( $wgUser ) ) { |
284 | | - $label = TranslateTask::labelForTask( $id ); |
285 | | - $selector->addOption( $label, $id ); |
| 303 | + foreach ( $tasks as $index => $id ) { |
| 304 | + $task = TranslateTasks::getTask( $id ); |
| 305 | + if ( !$task ) { |
| 306 | + unset( $tasks[$index] ); |
| 307 | + continue; |
286 | 308 | } |
| 309 | + |
| 310 | + if ( !$task->isAllowedFor( $user ) ) { |
| 311 | + unset( $tasks[$index] ); |
| 312 | + continue; |
| 313 | + } |
287 | 314 | } |
288 | 315 | |
289 | | - return $selector->getHTML(); |
| 316 | + $sep = Html::element( 'br' ); |
| 317 | + $count = count( $tasks ); |
| 318 | + if ( $count === 0 ) { |
| 319 | + return $sep . wfMessage( 'translate-taction-disabled' )->escaped(); |
| 320 | + } elseif ( $count === 1 ) { |
| 321 | + $id = array_pop( $tasks ); |
| 322 | + // If there is only one task, and it is the default task, hide it. |
| 323 | + // If someone disables the default task for action, we will show |
| 324 | + // a list of alternative task(s), but not showing anything |
| 325 | + // by default. */ |
| 326 | + if ( $this->defaults['task'] === $id ) { |
| 327 | + return ''; |
| 328 | + } |
| 329 | + return $sep . Xml::radioLabel( |
| 330 | + wfMessage( "translate-taskui-$id" )->text(), |
| 331 | + 'task', $id, 'task', // Name, value, id |
| 332 | + true // Selected |
| 333 | + ); |
| 334 | + } else { |
| 335 | + $output = ''; |
| 336 | + foreach ( $tasks as $index => $id ) { |
| 337 | + $output .= Xml::radioLabel( |
| 338 | + wfMessage( "translate-taskui-$id" )->text(), |
| 339 | + 'task', // Name |
| 340 | + $id, |
| 341 | + "task-$index", // id |
| 342 | + $this->options['task'] === $id |
| 343 | + ); |
| 344 | + } |
| 345 | + return $sep . $output; |
| 346 | + } |
290 | 347 | } |
291 | 348 | |
292 | 349 | protected function groupSelector() { |
— | — | @@ -488,10 +545,10 @@ |
489 | 546 | |
490 | 547 | $title = $this->getTitle(); |
491 | 548 | |
492 | | - $code = $this->options['language']; |
493 | 549 | $queryParams = array( |
494 | 550 | 'group' => $id, |
495 | | - 'language' => $code |
| 551 | + 'language' => $this->options['language'], |
| 552 | + 'taction' => $this->options['taction'], |
496 | 553 | ); |
497 | 554 | |
498 | 555 | $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker; |
— | — | @@ -583,4 +640,86 @@ |
584 | 641 | $box = Html::rawElement( 'div', array( 'id' => 'mw-sp-translate-workflow' ), $message->escaped() ); |
585 | 642 | return $box; |
586 | 643 | } |
| 644 | + |
| 645 | + /** |
| 646 | + * Adds the task-based tabs on Special:Translate and few other special pages. |
| 647 | + * Hook: SkinTemplateNavigation::SpecialPage |
| 648 | + * @since 2012-02-10 |
| 649 | + */ |
| 650 | + static function tabify( Skin $skin, array &$tabs ) { |
| 651 | + global $wgRequest, $wgOut; |
| 652 | + |
| 653 | + $title = $skin->getTitle(); |
| 654 | + list( $alias, $sub ) = SpecialPage::resolveAliasWithSubpage( $title->getText() ); |
| 655 | + |
| 656 | + $pagesInGroup = array( 'Translate', 'LanguageStats', 'MessageGroupStats' ); |
| 657 | + if ( !in_array( $alias, $pagesInGroup, true ) ) { |
| 658 | + return true; |
| 659 | + } |
| 660 | + |
| 661 | + $wgOut->addModules( 'ext.translate.tabgroup' ); |
| 662 | + |
| 663 | + // Extract subpage syntax, otherwise the values are not passed forward |
| 664 | + $params = array(); |
| 665 | + if ( trim( $sub ) !== '' ) { |
| 666 | + if ( $alias === 'Translate' || $alias === 'MessageGroupStats' ) { |
| 667 | + $params['group'] = $sub; |
| 668 | + } elseif( $alias === 'LanguageStats' ) { |
| 669 | + // Breaks if additional parameters besides language are code provided |
| 670 | + $params['language'] = $sub; |
| 671 | + } |
| 672 | + } |
| 673 | + // However, query string params take precedence |
| 674 | + $params = $wgRequest->getQueryValues() + $params; |
| 675 | + asort( $params ); |
| 676 | + |
| 677 | + $taction = $wgRequest->getVal( 'taction', 'translate' ); |
| 678 | + |
| 679 | + $translate = SpecialPage::getTitleFor( 'Translate' ); |
| 680 | + $languagestats = SpecialPage::getTitleFor( 'LanguageStats' ); |
| 681 | + $messagegroupstats = SpecialPage::getTitleFor( 'MessageGroupStats' ); |
| 682 | + |
| 683 | + |
| 684 | + unset( $params['task'] ); // Depends on taction |
| 685 | + unset( $params['taction'] ); // We're supplying this ourself |
| 686 | + unset( $params['title'] ); // As above |
| 687 | + unset( $params['x'] ); // Was posted -marker on stats pages |
| 688 | + unset( $params['suppresscomplete'] ); // Stats things, should |
| 689 | + unset( $params['suppressempty'] ); // not be passed |
| 690 | + |
| 691 | + // Clear the special page tab that might be there already |
| 692 | + $tabs['namespaces'] = array(); |
| 693 | + |
| 694 | + $tabs['namespaces']['translate'] = $data = array( |
| 695 | + 'text' => wfMessage( 'translate-taction-translate' )->text(), |
| 696 | + 'href' => $translate->getLocalUrl( array( 'taction' => 'translate' ) + $params ), |
| 697 | + 'class' => $alias === 'Translate' && $taction === 'translate' ? 'selected' : '', |
| 698 | + ); |
| 699 | + $tabs['namespaces']['proofread'] = $data = array( |
| 700 | + 'text' => wfMessage( 'translate-taction-proofread' )->text(), |
| 701 | + 'href' => $translate->getLocalUrl( array( 'taction' => 'proofread' ) + $params ), |
| 702 | + 'class' => $alias === 'Translate' && $taction === 'proofread' ? 'selected' : '', |
| 703 | + ); |
| 704 | + |
| 705 | + // Limit only applies to the above |
| 706 | + unset( $params['limit'] ); |
| 707 | + |
| 708 | + $tabs['views']['lstats'] = array( |
| 709 | + 'text' => wfMessage( 'translate-taction-lstats' )->text(), |
| 710 | + 'href' => $languagestats->getLocalUrl( $params ), |
| 711 | + 'class' => $alias === 'LanguageStats' ? 'selected' : '', |
| 712 | + ); |
| 713 | + $tabs['views']['mstats'] = array( |
| 714 | + 'text' => wfMessage( 'translate-taction-mstats' )->text(), |
| 715 | + 'href' => $messagegroupstats->getLocalUrl( $params ), |
| 716 | + 'class' => $alias === 'MessageGroupStats' ? 'selected' : '', |
| 717 | + ); |
| 718 | + $tabs['views']['export'] = array( |
| 719 | + 'text' => wfMessage( 'translate-taction-export' )->text(), |
| 720 | + 'href' => $translate->getLocalUrl( array( 'taction' => 'export' ) + $params ), |
| 721 | + 'class' => $alias === 'Translate' && $taction === 'export' ? 'selected' : '', |
| 722 | + ); |
| 723 | + |
| 724 | + return true; |
| 725 | + } |
587 | 726 | } |
Index: trunk/extensions/Translate/specials/SpecialMessageGroupStats.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | */ |
18 | 18 | class SpecialMessageGroupStats extends SpecialLanguageStats { |
19 | 19 | /// Overwritten from SpecialLanguageStats |
20 | | - protected $targetValueName = 'group'; |
| 20 | + protected $targetValueName = array( 'group' ); |
21 | 21 | /// Overwritten from SpecialLanguageStats |
22 | 22 | protected $noComplete = false; |
23 | 23 | /// Overwritten from SpecialLanguageStats |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | |
59 | 59 | /// Overwriten from SpecialLanguageStats |
60 | 60 | function getform() { |
61 | | - global $wgScript; |
| 61 | + global $wgScript, $wgRequest; |
62 | 62 | |
63 | 63 | $out = Html::openElement( 'div' ); |
64 | 64 | $out .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
— | — | @@ -96,6 +96,13 @@ |
97 | 97 | |
98 | 98 | $out .= Html::closeElement( 'table' ); |
99 | 99 | $out .= Html::closeElement( 'fieldset' ); |
| 100 | + /* Since these pages are in the tabgroup with Special:Translate, |
| 101 | + * it makes sense to retain the selected group/language parameter |
| 102 | + * on post requests even when not relevant to the current page. */ |
| 103 | + $val = $wgRequest->getVal( 'language' ); |
| 104 | + if ( $val !== null ) { |
| 105 | + $out .= Html::hidden( 'language', $val ); |
| 106 | + } |
100 | 107 | $out .= Html::closeElement( 'form' ); |
101 | 108 | $out .= Html::closeElement( 'div' ); |
102 | 109 | |
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | /** |
31 | 31 | * @var String |
32 | 32 | */ |
33 | | - protected $targetValueName = 'code'; |
| 33 | + protected $targetValueName = array( 'code', 'language' ); |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Most of the displayed numbers added together. |
— | — | @@ -117,7 +117,9 @@ |
118 | 118 | $submitted = !$this->including() && $request->getVal( 'x' ) === 'D'; |
119 | 119 | |
120 | 120 | // Default booleans to false if the form was submitted |
121 | | - $this->target = $request->getVal( $this->targetValueName, $this->target ); |
| 121 | + foreach ( $this->targetValueName as $key ) { |
| 122 | + $this->target = $request->getVal( $key, $this->target ); |
| 123 | + } |
122 | 124 | $this->noComplete = $request->getBool( 'suppresscomplete', $this->noComplete && !$submitted ); |
123 | 125 | $this->noEmpty = $request->getBool( 'suppressempty', $this->noEmpty && !$submitted ); |
124 | 126 | |
— | — | @@ -165,7 +167,7 @@ |
166 | 168 | * @todo duplicated code |
167 | 169 | */ |
168 | 170 | protected function getForm() { |
169 | | - global $wgScript; |
| 171 | + global $wgScript, $wgRequest; |
170 | 172 | |
171 | 173 | $out = Html::openElement( 'div' ); |
172 | 174 | $out .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
— | — | @@ -177,10 +179,10 @@ |
178 | 180 | |
179 | 181 | $out .= Html::openElement( 'tr' ); |
180 | 182 | $out .= Html::openElement( 'td', array( 'class' => 'mw-label' ) ); |
181 | | - $out .= Xml::label( wfMsg( 'translate-language-code-field-name' ), 'code' ); |
| 183 | + $out .= Xml::label( wfMsg( 'translate-language-code-field-name' ), 'language' ); |
182 | 184 | $out .= Html::closeElement( 'td' ); |
183 | 185 | $out .= Html::openElement( 'td', array( 'class' => 'mw-input' ) ); |
184 | | - $out .= Xml::input( 'code', 10, $this->target, array( 'id' => 'code' ) ); |
| 186 | + $out .= Xml::input( 'language', 10, $this->target, array( 'id' => 'language' ) ); |
185 | 187 | $out .= Html::closeElement( 'td' ); |
186 | 188 | $out .= Html::closeElement( 'tr' ); |
187 | 189 | |
— | — | @@ -204,6 +206,13 @@ |
205 | 207 | |
206 | 208 | $out .= Html::closeElement( 'table' ); |
207 | 209 | $out .= Html::closeElement( 'fieldset' ); |
| 210 | + /* Since these pages are in the tabgroup with Special:Translate, |
| 211 | + * it makes sense to retain the selected group/language parameter |
| 212 | + * on post requests even when not relevant to the current page. */ |
| 213 | + $val = $wgRequest->getVal( 'group' ); |
| 214 | + if ( $val !== null ) { |
| 215 | + $out .= Html::hidden( 'group', $val ); |
| 216 | + } |
208 | 217 | $out .= Html::closeElement( 'form' ); |
209 | 218 | $out .= Html::closeElement( 'div' ); |
210 | 219 | |
— | — | @@ -408,13 +417,13 @@ |
409 | 418 | |
410 | 419 | protected function getWorkflowStates() { |
411 | 420 | $db = wfGetDB( DB_SLAVE ); |
412 | | - |
413 | | - switch ( $this->targetValueName ) { |
| 421 | + $key = array_pop( $this->targetValueName ); |
| 422 | + switch ( $key ) { |
414 | 423 | case 'group': |
415 | 424 | $targetCol = 'tgr_group'; |
416 | 425 | $selectKey = 'tgr_lang'; |
417 | 426 | break; |
418 | | - case 'code': |
| 427 | + case 'language': |
419 | 428 | $targetCol = 'tgr_lang'; |
420 | 429 | $selectKey = 'tgr_group'; |
421 | 430 | break; |
Index: trunk/extensions/Translate/resources/ext.translate.special.translate.css |
— | — | @@ -1,5 +1,6 @@ |
2 | | -/* Group listing at Special:Translate */ |
3 | | - |
| 2 | +/* |
| 3 | + * Group listing at Special:Translate |
| 4 | + */ |
4 | 5 | table.mw-sp-translate-grouplist td { |
5 | 6 | min-width: 13em; |
6 | 7 | } |
— | — | @@ -23,27 +24,45 @@ |
24 | 25 | cursor: pointer; |
25 | 26 | } |
26 | 27 | |
27 | | -/* Form at Special:Translate */ |
28 | | - |
| 28 | +/* |
| 29 | + * Form at Special:Translate |
| 30 | + */ |
29 | 31 | .mw-sp-translate-error { |
30 | 32 | font-style: italic; |
31 | 33 | background-color: yellow; |
32 | | - padding-left: 3em; |
33 | | - padding-right: 3em; |
34 | 34 | } |
35 | 35 | |
36 | | -.mw-sp-translate-settings table { |
37 | | - border-spacing: 12pt 5pt; |
38 | | - background-color: inherit; |
| 36 | +/* Make the less important selectors fade to reduce the feel that |
| 37 | + * there is ton of options that need scanning and changing. Subject |
| 38 | + * to change to better solution later. */ |
| 39 | +.mw-sp-translate-nonessential { |
39 | 40 | font-weight: bold; |
| 41 | + opacity: 0.4; |
40 | 42 | } |
41 | 43 | |
| 44 | +.mw-sp-translate-nonessential:hover { |
| 45 | + opacity: 1.0; |
| 46 | +} |
| 47 | + |
| 48 | +/* This gets pretty far on wide screens... */ |
| 49 | +.mw-sp-translate-settings input[type=submit] { |
| 50 | + float: right; |
| 51 | +} |
| 52 | + |
| 53 | +/* For some reason a non-breaking space is not enough to keep the label |
| 54 | + * with the dropdown. */ |
| 55 | +.mw-sp-translate-settings label { |
| 56 | + white-space: nowrap; |
| 57 | +} |
| 58 | + |
| 59 | +/* |
| 60 | + * This reserves one corner with curvy lines for the message group status. |
| 61 | + */ |
42 | 62 | #mw-sp-translate-workflow { |
43 | 63 | float: right; |
44 | 64 | vertical-align: middle; |
45 | 65 | padding: 0.5em; |
46 | 66 | margin-left: 20px; |
47 | | - margin-bottom: 20px; |
48 | 67 | margin-right: -1em; |
49 | 68 | margin-top: -1em; |
50 | 69 | border-bottom: 2px dotted #666; |
Index: trunk/extensions/Translate/resources/ext.translate.tabgroup.css |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +/* Heading not needer for special pages in tab group */ |
| 3 | +#firstHeading { |
| 4 | + display: none; |
| 5 | +} |
| 6 | + |
| 7 | +#left-navigation .selected { |
| 8 | + font-weight: bold; |
| 9 | +} |
Property changes on: trunk/extensions/Translate/resources/ext.translate.tabgroup.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |