From: Kunal Mehta Date: Wed, 1 Jul 2015 05:31:14 +0000 (-0700) Subject: SpecialChangeContentModel: Use autocomplete for title field X-Git-Tag: 1.31.0-rc.0~10642^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=2e69aaab1d31b440dfb65303d4bcd995b55d35b1;p=lhc%2Fweb%2Fwiklou.git SpecialChangeContentModel: Use autocomplete for title field Change-Id: I766da59e6cbf7ed8f887d1a684ea9e284e9cf67e --- diff --git a/includes/specials/SpecialChangeContentModel.php b/includes/specials/SpecialChangeContentModel.php index 7647999813..cce5da5c12 100644 --- a/includes/specials/SpecialChangeContentModel.php +++ b/includes/specials/SpecialChangeContentModel.php @@ -44,22 +44,10 @@ class SpecialChangeContentModel extends FormSpecialPage { // No form input yet return true; } - try { - $titleObj = Title::newFromTextThrow( $title ); - } catch ( MalformedTitleException $e ) { - $msg = $this->msg( $e->getErrorMessage() ); - $params = $e->getErrorMessageParameters(); - if ( $params ) { - $msg->params( $params ); - } - return $msg->parse(); - } - if ( !$titleObj->canExist() ) { - return $this->msg( - 'changecontentmodel-title-cantexist', - $titleObj->getPrefixedText() - )->escaped(); - } + + // Already validated by HTMLForm, but if not, throw + // and exception instead of a fatal + $titleObj = Title::newFromTextThrow( $title ); $this->oldRevision = Revision::newFromTitle( $titleObj ) ?: false; @@ -79,7 +67,8 @@ class SpecialChangeContentModel extends FormSpecialPage { $that = $this; $fields = array( 'pagetitle' => array( - 'type' => 'text', + 'type' => 'title', + 'creatable' => true, 'name' => 'pagetitle', 'default' => $this->par, 'label-message' => 'changecontentmodel-title-label', diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 1fdd75d7b8..97f131014d 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1950,7 +1950,6 @@ "changecontentmodel-success-title": "The content model was changed", "changecontentmodel-success-text": "The content type of [[:$1]] has been changed.", "changecontentmodel-cannot-convert": "The content on [[:$1]] cannot be converted to a type of $2.", - "changecontentmodel-title-cantexist": "It is not possible to have a page at $1.", "changecontentmodel-nodirectediting": "The $1 content model does not support direct editing", "log-name-contentmodel": "Content model change log", "log-description-contentmodel": "Events related to the content models of a page", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 872a89f39c..4137931f72 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2121,7 +2121,6 @@ "changecontentmodel-success-title": "Title of the success page of the change content model special page", "changecontentmodel-success-text": "Message telling user that their change has been successfully done.\n* $1 - Target page title", "changecontentmodel-cannot-convert": "Error message shown if the content model cannot be changed to the specified type. $1 is the page title, $2 is the localized content model name.", - "changecontentmodel-title-cantexist": "Error message shown if the page the user provided is a special page.\n\nParameters:\n* $1 - the page title which cannot exist", "changecontentmodel-nodirectediting": "Error message shown if the content model does not allow for direct editing. $1 is the localized name of the content model.", "log-name-contentmodel": "{{doc-logpage}}\n\nTitle of [[Special:Log/contentmodel]].", "log-description-contentmodel": "Text in [[Special:Log/contentmodel]].",