Index: trunk/extensions/Storyboard/storyboard.css |
— | — | @@ -11,15 +11,15 @@ |
12 | 12 | * Css for stories |
13 | 13 | */ |
14 | 14 | .story { |
15 | | - margin-left: 15px; |
16 | | - margin-top: 5px; |
| 15 | + margin: 5px 10px 0px 0px; |
17 | 16 | float: left; |
18 | 17 | overflow: hidden; |
19 | 18 | } |
20 | 19 | .story-title { |
21 | 20 | font: 16px "Lucida Sans", Verdana; |
| 21 | + margin-left: 15px; |
| 22 | + margin-top: 5px; |
22 | 23 | font-weight: bold; |
23 | | - float: left; |
24 | 24 | overflow: hidden; |
25 | 25 | } |
26 | 26 | .story-image { |
Index: trunk/extensions/Storyboard/Storyboard.i18n.php |
— | — | @@ -17,10 +17,12 @@ |
18 | 18 | // General |
19 | 19 | 'storyboard-name' => 'Storyboard', |
20 | 20 | 'storyboard-desc' => 'Provides a landing page for donors, a page where stories can be submitted, and a story moderation interface', |
21 | | - |
22 | 21 | 'right-storyreview' => 'Review, edit, publish, and hide stories', |
| 22 | + 'specialpages-group-contribution' => 'Contribution', |
23 | 23 | |
24 | 24 | // Special:Story |
| 25 | + 'story' => 'Story', |
| 26 | + 'storyboard-viewstories' => 'View stories', |
25 | 27 | 'storyboard-nosuchstory' => 'The story you requested does not exist. It might have been removed.', |
26 | 28 | 'storyboard-unpublished' => 'The story you requested has not been published yet.', |
27 | 29 | 'storyboard-nostorytitle' => 'You need to specify the title or id of the story you want to view.', |
— | — | @@ -28,7 +30,7 @@ |
29 | 31 | 'storyboard-canedit' => 'You can [$1 edit] and publish this story.', |
30 | 32 | |
31 | 33 | // Story review |
32 | | - 'storyboard-storyreview' => 'Story review', |
| 34 | + 'storyreview' => 'Story review', |
33 | 35 | 'storyboard-publish' => 'Publish', |
34 | 36 | 'storyboard-unpublish' => 'Unpublish', |
35 | 37 | 'storyboard-reviewed' => 'Reviewed', |
— | — | @@ -49,7 +51,8 @@ |
50 | 52 | 'storyboard-charsleft' => '($1 {{PLURAL:$1|character|characters}} left)', |
51 | 53 | 'storyboard-cannotbelonger' => 'Your story is <b>$1</b> {{PLURAL:$1|character|characters}} to long!', |
52 | 54 | 'storyboard-charsneeded' => '($1 more {{PLURAL:$1|character|characters}} needed)', |
53 | | - 'storyboard-needtoagree' => 'You need to agree to the publication of your story to submit it.' |
| 55 | + 'storyboard-needtoagree' => 'You need to agree to the publication of your story to submit it.', |
| 56 | + 'storyboard-createdsucessfully' => 'Your story titled "$1" has been submitted sucesfully. It will be publicly accessible once it has been reviewed. View my story now.', |
54 | 57 | ); |
55 | 58 | |
56 | 59 | /** Afrikaans (Afrikaans) |
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
— | — | @@ -9,8 +9,8 @@ |
10 | 10 | $( document ).ready( function() { |
11 | 11 | $( '.storyboard' ).ajaxScroll( { |
12 | 12 | updateBatch: updateStoryboard, |
13 | | - batchSize: 3, |
14 | | - batchNum: 2 |
| 13 | + batchSize: 4, |
| 14 | + batchNum: 1 |
15 | 15 | } ); |
16 | 16 | } ); |
17 | 17 | |
— | — | @@ -20,11 +20,11 @@ |
21 | 21 | 'action': 'query', |
22 | 22 | 'list': 'stories', |
23 | 23 | 'stcontinue': $storyboard.attr( 'offset' ), |
24 | | - 'stlimit': 5, |
| 24 | + 'stlimit': 4, |
25 | 25 | 'format': 'json' |
26 | 26 | }, |
27 | 27 | function( data ) { |
28 | | - var $div = $( "<div />" ); |
| 28 | + var html = ''; |
29 | 29 | for ( var i in data.query.stories ) { |
30 | 30 | var story = data.query.stories[i]; |
31 | 31 | var $storyBody = $( "<div />" ).addClass( "storyboard-box" ); |
— | — | @@ -82,9 +82,9 @@ |
83 | 83 | |
84 | 84 | // TODO: add delete button that hides the story from the storyboard (=unpublish+hide?) |
85 | 85 | |
86 | | - $div.append( $storyBody ); |
| 86 | + html += $storyBody; |
87 | 87 | } |
88 | | - $storyboard.html( $div ); |
| 88 | + $storyboard.html( html ); |
89 | 89 | } |
90 | 90 | ); |
91 | 91 | } |
Index: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.js |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | }; |
113 | 113 | |
114 | 114 | function vEnd(){ |
115 | | - if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){ |
| 115 | + if(ele.scrollTop > 0 && ele.scrollHeight-ele.scrollTop < opt.eBound){ |
116 | 116 | offset=batch($sp,offset,opt); |
117 | 117 | return 1; |
118 | 118 | } |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | }; |
127 | 127 | |
128 | 128 | function monEnd(){ |
129 | | - if(offset<opt.maxOffset){ |
| 129 | + if(offset < opt.maxOffset){ |
130 | 130 | setTimeout(monEnd,fnEnd()); |
131 | 131 | } |
132 | 132 | } |
Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php |
— | — | @@ -152,16 +152,17 @@ |
153 | 153 | private static function doSubmissionAndGetResult() { |
154 | 154 | global $wgRequest, $wgUser; |
155 | 155 | |
| 156 | + $dbr = wfGetDB( DB_SLAVE ); |
156 | 157 | $dbw = wfGetDB( DB_MASTER ); |
| 158 | + |
| 159 | + $title = $wgRequest->getText( 'storytitle' ); |
157 | 160 | |
158 | | - // TODO: some sort of validation? |
159 | | - |
160 | 161 | $story = array( |
161 | 162 | 'story_author_name' => $wgRequest->getText( 'name' ), |
162 | 163 | 'story_author_location' => $wgRequest->getText( 'location' ), |
163 | 164 | 'story_author_occupation' => $wgRequest->getText( 'occupation' ), |
164 | 165 | 'story_author_contact' => $wgRequest->getText( 'contact' ), |
165 | | - 'story_title' => $wgRequest->getText( 'storytitle' ), |
| 166 | + 'story_title' => $title, |
166 | 167 | 'story_text' => $wgRequest->getText( 'storytext' ), |
167 | 168 | 'story_created' => $dbw->timestamp( time() ), |
168 | 169 | 'story_modified' => $dbw->timestamp( time() ), |
— | — | @@ -174,7 +175,7 @@ |
175 | 176 | |
176 | 177 | $dbw->insert( 'storyboard', $story ); |
177 | 178 | |
178 | | - $responseHtml = ''; // TODO: create html response |
| 179 | + $responseHtml = wfMsgExt( 'storyboard-createdsucessfully', htmlspecialchars( $title ) ); // TODO: create html response |
179 | 180 | |
180 | 181 | return $responseHtml; |
181 | 182 | } |
Index: trunk/extensions/Storyboard/Storyboard_Utils.php |
— | — | @@ -18,13 +18,16 @@ |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Get the width or height from an arguments array, or use the default value if not specified or not valid |
22 | | - * @param $arr Array of arguments |
23 | | - * @param $name Key in $array |
24 | | - * @param $default Default value to use if $arr[$name] is not set or not valid |
| 22 | + * |
| 23 | + * @param array $arr Array of arguments |
| 24 | + * @param string $name Key in $array |
| 25 | + * @param single $default Default value to use if $arr[$name] is not set or not valid |
| 26 | + * |
| 27 | + * @return string |
25 | 28 | */ |
26 | | - public static function getDimension( $arr, $name, $default ) { |
| 29 | + public static function getDimension( array $arr, $name, $default ) { |
27 | 30 | $value = $default; |
28 | | - if ( isset( $arr[$name] ) && preg_match( '/\d+(\.\d+)?%?/', $arr[$name] ) ) { |
| 31 | + if ( isset( $arr[$name] ) && preg_match( '/^\d+(\.\d+)?(px|ex|em|%)?$/', $arr[$name] ) ) { |
29 | 32 | $value = $arr[$name]; |
30 | 33 | } |
31 | 34 | if ( !preg_match( '/(px|ex|em|%)$/', $value ) ) { |
Index: trunk/extensions/Storyboard/specials/Story/Story_body.php |
— | — | @@ -21,11 +21,9 @@ |
22 | 22 | |
23 | 23 | public function execute( $title ) { |
24 | 24 | wfProfileIn( __METHOD__ ); |
25 | | - |
26 | 25 | global $wgOut, $wgRequest, $wgUser; |
27 | 26 | |
28 | 27 | $title = str_replace( '_', ' ', $title ); |
29 | | - $wgOut->setPageTitle( $title ); |
30 | 28 | |
31 | 29 | if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
32 | 30 | if ( $wgUser->isAllowed( 'storyreview' ) ) { |
— | — | @@ -36,8 +34,10 @@ |
37 | 35 | } |
38 | 36 | |
39 | 37 | if ( trim( $title ) != '' || $wgRequest->getIntOrNull( 'id' ) ) { |
| 38 | + $wgOut->setPageTitle( $title ); |
40 | 39 | $this->queryAndShowStory( $title ); |
41 | 40 | } else { |
| 41 | + $wgOut->setPageTitle( wfMsg( 'storyboard-viewstories' ) ); |
42 | 42 | $wgOut->addWikiMsg( 'storyboard-nostorytitle' ); |
43 | 43 | } |
44 | 44 | |
— | — | @@ -98,9 +98,13 @@ |
99 | 99 | $wgOut->addWikiMsg( 'storyboard-unpublished' ); |
100 | 100 | |
101 | 101 | if ( $wgUser->isAllowed( 'storyreview' ) ) { |
102 | | - $wgOut->addWikiMsg( // TODO: find out how to make the link working |
103 | | - 'storyboard-canedit', |
104 | | - $this->getTitle()->getLocalURL( 'action=edit' ) |
| 102 | + global $wgParser; |
| 103 | + |
| 104 | + $wgOut->addWikiMsg( |
| 105 | + $wgParser->recursiveTagParse( |
| 106 | + 'storyboard-canedit', |
| 107 | + $this->getTitle()->getLocalURL( 'action=edit' ) |
| 108 | + ) |
105 | 109 | ); |
106 | 110 | } |
107 | 111 | } |
— | — | @@ -129,11 +133,8 @@ |
130 | 134 | $text = htmlspecialchars( $story->story_text ); |
131 | 135 | |
132 | 136 | $wgOut->addHTML( <<<EOT |
133 | | - <div class="story"> |
134 | | - <img src="$imageSrc" class="story-image"> |
135 | | - <div class="story-title">$title</div><br /> |
136 | | - $text |
137 | | - </div> |
| 137 | + <img src="$imageSrc" class="story-image"> |
| 138 | + $text |
138 | 139 | EOT |
139 | 140 | ); |
140 | 141 | } |
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | |
26 | 26 | global $wgUser, $wgOut; |
27 | 27 | |
28 | | - $wgOut->setPageTitle( wfMsg( 'storyboard-storyreview' ) ); |
| 28 | + $wgOut->setPageTitle( wfMsg( 'storyreview' ) ); |
29 | 29 | |
30 | 30 | if ( $this->userCanExecute( $wgUser ) ) { |
31 | 31 | // If the user has the storyreview permission and is not blocked, show the regular output. |
Index: trunk/extensions/Storyboard/Storyboard.php |
— | — | @@ -59,7 +59,9 @@ |
60 | 60 | // Hooks |
61 | 61 | $wgHooks['ParserFirstCallInit'][] = 'efStoryboardParserFirstCallInit'; |
62 | 62 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efStoryboardSchemaUpdate'; |
| 63 | +$wgHooks['SkinTemplateContentActions'][] = 'efStoryboardAddStoryEditAction'; |
63 | 64 | |
| 65 | + |
64 | 66 | /** |
65 | 67 | * The 'storyboard' permission key can be given out to users |
66 | 68 | * to enable them to review, edit, publish, and hide stories. |
— | — | @@ -94,3 +96,20 @@ |
95 | 97 | $parser->setHook( 'storysubmission', array( 'TagStorysubmission', 'render' ) ); |
96 | 98 | return true; |
97 | 99 | } |
| 100 | + |
| 101 | +function efStoryboardAddStoryEditAction( &$content_actions ) { |
| 102 | + global $wgRequest, $wgRequest, $wgTitle; |
| 103 | + |
| 104 | + $action = $wgRequest->getText( 'action' ); |
| 105 | + |
| 106 | + if ( $wgTitle->equals( SpecialPage::getTitleFor( 'story' ) ) ) { |
| 107 | + $content_actions['edit'] = array( |
| 108 | + 'class' => $action == 'edit' ? 'selected' : false, |
| 109 | + 'text' => wfMsg( 'edit' ), |
| 110 | + 'href' => $wgTitle->getLocalUrl( 'action=edit' ) |
| 111 | + ); |
| 112 | + } |
| 113 | + |
| 114 | + return true; |
| 115 | +} |
| 116 | + |