r63775 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63774‎ | r63775 | r63776 >
Date:16:35, 15 March 2010
Author:jeroendedauw
Status:ok
Tags:
Comment:
Follow up to r63758 and r63763.
Modified paths:
  • /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/specials/StoryReview/storyreview.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -41,7 +41,7 @@
4242 }
4343 }
4444
45 - $stories = $dbr->selectRow(
 45+ $story = $dbr->selectRow(
4646 'storyboard',
4747 array(
4848 'story_id',
@@ -54,7 +54,7 @@
5555 $conds
5656 );
5757
58 - $story = $dbr->fetchObject( $stories );
 58+ $story = $dbr->fetchObject( $story );
5959
6060 if ( $story ) {
6161 if ( $story->story_is_published == 1 ) {
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php
@@ -100,10 +100,14 @@
101101 $title = htmlspecialchars( $story->story_title );
102102 $text = htmlspecialchars( $story->story_text );
103103
 104+ // TODO: htmlspecialchars the messages?
 105+
104106 $publishAction = $story->story_is_published ? 'unpublish' : 'publish';
 107+ // Uses storyboard-unpublish or storyboard-publish
105108 $publishMsg = wfMsg( "storyboard-$publishAction" );
106109
107110 $imageAction = $story->story_image_hidden ? 'unhideimage' : 'hideimage';
 111+ // Uses storyboard-unhideimage or storyboard-hideimage
108112 $imageMsg = wfMsg( "storyboard-$imageAction" );
109113
110114 $editMsg = wfMsg( 'edit' );
Index: trunk/extensions/Storyboard/specials/StoryReview/storyreview.js
@@ -1,37 +1,33 @@
2 -//(function($) {
3 -
4 - function doStoryAction( sender, storyid, action ) {
5 - sender.disabled = true;
6 -
7 - jQuery.getJSON( wgScriptPath + '/api.php',
8 - {
9 - 'action': 'storyreview',
10 - 'format': 'json',
11 - 'storyid': storyid,
12 - 'storyaction': action
13 - },
14 - function( data ) {
15 - if ( data.result ) {
16 - switch( data.result.action ) {
17 - case 'publish' : case 'unpublish' : case 'hide' :
18 - jQuery( '#story_' + data.result.id ).slideUp( 'slow', function () {
19 - jQuery( this ).remove();
20 - } );
21 - // TODO: would be neat to update the other list when doing an (un)publish here
22 - break;
23 - // TODO: add handling for the other actions
24 - }
25 - } else {
26 - alert( 'An error occured:\n' + data.error.info ); // TODO: i18n
 2+function doStoryAction( sender, storyid, action ) {
 3+ sender.disabled = true;
 4+
 5+ jQuery.getJSON( wgScriptPath + '/api.php',
 6+ {
 7+ 'action': 'storyreview',
 8+ 'format': 'json',
 9+ 'storyid': storyid,
 10+ 'storyaction': action
 11+ },
 12+ function( data ) {
 13+ if ( data.result ) {
 14+ switch( data.result.action ) {
 15+ case 'publish' : case 'unpublish' : case 'hide' :
 16+ jQuery( '#story_' + data.result.id ).slideUp( 'slow', function () {
 17+ jQuery( this ).remove();
 18+ } );
 19+ // TODO: would be neat to update the other list when doing an (un)publish here
 20+ break;
 21+ // TODO: add handling for the other actions
2722 }
 23+ } else {
 24+ alert( 'An error occured:\n' + data.error.info ); // TODO: i18n
2825 }
29 - );
30 - }
31 -
32 - function deleteStoryImage( sender, storyid ) {
33 - if ( confirm( 'Are you sure you want to permanently delete this stories image?' ) ) { // TODO: i18n
34 - doStoryAction( sender, storyid, 'deleteimage' )
3526 }
 27+ );
 28+}
 29+
 30+function deleteStoryImage( sender, storyid ) {
 31+ if ( confirm( 'Are you sure you want to permanently delete this stories image?' ) ) { // TODO: i18n
 32+ doStoryAction( sender, storyid, 'deleteimage' );
3633 }
37 -
38 -//})(jQuery);
\ No newline at end of file
 34+}
\ No newline at end of file
Index: trunk/extensions/Storyboard/api/ApiStoryReview.php
@@ -59,7 +59,7 @@
6060 $dbw = wfGetDB( DB_MASTER );
6161
6262 if ( $params['storyaction'] == 'delete' ) {
63 - $dbw->delete( 'storyboard', array( 'story_id' => $dbw->escape( $params['storyid'] ) ) );
 63+ $dbw->delete( 'storyboard', array( 'story_id' => $params['storyid'] ) );
6464 } else {
6565 $conds = array(
6666 'story_id' => $params['storyid']
@@ -112,7 +112,7 @@
113113 );
114114
115115 $this->getResult()->setIndexedTagName( $result, 'story' );
116 - $this->getResult()->addValue( null, 'result', $result );
 116+ $this->getResult()->addValue( null, $this->getModuleName(), $result );
117117 }
118118
119119 public function getAllowedParams() {
@@ -122,6 +122,7 @@
123123 ),
124124 'storyaction' => array(
125125 ApiBase::PARAM_TYPE => array(
 126+ 'delete',
126127 'hide',
127128 'unhide',
128129 'publish',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r63758Partial follow up to r63722 - will test the API module later todayjeroendedauw20:48, 14 March 2010
r63763* Made Special:StoryReview use it's API class for actions...jeroendedauw03:08, 15 March 2010

Status & tagging log