Prevent user from trying to move a page to a title longer than 255 bytes.
authorBrian Wolff <bawolff@users.mediawiki.org>
Tue, 10 May 2011 05:36:15 +0000 (05:36 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Tue, 10 May 2011 05:36:15 +0000 (05:36 +0000)
This just puts a maxlength on the field (+ byte counter js) which is much
nicer and clearer feedback to the user if they went over the limit then:
"The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles"
Which doesn't exactly indicate a length error.

RELEASE-NOTES-1.19
includes/specials/SpecialMovepage.php
resources/mediawiki.special/mediawiki.special.movePage.js

index 1984819..1c25609 100644 (file)
@@ -27,6 +27,7 @@ file description page for multi-paged documents.
 used in Tiff files.
 * When translcuding a special page, do not let it interpret url parameters.
 * (bug 28887) Special page classes are no longer re-used during 1 request.
+* New title field of Special:MovePage is now length limited on client side.
 
 === API changes in 1.19 ===
 
index df200a8..b61f963 100644 (file)
@@ -229,7 +229,8 @@ class MovePageForm extends UnlistedSpecialPage {
                                        Xml::label( wfMsg( 'newtitle' ), 'wpNewTitle' ) .
                                "</td>
                                <td class='mw-input'>" .
-                                       Xml::input( 'wpNewTitle', 40, $wgContLang->recodeForEdit( $newTitle->getPrefixedText() ), array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) .
+                                       Xml::input( 'wpNewTitle', 40, $wgContLang->recodeForEdit( $newTitle->getPrefixedText() ), array( 'type' => 'text', 'id' => 'wpNewTitle', 'maxlength' => 255 ) ) .
+                                       // maxLength enforced in JS.
                                        Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) .
                                "</td>
                        </tr>
index 2f94cc0..be238df 100644 (file)
@@ -2,4 +2,5 @@
 
 jQuery( function( $ ) {
        $( '#wpReason' ).byteLimit();
+       $( '#wpNewTitle' ).byteLimit();
 });