Index: trunk/extensions/Storyboard/specials/Story/Story_body.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | | - $stories = $dbr->selectRow( |
| 45 | + $story = $dbr->selectRow( |
46 | 46 | 'storyboard', |
47 | 47 | array( |
48 | 48 | 'story_id', |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | $conds |
56 | 56 | ); |
57 | 57 | |
58 | | - $story = $dbr->fetchObject( $stories ); |
| 58 | + $story = $dbr->fetchObject( $story ); |
59 | 59 | |
60 | 60 | if ( $story ) { |
61 | 61 | if ( $story->story_is_published == 1 ) { |
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php |
— | — | @@ -100,10 +100,14 @@ |
101 | 101 | $title = htmlspecialchars( $story->story_title ); |
102 | 102 | $text = htmlspecialchars( $story->story_text ); |
103 | 103 | |
| 104 | + // TODO: htmlspecialchars the messages? |
| 105 | + |
104 | 106 | $publishAction = $story->story_is_published ? 'unpublish' : 'publish'; |
| 107 | + // Uses storyboard-unpublish or storyboard-publish |
105 | 108 | $publishMsg = wfMsg( "storyboard-$publishAction" ); |
106 | 109 | |
107 | 110 | $imageAction = $story->story_image_hidden ? 'unhideimage' : 'hideimage'; |
| 111 | + // Uses storyboard-unhideimage or storyboard-hideimage |
108 | 112 | $imageMsg = wfMsg( "storyboard-$imageAction" ); |
109 | 113 | |
110 | 114 | $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 |
27 | 22 | } |
| 23 | + } else { |
| 24 | + alert( 'An error occured:\n' + data.error.info ); // TODO: i18n |
28 | 25 | } |
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' ) |
35 | 26 | } |
| 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' ); |
36 | 33 | } |
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 @@ |
60 | 60 | $dbw = wfGetDB( DB_MASTER ); |
61 | 61 | |
62 | 62 | if ( $params['storyaction'] == 'delete' ) { |
63 | | - $dbw->delete( 'storyboard', array( 'story_id' => $dbw->escape( $params['storyid'] ) ) ); |
| 63 | + $dbw->delete( 'storyboard', array( 'story_id' => $params['storyid'] ) ); |
64 | 64 | } else { |
65 | 65 | $conds = array( |
66 | 66 | 'story_id' => $params['storyid'] |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | ); |
114 | 114 | |
115 | 115 | $this->getResult()->setIndexedTagName( $result, 'story' ); |
116 | | - $this->getResult()->addValue( null, 'result', $result ); |
| 116 | + $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
117 | 117 | } |
118 | 118 | |
119 | 119 | public function getAllowedParams() { |
— | — | @@ -122,6 +122,7 @@ |
123 | 123 | ), |
124 | 124 | 'storyaction' => array( |
125 | 125 | ApiBase::PARAM_TYPE => array( |
| 126 | + 'delete', |
126 | 127 | 'hide', |
127 | 128 | 'unhide', |
128 | 129 | 'publish', |