r64709 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64708‎ | r64709 | r64710 >
Date:16:33, 7 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changed story_is_published and story_is_hidden to story_state. Will update interfaces to work with this in follow up commit.
Modified paths:
  • /trunk/extensions/Storyboard/Storyboard.i18n.php (modified) (history)
  • /trunk/extensions/Storyboard/Storyboard.php (modified) (history)
  • /trunk/extensions/Storyboard/api/ApiQueryStories.php (modified) (history)
  • /trunk/extensions/Storyboard/api/ApiStoryReview.php (modified) (history)
  • /trunk/extensions/Storyboard/specials/Story/Story_body.php (modified) (history)
  • /trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php (modified) (history)
  • /trunk/extensions/Storyboard/storyboard.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -92,8 +92,7 @@
9393 'story_text',
9494 'story_created',
9595 'story_modified',
96 - 'story_is_published',
97 - 'story_is_hidden',
 96+ 'story_state'
9897 ),
9998 array( 'story_title' => $title )
10099 );
@@ -113,7 +112,7 @@
114113 $wgOut->addWikiMsg( 'storyboard-cantedit' );
115114 }
116115
117 - if ( $story->story_is_published == 1 ) {
 116+ if ( $story->story_state == Storyboard_STORY_PUBLISHED ) {
118117 $this->showStory( $story );
119118 }
120119 elseif ( !$isEdit ) {
@@ -304,15 +303,11 @@
305304 ) .
306305 '</td></tr>';
307306
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 ' : '';
309309 $formBody .= '<tr><td colspan="2"><input type="checkbox" name="published" ' . $checked . '/>&nbsp;' .
310310 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 . '/>&nbsp;' .
315 - htmlspecialchars( wfMsg( 'storyboard-ishidden' ) ) .
316 - '</td></tr>';
 311+ '</td></tr>';
317312
318313 $formBody .= '<tr><td colspan="2">' .
319314 Html::input( '', wfMsg( 'htmlform-submit' ), 'submit', array( 'id' => 'storysubmission-button' ) ) .
@@ -397,8 +392,7 @@
398393 'story_title' => $wgRequest->getText( 'storytitle' ),
399394 'story_text' => $wgRequest->getText( 'storytext' ),
400395 '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' ),
403397 ),
404398 array(
405399 'story_id' => $wgRequest->getText( 'storyId' ),
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php
@@ -59,11 +59,11 @@
6060 'story_author_name',
6161 'story_title',
6262 'story_text',
63 - 'story_is_published',
 63+ 'story_state',
6464 'story_author_image',
6565 'story_image_hidden'
6666 ),
67 - array( 'story_is_hidden' => 0 )
 67+ array( 'story_state' => $dbr->makeList( array ( 'Storyboard_STORY_UNPUBLISHED', 'Storyboard_STORY_PUBLISHED' ), LIST_OR ) )
6868 );
6969
7070 // String to hold the html for both the unreviewed and reviewed stories.
@@ -72,7 +72,7 @@
7373
7474 // Loop through all stories, get their html, and add it to the appropriate string.
7575 while ( $story = $dbr->fetchObject( $stories ) ) {
76 - if ( $story->story_is_published ) {
 76+ if ( $story->story_state == Storyboard_STORY_UNPUBLISHED ) {
7777 $reviewed .= $this->getStorySegments( $story );
7878 }
7979 else {
@@ -109,7 +109,7 @@
110110 $title = htmlspecialchars( $story->story_title );
111111 $text = htmlspecialchars( $story->story_text );
112112
113 - $publishAction = $story->story_is_published ? 'unpublish' : 'publish';
 113+ $publishAction = $story->story_state == Storyboard_STORY_PUBLISHED ? 'unpublish' : 'publish';
114114 // Uses storyboard-unpublish or storyboard-publish.
115115 $publishMsg = htmlspecialchars( wfMsg( "storyboard-$publishAction" ) );
116116
Index: trunk/extensions/Storyboard/api/ApiQueryStories.php
@@ -57,7 +57,7 @@
5858 'story_created'
5959 ) );
6060 $this->addWhere( array(
61 - 'story_is_published' => 1
 61+ 'story_state' => Storyboard_STORY_PUBLISHED
6262 ) );
6363 $this->addOption( 'LIMIT', $params['limit'] + 1 );
6464 $this->addOption( 'ORDER BY', 'story_modified, story_id DESC' );
Index: trunk/extensions/Storyboard/api/ApiStoryReview.php
@@ -68,22 +68,17 @@
6969 switch( $params['storyaction'] ) {
7070 case 'hide' :
7171 $values = array(
72 - 'story_is_hidden' => 1
 72+ 'story_state' => Storyboard_STORY_HIDDEN
7373 );
7474 break;
75 - case 'unhide' :
76 - $values = array(
77 - 'story_is_hidden' => 0
78 - );
79 - break;
8075 case 'publish' :
8176 $values = array(
82 - 'story_is_published' => 1
 77+ 'story_state' => Storyboard_STORY_PUBLISHED
8378 );
8479 break;
8580 case 'unpublish' :
8681 $values = array(
87 - 'story_is_published' => 0
 82+ 'story_state' => Storyboard_STORY_UNPUBLISHED
8883 );
8984 break;
9085 case 'hideimage' :
Index: trunk/extensions/Storyboard/Storyboard.php
@@ -25,6 +25,10 @@
2626
2727 define( 'Storyboard_TABLE', 'storyboard' );
2828
 29+define( 'Storyboard_STORY_UNPUBLISHED', 0 );
 30+define( 'Storyboard_STORY_PUBLISHED', 1 );
 31+define( 'Storyboard_STORY_HIDDEN', 2 );
 32+
2933 $egStoryboardScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/Storyboard';
3034 $egStoryboardDir = dirname( __FILE__ ) . '/';
3135 $egStoryboardStyleVersion = $wgStyleVersion . '-' . Storyboard_VERSION;
Index: trunk/extensions/Storyboard/storyboard.sql
@@ -14,8 +14,7 @@
1515 story_text MEDIUMBLOB NOT NULL,
1616 story_modified CHAR(14) binary NOT NULL default '',
1717 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',
2019 story_image_hidden TINYINT NOT NULL default '0'
2120 ) /*$wgDBTableOptions*/;
2221
Index: trunk/extensions/Storyboard/Storyboard.i18n.php
@@ -41,7 +41,6 @@
4242 // Story review
4343 'storyreview' => 'Story review',
4444 'storyboard-publish' => 'Publish',
45 - 'storyboard-unpublish' => 'Unpublish',
4645 'storyboard-reviewed' => 'Reviewed',
4746 'storyboard-unreviewed' => 'Unreviewed',
4847 'storyboard-hideimage' => 'Hide image',

Status & tagging log