Dan-nl has uploaded a new change for review.

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


Change subject: whitelist-instructions
......................................................................

whitelist-instructions

adding instructions for the user so that they know that a whitelist exists and
how to add a request to add their media file domain to that whitelist.

Change-Id: Icc56f3bdfc882de3e5ba5f212c37b8e055dd4181
---
M GWToolset.i18n.php
M includes/Forms/MetadataDetectForm.php
M resources/css/ext.gwtoolset.css
3 files changed, 50 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/48/100548/1

diff --git a/GWToolset.i18n.php b/GWToolset.i18n.php
index 3eb694c..4b0ba07 100644
--- a/GWToolset.i18n.php
+++ b/GWToolset.i18n.php
@@ -164,10 +164,9 @@
        'gwtoolset-record-element-name' => 'What is the XML element that 
contains each metadata record:',
        'gwtoolset-step-1-heading' => 'Step 1: Metadata detection',
        'gwtoolset-step-1-instructions-1' => 'The Metadata upload process 
consists of 4 steps:',
-       'gwtoolset-step-1-instructions-2' => 'In this step, you upload a new 
metadata file to the wiki. The tool will attempt to extract the metadata fields 
available in the metadata file, which you will then map to a MediaWiki template 
in "{{int:gwtoolset-step-2-heading}}".
-
-====Domain whitelist====
-If you haven’t already done so, please [http://ur1.ca/g600j request] that your 
media file domain be added to the commons.wikipedia.com upload from URL 
whitelist. The whitelist allows commons.wikipedia.com access to your media file 
domain. The best example is to submit an actual URL to a media file.',
+       'gwtoolset-step-1-instructions-2' => 'In this step, you upload a new 
metadata file to the wiki. The tool will attempt to extract the metadata fields 
available in the metadata file, which you will then map to a MediaWiki template 
in "{{int:gwtoolset-step-2-heading}}".',
+       'gwtoolset-step-1-instructions-3' => 'If your media file domain is not 
listed below, please [http://ur1.ca/g600j request] that your media file domain 
be added to the Wikimedia Commons domain whitelist. The domain whitelist is a 
list of domains Wikimedia Commons checks against before fetching media files. 
If your media file domain is not on that list, Wikimedia Commons will not 
download media files from that domain. The best example, to submit in your 
request, is an actual link to a media file.',
+       'gwtoolset-step-1-instructions-3-heading' => 'Domain whitelist',
        'gwtoolset-step-1-instructions-li-1' => 'Metadata detection',
        'gwtoolset-step-1-instructions-li-2' => 'Metadata mapping',
        'gwtoolset-step-1-instructions-li-3' => 'Batch preview',
diff --git a/includes/Forms/MetadataDetectForm.php 
b/includes/Forms/MetadataDetectForm.php
index b96355d..934a173 100644
--- a/includes/Forms/MetadataDetectForm.php
+++ b/includes/Forms/MetadataDetectForm.php
@@ -21,6 +21,42 @@
 class MetadataDetectForm {
 
        /**
+        * @return {null|string}
+        */
+       public static function getCopyUploadsDomainsAsList() {
+               global $wgCopyUploadsDomains;
+               $result = null;
+
+               if ( !empty( $wgCopyUploadsDomains ) ) {
+                       $result = Html::rawElement(
+                               'h4',
+                               array(),
+                               wfMessage( 
'gwtoolset-step-1-instructions-3-heading' )
+                       );
+
+                       $result .= Html::rawElement(
+                               'p',
+                               array(),
+                               wfMessage( 'gwtoolset-step-1-instructions-3' )
+                       );
+
+                       $result .= Html::openElement( 'ul', array( 'id' => 
'gwtoolset-whitelist' ) );
+
+                       foreach( $wgCopyUploadsDomains as $domain ) {
+                               $result .= Html::rawElement(
+                                       'li',
+                                       array(),
+                                       Utils::sanitizeString( $domain )
+                               );
+                       }
+
+                       $result .= Html::closeElement( 'ul' );
+               }
+
+               return $result;
+       }
+
+       /**
         * returns an html form for step 1 : Metadata Detect
         *
         * @param {SpecialPage} $SpecialPage
@@ -79,6 +115,8 @@
                                wfMessage( 'gwtoolset-step-1-instructions-2' 
)->parse()
                        ) .
 
+                       self::getCopyUploadsDomainsAsList() .
+
                        Html::openElement(
                                'form',
                                array(
diff --git a/resources/css/ext.gwtoolset.css b/resources/css/ext.gwtoolset.css
index 23b13de..430106f 100644
--- a/resources/css/ext.gwtoolset.css
+++ b/resources/css/ext.gwtoolset.css
@@ -62,3 +62,12 @@
 .no-close .ui-dialog-titlebar-close {
   display: none;
 }
+
+#gwtoolset-whitelist {
+       height: 100px;
+       width: 300px;
+       border: 1px solid #ccc;
+       margin: 0;
+       padding: 7px 0 7px 18px;
+       overflow: auto;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc56f3bdfc882de3e5ba5f212c37b8e055dd4181
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Dan-nl <[email protected]>

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

Reply via email to