Merge "ApiSandbox: Support 'all' specifiers"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 23 Nov 2016 19:00:27 +0000 (19:00 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 23 Nov 2016 19:00:27 +0000 (19:00 +0000)
1  2 
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.special/mediawiki.special.apisandbox.js

diff --combined languages/i18n/en.json
        "passwordreset-emaildisabled": "Email features have been disabled on this wiki.",
        "passwordreset-username": "Username:",
        "passwordreset-domain": "Domain:",
 -      "passwordreset-capture": "View the resulting email?",
 -      "passwordreset-capture-help": "If you check this box, the email (with the temporary password) will be shown to you as well as being sent to the user.",
        "passwordreset-email": "Email address:",
        "passwordreset-emailtitle": "Account details on {{SITENAME}}",
        "passwordreset-emailtext-ip": "Someone (probably you, from IP address $1) requested a reset of your\npassword for {{SITENAME}} ($4). The following user {{PLURAL:$3|account is|accounts are}}\nassociated with this email address:\n\n$2\n\n{{PLURAL:$3|This temporary password|These temporary passwords}} will expire in {{PLURAL:$5|one day|$5 days}}.\nYou should log in and choose a new password now. If someone else made this\nrequest, or if you have remembered your original password, and you no longer\nwish to change it, you may ignore this message and continue using your old\npassword.",
        "passwordreset-emailelement": "Username:\n$1\n\nTemporary password:\n$2",
        "passwordreset-emailsentemail": "If this email address is associated with your account, then a password reset email will be sent.",
        "passwordreset-emailsentusername": "If there is an email address associated with this username, then a password reset email will be sent.",
 -      "passwordreset-emailsent-capture2": "The password reset {{PLURAL:$1|email has|emails have}} been sent. The {{PLURAL:$1|username and password|list of usernames and passwords}} is shown here.",
 -      "passwordreset-emailerror-capture2": "Emailing the {{GENDER:$2|user}} failed: $1 The {{PLURAL:$3|username and password|list of usernames and passwords}} is shown here.",
        "passwordreset-nocaller": "A caller must be provided",
        "passwordreset-nosuchcaller": "Caller does not exist: $1",
        "passwordreset-ignored": "The password reset was not handled. Maybe no provider was configured?",
        "right-siteadmin": "Lock and unlock the database",
        "right-override-export-depth": "Export pages including linked pages up to a depth of 5",
        "right-sendemail": "Send email to other users",
 -      "right-passwordreset": "View password reset emails",
        "right-managechangetags": "Create and (de)activate [[Special:Tags|tags]]",
        "right-applychangetags": "Apply [[Special:Tags|tags]] along with one's changes",
        "right-changetags": "Add and remove arbitrary [[Special:Tags|tags]] on individual revisions and log entries",
        "apisandbox-continue-clear": "Clear",
        "apisandbox-continue-help": "{{int:apisandbox-continue}} will [https://www.mediawiki.org/wiki/API:Query#Continuing_queries continue] the last request; {{int:apisandbox-continue-clear}} will clear continuation-related parameters.",
        "apisandbox-param-limit": "Enter <kbd>max</kbd> to use the maximum limit.",
+       "apisandbox-multivalue-all-namespaces": "$1 (All namespaces)",
+       "apisandbox-multivalue-all-values": "$1 (All values)",
        "booksources": "Book sources",
        "booksources-summary": "",
        "booksources-search-legend": "Search for book sources",
        "mw-widgets-dateinput-placeholder-month": "YYYY-MM",
        "mw-widgets-titleinput-description-new-page": "page does not exist yet",
        "mw-widgets-titleinput-description-redirect": "redirect to $1",
 +      "mw-widgets-categoryselector-add-category-placeholder": "Add a category...",
        "sessionmanager-tie": "Cannot combine multiple request authentication types: $1.",
        "sessionprovider-generic": "$1 sessions",
        "sessionprovider-mediawiki-session-cookiesessionprovider": "cookie-based sessions",
diff --combined languages/i18n/qqq.json
        "passwordreset-emaildisabled": "Used as error message in changing password when site's email feature is disabled.",
        "passwordreset-username": "{{Identical|Username}}",
        "passwordreset-domain": "A domain like used in Domain Name System (DNS) or more specifically like a domain component in the Lightweight Directory Access Protocol (LDAP).\n{{Identical|Domain}}",
 -      "passwordreset-capture": "Label for checkbox asking the user whether they want to see the contents of the password reset email (only shown if they have the <code>passwordreset</code> permission).",
 -      "passwordreset-capture-help": "Longer explanatory message for the capture checkbox label.",
        "passwordreset-email": "{{Identical|E-mail address}}",
        "passwordreset-emailtitle": "Used as subject (title) of email.",
        "passwordreset-emailtext-ip": "Be consistent with {{msg-mw|Passwordreset-emailtext-user}}.\n\nParameters:\n* $1 - an IP address\n* $2 - message {{msg-mw|Passwordreset-emailelement}} repeated $3 times\n* $3 - the number of repetitions in $2\n* $4 - base URL of the wiki\n* $5 - number of days",
        "passwordreset-emailelement": "This is a body of a password reset email to allow them into the system with a new password. Parameters:\n* $1 - the user's login name. This parameter can be used for GENDER.\n* $2 - the temporary password given by the system",
        "passwordreset-emailsentemail": "Used in [[Special:PasswordReset]].\n\nSee also:\n* {{msg-mw|Passwordreset-emailsent-capture}}\n* {{msg-mw|Passwordreset-emailerror-capture}}",
        "passwordreset-emailsentusername": "Used in [[Special:PasswordReset]].\n\nSee also:\n* {{msg-mw|Passwordreset-emailsent-capture}}\n* {{msg-mw|Passwordreset-emailerror-capture}}",
 -      "passwordreset-emailsent-capture2": "Used in [[Special:PasswordReset]].\n\nParameters:\n* $1 - number of accounts notified\n\nSee also:\n* {{msg-mw|Passwordreset-emailsentemail}}\n* {{msg-mw|Passwordreset-emailsentusername}}\n* {{msg-mw|Passwordreset-emailerror-capture}}",
 -      "passwordreset-emailerror-capture2": "Error message displayed in [[Special:PasswordReset]] when sending an email fails. Parameters:\n* $1 - error message\n* $2 - username, used for GENDER\n* $3 - number of accounts notified\n\nSee also:\n* {{msg-mw|Passwordreset-emailsentemail}}\n* {{msg-mw|Passwordreset-emailsentusername}}\n* {{msg-mw|Passwordreset-emailsent-capture}}\n* {{msg-mw|Passwordreset-emailerror-capture}}",
        "passwordreset-nocaller": "Shown when a password reset was requested but the process failed due to an internal error related to missing details about the origin (caller) of the password reset request.",
        "passwordreset-nosuchcaller": "Shown when a password reset was requested but the username of the caller could not be resolved to a user. This is an internal error.\n\nParameters:\n* $1 - username of the caller",
        "passwordreset-ignored": "Shown when password reset was unsuccessful due to configuration problems.",
        "right-siteadmin": "{{doc-right|siteadmin}}",
        "right-override-export-depth": "{{doc-right|override-export-depth}}",
        "right-sendemail": "{{doc-right|sendemail}}",
 -      "right-passwordreset": "{{doc-right|passwordreset}}",
        "right-managechangetags": "{{doc-right|managechangetags}}",
        "right-applychangetags": "{{doc-right|applychangetags}}",
        "right-changetags": "{{doc-right|changetags}}",
        "apisandbox-continue-clear": "Button text for clearing query continuation parameters.\n{{Identical|Clear}}",
        "apisandbox-continue-help": "Help text for the continue and clear buttons.",
        "apisandbox-param-limit": "Additional documentation text for 'limit'-type parameters.",
+       "apisandbox-multivalue-all-namespaces": "Used as an entry in a multiple-namespace widget to select all available namespaces. Parameters:\n* $1 - API input value meaning \"all namespaces\".",
+       "apisandbox-multivalue-all-values": "Used as an entry in a multiple-value widget to select all available values. Parameters:\n* $1 - API input value meaning \"all values\".",
        "booksources": "{{doc-special|BookSources}}\n\n'''This message shouldn't be changed unless it has serious mistakes.'''\n\nIt's used as the page name of the configuration page of [[Special:BookSources]]. Changing it breaks existing sites using the default version of this message.\n\nSee also:\n* {{msg-mw|Booksources|title}}\n* {{msg-mw|Booksources-text|text}}",
        "booksources-summary": "{{doc-specialpagesummary|booksources}}",
        "booksources-search-legend": "Box heading on [[Special:BookSources|book sources]] special page. The box is for searching for places where a particular book can be bought or viewed.",
        "mediastatistics-header-audio": "Header on [[Special:MediaStatistics]] for file types that are in the audio category\n{{Identical|Audio}}",
        "mediastatistics-header-video": "Header on [[Special:MediaStatistics]] for file types that are in the video category\n{{Identical|Video}}",
        "mediastatistics-header-multimedia": "Header on [[Special:MediaStatistics]] for file types that are in the multimedia category. This does not include plain audio or video files, but more complex multimedia such as flash or vrml. This especially includes scripted multimedia. Ogg files in which MediaWiki cannot determine if it is an audio or video file (or something else) are included here.",
 -      "mediastatistics-header-office": "Header on [[Special:MediaStatistics]] for file types that are in the Office category. This includes PDFs, OpenDocument files, Microsoft Word files, etc.",
 +      "mediastatistics-header-office": "Header on [[Special:MediaStatistics]] for file types that are in the Office category. This includes PDFs, OpenDocument files, Microsoft Word files, etc.\n{{Identical|Office}}",
        "mediastatistics-header-text": "Header on [[Special:MediaStatistics]] for file types that are in the text category. This includes simple text formats, including plain text formats, json, csv, and xml. Source code of compiled programming languages may be included here in the future, but isn't currently.",
        "mediastatistics-header-executable": "Header on [[Special:MediaStatistics]] for file types that are in the executable category. This includes things like source files for interpreted programming language (Shell scripts, javascript, etc).",
        "mediastatistics-header-archive": "Header on [[Special:MediaStatistics]] for file types that are in the archive category. Includes things like tar, zip, gzip etc.",
        "mw-widgets-titleinput-description-new-page": "Description label for a new page in the title input widget.",
        "mw-widgets-titleinput-description-redirect": "Description label for a redirect in the title input widget.",
        "sessionmanager-tie": "Used as an error message when multiple session sources are tied in priority.\n\nParameters:\n* $1 - List of dession type descriptions, from messages like {{msg-mw|sessionprovider-mediawiki-session-cookiesessionprovider}}.",
 +      "mw-widgets-categoryselector-add-category-placeholder": "Placeholder displayed in the category selector widget after the capsules of already added categories.",
        "sessionprovider-generic": "Used to create a generic session type description when one isn't provided via the proper message. Should be phrased to make sense when added to a message such as {{msg-mw|cannotloginnow-text}}.\n\nParameters:\n* $1 - PHP classname.",
        "sessionprovider-mediawiki-session-cookiesessionprovider": "Description of the sessions provided by the CookieSessionProvider class, which use HTTP cookies. Should be phrased to make sense when added to a message such as {{msg-mw|cannotloginnow-text}}.",
        "sessionprovider-nocookies": "Used to inform the user that sessions may be missing due to lack of cookies.",
diff --combined resources/Resources.php
@@@ -334,6 -334,7 +334,6 @@@ return 
                        'message' => 'Please use "mediawiki.storage" instead.',
                ],
                'scripts' => 'resources/lib/jquery/jquery.jStorage.js',
 -              'dependencies' => 'json',
        ],
        'jquery.suggestions' => [
                'scripts' => 'resources/src/jquery/jquery.suggestions.js',
  
        /* json2 */
  
 +      // Deprecated since MediaWiki 1.29.0
        'json' => [
 -              'scripts' => 'resources/lib/json2/json2.js',
 +              'deprecated' => 'Use of the "json" MediaWiki module is deprecated since MediaWiki 1.29.0',
                'targets' => [ 'desktop', 'mobile' ],
 -              'skipFunction' => 'resources/src/json-skip.js',
        ],
  
        /* Moment.js */
                        'dom-level2-shim',
                        'mediawiki.api',
                        'mediawiki.api.edit',
 -                      'json',
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
                'dependencies' => [
                        'jquery.byteLength',
                        'mediawiki.RegExp',
 -                      'json',
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'mediawiki.Title' => [
 -              'scripts' => 'resources/src/mediawiki/mediawiki.Title.js',
 +              'scripts' => [
 +                      'resources/src/mediawiki/mediawiki.Title.js',
 +                      'resources/src/mediawiki/mediawiki.Title.phpCharToUpper.js',
 +              ],
                'dependencies' => [
                        'jquery.byteLength',
                        'mediawiki.util',
                        'apisandbox-continue-clear',
                        'apisandbox-continue-help',
                        'apisandbox-param-limit',
+                       'apisandbox-multivalue-all-namespaces',
+                       'apisandbox-multivalue-all-values',
                        'api-format-prettyprint-status',
                        'blanknamespace',
                ],
                ],
                'messages' => [
                        'red-link-title',
 +                      'mw-widgets-categoryselector-add-category-placeholder'
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
                'targets' => [ 'desktop', 'mobile' ],
                'dependencies' => [
                        'es5-shim',
 -                      'json',
                ],
        ],
  
                                }
                        },
                        apiCheckValid: function () {
-                               var ok = this.getApiValue() !== undefined || suppressErrors;
+                               var ok = true,
+                                       pi = this.paramInfo;
+                               if ( !suppressErrors ) {
+                                       ok = this.getApiValue() !== undefined && !(
+                                               pi.allspecifier !== undefined &&
+                                               this.getItemsData().length > 1 &&
+                                               this.getItemsData().indexOf( pi.allspecifier ) !== -1
+                                       );
+                               }
                                this.setIcon( ok ? null : 'alert' );
                                this.setIconTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() );
                                return $.Deferred().resolve( ok ).promise();
                                                return a.data - b.data;
                                        } );
                                        if ( Util.apiBool( pi.multi ) ) {
+                                               if ( pi.allspecifier !== undefined ) {
+                                                       items.unshift( new OO.ui.MenuOptionWidget( {
+                                                               data: pi.allspecifier,
+                                                               label: mw.message( 'apisandbox-multivalue-all-namespaces', pi.allspecifier ).text()
+                                                       } ) );
+                                               }
                                                widget = new OO.ui.CapsuleMultiselectWidget( {
                                                        menu: { items: items }
                                                } );
                                                return new OO.ui.MenuOptionWidget( { data: String( v ), label: String( v ) } );
                                        } );
                                        if ( Util.apiBool( pi.multi ) ) {
+                                               if ( pi.allspecifier !== undefined ) {
+                                                       items.unshift( new OO.ui.MenuOptionWidget( {
+                                                               data: pi.allspecifier,
+                                                               label: mw.message( 'apisandbox-multivalue-all-values', pi.allspecifier ).text()
+                                                       } ) );
+                                               }
                                                widget = new OO.ui.CapsuleMultiselectWidget( {
                                                        menu: { items: items }
                                                } );
  
                                                $result.empty();
                                                if ( /^text\/mediawiki-api-prettyprint-wrapped(?:;|$)/.test( ct ) ) {
 -                                                      data = $.parseJSON( data );
 +                                                      data = JSON.parse( data );
                                                        if ( data.modules.length ) {
                                                                mw.loader.load( data.modules );
                                                        }