jenkins-bot has submitted this change and it was merged.

Change subject: Enable use of wikitext in field labels
......................................................................


Enable use of wikitext in field labels

Bug: 39911

GitHub: https://github.com/wikimedia/mediawiki-extensions-UploadWizard/pull/5
Change-Id: I6b5b274aa3b61c3b584a3d4b3305717587148122
---
M UploadWizard.config.php
M includes/CampaignSchema.php
M includes/specials/SpecialUploadWizard.php
M maintenance/migrateCampaigns.php
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardDetails.js
6 files changed, 19 insertions(+), 29 deletions(-)

Approvals:
  Brion VIBBER: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UploadWizard.config.php b/UploadWizard.config.php
index ed1bd80..e0fb8ca 100644
--- a/UploadWizard.config.php
+++ b/UploadWizard.config.php
@@ -91,14 +91,12 @@
        'missingCategoriesWikiText' => '',
 
        'display' => array(
-               // Page containing the (wiki)text to display above the 
UploadWizard UI.
-               // $1 is replaced by the language code.
-               'headerLabelPage' => '',
+               // wikitext to display above the UploadWizard UI.
+               'headerLabel' => '',
 
-               // Page containing the (wiki)text to display on top of the 
"use" page.
-               // $1 is replaced by the language code.
+               // wikitext to display on top of the "use" page.
                // When not provided, the message mwe-upwiz-thanks-intro will 
be used.
-               'thanksLabelPage' => ''
+               'thanksLabel' => ''
        ),
 
        // Settings for the tutorial to be shown.
@@ -124,12 +122,8 @@
                        // When non empty, this field will be shown, and $1 
will be replaced by it's value.
                        'wikitext' => '',
 
-                       // Label text to display with the field.
+                       // Label text to display with the field. Is parsed as 
wikitext.
                        'label' => '',
-
-                       // Page on which the text to display with the id field 
is stored.
-                       // Overrides label when set. $1 is replaced by the 
language code.
-                       'lagelPage' => '',
 
                        // The maximum length of the id field.
                        'maxLength' => 25,
diff --git a/includes/CampaignSchema.php b/includes/CampaignSchema.php
index 36997cb..42c18d6 100644
--- a/includes/CampaignSchema.php
+++ b/includes/CampaignSchema.php
@@ -36,9 +36,6 @@
                                                "label" => array(
                                                        "type" => "string"
                                                ),
-                                               "labelPage" => array(
-                                                       "type" => "string"
-                                               ),
                                                "maxLength" => array(
                                                        "type" => "integer"
                                                ),
@@ -80,10 +77,10 @@
                "display" => array(
                        "type" => "object",
                        "properties" =>array(
-                               "headerLabelPage" => array(
+                               "headerLabel" => array(
                                        "type" => "string"
                                ),
-                               "thanksLabelPage" => array(
+                               "thanksLabel" => array(
                                        "type" => "string"
                                )
                        )
diff --git a/includes/specials/SpecialUploadWizard.php 
b/includes/specials/SpecialUploadWizard.php
index aee579d..697cdb2 100644
--- a/includes/specials/SpecialUploadWizard.php
+++ b/includes/specials/SpecialUploadWizard.php
@@ -179,10 +179,10 @@
 
                if ( array_key_exists( 'fields', $config ) ) {
                        foreach ( $config['fields'] as &$field ) {
-                               if ( array_key_exists( 'labelPage', $field ) ) {
-                                       $labelPageContent = 
$this->getPageContent( $field['labelPage'] );
-                                       if ( $labelPageContent !== false ) {
-                                               $field['label'] = 
$labelPageContent;
+                               if ( array_key_exists( 'label', $field ) ) {
+                                       $labelContent = 
$this->getOutput()->parseInline( $field['label'] );
+                                       if ( $labelContent !== false ) {
+                                               $field['label'] = $labelContent;
                                        }
                                }
                        }
@@ -195,8 +195,8 @@
                        $config['UploadFromUrl'] = false;
                }
 
-               if ( array_key_exists( 'display', $config ) && 
array_key_exists( 'thanksLabelPage', $config['display'] ) ) {
-                       $thanksLabelContent = $this->getPageContent( 
$config['display']['thanksLabelPage'] );
+               if ( array_key_exists( 'display', $config ) && 
array_key_exists( 'thanksLabel', $config['display'] ) ) {
+                       $thanksLabelContent = $this->getOutput()->parseInline( 
$config['display']['thanksLabel'] );
                        if ( $thanksLabelContent !== false ) {
                                $config['display']['thanksLabel'] = 
$thanksLabelContent;
                        }
@@ -363,11 +363,8 @@
 
                $config = UploadWizardConfig::getConfig( $this->campaign );
 
-               if ( array_key_exists( 'display', $config ) && 
array_key_exists( 'headerLabelPage', $config['display'] ) ) {
-                       $headerContent = $this->getPageContent( 
$config['display']['headerLabelPage'] );
-                       if ( $headerContent !== false ) {
-                               $this->getOutput()->addWikiText( $headerContent 
);
-                       }
+               if ( array_key_exists( 'display', $config ) && 
array_key_exists( 'headerLabel', $config['display'] ) ) {
+                       $this->getOutput()->addWikiText( 
$config['display']['headerLabel'] );
                }
 
                if ( array_key_exists( 'fallbackToAltUploadForm', $config )
diff --git a/maintenance/migrateCampaigns.php b/maintenance/migrateCampaigns.php
index a77f2c1..fb7ba77 100644
--- a/maintenance/migrateCampaigns.php
+++ b/maintenance/migrateCampaigns.php
@@ -190,6 +190,8 @@
                                array(
                                        'wikitext' => $oldConfig['idField'],
                                        'label' => $oldConfig['idFieldLabel'],
+                                       # Migrated even though this is a nop.
+                                       # People will have to migrate this 
manually
                                        'labelPage' => 
$oldConfig['idFieldLabelPage'],
                                        'maxLength' => 
$oldConfig['idFieldMaxLength'],
                                        'initialValue' => 
$oldConfig['idFieldInitialValue']
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 2f29ba9..937d47a 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -1177,7 +1177,7 @@
                        thnxHeader.msg( 'mwe-upwiz-thanks-intro' );
                }
                else {
-                       thnxHeader.html( mw.UploadWizard.config.thanksLabel );
+                       thnxHeader.html( 
mw.UploadWizard.config.display.thanksLabel );
                }
 
                $j( '#mwe-upwiz-thanks' )
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index de642b3..f1466ad 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -215,7 +215,7 @@
                        _this.$form.append(
                                $j( '<div>' ).attr( 'class', 
'mwe-upwiz-details-input-error' )
                                        .append( $j( '<label>' ).attr( { 
'class': 'mwe-validator-error', 'for': fieldInputId, 'generated': 'true' } ) ),
-                               $j( '<div>' ).attr( 'class', 
'mwe-upwiz-details-fieldname' ).text( field.label ).requiredFieldLabel(),
+                               $j( '<div>' ).attr( 'class', 
'mwe-upwiz-details-fieldname' ).html( field.label ).requiredFieldLabel(),
                                $j( '<div>' ).attr( 'class', 'mwe-id-field' )
                                        .append( $fieldInput )
                        );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6b5b274aa3b61c3b584a3d4b3305717587148122
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: SuchABot <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Platonides <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to