Merge "ApiSandbox: Add text about limit's "max" value"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 15 Nov 2016 18:43:33 +0000 (18:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 15 Nov 2016 18:43:33 +0000 (18:43 +0000)
1  2 
languages/i18n/en.json
languages/i18n/qqq.json
resources/src/mediawiki.special/mediawiki.special.apisandbox.js

diff --combined languages/i18n/en.json
        "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?",
 -      "passwordreset-invalideamil": "Invalid email address",
 +      "passwordreset-invalidemail": "Invalid email address",
        "passwordreset-nodata": "Neither a username nor an email address was supplied",
        "changeemail": "Change or remove email address",
        "changeemail-summary": "",
        "apisandbox-continue": "Continue",
        "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.",
        "booksources": "Book sources",
        "booksources-summary": "",
        "booksources-search-legend": "Search for book sources",
diff --combined languages/i18n/qqq.json
        "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.",
 -      "passwordreset-invalideamil": "Returned when the email address is syntatically invalid.",
 +      "passwordreset-invalidemail": "Returned when the email address is syntatically invalid.",
        "passwordreset-nodata": "Returned when no data was provided.",
        "changeemail": "Title of [[Special:ChangeEmail|special page]]. This page also allows removing the user's email address.",
        "changeemail-summary": "{{ignored}}",
        "apisandbox-continue": "Button text for sending another request using query continuation.\n{{Identical|Continue}}",
        "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.",
        "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.",
                                        break;
  
                                case 'limit':
 -                                      widget = new OO.ui.NumberInputWidget( {
 -                                              required: Util.apiBool( pi.required ),
 -                                              isInteger: true
 +                                      widget = new OO.ui.TextInputWidget( {
 +                                              required: Util.apiBool( pi.required )
                                        } );
 -                                      widget.setIcon = widget.input.setIcon.bind( widget.input );
 -                                      widget.setIconTitle = widget.input.setIconTitle.bind( widget.input );
 -                                      widget.getValidity = widget.input.getValidity.bind( widget.input );
 -                                      widget.input.setValidation( function ( value ) {
 -                                              return value === 'max' || widget.validateNumber( value );
 +                                      widget.setValidation( function ( value ) {
 +                                              var n, pi = this.paramInfo;
 +
 +                                              if ( value === 'max' ) {
 +                                                      return true;
 +                                              } else {
 +                                                      n = +value;
 +                                                      return !isNaN( n ) && isFinite( n ) &&
 +                                                              /* jshint bitwise: false */
 +                                                              ( n | 0 ) === n &&
 +                                                              /* jshint bitwise: true */
 +                                                              n >= pi.min && n <= pi.apiSandboxMax;
 +                                              }
                                        } );
 +                                      pi.min = pi.min || 0;
 +                                      pi.apiSandboxMax = mw.config.get( 'apihighlimits' ) ? pi.highmax : pi.max;
                                        widget.paramInfo = pi;
                                        $.extend( widget, WidgetMethods.textInputWidget );
 -                                      widget.setRange( pi.min || 0, mw.config.get( 'apihighlimits' ) ? pi.highmax : pi.max );
                                        multiMode = 'enter';
                                        break;
  
                                                                if ( pi.parameters[ i ].highmax !== undefined ) {
                                                                        dl.append( $( '<dd>', {
                                                                                addClass: 'info',
-                                                                               append: Util.parseHTML( mw.message(
-                                                                                       'api-help-param-limit2', pi.parameters[ i ].max, pi.parameters[ i ].highmax
-                                                                               ).parse() )
+                                                                               append: [
+                                                                                       Util.parseHTML( mw.message(
+                                                                                               'api-help-param-limit2', pi.parameters[ i ].max, pi.parameters[ i ].highmax
+                                                                                       ).parse() ),
+                                                                                       ' ',
+                                                                                       Util.parseHTML( mw.message( 'apisandbox-param-limit' ).parse() )
+                                                                               ]
                                                                        } ) );
                                                                } else {
                                                                        dl.append( $( '<dd>', {
                                                                                addClass: 'info',
-                                                                               append: Util.parseHTML( mw.message(
-                                                                                       'api-help-param-limit', pi.parameters[ i ].max
-                                                                               ).parse() )
+                                                                               append: [
+                                                                                       Util.parseHTML( mw.message(
+                                                                                               'api-help-param-limit', pi.parameters[ i ].max
+                                                                                       ).parse() ),
+                                                                                       ' ',
+                                                                                       Util.parseHTML( mw.message( 'apisandbox-param-limit' ).parse() )
+                                                                               ]
                                                                        } ) );
                                                                }
                                                                break;