Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -194,6 +194,13 @@ |
195 | 195 | |
196 | 196 | $wgResourceModules['ext.translate.special.translate'] = array( |
197 | 197 | 'styles' => 'resources/ext.translate.special.translate.css', |
| 198 | + 'scripts' => 'resources/ext.translate.special.translate.js', |
| 199 | + 'position' => 'top', |
| 200 | + 'messages' => array( |
| 201 | + 'translate-workflow-set-do', |
| 202 | + 'translate-workflow-set-doing', |
| 203 | + 'translate-workflow-set-done', |
| 204 | + ), |
198 | 205 | ) + $resourcePaths; |
199 | 206 | |
200 | 207 | $wgResourceModules['ext.translate.special.supportedlanguages'] = array( |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -399,6 +399,12 @@ |
400 | 400 | 'log-description-translationreview' => 'Log of all reviews to translations and message groups.', |
401 | 401 | 'logentry-translationreview-message' => '$1 {{GENDER:$2|accepted}} translation $3', |
402 | 402 | |
| 403 | + 'translate-workflow-state-' => '(unset)', |
| 404 | + 'translate-workflowstatus' => 'Status: $1', |
| 405 | + 'translate-workflow-set-do' => 'Set', |
| 406 | + 'translate-workflow-set-doing' => 'Setting...', |
| 407 | + 'translate-workflow-set-done' => 'Set!', |
| 408 | + |
403 | 409 | ); |
404 | 410 | |
405 | 411 | /** Message documentation (Message documentation) |
— | — | @@ -625,6 +631,12 @@ |
626 | 632 | 'translate-messagereview-no-fuzzy' => 'Tooltip for disabled review button', |
627 | 633 | 'translate-messagereview-no-own' => 'Tooltip for disabled review button', |
628 | 634 | 'translate-messagereview-doit' => 'Tooltip for review button', |
| 635 | + |
| 636 | + 'translate-workflow-state-' => 'Unselectable select option in Special:Translate if workflow state editing is on', |
| 637 | + 'translate-workflowstatus' => 'In Special:Translate if workflow states are in use, $1 is selector or the current state', |
| 638 | + 'translate-workflow-set-do' => 'Submit button text when active', |
| 639 | + 'translate-workflow-set-doing' => 'Submit button text when waiting for reply from server', |
| 640 | + 'translate-workflow-set-done' => 'Submit button text when submission completed succesfully', |
629 | 641 | ); |
630 | 642 | |
631 | 643 | /** Faeag Rotuma (Faeag Rotuma) |
Index: trunk/extensions/Translate/specials/SpecialTranslate.php |
— | — | @@ -132,13 +132,18 @@ |
133 | 133 | $note = wfMessage( 'translate-page-description-hasoptional' )->rawParams( $link )->parseAsBlock(); |
134 | 134 | |
135 | 135 | if ( $description ) { |
136 | | - $description .= '<hr>' . $note; |
| 136 | + $description .= '<br>' . $note; |
137 | 137 | } else { |
138 | 138 | $description = $note; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
| 143 | + $status = $this->getWorkflowStatus(); |
| 144 | + if ( $status !== false ) { |
| 145 | + $description = $status . $description; |
| 146 | + } |
| 147 | + |
143 | 148 | if ( $description ) { |
144 | 149 | $description = Xml::fieldset( wfMsg( 'translate-page-description-legend' ), $description ); |
145 | 150 | } |
— | — | @@ -466,4 +471,50 @@ |
467 | 472 | |
468 | 473 | return $out; |
469 | 474 | } |
| 475 | + |
| 476 | + protected function getWorkflowStatus() { |
| 477 | + global $wgTranslateWorkflowStates, $wgUser; |
| 478 | + if ( !$wgTranslateWorkflowStates ) { |
| 479 | + return false; |
| 480 | + } |
| 481 | + |
| 482 | + $dbr = wfGetDB( DB_SLAVE ); |
| 483 | + $current = $dbr->selectField( |
| 484 | + 'translate_groupreviews', |
| 485 | + 'tgr_state', |
| 486 | + array( 'tgr_group' => $this->options['group'], 'tgr_lang' => $this->options['language'] ), |
| 487 | + __METHOD__ |
| 488 | + ); |
| 489 | + |
| 490 | + if ( $wgUser->isAllowed( 'translate-groupreview' ) ) { |
| 491 | + $selector = new XmlSelect( 'workflow' ); |
| 492 | + |
| 493 | + $selector->setAttribute( 'class', 'mw-translate-workflowselector' ); |
| 494 | + $selector->setDefault( $current ); |
| 495 | + $selector->addOption( wfMessage( 'translate-workflow-state-' )->text(), '' ); |
| 496 | + foreach ( $wgTranslateWorkflowStates as $state ) { |
| 497 | + $selector->addOption( $state ); |
| 498 | + } |
| 499 | + $state = $selector->getHTML(); |
| 500 | + |
| 501 | + $attributes = array( |
| 502 | + 'type' => 'button', |
| 503 | + 'id' => 'mw-translate-workflowset', |
| 504 | + 'data-token' => ApiGroupReview::getToken( 0, '' ), |
| 505 | + 'data-group' => $this->options['group'], |
| 506 | + 'data-language' => $this->options['language'], |
| 507 | + 'style' => 'visibility: hidden;', |
| 508 | + 'value' => 'Set', |
| 509 | + ); |
| 510 | + $state .= Html::element( 'input', $attributes ); |
| 511 | + } elseif ( strval( $current ) !== '' ) { |
| 512 | + $state = $current; |
| 513 | + } else { |
| 514 | + $state = wfMessage( 'translate-workflow-state-' )->escaped(); |
| 515 | + } |
| 516 | + |
| 517 | + $message = wfMessage( 'translate-workflowstatus' )->rawParams( $state ); |
| 518 | + $box = Html::rawElement( 'div', array( 'id' => 'mw-sp-translate-workflow' ), $message->escaped() ); |
| 519 | + return $box; |
| 520 | + } |
470 | 521 | } |
Index: trunk/extensions/Translate/resources/ext.translate.special.translate.css |
— | — | @@ -36,4 +36,17 @@ |
37 | 37 | border-spacing: 12pt 5pt; |
38 | 38 | background-color: inherit; |
39 | 39 | font-weight: bold; |
40 | | -} |
\ No newline at end of file |
| 40 | +} |
| 41 | + |
| 42 | +#mw-sp-translate-workflow { |
| 43 | + float: right; |
| 44 | + vertical-align: middle; |
| 45 | + padding: 0.5em; |
| 46 | + margin-left: 20px; |
| 47 | + margin-bottom: 20px; |
| 48 | + margin-right: -1em; |
| 49 | + margin-top: -1em; |
| 50 | + border-bottom: 2px dotted #666; |
| 51 | + border-left: 1px dotted #AAA; |
| 52 | + border-bottom-left-radius: 10px; |
| 53 | +} |