Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php |
— | — | @@ -16,20 +16,19 @@ |
17 | 17 | class SpecialStoryReview extends SpecialPage { |
18 | 18 | |
19 | 19 | public function __construct() { |
20 | | - parent::__construct( 'StoryReview' ); |
| 20 | + parent::__construct( 'StoryReview', 'storyreview' ); |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function execute( $language ) { |
24 | 24 | wfProfileIn( __METHOD__ ); |
25 | 25 | |
26 | 26 | global $wgUser; |
27 | | - if ( $wgUser->isAllowed( 'storyreview' ) && !$wgUser->isBlocked() ) { |
| 27 | + if( $this->userCanExecute( $wgUser ) ){ |
28 | 28 | // If the user has the storyreview permission and is not blocked, show the regular output. |
29 | 29 | $this->addOutput(); |
30 | 30 | } else { |
31 | 31 | // If the user is not authorized, show an error. |
32 | | - global $wgOut; |
33 | | - $wgOut->permissionRequired( 'storyreview' ); |
| 32 | + $this->displayRestrictionError(); |
34 | 33 | } |
35 | 34 | |
36 | 35 | wfProfileOut( __METHOD__ ); |
Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php |
— | — | @@ -25,6 +25,8 @@ |
26 | 26 | |
27 | 27 | global $wgRequest; |
28 | 28 | |
| 29 | + var_dump($wgRequest->wasPosted()); die(); |
| 30 | + |
29 | 31 | if ( $wgRequest->wasPosted() ) { |
30 | 32 | $output = self::doSubmissionAndGetResult(); |
31 | 33 | } else { |
— | — | @@ -37,7 +39,7 @@ |
38 | 40 | } |
39 | 41 | |
40 | 42 | private static function getFrom( $parser, $args ) { |
41 | | - global $wgOut, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen; |
| 43 | + global $wgOut, $wgJsMimeType, $wgSc, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen; |
42 | 44 | |
43 | 45 | $wgOut->addStyle( $egStoryboardScriptPath . '/tags/Storysubmission/storysubmission.css' ); |
44 | 46 | $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storysubmission/storysubmission.js' ); |
— | — | @@ -48,7 +50,7 @@ |
49 | 51 | $maxLen = array_key_exists('maxlength', $args) && is_numeric($args['maxlength']) ? $args['maxlength'] : $egStoryboardMaxStoryLen; |
50 | 52 | $minLen = array_key_exists('minlength', $args) && is_numeric($args['minlength']) ? $args['minlength'] : $egStoryboardMinStoryLen; |
51 | 53 | |
52 | | - $submissionUrl = $parser->getTitle()->getLocalURL( 'action=submit' ); // TODO: fix parameters |
| 54 | + $submissionUrl = $parser->getTitle()->getLocalURL( '' ); // TODO: fix parameters |
53 | 55 | |
54 | 56 | $formBody = "<table width='$width'>"; |
55 | 57 | |
— | — | @@ -105,7 +107,7 @@ |
106 | 108 | |
107 | 109 | $formBody .= '</table>'; |
108 | 110 | |
109 | | - return Html::rawElement( |
| 111 | + $formHtml = Html::rawElement( |
110 | 112 | 'form', |
111 | 113 | array( |
112 | 114 | 'id' => 'storyform', |
— | — | @@ -116,6 +118,11 @@ |
117 | 119 | ), |
118 | 120 | $formBody |
119 | 121 | ); |
| 122 | + |
| 123 | + // Disable the submission button when JS is enabled. |
| 124 | + $formJs = "<script type='$wgJsMimeType'>/*<![CDATA[*/ document.getElementById( 'storysubmission-button' ).disabled = true; /*]]>*/</script>"; |
| 125 | + |
| 126 | + return $formHtml . $formJs; |
120 | 127 | } |
121 | 128 | |
122 | 129 | private static function doSubmissionAndGetResult() { |
Index: trunk/extensions/Storyboard/tags/Storysubmission/storysubmission.js |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | var info = document.getElementById( infodiv ); |
18 | 18 | |
19 | 19 | if(textlength > upperLimit) { |
20 | | - info.innerHTML = 'Your story may not exceed ' + upperLimit + ' characters!'; // TODO: i18n |
| 20 | + info.innerHTML = ( upperLimit - textlength ) + ' characters to many!'; // TODO: i18n |
21 | 21 | return false; |
22 | 22 | } else if (textlength < lowerLimit) { |
23 | 23 | info.innerHTML = '('+ ( lowerLimit - textlength ) + ' more characters needed)'; // TODO: i18n |