Index: trunk/extensions/Storyboard/specials/Story/Story_body.php |
— | — | @@ -92,8 +92,7 @@ |
93 | 93 | 'story_text', |
94 | 94 | 'story_created', |
95 | 95 | 'story_modified', |
96 | | - 'story_is_published', |
97 | | - 'story_is_hidden', |
| 96 | + 'story_state' |
98 | 97 | ), |
99 | 98 | array( 'story_title' => $title ) |
100 | 99 | ); |
— | — | @@ -113,7 +112,7 @@ |
114 | 113 | $wgOut->addWikiMsg( 'storyboard-cantedit' ); |
115 | 114 | } |
116 | 115 | |
117 | | - if ( $story->story_is_published == 1 ) { |
| 116 | + if ( $story->story_state == Storyboard_STORY_PUBLISHED ) { |
118 | 117 | $this->showStory( $story ); |
119 | 118 | } |
120 | 119 | elseif ( !$isEdit ) { |
— | — | @@ -304,15 +303,11 @@ |
305 | 304 | ) . |
306 | 305 | '</td></tr>'; |
307 | 306 | |
308 | | - $checked = $story->story_is_published ? 'checked ' : ''; |
| 307 | + // TODO: fix this to work with new state field |
| 308 | + $checked = $story->story_state = Storyboard_STORY_PUBLISHED ? 'checked ' : ''; |
309 | 309 | $formBody .= '<tr><td colspan="2"><input type="checkbox" name="published" ' . $checked . '/> ' . |
310 | 310 | htmlspecialchars( wfMsg( 'storyboard-ispublished' ) ) . |
311 | | - '</td></tr>'; |
312 | | - |
313 | | - $checked = $story->story_is_hidden ? 'checked ' : ''; |
314 | | - $formBody .= '<tr><td colspan="2"><input type="checkbox" name="hidden" ' . $checked . '/> ' . |
315 | | - htmlspecialchars( wfMsg( 'storyboard-ishidden' ) ) . |
316 | | - '</td></tr>'; |
| 311 | + '</td></tr>'; |
317 | 312 | |
318 | 313 | $formBody .= '<tr><td colspan="2">' . |
319 | 314 | Html::input( '', wfMsg( 'htmlform-submit' ), 'submit', array( 'id' => 'storysubmission-button' ) ) . |
— | — | @@ -397,8 +392,7 @@ |
398 | 393 | 'story_title' => $wgRequest->getText( 'storytitle' ), |
399 | 394 | 'story_text' => $wgRequest->getText( 'storytext' ), |
400 | 395 | 'story_modified' => $dbw->timestamp( time() ), |
401 | | - 'story_is_published' => $wgRequest->getCheck( 'published' ) ? 1 : 0, |
402 | | - 'story_is_hidden' => $wgRequest->getCheck( 'hidden' ) ? 1 : 0, |
| 396 | + 'story_state' => $wgRequest->getIntOrNull( 'state' ), |
403 | 397 | ), |
404 | 398 | array( |
405 | 399 | 'story_id' => $wgRequest->getText( 'storyId' ), |
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php |
— | — | @@ -59,11 +59,11 @@ |
60 | 60 | 'story_author_name', |
61 | 61 | 'story_title', |
62 | 62 | 'story_text', |
63 | | - 'story_is_published', |
| 63 | + 'story_state', |
64 | 64 | 'story_author_image', |
65 | 65 | 'story_image_hidden' |
66 | 66 | ), |
67 | | - array( 'story_is_hidden' => 0 ) |
| 67 | + array( 'story_state' => $dbr->makeList( array ( 'Storyboard_STORY_UNPUBLISHED', 'Storyboard_STORY_PUBLISHED' ), LIST_OR ) ) |
68 | 68 | ); |
69 | 69 | |
70 | 70 | // String to hold the html for both the unreviewed and reviewed stories. |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | |
74 | 74 | // Loop through all stories, get their html, and add it to the appropriate string. |
75 | 75 | while ( $story = $dbr->fetchObject( $stories ) ) { |
76 | | - if ( $story->story_is_published ) { |
| 76 | + if ( $story->story_state == Storyboard_STORY_UNPUBLISHED ) { |
77 | 77 | $reviewed .= $this->getStorySegments( $story ); |
78 | 78 | } |
79 | 79 | else { |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | $title = htmlspecialchars( $story->story_title ); |
111 | 111 | $text = htmlspecialchars( $story->story_text ); |
112 | 112 | |
113 | | - $publishAction = $story->story_is_published ? 'unpublish' : 'publish'; |
| 113 | + $publishAction = $story->story_state == Storyboard_STORY_PUBLISHED ? 'unpublish' : 'publish'; |
114 | 114 | // Uses storyboard-unpublish or storyboard-publish. |
115 | 115 | $publishMsg = htmlspecialchars( wfMsg( "storyboard-$publishAction" ) ); |
116 | 116 | |
Index: trunk/extensions/Storyboard/api/ApiQueryStories.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | 'story_created' |
59 | 59 | ) ); |
60 | 60 | $this->addWhere( array( |
61 | | - 'story_is_published' => 1 |
| 61 | + 'story_state' => Storyboard_STORY_PUBLISHED |
62 | 62 | ) ); |
63 | 63 | $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
64 | 64 | $this->addOption( 'ORDER BY', 'story_modified, story_id DESC' ); |
Index: trunk/extensions/Storyboard/api/ApiStoryReview.php |
— | — | @@ -68,22 +68,17 @@ |
69 | 69 | switch( $params['storyaction'] ) { |
70 | 70 | case 'hide' : |
71 | 71 | $values = array( |
72 | | - 'story_is_hidden' => 1 |
| 72 | + 'story_state' => Storyboard_STORY_HIDDEN |
73 | 73 | ); |
74 | 74 | break; |
75 | | - case 'unhide' : |
76 | | - $values = array( |
77 | | - 'story_is_hidden' => 0 |
78 | | - ); |
79 | | - break; |
80 | 75 | case 'publish' : |
81 | 76 | $values = array( |
82 | | - 'story_is_published' => 1 |
| 77 | + 'story_state' => Storyboard_STORY_PUBLISHED |
83 | 78 | ); |
84 | 79 | break; |
85 | 80 | case 'unpublish' : |
86 | 81 | $values = array( |
87 | | - 'story_is_published' => 0 |
| 82 | + 'story_state' => Storyboard_STORY_UNPUBLISHED |
88 | 83 | ); |
89 | 84 | break; |
90 | 85 | case 'hideimage' : |
Index: trunk/extensions/Storyboard/Storyboard.php |
— | — | @@ -25,6 +25,10 @@ |
26 | 26 | |
27 | 27 | define( 'Storyboard_TABLE', 'storyboard' ); |
28 | 28 | |
| 29 | +define( 'Storyboard_STORY_UNPUBLISHED', 0 ); |
| 30 | +define( 'Storyboard_STORY_PUBLISHED', 1 ); |
| 31 | +define( 'Storyboard_STORY_HIDDEN', 2 ); |
| 32 | + |
29 | 33 | $egStoryboardScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/Storyboard'; |
30 | 34 | $egStoryboardDir = dirname( __FILE__ ) . '/'; |
31 | 35 | $egStoryboardStyleVersion = $wgStyleVersion . '-' . Storyboard_VERSION; |
Index: trunk/extensions/Storyboard/storyboard.sql |
— | — | @@ -14,8 +14,7 @@ |
15 | 15 | story_text MEDIUMBLOB NOT NULL, |
16 | 16 | story_modified CHAR(14) binary NOT NULL default '', |
17 | 17 | story_created CHAR(14) binary NOT NULL default '', |
18 | | - story_is_published TINYINT NOT NULL default '0', |
19 | | - story_is_hidden TINYINT NOT NULL default '0', |
| 18 | + story_state TINYINT NOT NULL default '0', |
20 | 19 | story_image_hidden TINYINT NOT NULL default '0' |
21 | 20 | ) /*$wgDBTableOptions*/; |
22 | 21 | |
Index: trunk/extensions/Storyboard/Storyboard.i18n.php |
— | — | @@ -41,7 +41,6 @@ |
42 | 42 | // Story review |
43 | 43 | 'storyreview' => 'Story review', |
44 | 44 | 'storyboard-publish' => 'Publish', |
45 | | - 'storyboard-unpublish' => 'Unpublish', |
46 | 45 | 'storyboard-reviewed' => 'Reviewed', |
47 | 46 | 'storyboard-unreviewed' => 'Unreviewed', |
48 | 47 | 'storyboard-hideimage' => 'Hide image', |