Merge "Remove $wgUseLinkNamespaceDBFields"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 29 Sep 2015 18:24:56 +0000 (18:24 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 29 Sep 2015 18:24:56 +0000 (18:24 +0000)
13 files changed:
includes/DefaultSettings.php
includes/api/ApiBase.php
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/specials/SpecialChangeEmail.php
languages/i18n/en.json
languages/i18n/qqq.json
maintenance/jsduck/categories.json
resources/Resources.php
resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js [new file with mode: 0644]
resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
resources/src/mediawiki/mediawiki.Upload.Dialog.js
resources/src/mediawiki/mediawiki.jqueryMsg.js
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js

index 50b664a..6b5155a 100644 (file)
@@ -525,6 +525,14 @@ $wgForeignFileRepos = array();
  */
 $wgUseInstantCommons = false;
 
+/**
+ * Name of the remote repository to which users will be allowed to upload
+ * files in their editors. Used to find a set of message names to describe
+ * the legal requirements for uploading to that wiki, and suggestions for
+ * when those requirements are not met.
+ */
+$wgRemoteUploadTarget = 'default';
+
 /**
  * File backend structure configuration.
  *
index 5a1099e..f5ceb33 100644 (file)
@@ -1358,8 +1358,8 @@ abstract class ApiBase extends ContextSource {
         * @param string $errorCode Brief, arbitrary, stable string to allow easy
         *   automated identification of the error, e.g., 'unknown_action'
         * @param int $httpRespCode HTTP response code
-        * @param array $extradata Data to add to the "<error>" element; array in ApiResult format
-        * @throws UsageException
+        * @param array|null $extradata Data to add to the "<error>" element; array in ApiResult format
+        * @throws UsageException always
         */
        public function dieUsage( $description, $errorCode, $httpRespCode = 0, $extradata = null ) {
                throw new UsageException(
@@ -1415,10 +1415,9 @@ abstract class ApiBase extends ContextSource {
         *
         * @since 1.22
         * @param Status $status
-        * @throws MWException
+        * @throws UsageException always
         */
        public function dieStatus( $status ) {
-
                list( $code, $msg ) = $this->getErrorFromStatus( $status );
                $this->dieUsage( $msg, $code );
        }
@@ -1932,6 +1931,8 @@ abstract class ApiBase extends ContextSource {
 
        /**
         * Helper function for readonly errors
+        *
+        * @throws UsageException always
         */
        public function dieReadOnly() {
                $parsed = $this->parseMsg( array( 'readonlytext' ) );
@@ -1942,6 +1943,7 @@ abstract class ApiBase extends ContextSource {
        /**
         * Output the error message related to a certain array
         * @param array|string $error Element of a getUserPermissionsErrors()-style array
+        * @throws UsageException always
         */
        public function dieUsageMsg( $error ) {
                # most of the time we send a 1 element, so we might as well send it as
@@ -1957,6 +1959,7 @@ abstract class ApiBase extends ContextSource {
         * Will only set a warning instead of failing if the global $wgDebugAPI
         * is set to true. Otherwise behaves exactly as dieUsageMsg().
         * @param array|string $error Element of a getUserPermissionsErrors()-style array
+        * @throws UsageException
         * @since 1.21
         */
        public function dieUsageMsgOrDebug( $error ) {
@@ -1975,6 +1978,7 @@ abstract class ApiBase extends ContextSource {
         * Die with the $prefix.'badcontinue' error. This call is common enough to
         * make it into the base method.
         * @param bool $condition Will only die if this value is true
+        * @throws UsageException
         * @since 1.21
         */
        protected function dieContinueUsageIf( $condition ) {
@@ -2016,7 +2020,7 @@ abstract class ApiBase extends ContextSource {
         * Internal code errors should be reported with this method
         * @param string $method Method or function name
         * @param string $message Error message
-        * @throws MWException
+        * @throws MWException always
         */
        protected static function dieDebug( $method, $message ) {
                throw new MWException( "Internal error in $method: $message" );
index 0553df0..e5f3fb8 100644 (file)
@@ -102,6 +102,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        'wgResourceLoaderStorageVersion' => $conf->get( 'ResourceLoaderStorageVersion' ),
                        'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ),
                        'wgResourceLoaderLegacyModules' => self::getLegacyModules(),
+                       'wgRemoteUploadTarget' => $conf->get( 'RemoteUploadTarget' ),
                );
 
                Hooks::run( 'ResourceLoaderGetConfigVars', array( &$vars ) );
index 22df04e..65fa01f 100644 (file)
@@ -92,7 +92,8 @@ class SpecialChangeEmail extends FormSpecialPage {
                        'NewEmail' => array(
                                'type' => 'email',
                                'label-message' => 'changeemail-newemail',
-                               'autofocus' => true
+                               'autofocus' => true,
+                               'help-message' => 'changeemail-newemail-help',
                        ),
                );
 
index df55298..4d8e392 100644 (file)
        "passwordreset-emailsent": "A password reset email has been sent.",
        "passwordreset-emailsent-capture": "A password reset email has been sent, which is shown below.",
        "passwordreset-emailerror-capture": "A password reset email was generated, which is shown below, but sending it to the {{GENDER:$2|user}} failed: $1",
-       "changeemail": "Change email address",
+       "changeemail": "Change or remove email address",
        "changeemail-summary": "",
-       "changeemail-text": "Complete this form to change your email address. You will need to enter your password to confirm this change. If you would like to remove the association of any email address from your account, leave the email address blank when submitting the form.",
+       "changeemail-text": "Complete this form to change your email address. You will need to enter your password to confirm this change. If you would like to remove the association of any email address from your account, leave the new email address blank when submitting the form.",
        "changeemail-no-info": "You must be logged in to access this page directly.",
        "changeemail-oldemail": "Current email address:",
        "changeemail-newemail": "New email address:",
+       "changeemail-newemail-help": "This field should be left blank if you want to remove your email address. You will not be able to reset a forgotten password and will not receive emails from this wiki if the email address is removed.",
        "changeemail-none": "(none)",
        "changeemail-password": "Your {{SITENAME}} password:",
        "changeemail-submit": "Change email",
        "mergehistory-go": "Show mergeable edits",
        "mergehistory-submit": "Merge revisions",
        "mergehistory-empty": "No revisions can be merged.",
-       "mergehistory-done": "$3 {{PLURAL:$3|revision|revisions}} of $1 were merged into [[:$2]].",
+       "mergehistory-done": "$3 {{PLURAL:$3|revision|revisions}} of $1 {{PLURAL:$3|was|were}} merged into [[:$2]].",
        "mergehistory-fail": "Unable to perform history merge, please recheck the page and time parameters.",
        "mergehistory-fail-toobig" : "Unable to perform history merge as more than the limit of $1 {{PLURAL:$1|revision|revisions}} would be moved.",
        "mergehistory-no-source": "Source page $1 does not exist.",
        "prefs-watchlist-token": "Watchlist token:",
        "prefs-misc": "Misc",
        "prefs-resetpass": "Change password",
-       "prefs-changeemail": "Change email address",
+       "prefs-changeemail": "Change or remove email address",
        "prefs-setemail": "Set an email address",
        "prefs-email": "Email options",
        "prefs-rendering": "Appearance",
        "upload-form-label-infoform-description": "Description",
        "upload-form-label-usage-title": "Usage",
        "upload-form-label-usage-filename": "File name",
+       "foreign-structured-upload-form-label-own-work": "This is my own work",
+       "foreign-structured-upload-form-label-infoform-categories": "Categories",
+       "foreign-structured-upload-form-label-infoform-date": "Date",
+       "foreign-structured-upload-form-label-own-work-message-default": "I understand that I am uploading this file to a shared repository. I confirm that I am doing so following the terms of service and licensing policies there.",
+       "foreign-structured-upload-form-label-not-own-work-message-default": "If you are not able to upload this file under the policies of the shared repository, please close this dialog and try another method.",
+       "foreign-structured-upload-form-label-not-own-work-local-default": "You may also want to try using [[Special:Upload|the upload page on {{SITENAME}}]], if this file can be uploaded there under their policies.",
+       "foreign-structured-upload-form-label-own-work-message-wikimediacommons": "I attest that I own the copyright on this file, and agree to irrevocably release this file to Wikimedia Commons under the [https://creativecommons.org/licenses/by-sa/4.0/ Creative Commons Attribution-ShareAlike 4.0] license, and I agree to the [https://wikimediafoundation.org/wiki/Terms_of_Use Terms of Use].",
+       "foreign-structured-upload-form-label-not-own-work-message-wikimediacommons": "If you do not own the copyright on this file, or you wish to release it under a different license, consider using the [https://commons.wikimedia.org/wiki/Special:UploadWizard Commons Upload Wizard].",
+       "foreign-structured-upload-form-label-not-own-work-local-wikimediacommons": "You may also want to try using [[Special:Upload|the upload page on {{SITENAME}}]], if the site allows the upload of this file under their policies.",
        "backend-fail-stream": "Could not stream file \"$1\".",
        "backend-fail-backup": "Could not backup file \"$1\".",
        "backend-fail-notexists": "The file $1 does not exist.",
index 6c3f459..f32a585 100644 (file)
        "passwordreset-emailsent": "Used in [[Special:PasswordReset]].\n\nSee also:\n* {{msg-mw|Passwordreset-emailsent-capture}}\n* {{msg-mw|Passwordreset-emailerror-capture}}",
        "passwordreset-emailsent-capture": "Used in [[Special:PasswordReset]].\n\nSee also:\n* {{msg-mw|Passwordreset-emailsent}}\n* {{msg-mw|Passwordreset-emailerror-capture}}",
        "passwordreset-emailerror-capture": "Error message displayed in [[Special:PasswordReset]] when sending an email fails. Parameters:\n* $1 - error message\n* $2 - username, used for GENDER\nSee also:\n* {{msg-mw|Passwordreset-emailsent}}\n* {{msg-mw|Passwordreset-emailsent-capture}}",
-       "changeemail": "Title of [[Special:ChangeEmail|special page]].",
+       "changeemail": "Title of [[Special:ChangeEmail|special page]]. This page also allows removing the user's email address.",
        "changeemail-summary": "{{ignored}}",
        "changeemail-text": "Text of [[Special:ChangeEmail]].",
        "changeemail-no-info": "Error message for [[Special:ChangeEmail]].\n\nParameters:\n* $1 (unused) - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description",
        "changeemail-oldemail": "Label for e-mail address field in [[Special:ChangeEmail]].",
-       "changeemail-newemail": "Label for e-mail address field in [[Special:ChangeEmail]].",
+       "changeemail-newemail": "Label for e-mail address field in [[Special:ChangeEmail]]. See also {{msg-mw|changeemail-newemail-help}}",
+       "changeemail-newemail-help": "Help message shown next to the new email address field. See also {{msg-mw|changeemail-newemail}}",
        "changeemail-none": "Probably appears in 'Current E-mail address' field when no address held, in [[Special:ChangeEmail]].\n\n{{Identical|None}}",
        "changeemail-password": "Label for password field in [[Special:ChangeEmail]].",
        "changeemail-submit": "Submit button on [[Special:ChangeEmail]]",
        "prefs-watchlist-token": "Used in [[Special:Preferences]], tab Watchlist.",
        "prefs-misc": "Tab used on the [[Special:Preferences|user preferences]] special page.",
        "prefs-resetpass": "Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ResetPass]].\n\n{{Identical|Change password}}",
-       "prefs-changeemail": "Link on [[Special:Preferences]] to [[Special:ChangeEmail]].\n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-setemail|link title}}",
+       "prefs-changeemail": "Link on [[Special:Preferences]] to [[Special:ChangeEmail]]. [[Special:ChangeEmail]] also allows removing email address. \n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-setemail|link title}}",
        "prefs-setemail": "Used as link title in [[Special:Preferences]], if the user has not set E-mail address yet.\n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-changeemail|link title}}",
        "prefs-email": "Used as section name in [[Special:Preferences]].",
        "prefs-rendering": "Title of tab in [[Special:Preferences]].\n{{Identical|Appearance}}",
        "upload-form-label-infoform-description": "Label for the file description input\n{{Identical|Description}}",
        "upload-form-label-usage-title": "Title for the insert form showing how to use the uploaded item.\n{{Identical|Usage}}",
        "upload-form-label-usage-filename": "Label for the file name input\n{{Identical|Filename}}",
+       "foreign-structured-upload-form-label-own-work": "Label for own work toggle",
+       "foreign-structured-upload-form-label-infoform-categories": "Label for category selector input",
+       "foreign-structured-upload-form-label-infoform-date": "Label for date input",
+       "foreign-structured-upload-form-label-own-work-message-default": "Message shown by default when a user affirms that they are allowed to upload a file to a remote wiki.",
+       "foreign-structured-upload-form-label-not-own-work-message-default": "Message shown by default when a user cannot upload a file to a remote wiki.",
+       "foreign-structured-upload-form-label-not-own-work-local-default": "Suggests uploading a file locally instead of to a remote wiki. $1 is the name of the local wiki.",
+       "foreign-structured-upload-form-label-own-work-message-wikimediacommons": "Legal message to show when the work is made by the uploader.",
+       "foreign-structured-upload-form-label-not-own-work-message-wikimediacommons": "Message to show when the work isn't owned by the uploader.",
+       "foreign-structured-upload-form-label-not-own-work-local-wikimediacommons": "Message suggesting the user might want to upload a file locally instead of to Wikimedia Commons. $1 is the name of the local wiki.",
+       "upload-form-label-usage-filename": "Label for the file name input\n{{Identical|Filename}}",
        "backend-fail-stream": "Parameters:\n* $1 - a filename",
        "backend-fail-backup": "Parameters:\n* $1 - a filename",
        "backend-fail-notexists": "Parameters:\n* $1 - a filename",
index d142556..ef264c3 100644 (file)
@@ -63,7 +63,7 @@
                                        "mw.Feedback*",
                                        "mw.Upload*",
                                        "mw.ForeignUpload",
-                                       "mw.ForeignStructuredUpload"
+                                       "mw.ForeignStructuredUpload*"
                                ]
                        },
                        {
index d6e13ed..14ab8fe 100644 (file)
@@ -1184,6 +1184,26 @@ return array(
                        'upload-form-label-usage-filename',
                ),
        ),
+       'mediawiki.ForeignStructuredUpload.BookletLayout' => array(
+               'scripts' => 'resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js',
+               'dependencies' => array(
+                       'mediawiki.ForeignStructuredUpload',
+                       'mediawiki.Upload.BookletLayout',
+                       'mediawiki.widgets',
+                       'mediawiki.jqueryMsg',
+               ),
+               'messages' => array(
+                       'foreign-structured-upload-form-label-own-work',
+                       'foreign-structured-upload-form-label-infoform-categories',
+                       'foreign-structured-upload-form-label-infoform-date',
+                       'foreign-structured-upload-form-label-own-work-message-default',
+                       'foreign-structured-upload-form-label-not-own-work-message-default',
+                       'foreign-structured-upload-form-label-not-own-work-local-default',
+                       'foreign-structured-upload-form-label-own-work-message-wikimediacommons',
+                       'foreign-structured-upload-form-label-not-own-work-message-wikimediacommons',
+                       'foreign-structured-upload-form-label-not-own-work-local-wikimediacommons',
+               ),
+       ),
        'mediawiki.toc' => array(
                'scripts' => 'resources/src/mediawiki/mediawiki.toc.js',
                'dependencies' => 'mediawiki.cookie',
diff --git a/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js b/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js
new file mode 100644 (file)
index 0000000..3051d52
--- /dev/null
@@ -0,0 +1,196 @@
+/*global moment */
+( function ( $, mw ) {
+
+       /**
+        * mw.ForeignStructuredUpload.BookletLayout encapsulates the process
+        * of uploading a file to MediaWiki using the mw.ForeignStructuredUpload model.
+        *
+        *     var uploadDialog = new mw.Upload.Dialog( {
+        *         bookletClass: mw.ForeignStructuredUpload.BookletLayout,
+        *         booklet: {
+        *             targetHost: 'localhost:8080'
+        *         }
+        *     } );
+        *     var windowManager = new OO.ui.WindowManager();
+        *     $( 'body' ).append( windowManager.$element );
+        *     windowManager.addWindows( [ uploadDialog ] );
+        *
+        * @class mw.ForeignStructuredUpload.BookletLayout
+        * @uses mw.ForeignStructuredUpload
+        * @extends mw.Upload.BookletLayout
+        * @cfg {string} [targetHost] Used to set up the target wiki.
+        *     If nothing is passed, the {@link mw.ForeignUpload#property-targetHost default} is used.
+        */
+       mw.ForeignStructuredUpload.BookletLayout = function ( config ) {
+               config = config || {};
+               // Parent constructor
+               mw.ForeignStructuredUpload.BookletLayout.parent.call( this, config );
+
+               this.targetHost = config.targetHost;
+       };
+
+       /* Setup */
+
+       OO.inheritClass( mw.ForeignStructuredUpload.BookletLayout, mw.Upload.BookletLayout );
+
+       /* Uploading */
+
+       /**
+        * Returns a {@link mw.ForeignStructuredUpload mw.ForeignStructuredUpload}
+        * with the {@link #cfg-targetHost targetHost} specified in config.
+        *
+        * @protected
+        * @return {mw.Upload}
+        */
+       mw.ForeignStructuredUpload.BookletLayout.prototype.createUpload = function () {
+               return new mw.ForeignStructuredUpload( this.targetHost );
+       };
+
+       /* Form renderers */
+
+       /**
+        * @inheritdoc
+        */
+       mw.ForeignStructuredUpload.BookletLayout.prototype.renderUploadForm = function () {
+               var fieldset,
+                       target = mw.config.get( 'wgRemoteUploadTarget' ),
+                       $ownWorkMessage = $( '<p>' ).html(
+                               mw.message( 'foreign-structured-upload-form-label-own-work-message-' + target ).parse()
+                       ),
+                       $notOwnWorkMessage = $( '<div>' ).append(
+                               $( '<p>' ).html(
+                                       mw.message( 'foreign-structured-upload-form-label-not-own-work-message-' + target ).parse()
+                               ),
+                               $( '<p>' ).html(
+                                       mw.message( 'foreign-structured-upload-form-label-not-own-work-local-' + target ).parse()
+                               )
+                       ),
+                       layout = this;
+
+               this.selectFileWidget = new OO.ui.SelectFileWidget();
+               this.messageLabel = new OO.ui.LabelWidget( {
+                       label: $notOwnWorkMessage
+               } );
+               this.ownWorkCheckbox = new OO.ui.CheckboxInputWidget().on( 'change', function ( on ) {
+                       if ( on ) {
+                               layout.messageLabel.setLabel( $ownWorkMessage );
+                       } else {
+                               layout.messageLabel.setLabel( $notOwnWorkMessage );
+                       }
+               } );
+
+               fieldset = new OO.ui.FieldsetLayout();
+               fieldset.addItems( [
+                       new OO.ui.FieldLayout( this.selectFileWidget, {
+                               align: 'top',
+                               label: mw.msg( 'upload-form-label-select-file' )
+                       } ),
+                       new OO.ui.FieldLayout( this.ownWorkCheckbox, {
+                               align: 'inline',
+                               label: mw.msg( 'foreign-structured-upload-form-label-own-work' )
+                       } ),
+                       this.messageLabel
+               ] );
+               this.uploadForm = new OO.ui.FormLayout( { items: [ fieldset ] } );
+
+               // Validation
+               this.selectFileWidget.on( 'change', this.onUploadFormChange.bind( this ) );
+               this.ownWorkCheckbox.on( 'change', this.onUploadFormChange.bind( this ) );
+
+               return this.uploadForm;
+       };
+
+       /**
+        * @inheritdoc
+        */
+       mw.ForeignStructuredUpload.BookletLayout.prototype.onUploadFormChange = function () {
+               var file = this.selectFileWidget.getValue(),
+                       ownWork = this.ownWorkCheckbox.isSelected(),
+                       valid = !!file && ownWork;
+               this.emit( 'uploadValid', valid );
+       };
+
+       /**
+        * @inheritdoc
+        */
+       mw.ForeignStructuredUpload.BookletLayout.prototype.renderInfoForm = function () {
+               var fieldset;
+
+               this.filenameWidget = new OO.ui.TextInputWidget( {
+                       required: true,
+                       validate: /.+/
+               } );
+               this.descriptionWidget = new OO.ui.TextInputWidget( {
+                       required: true,
+                       validate: /.+/,
+                       multiline: true,
+                       autosize: true
+               } );
+               this.dateWidget = new mw.widgets.DateInputWidget( {
+                       $overlay: this.$overlay,
+                       required: true,
+                       mustBeBefore: moment().add( 1, 'day' ).locale( 'en' ).format( 'YYYY-MM-DD' ) // Tomorrow
+               } );
+               this.categoriesWidget = new mw.widgets.CategorySelector( {
+                       $overlay: this.$overlay
+               } );
+
+               fieldset = new OO.ui.FieldsetLayout( {
+                       label: mw.msg( 'upload-form-label-infoform-title' )
+               } );
+               fieldset.addItems( [
+                       new OO.ui.FieldLayout( this.filenameWidget, {
+                               label: mw.msg( 'upload-form-label-infoform-name' ),
+                               align: 'top'
+                       } ),
+                       new OO.ui.FieldLayout( this.categoriesWidget, {
+                               label: mw.msg( 'foreign-structured-upload-form-label-infoform-categories' ),
+                               align: 'top'
+                       } ),
+                       new OO.ui.FieldLayout( this.descriptionWidget, {
+                               label: mw.msg( 'upload-form-label-infoform-description' ),
+                               align: 'top'
+                       } ),
+                       new OO.ui.FieldLayout( this.dateWidget, {
+                               label: mw.msg( 'foreign-structured-upload-form-label-infoform-date' ),
+                               align: 'top'
+                       } )
+               ] );
+               this.infoForm = new OO.ui.FormLayout( { items: [ fieldset ] } );
+
+               // Validation
+               this.filenameWidget.on( 'change', this.onInfoFormChange.bind( this ) );
+               this.descriptionWidget.on( 'change', this.onInfoFormChange.bind( this ) );
+               this.dateWidget.on( 'change', this.onInfoFormChange.bind( this ) );
+
+               return this.infoForm;
+       };
+
+       /**
+        * @inheritdoc
+        */
+       mw.ForeignStructuredUpload.BookletLayout.prototype.onInfoFormChange = function () {
+               var layout = this;
+               $.when(
+                       this.filenameWidget.getValidity(),
+                       this.descriptionWidget.getValidity(),
+                       this.dateWidget.getValidity()
+               ).done( function () {
+                       layout.emit( 'infoValid', true );
+               } ).fail( function () {
+                       layout.emit( 'infoValid', false );
+               } );
+       };
+
+       /* Getters */
+
+       /**
+        * @inheritdoc
+        */
+       mw.ForeignStructuredUpload.BookletLayout.prototype.getText = function () {
+               this.upload.addDescription( 'en', this.descriptionWidget.getValue() );
+               this.upload.setDate( this.dateWidget.getValue() );
+               this.upload.addCategories( this.categoriesWidget.getItemsData() );
+               return this.upload.getText();
+       };
+}( jQuery, mediaWiki ) );
index cb532c3..41200d3 100644 (file)
         *
         * @constructor
         * @param {Object} config Configuration options
+        * @cfg {jQuery} [$overlay] Overlay to use for widgets in the booklet
         */
        mw.Upload.BookletLayout = function ( config ) {
                // Parent constructor
                mw.Upload.BookletLayout.parent.call( this, config );
 
+               this.$overlay = config.$overlay;
+
                this.renderUploadForm();
                this.renderInfoForm();
                this.renderInsertForm();
index de005f8..03e3971 100644 (file)
         * @class mw.Upload.Dialog
         * @uses mw.Upload
         * @extends OO.ui.ProcessDialog
+        * @cfg {Function} [bookletClass=mw.Upload.BookletLayout] Booklet class to be
+        *     used for the steps
+        * @cfg {Object} [booklet] Booklet constructor configuration
         */
        mw.Upload.Dialog = function ( config ) {
+               // Config initialization
+               config = $.extend( {
+                       bookletClass: mw.Upload.BookletLayout
+               }, config );
+
                // Parent constructor
                mw.Upload.Dialog.parent.call( this, config );
+
+               // Initialize
+               this.bookletClass = config.bookletClass;
+               this.bookletConfig = config.booklet;
        };
 
        /* Setup */
         * @return {mw.Upload.BookletLayout} An upload booklet
         */
        mw.Upload.Dialog.prototype.createUploadBooklet = function () {
-               return new mw.Upload.BookletLayout();
+               return new this.bookletClass( $.extend( {
+                       $overlay: this.$overlay
+               }, this.bookletConfig ) );
        };
 
        /**
index ce92423..9463ac8 100644 (file)
                                var result = sequence( [
                                        wikilinkPage,
                                        pipe,
-                                       expression
+                                       nOrMore( 1, expression )
                                ] );
-                               return result === null ? null : [ result[ 0 ], result[ 2 ] ];
+                               return result === null ? null : [ result[ 0 ], [ 'CONCAT' ].concat( result[ 2 ] ) ];
                        }
 
                        wikilinkContents = choice( [
                        return $( '<a>' ).attr( {
                                title: page,
                                href: url
-                       } ).text( anchor );
+                       } )
+                               // FIXME This means that you can't have anything with formatting inside a wikilink.
+                               .text( anchor.jquery ? anchor.text() : anchor );
                },
 
                /**
index 161b8e1..f287caa 100644 (file)
@@ -1,5 +1,6 @@
 ( function ( mw, $ ) {
-       var formatText, formatParse, formatnumTests, specialCharactersPageName, expectedListUsers, expectedEntrypoints,
+       var formatText, formatParse, formatnumTests, specialCharactersPageName, expectedListUsers,
+               expectedListUsersSitename, expectedEntrypoints,
                mwLanguageCache = {},
                hasOwn = Object.hasOwnProperty;
 
@@ -16,6 +17,8 @@
                        specialCharactersPageName = '"Who" wants to be a millionaire & live on \'Exotic Island\'?';
 
                        expectedListUsers = '注册<a title="Special:ListUsers" href="/wiki/Special:ListUsers">用户</a>';
+                       expectedListUsersSitename = '注册<a title="Special:ListUsers" href="/wiki/Special:ListUsers">用户' +
+                               mw.config.get( 'wgSiteName' ) + '</a>';
 
                        expectedEntrypoints = '<a href="https://www.mediawiki.org/wiki/Manual:index.php">index.php</a>';
 
@@ -52,6 +55,7 @@
                        'see-portal-url': '{{Int:portal-url}} is an important community page.',
 
                        'jquerymsg-test-statistics-users': '注册[[Special:ListUsers|用户]]',
+                       'jquerymsg-test-statistics-users-sitename': '注册[[Special:ListUsers|用户{{SITENAME}}]]',
 
                        'jquerymsg-test-version-entrypoints-index-php': '[https://www.mediawiki.org/wiki/Manual:index.php index.php]',
 
                process( tasks, QUnit.start );
        } );
 
-       QUnit.test( 'Links', 6, function ( assert ) {
+       QUnit.test( 'Links', 7, function ( assert ) {
                var expectedDisambiguationsText,
                        expectedMultipleBars,
                        expectedSpecialCharacters;
                        expectedSpecialCharacters,
                        'Special characters'
                );
+
+               assert.htmlEqual(
+                       formatParse( 'jquerymsg-test-statistics-users-sitename' ),
+                       expectedListUsersSitename,
+                       'Piped wikilink with parser function in the text'
+               );
        } );
 
        // Tests that {{-transformation vs. general parsing are done as requested