r86719 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86718‎ | r86719 | r86720 >
Date:18:26, 22 April 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
(bug 28651) - set maxlength to comment fields of FlaggedRevs
Modified paths:
  • /trunk/extensions/FlaggedRevs/presentation/RejectConfirmationFormUI.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/actions/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/presentation/specialpages/actions/Stabilization_body.php
@@ -215,7 +215,7 @@
216216 '</td>
217217 <td class="mw-input">' .
218218 Xml::input( 'wpReason', 70, $form->getReasonExtra(),
219 - array( 'id' => 'wpReason' ) ) .
 219+ array( 'id' => 'wpReason', 'maxlength' => 255 ) ) .
220220 '</td>
221221 </tr>
222222 <tr>
Index: trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php
@@ -157,7 +157,8 @@
158158 }
159159 $form .= "<span id='mw-fr-commentbox' style='clear:both'>" .
160160 Xml::inputLabel( wfMsg( 'revreview-log' ), 'wpReason', 'wpReason', 40, '',
161 - array( 'class' => 'fr-comment-box' ) ) . "&#160;&#160;&#160;</span>";
 161+ array( 'maxlength' => 255, 'class' => 'fr-comment-box' ) ) .
 162+ "&#160;&#160;&#160;</span>";
162163 }
163164 # Determine if there will be reject button
164165 $rejectId = $this->rejectRefRevId();
Index: trunk/extensions/FlaggedRevs/presentation/RejectConfirmationFormUI.php
@@ -132,7 +132,7 @@
133133 $form .= Html::hidden( 'wpEditToken', $this->form->getUser()->editToken() );
134134 $form .= Html::hidden( 'changetime', $newRev->getTimestamp() );
135135 $form .= Xml::inputLabel( wfMsg( 'revreview-reject-summary' ), 'wpReason',
136 - 'wpReason', 120, $defaultSummary ) . "<br />";
 136+ 'wpReason', 120, $defaultSummary, array( 'maxlength' => 200 ) ) . "<br />";
137137 $form .= Html::input( 'wpSubmit', wfMsg( 'revreview-reject-confirm' ), 'submit' );
138138 $form .= ' ';
139139 $form .= $skin->link( $this->form->getPage(), wfMsg( 'revreview-reject-cancel' ),

Comments

#Comment by JanPaul123 (talk | contribs)   15:08, 23 April 2011

I'm not sure if it applies here, but if you need byte limits instead of character limits (as UTF-8 characters can be multiple bytes), you can use phase3/resources/jquery/jquery.byteLimit.js (e.g. like this: $('#wpReason').byteLimit(200);)

#Comment by Bawolff (talk | contribs)   00:59, 24 April 2011

That sounds cool. Should probably kill the stuff in phase3/resources/mediawiki.action/mediawiki.action.edit.js and replace it with that.

#Comment by JanPaul123 (talk | contribs)   01:13, 24 April 2011

That's where this came from ;) See r86698.

#Comment by Bawolff (talk | contribs)   01:26, 24 April 2011

oh excellent :D. There's an open bug somewhere to apply that byte counting to other various fields (especially the move comment field since its a text area and people often put too much stuff there, having that in a module would mean that that bug is 90% of the way to being solved :)

#Comment by JanPaul123 (talk | contribs)   17:35, 24 April 2011

Right, you're referring to bug 16921, I just attached a patch there.

Status & tagging log