Index: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js |
— | — | @@ -6,7 +6,6 @@ |
7 | 7 | * @author Jeroen De Dauw |
8 | 8 | * @license GPL |
9 | 9 | * @version 0.2 |
10 | | - * |
11 | 10 | */ |
12 | 11 | (function($) { |
13 | 12 | $.fn.ajaxScroll=function(opt){ |
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php |
— | — | @@ -10,7 +10,6 @@ |
11 | 11 | * |
12 | 12 | * TODO: implement eternal load stuff for each list |
13 | 13 | * TODO: fix layout |
14 | | - * TODO: fix story blocks to work with new story state handling |
15 | 14 | * TODO: ajax load tab contents? |
16 | 15 | */ |
17 | 16 | |
— | — | @@ -97,14 +96,14 @@ |
98 | 97 | array( 'story_state' => $storyState ) |
99 | 98 | ); |
100 | 99 | |
101 | | - $html = ''; |
| 100 | + $storyBlocks = array(); |
102 | 101 | |
103 | 102 | // Loop through all stories, get their html, and add it to the appropriate string. |
104 | 103 | while ( $story = $dbr->fetchObject( $stories ) ) { |
105 | | - $html .= $this->getStorySegments( $story, $storyState ); |
| 104 | + $storyBlocks[] = $this->getStoryBlock( $story, $storyState ); |
106 | 105 | } |
107 | 106 | |
108 | | - return "<div id='storyreview-tabs-$storyState'>$html</div>"; |
| 107 | + return "<div id='storyreview-tabs-$storyState'>" . implode( '<br />', $storyBlocks ) . '</div>'; |
109 | 108 | } |
110 | 109 | |
111 | 110 | /** |
— | — | @@ -114,7 +113,7 @@ |
115 | 114 | * |
116 | 115 | * @return string |
117 | 116 | */ |
118 | | - private function getStorySegments( $story, $storyState ) { |
| 117 | + private function getStoryBlock( $story, $storyState ) { |
119 | 118 | global $wgTitle; |
120 | 119 | |
121 | 120 | $editUrl = SpecialPage::getTitleFor( 'story', $story->story_title )->getFullURL( 'action=edit&returnto=' . $wgTitle->getPrefixedText() ); |
— | — | @@ -131,8 +130,25 @@ |
132 | 131 | $hideMsg = htmlspecialchars( wfMsg( 'hide' ) ); |
133 | 132 | |
134 | 133 | $imageHtml = ''; |
135 | | - $imageButtonsHtml = ''; |
136 | 134 | |
| 135 | + $buttons = array(); |
| 136 | + |
| 137 | + if ( $storyState != Storyboard_STORY_PUBLISHED ) { |
| 138 | + $buttons[] = $this->getStateActionButton( $story->story_id, 'publish', 'storyboard-publish' ); |
| 139 | + } |
| 140 | + |
| 141 | + if ( $storyState != Storyboard_STORY_UNPUBLISHED ) { |
| 142 | + $buttons[] = $this->getStateActionButton( $story->story_id, 'unpublish', 'storyboard-unpublish' ); |
| 143 | + } |
| 144 | + |
| 145 | + if ( $storyState != Storyboard_STORY_HIDDEN ) { |
| 146 | + $buttons[] = $this->getStateActionButton( $story->story_id, 'hide', 'storyboard-hide' ); |
| 147 | + } |
| 148 | + |
| 149 | + $buttons[] = <<<EOT |
| 150 | + <button type="button" onclick="window.location='$editUrl'">$editMsg</button> |
| 151 | +EOT; |
| 152 | + |
137 | 153 | if ( $story->story_author_image ) { |
138 | 154 | $imageAction = $story->story_image_hidden ? 'unhideimage' : 'hideimage'; |
139 | 155 | // Uses storyboard-unhideimage or storyboard-hideimage. |
— | — | @@ -154,13 +170,18 @@ |
155 | 171 | |
156 | 172 | $imageHtml = Html::element( 'img', $imgAttribs ); |
157 | 173 | |
158 | | - $imageButtonsHtml = <<<EOT |
159 | | - <button type="button" |
160 | | - onclick="stbDoStoryAction( this, $story->story_id, '$imageAction' )" id="image_button_$story->story_id">$imageMsg</button> |
161 | | - <button type="button" onclick="stbDeleteStoryImage( this, $story->story_id )">$deleteImageMsg</button> |
| 174 | + $buttons[] = <<<EOT |
| 175 | + <button type="button" onclick="stbDoStoryAction( this, $story->story_id, '$imageAction' )" |
| 176 | + id="image_button_$story->story_id">$imageMsg</button> |
162 | 177 | EOT; |
| 178 | + $buttons[] = <<<EOT |
| 179 | + <button type="button" onclick="stbDeleteStoryImage( this, $story->story_id )">$deleteImageMsg</button> |
| 180 | +EOT; |
| 181 | + |
163 | 182 | } |
164 | 183 | |
| 184 | + $buttonHtml = implode( ' ', $buttons ); |
| 185 | + |
165 | 186 | return <<<EOT |
166 | 187 | <table width="100%" border="1" id="story_$story->story_id"> |
167 | 188 | <tr> |
— | — | @@ -174,12 +195,17 @@ |
175 | 196 | </tr> |
176 | 197 | <tr> |
177 | 198 | <td align="center" height="35"> |
178 | | - <button type="button" onclick="stbDoStoryAction( this, $story->story_id, '$publishAction' )">$publishMsg</button> |
179 | | - <button type="button" onclick="window.location='$editUrl'">$editMsg</button> |
180 | | - <button type="button" onclick="stbDoStoryAction( this, $story->story_id, 'hide' )">$hideMsg</button>$imageButtonsHtml |
| 199 | + $buttonHtml |
181 | 200 | </td> |
182 | 201 | </tr> |
183 | 202 | </table> |
184 | 203 | EOT; |
185 | 204 | } |
| 205 | + |
| 206 | + private function getStateActionButton( $storyId, $action, $messageKey ) { |
| 207 | + $message = htmlspecialchars( wfMsg( $messageKey ) ); |
| 208 | + return <<<EOT |
| 209 | + <button type="button" onclick="stbDoStoryAction( this, $storyId, '$action' )">$message</button> |
| 210 | +EOT; |
| 211 | + } |
186 | 212 | } |
\ No newline at end of file |