r65338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65337‎ | r65338 | r65339 >
Date:19:10, 20 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r65334 and r65335 - also fixed title validation in storysubmission form
Modified paths:
  • /trunk/extensions/Storyboard/specials/Story/Story_body.php (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php
@@ -45,24 +45,34 @@
4646 *
4747 * @param Parser $parser
4848 * @param array $args
 49+ *
4950 * @return HTML
50 - *
51 - * TODO: Fix the validation for the story title
5251 */
5352 private static function getFrom( Parser $parser, array $args ) {
54 - global $wgUser, $wgStyleVersion, $wgJsMimeType, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen;
 53+ global $wgUser, $wgStyleVersion, $wgJsMimeType, $wgScriptPath, $wgStylePath;
 54+ global $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen;
5555
5656 // Loading a seperate JS file would be overkill for just these 3 lines, and be bad for performance.
5757 $parser->getOutput()->addHeadItem(
5858 <<<EOT
5959 <link rel="stylesheet" href="$egStoryboardScriptPath/storyboard.css?$wgStyleVersion" />
6060 <script type="$wgJsMimeType" src="$egStoryboardScriptPath/storyboard.js?$wgStyleVersion"></script>
 61+ <script type="$wgJsMimeType" src="$wgStylePath/common/jquery.min.js?$wgStyleVersion"></script>
6162 <script type="$wgJsMimeType" src="$egStoryboardScriptPath/jquery/jquery.validate.js?$wgStyleVersion"></script>
62 - <script type="$wgJsMimeType"> /*<![CDATA[*/
63 - addOnloadHook( function() {
64 - document.getElementById( 'storysubmission-button' ).disabled = true;
65 - } );
66 - /*]]>*/ </script>
 63+<script type="$wgJsMimeType"> /*<![CDATA[*/
 64+addOnloadHook( function() {
 65+ document.getElementById( 'storysubmission-button' ).disabled = true;
 66+} );
 67+jQuery(document).ready(function() {
 68+ jQuery("#storyform").validate({
 69+ messages: {
 70+ storytitle: {
 71+ remote: jQuery.validator.format("<b>{0}</b> is already taken, please choose a different title.") // TODO: i18n
 72+ }
 73+ }
 74+ });
 75+});
 76+/*]]>*/ </script>
6777 EOT
6878 );
6979
@@ -149,9 +159,10 @@
150160 'text',
151161 array(
152162 'size' => $fieldSize,
153 - 'class' => 'required',
 163+ 'class' => 'required storytitle',
154164 'maxlength' => 255,
155 - 'minlength' => 2
 165+ 'minlength' => 2,
 166+ 'remote' => "$wgScriptPath/api.php?format=json&action=storyexists"
156167 )
157168 ) . '</td></tr>';
158169
@@ -192,6 +203,7 @@
193204
194205 if ( !array_key_exists( 'language', $args )
195206 || !array_key_exists( $args['language'], Language::getLanguageNames() ) ) {
 207+ global $wgContLanguageCode;
196208 $args['language'] = $wgContLanguageCode;
197209 }
198210
@@ -212,6 +224,4 @@
213225 );
214226 }
215227
216 -
217 -
218228 }
\ No newline at end of file
Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -174,7 +174,7 @@
175175 ) )
176176 );
177177
178 - // FIXME: this is a temporary solution untill the SkinTemplateNavigation on special pages issue is fixed.
 178+ // FIXME: this button is a temporary solution untill the SkinTemplateNavigation on special pages issue is fixed.
179179 if ( $wgUser->isAllowed( 'storyreview' ) ) {
180180 $editMsg = htmlspecialchars( wfMsg( 'edit' ) );
181181 $editUrl = $this->getTitle( $story->story_title )->getLocalURL( 'action=edit' );
@@ -189,8 +189,6 @@
190190 * Outputs a form to edit the story with. Code based on <storysubmission>.
191191 *
192192 * @param $story
193 - *
194 - * TODO: Fix the validation for the story title
195193 */
196194 private function showStoryForm( $story ) {
197195 global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, $wgScriptPath;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65334Fixed title validation on Special:Storyjeroendedauw18:24, 20 April 2010
r65335Fixed error message for when email already existsjeroendedauw18:49, 20 April 2010

Status & tagging log