Siebrand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76117


Change subject: Accept article ID as default setting for translatable page
......................................................................

Accept article ID as default setting for translatable page

Change-Id: Icbc38d07bbdf3c02646b929df1c6eba033be35d4
---
M SpecialNotifyTranslators.php
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslationNotifications 
refs/changes/17/76117/1

diff --git a/SpecialNotifyTranslators.php b/SpecialNotifyTranslators.php
index 0056a09..5d93593 100644
--- a/SpecialNotifyTranslators.php
+++ b/SpecialNotifyTranslators.php
@@ -40,7 +40,9 @@
 
                $this->checkPermissions();
 
-               $htmlFormDataModel = $this->getFormFields();
+               $htmlFormDataModel = $this->getFormFields(
+                       (int) $this->getRequest()->getVal( 'group', 0 )
+               );
                $output = $this->getOutput();
 
                if ( !is_array( $htmlFormDataModel ) ) {
@@ -72,9 +74,10 @@
        /**
         * Builds the form fields
         *
+        * @param int $tpage Article ID to preselect as translatable page in 
form
         * @return array or string with an error message key in case of error
         */
-       private function getFormFields() {
+       private function getFormFields( $tpage = 0 ) {
                // Translatable pages dropdown
                $translatablePages = MessageGroups::getGroupsByType( 
'WikiPageMessageGroup' );
 
@@ -96,11 +99,12 @@
 
                $formFields = array();
 
+               $default = (int) $tpage !== 0 ? $tpage : 'unset';
                $formFields['TranslatablePage'] = array(
                        'type' => 'select',
                        'label-message' => array( 
'translationnotifications-translatablepage-title' ),
                        'options' => $translatablePagesOptions,
-                       'default' => 'unset',
+                       'default' => $default
                );
 
                // Languages to notify input box

-- 
To view, visit https://gerrit.wikimedia.org/r/76117
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbc38d07bbdf3c02646b929df1c6eba033be35d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to