Merge "HTMLForm: Add 'title' type"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 16 Jul 2015 18:33:13 +0000 (18:33 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 16 Jul 2015 18:33:13 +0000 (18:33 +0000)
1  2 
autoload.php
includes/htmlform/HTMLForm.php
languages/i18n/en.json
languages/i18n/qqq.json

diff --combined autoload.php
@@@ -488,10 -488,10 +488,10 @@@ $wgAutoloadLocalClasses = array
        'HTMLFileCache' => __DIR__ . '/includes/cache/HTMLFileCache.php',
        'HTMLFloatField' => __DIR__ . '/includes/htmlform/HTMLFloatField.php',
        'HTMLForm' => __DIR__ . '/includes/htmlform/HTMLForm.php',
 -      'HTMLFormFieldWithButton' => __DIR__ . '/includes/htmlform/HTMLFormFieldWithButton.php',
        'HTMLFormField' => __DIR__ . '/includes/htmlform/HTMLFormField.php',
        'HTMLFormFieldCloner' => __DIR__ . '/includes/htmlform/HTMLFormFieldCloner.php',
        'HTMLFormFieldRequiredOptionsException' => __DIR__ . '/includes/htmlform/HTMLFormFieldRequiredOptionsException.php',
 +      'HTMLFormFieldWithButton' => __DIR__ . '/includes/htmlform/HTMLFormFieldWithButton.php',
        'HTMLHiddenField' => __DIR__ . '/includes/htmlform/HTMLHiddenField.php',
        'HTMLInfoField' => __DIR__ . '/includes/htmlform/HTMLInfoField.php',
        'HTMLIntField' => __DIR__ . '/includes/htmlform/HTMLIntField.php',
        'HTMLTextAreaField' => __DIR__ . '/includes/htmlform/HTMLTextAreaField.php',
        'HTMLTextField' => __DIR__ . '/includes/htmlform/HTMLTextField.php',
        'HTMLTextFieldWithButton' => __DIR__ . '/includes/htmlform/HTMLTextFieldWithButton.php',
+       'HTMLTitleTextField' => __DIR__ . '/includes/htmlform/HTMLTitleTextField.php',
        'HWLDFWordAccumulator' => __DIR__ . '/includes/diff/DairikiDiff.php',
        'HashBagOStuff' => __DIR__ . '/includes/libs/objectcache/HashBagOStuff.php',
        'HashConfig' => __DIR__ . '/includes/config/HashConfig.php',
        'ICacheHelper' => __DIR__ . '/includes/cache/CacheHelper.php',
        'IContextSource' => __DIR__ . '/includes/context/IContextSource.php',
        'IDBAccessObject' => __DIR__ . '/includes/dao/IDBAccessObject.php',
 -      'IDatabase' => __DIR__ . '/includes/db/Database.php',
 +      'IDatabase' => __DIR__ . '/includes/db/IDatabase.php',
        'IEContentAnalyzer' => __DIR__ . '/includes/libs/IEContentAnalyzer.php',
        'IEUrlExtension' => __DIR__ . '/includes/libs/IEUrlExtension.php',
        'IJobSpecification' => __DIR__ . '/includes/jobqueue/JobSpecification.php',
        'LoadBalancer' => __DIR__ . '/includes/db/LoadBalancer.php',
        'LoadBalancerSingle' => __DIR__ . '/includes/db/LBFactorySingle.php',
        'LoadMonitor' => __DIR__ . '/includes/db/LoadMonitor.php',
 -      'LoadMonitorMySQL' => __DIR__ . '/includes/db/LoadMonitor.php',
 +      'LoadMonitorMySQL' => __DIR__ . '/includes/db/LoadMonitorMySQL.php',
        'LoadMonitorNull' => __DIR__ . '/includes/db/LoadMonitor.php',
        'LocalFile' => __DIR__ . '/includes/filerepo/file/LocalFile.php',
        'LocalFileDeleteBatch' => __DIR__ . '/includes/filerepo/file/LocalFile.php',
        'PoolWorkArticleView' => __DIR__ . '/includes/poolcounter/PoolWorkArticleView.php',
        'PopulateBacklinkNamespace' => __DIR__ . '/maintenance/populateBacklinkNamespace.php',
        'PopulateCategory' => __DIR__ . '/maintenance/populateCategory.php',
 +      'PopulateContentModel' => __DIR__ . '/maintenance/populateContentModel.php',
        'PopulateFilearchiveSha1' => __DIR__ . '/maintenance/populateFilearchiveSha1.php',
        'PopulateImageSha1' => __DIR__ . '/maintenance/populateImageSha1.php',
        'PopulateLogSearch' => __DIR__ . '/maintenance/populateLogSearch.php',
@@@ -153,6 -153,7 +153,7 @@@ class HTMLForm extends ContextSource 
                'email' => 'HTMLTextField',
                'password' => 'HTMLTextField',
                'url' => 'HTMLTextField',
+               'title' => 'HTMLTitleTextField',
        );
  
        public $mFieldData;
  
                $html = ''
                        . $this->getErrors( $submitResult )
 -                      . $this->mHeader
 +                      // In OOUI forms, we handle mHeader elsewhere. FIXME This is horrible.
 +                      . ( $this->getDisplayFormat() === 'ooui' ? '' : $this->mHeader )
                        . $this->getBody()
                        . $this->getHiddenFields()
                        . $this->getButtons()
                $attribs = array(
                        'action' => $this->getAction(),
                        'method' => $this->getMethod(),
 -                      'class' => array( 'visualClear' ),
                        'enctype' => $encType,
                );
                if ( !empty( $this->mId ) ) {
        function wrapForm( $html ) {
                # Include a <fieldset> wrapper for style, if requested.
                if ( $this->mWrapperLegend !== false ) {
 -                      $html = Xml::fieldset( $this->mWrapperLegend, $html );
 +                      $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend : false;
 +                      $html = Xml::fieldset( $legend, $html );
                }
  
 -              return Html::rawElement( 'form', $this->getFormAttributes(), $html );
 +              return Html::rawElement( 'form', $this->getFormAttributes() + array( 'class' => 'visualClear' ), $html );
        }
  
        /**
         * Prompt the whole form to be wrapped in a "<fieldset>", with
         * this text as its "<legend>" element.
         *
 -       * @param string|bool $legend HTML to go inside the "<legend>" element, or
 -       * false for no <legend>
 -       *     Will be escaped
 +       * @param string|bool $legend If false, no wrapper or legend will be displayed.
 +       *     If true, a wrapper will be displayed, but no legend.
 +       *     If a string, a wrapper will be displayed with that string as a legend.
 +       *     The string will be escaped before being output (this doesn't support HTML).
         *
         * @return HTMLForm $this for chaining calls (since 1.20)
         */
                                if ( $sectionName ) {
                                        $config['id'] = Sanitizer::escapeId( $sectionName );
                                }
 +                              if ( is_string( $this->mWrapperLegend ) ) {
 +                                      $config['label'] = $this->mWrapperLegend;
 +                              }
                                $fieldset = new OOUI\FieldsetLayout( $config );
                                // Ewww. We should pass this as $config['items'], but there might be string snippets.
                                $fieldset->group->appendContent( new OOUI\HtmlSnippet( $html ) );
 -                              $html = $fieldset->toString();
 +                              $html = $fieldset;
                        } else {
                                $html = Html::rawElement( 'div', $attribs, "\n$html\n" );
                        }
                }
  
 -              if ( $this->mSubSectionBeforeFields ) {
 -                      return $subsectionHtml . "\n" . $html;
 +              if ( $subsectionHtml ) {
 +                      if ( $this->mSubSectionBeforeFields ) {
 +                              return $subsectionHtml . "\n" . $html;
 +                      } else {
 +                              return $html . "\n" . $subsectionHtml;
 +                      }
                } else {
 -                      return $html . "\n" . $subsectionHtml;
 +                      return $html;
                }
        }
  
diff --combined languages/i18n/en.json
        "protectedinterface": "This page provides interface text for the software on this wiki, and is protected to prevent abuse.\nTo add or change translations for all wikis, please use [//translatewiki.net/ translatewiki.net], the MediaWiki localisation project.",
        "editinginterface": "<strong>Warning:</strong> You are editing a page that is used to provide interface text for the software.\nChanges to this page will affect the appearance of the user interface for other users on this wiki.",
        "translateinterface": "To add or change translations for all wikis, please use [//translatewiki.net/ translatewiki.net], the MediaWiki localisation project.",
 -      "cascadeprotected": "This page has been protected from editing because it is included in the following {{PLURAL:$1|page, which is|pages, which are}} protected with the \"cascading\" option turned on:\n$2",
 +      "cascadeprotected": "This page has been protected from editing because it is transcluded in the following {{PLURAL:$1|page, which is|pages, which are}} protected with the \"cascading\" option turned on:\n$2",
        "namespaceprotected": "You do not have permission to edit pages in the <strong>$1</strong> namespace.",
        "customcssprotected": "You do not have permission to edit this CSS page because it contains another user's personal settings.",
        "customjsprotected": "You do not have permission to edit this JavaScript page because it contains another user's personal settings.",
        "readonlywarning": "<strong>Warning: The database has been locked for maintenance, so you will not be able to save your edits right now.</strong>\nYou may wish to copy and paste your text into a text file and save it for later.\n\nThe administrator who locked it offered this explanation: $1",
        "protectedpagewarning": "<strong>Warning: This page has been protected so that only users with administrator privileges can edit it.</strong>\nThe latest log entry is provided below for reference:",
        "semiprotectedpagewarning": "<strong>Note:</strong> This page has been protected so that only registered users can edit it.\nThe latest log entry is provided below for reference:",
 -      "cascadeprotectedwarning": "<strong>Warning:</strong> This page has been protected so that only users with administrator privileges can edit it because it is included in the following cascade-protected {{PLURAL:$1|page|pages}}:",
 +      "cascadeprotectedwarning": "<strong>Warning:</strong> This page has been protected so that only users with administrator privileges can edit it because it is transcluded in the following cascade-protected {{PLURAL:$1|page|pages}}:",
        "titleprotectedwarning": "<strong>Warning: This page has been protected so that [[Special:ListGroupRights|specific rights]] are needed to create it.</strong>\nThe latest log entry is provided below for reference:",
        "templatesused": "{{PLURAL:$1|Template|Templates}} used on this page:",
        "templatesusedpreview": "{{PLURAL:$1|Template|Templates}} used in this preview:",
        "linksearch-pat": "Search pattern:",
        "linksearch-ns": "Namespace:",
        "linksearch-ok": "Search",
 -      "linksearch-text": "Wildcards such as \"*.wikipedia.org\" may be used.\nNeeds at least a top-level domain, for example \"*.org\".<br />\nSupported {{PLURAL:$2|protocol|protocols}}: <code>$1</code> (defaults to http:// if no protocol is specified).",
 +      "linksearch-text": "Wildcards such as \"*.wikipedia.org\" may be used.\nNeeds at least a top-level domain, for example \"*.org\".<br />\nSupported {{PLURAL:$2|protocol|protocols}}: $1 (defaults to http:// if no protocol is specified).",
        "linksearch-line": "$1 is linked from $2",
        "linksearch-error": "Wildcards may appear only at the start of the hostname.",
        "listusersfrom": "Display users starting at:",
        "protect-locked-blocked": "You cannot change protection levels while blocked.\nHere are the current settings for the page <strong>$1</strong>:",
        "protect-locked-dblock": "Protection levels cannot be changed due to an active database lock.\nHere are the current settings for the page <strong>$1</strong>:",
        "protect-locked-access": "Your account does not have permission to change page protection levels.\nHere are the current settings for the page <strong>$1</strong>:",
 -      "protect-cascadeon": "This page is currently protected because it is included in the following {{PLURAL:$1|page, which has|pages, which have}} cascading protection turned on.\nChanges to this page's protection level will not affect the cascading protection.",
 +      "protect-cascadeon": "This page is currently protected because it is transcluded in the following {{PLURAL:$1|page, which has|pages, which have}} cascading protection turned on.\nChanges to this page's protection level will not affect the cascading protection.",
        "protect-default": "Allow all users",
        "protect-fallback": "Allow only users with \"$1\" permission",
        "protect-level-autoconfirmed": "Allow only autoconfirmed users",
        "pageinfo-robot-index": "Allowed",
        "pageinfo-robot-noindex": "Disallowed",
        "pageinfo-watchers": "Number of page watchers",
 -      "pageinfo-visiting-watchers": "Number of page watchers visiting recent edits",
 +      "pageinfo-visiting-watchers": "Number of page watchers who visited recent edits",
        "pageinfo-few-watchers": "Fewer than $1 {{PLURAL:$1|watcher|watchers}}",
        "pageinfo-few-visiting-watchers": "There may or may not be a watching user visiting recent edits",
        "pageinfo-redirects-name": "Number of redirects to this page",
        "htmlform-cloner-create": "Add more",
        "htmlform-cloner-delete": "Remove",
        "htmlform-cloner-required": "At least one value is required.",
+       "htmlform-title-badnamespace": "[[:$1]] is not in the \"{{ns:$2}}\" namespace.",
+       "htmlform-title-not-creatable": "\"$1\" is not a creatable page title",
+       "htmlform-title-not-exists": "[[:$1]] does not exist.",
        "sqlite-has-fts": "$1 with full-text search support",
        "sqlite-no-fts": "$1 without full-text search support",
        "logentry-delete-delete": "$1 {{GENDER:$2|deleted}} page $3",
diff --combined languages/i18n/qqq.json
        "mergehistory-reason": "{{Identical|Reason}}",
        "mergehistory-revisionrow": "{{Optional}}\nA revision row in the merge history page. Parameters:\n* $1 - a radio button to indicate a merge point\n* $2 - a link to the last revision of a page ({{msg-mw|Last}})\n* $3 - a page link\n* $4 - a user link\n* $5 - a revision size\n* $6 - a revision comment",
        "mergelog": "{{doc-logpage}}\n\nThis is the name of a log of merge actions done on [[Special:MergeHistory]]. This special page and this log is not enabled by default.",
 -      "pagemerge-logentry": "{{ignored}}This is ''logentry'' message only used on IRC.\n\nParameters:\n* $1 - the page name of the source of the content to be merged\n* $2 - the page into which the content is merged\n* $3 - a timestamp of limit\n\nThe log and its associated special page 'MergeHistory' is not enabled by default.\n\nPlease note that the parameters in a log entry will appear in the log only in the default language of the wiki. View [[Special:Log]] for examples on translatewiki.net with English default language.",
 +      "pagemerge-logentry": "{{ignored}}This is ''logentry'' message only used on IRC.\n\nParameters:\n* $1 - the page name of the source of the content to be merged\n* $2 - the page into which the content is merged\n* $3 - a timestamp of limit\n\nThe log and its associated special page 'MergeHistory' is not enabled by default.\n\nPlease note that the parameters in a log entry will appear in the log only in the default language of the wiki. View [[Special:Log]] for examples on translatewiki.net with English default language.",
        "revertmerge": "Used as link text",
        "mergelogpagetext": "Description of the [{{canonicalurl:Special:Log|type=merge&user=&page=&year=&month=-1}} merge log], on the log. The associated [[Special:MergeHistory|Merge]] special page is not enabled by default.",
        "history-title": "Displayed as page title when you click on the \"history\" tab. Parameters:\n* $1 - the normal page title",
        "uploadwarning": "Used as section header in [[Special:Upload]].",
        "uploadwarning-text": "Used in [[Special:Upload]].",
        "savefile": "When uploading a file",
 -      "uploadedimage": "{{ignored}}This is ''logentry'' message only used on IRC. $1 is the name of the file uploaded.",
 -      "overwroteimage": "{{ignored}}This is ''logentry'' message only used on IRC. $1 is the name of the file uploaded.",
 +      "uploadedimage": "{{ignored}}This is ''logentry'' message only used on IRC. $1 is the name of the file uploaded.",
 +      "overwroteimage": "{{ignored}}This is ''logentry'' message only used on IRC. $1 is the name of the file uploaded.",
        "uploaddisabled": "Title of the [[Special:Upload]] page when upload is disabled.\n\nSee also:\n* {{msg-mw|Copyuploaddisabled}}",
        "copyuploaddisabled": "See also:\n* {{msg-mw|Uploaddisabled}}",
        "uploaddisabledtext": "Parameters:\n* $1 - (Optional) the name of the target file. See r22243 and [[bugzilla:8818|bug 8818]].",
        "blocklogpage": "{{doc-logpage}}\n\nThe page name of [[Special:Log/block]]. Also appears in the drop down menu of [[Special:Log]] pages and in the action links of Special:Contributions/''Username'' pages (e.g. \"For Somebody (talk | block log | logs)\").\n\n{{Identical|Block log}}",
        "blocklog-showlog": "Parameters:\n* $1 - (Optional) the blocked user. Can be used for GENDER\nSee also:\n* {{msg-mw|Blocklog-showsuppresslog}}\n* {{msg-mw|Globalblocking-showlog}}",
        "blocklog-showsuppresslog": "Parameters:\n* $1 - (Optional) the blocked user. Can be used for GENDER",
 -      "blocklogentry": "This is ''logentry'' message only used on IRC.\n* $1 - the blocked user or IP (with link to contributions and talk)\n* $2 - the duration of the block (hours, days etc.) or the specified expiry date\n* $3 - contains \"(details) (''reason'')\", or empty string\nSee also:\n* {{msg-mw|Unblocklogentry}}\n* {{msg-mw|Reblock-logentry}}",
 -      "reblock-logentry": "This is ''logentry'' message only used on IRC.\n\nParameters:\n* $1 - the user being reblocked\n* $2 - the expiry time of the block\n* $3 - extra parameters like \"account creation blocked\" (they are automatically between brackets)",
 +      "blocklogentry": "This is ''logentry'' message only used on IRC.\n* $1 - the blocked user or IP (with link to contributions and talk)\n* $2 - the duration of the block (hours, days etc.) or the specified expiry date\n* $3 - contains \"(details) (''reason'')\", or empty string\nSee also:\n* {{msg-mw|Unblocklogentry}}\n* {{msg-mw|Reblock-logentry}}",
 +      "reblock-logentry": "This is ''logentry'' message only used on IRC.\n\nParameters:\n* $1 - the user being reblocked\n* $2 - the expiry time of the block\n* $3 - extra parameters like \"account creation blocked\" (they are automatically between brackets)",
        "blocklogtext": "Appears on top of [[Special:Log/block]].",
 -      "unblocklogentry": "This is ''logentry'' message only used on IRC.\n* $1 is the user being unblocked",
 +      "unblocklogentry": "This is ''logentry'' message only used on IRC.\n* $1 is the user being unblocked",
        "block-log-flags-anononly": "Used as a block log flag in [[Special:Log/block]] and in [[Special:Block]].\n\nSee also:\n* {{msg-mw|Anononlyblock}}\n{{Related|Block-log-flags}}",
        "block-log-flags-nocreate": "Used as a block log flag in [[Special:Log/block]] and in [[Special:Block]].\n\nSee also:\n* {{msg-mw|Createaccountblock}}\n{{Related|Block-log-flags}}",
        "block-log-flags-noautoblock": "Used as a block log flag in [[Special:Log/block]] and in [[Special:Block]].\n{{Related|Block-log-flags}}\n{{Identical|Autoblock disabled}}",
        "import-rootpage-nosubpage": "Used on [[Special:Import]], when the import namespace does not support subpages. Parameters:\n* $1 is a namespace name.",
        "importlogpage": "{{doc-logpage}}",
        "importlogpagetext": "This text appears at the top of the [{{canonicalurl:Special:Log|type=import}} import log] special page.",
 -      "import-logentry-upload": "{{ignored}}This is ''logentry'' message only used on IRC.\n* $1 is the name of the imported file",
 +      "import-logentry-upload": "{{ignored}}This is ''logentry'' message only used on IRC.\n* $1 is the name of the imported file",
        "import-logentry-upload-detail": "Used as success message and log entry. Parameters:\n* $1 - number of succeeded revisions\nSee also:\n* {{msg-mw|Import-logentry-interwiki-detail}}",
 -      "import-logentry-interwiki": "{{ignored}}This is ''logentry'' message only used on IRC. Parameters:\n* $1 - page title",
 +      "import-logentry-interwiki": "{{ignored}}This is ''logentry'' message only used on IRC. Parameters:\n* $1 - page title",
        "import-logentry-interwiki-detail": "Used as success message and log entry. Parameters:\n* $1 - number of succeeded revisions\n* $2 - interwiki name\nSee also:\n* {{msg-mw|Import-logentry-upload-detail}}",
        "javascripttest": "Title of the special page [[Special:JavaScriptTest]].\n\nSee also:\n* {{msg-mw|Javascripttest|title}}\n* {{msg-mw|Javascripttest-pagetext-noframework|summary}}\n* {{msg-mw|Javascripttest-pagetext-unknownframework|error message}}",
        "javascripttest-backlink": "{{optional}}\nUsed as subtitle in [[Special:JavaScriptTest]]. Parameters:\n* $1 - page title",
        "htmlform-cloner-create": "Used as the text for the button that adds a row to a multi-input HTML form element.\n\nSee also:\n* {{msg-mw|htmlform-cloner-delete}}\n* {{msg-mw|htmlform-cloner-required}}",
        "htmlform-cloner-delete": "Used as the text for the button that removes a row from a multi-input HTML form element\n\nSee also:\n* {{msg-mw|htmlform-cloner-create}}\n* {{msg-mw|htmlform-cloner-required}}\n{{Identical|Remove}}",
        "htmlform-cloner-required": "Used as an error message in HTML forms.\n\nSee also:\n* {{msg-mw|htmlform-required}}\n* {{msg-mw|htmlform-cloner-create}}\n* {{msg-mw|htmlform-cloner-delete}}",
+       "htmlform-title-badnamespace": "Error message shown if the page title provided by the user is not in the required namespace. $1 is the page, $2 is the numerical namespace index.",
+       "htmlform-title-not-creatable": "Error message shown if the page title provided by the user is not creatable (a special page). $1 is the page title.",
+       "htmlform-title-not-exists": "Error message shown if the page title provided by the user does not exist. $1 is the page title.",
        "sqlite-has-fts": "Shown on [[Special:Version]].\nParameters:\n* $1 - version",
        "sqlite-no-fts": "Shown on [[Special:Version]].\nParameters:\n* $1 - version",
        "logentry-delete-delete": "{{Logentry|[[Special:Log/delete]]}}",
        "patrol-log-line": "Text of notes on entries in the [{{FULLURL:Special:Log|type=patrol}} patrol log].\nParameters:\n* $1 - the link whose text is {{msg-mw|patrol-log-diff}}\n* $2 - the name of the page\n* $3 - appears to be {{msg-mw|Patrol-log-auto}} (at least sometimes)\n\nThe message appears after the name of the patroller.",
        "patrol-log-auto": "Automated edit summary when patrolling.\n\n{{Identical|Automatic}}",
        "patrol-log-diff": "The text of the diff link in {{msg-mw|Patrol-log-line}} (inside <code>$1</code> there).\n\nParameters:\n* $1 - revision ID\n{{Identical|Revision}}",
 -      "1movedto2": "{{ignored}}This is ''logentry'' message only used on IRC. Parameters:\n* $1 - the original page name\n* $2 - the destination page name\nSee also:\n* {{msg-mw|1movedto2 redir}}",
 -      "1movedto2_redir": "{{ignored}}This is ''logentry'' message only used on IRC. Parameters:\n* $1 - the original page name\n* $2 - the destination page name\nSee also:\n* {{msg-mw|1movedto2}}",
 +      "1movedto2": "{{ignored}}This is ''logentry'' message only used on IRC. Parameters:\n* $1 - the original page name\n* $2 - the destination page name\nSee also:\n* {{msg-mw|1movedto2 redir}}",
 +      "1movedto2_redir": "{{ignored}}This is ''logentry'' message only used on IRC. Parameters:\n* $1 - the original page name\n* $2 - the destination page name\nSee also:\n* {{msg-mw|1movedto2}}",
        "move-redirect-suppressed": "{{ignored}}Message unused?",
        "newuserlog-create-entry": "Part of the \"Newuserlog\" extension. It is the summary in the [[Special:RecentChanges|recent changes]] and on [[Special:Log/newusers]].",
        "newuserlog-create2-entry": "Part of the \"Newuserlog\" extension.\n\nIt is the summary in the [[Special:RecentChanges|recent changes]] and on [[Special:Log/newusers]] when creating an account for someone else (\"$1\").\n\nPreceded by the name of the user doing this task.\n\nParameters:\n* $1 - username",