Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php |
— | — | @@ -45,24 +45,34 @@ |
46 | 46 | * |
47 | 47 | * @param Parser $parser |
48 | 48 | * @param array $args |
| 49 | + * |
49 | 50 | * @return HTML |
50 | | - * |
51 | | - * TODO: Fix the validation for the story title |
52 | 51 | */ |
53 | 52 | 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; |
55 | 55 | |
56 | 56 | // Loading a seperate JS file would be overkill for just these 3 lines, and be bad for performance. |
57 | 57 | $parser->getOutput()->addHeadItem( |
58 | 58 | <<<EOT |
59 | 59 | <link rel="stylesheet" href="$egStoryboardScriptPath/storyboard.css?$wgStyleVersion" /> |
60 | 60 | <script type="$wgJsMimeType" src="$egStoryboardScriptPath/storyboard.js?$wgStyleVersion"></script> |
| 61 | + <script type="$wgJsMimeType" src="$wgStylePath/common/jquery.min.js?$wgStyleVersion"></script> |
61 | 62 | <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> |
67 | 77 | EOT |
68 | 78 | ); |
69 | 79 | |
— | — | @@ -149,9 +159,10 @@ |
150 | 160 | 'text', |
151 | 161 | array( |
152 | 162 | 'size' => $fieldSize, |
153 | | - 'class' => 'required', |
| 163 | + 'class' => 'required storytitle', |
154 | 164 | 'maxlength' => 255, |
155 | | - 'minlength' => 2 |
| 165 | + 'minlength' => 2, |
| 166 | + 'remote' => "$wgScriptPath/api.php?format=json&action=storyexists" |
156 | 167 | ) |
157 | 168 | ) . '</td></tr>'; |
158 | 169 | |
— | — | @@ -192,6 +203,7 @@ |
193 | 204 | |
194 | 205 | if ( !array_key_exists( 'language', $args ) |
195 | 206 | || !array_key_exists( $args['language'], Language::getLanguageNames() ) ) { |
| 207 | + global $wgContLanguageCode; |
196 | 208 | $args['language'] = $wgContLanguageCode; |
197 | 209 | } |
198 | 210 | |
— | — | @@ -212,6 +224,4 @@ |
213 | 225 | ); |
214 | 226 | } |
215 | 227 | |
216 | | - |
217 | | - |
218 | 228 | } |
\ No newline at end of file |
Index: trunk/extensions/Storyboard/specials/Story/Story_body.php |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | ) ) |
176 | 176 | ); |
177 | 177 | |
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. |
179 | 179 | if ( $wgUser->isAllowed( 'storyreview' ) ) { |
180 | 180 | $editMsg = htmlspecialchars( wfMsg( 'edit' ) ); |
181 | 181 | $editUrl = $this->getTitle( $story->story_title )->getLocalURL( 'action=edit' ); |
— | — | @@ -189,8 +189,6 @@ |
190 | 190 | * Outputs a form to edit the story with. Code based on <storysubmission>. |
191 | 191 | * |
192 | 192 | * @param $story |
193 | | - * |
194 | | - * TODO: Fix the validation for the story title |
195 | 193 | */ |
196 | 194 | private function showStoryForm( $story ) { |
197 | 195 | global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, $wgScriptPath; |