r101623 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101622‎ | r101623 | r101624 >
Date:13:23, 2 November 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Show message group status on Special:Translate
Also allows changing the value for privileged users.
Internationalization/#175
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/resources/ext.translate.special.translate.css (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -194,6 +194,13 @@
195195
196196 $wgResourceModules['ext.translate.special.translate'] = array(
197197 '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+ ),
198205 ) + $resourcePaths;
199206
200207 $wgResourceModules['ext.translate.special.supportedlanguages'] = array(
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -399,6 +399,12 @@
400400 'log-description-translationreview' => 'Log of all reviews to translations and message groups.',
401401 'logentry-translationreview-message' => '$1 {{GENDER:$2|accepted}} translation $3',
402402
 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+
403409 );
404410
405411 /** Message documentation (Message documentation)
@@ -625,6 +631,12 @@
626632 'translate-messagereview-no-fuzzy' => 'Tooltip for disabled review button',
627633 'translate-messagereview-no-own' => 'Tooltip for disabled review button',
628634 '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',
629641 );
630642
631643 /** Faeag Rotuma (Faeag Rotuma)
Index: trunk/extensions/Translate/specials/SpecialTranslate.php
@@ -132,13 +132,18 @@
133133 $note = wfMessage( 'translate-page-description-hasoptional' )->rawParams( $link )->parseAsBlock();
134134
135135 if ( $description ) {
136 - $description .= '<hr>' . $note;
 136+ $description .= '<br>' . $note;
137137 } else {
138138 $description = $note;
139139 }
140140 }
141141 }
142142
 143+ $status = $this->getWorkflowStatus();
 144+ if ( $status !== false ) {
 145+ $description = $status . $description;
 146+ }
 147+
143148 if ( $description ) {
144149 $description = Xml::fieldset( wfMsg( 'translate-page-description-legend' ), $description );
145150 }
@@ -466,4 +471,50 @@
467472
468473 return $out;
469474 }
 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+ }
470521 }
Index: trunk/extensions/Translate/resources/ext.translate.special.translate.css
@@ -36,4 +36,17 @@
3737 border-spacing: 12pt 5pt;
3838 background-color: inherit;
3939 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+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r101624Followup r101623: -bash: avn: command not foundnikerabbit14:03, 2 November 2011

Status & tagging log