Index: trunk/extensions/MoodBar/SpecialFeedbackDashboard.php |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | */ |
6 | 6 | class SpecialFeedbackDashboard extends SpecialPage { |
7 | 7 | protected $showHidden = false; |
| 8 | + protected $action = false; |
8 | 9 | |
9 | 10 | public function __construct() { |
10 | 11 | parent::__construct( 'FeedbackDashboard' ); |
— | — | @@ -27,6 +28,12 @@ |
28 | 29 | if ( $wgRequest->getCheck( 'show-feedback' ) ) { |
29 | 30 | $this->showHidden = true; |
30 | 31 | } |
| 32 | + |
| 33 | + if ( $wgRequest->getCheck( 'restore-feedback' ) ) { |
| 34 | + $this->action = 'restore'; |
| 35 | + } elseif ( $wgRequest->getCheck( 'hide-feedback' ) ) { |
| 36 | + $this->action = 'hide'; |
| 37 | + } |
31 | 38 | } else { |
32 | 39 | // Determine filters and offset from the query string |
33 | 40 | $filters = array(); |
— | — | @@ -254,7 +261,7 @@ |
255 | 262 | $linkText = wfMessage('moodbar-feedback-show')->escaped(); |
256 | 263 | $query = array('show-feedback' => '1'); |
257 | 264 | $link = $GLOBALS['wgUser']->getSkin() |
258 | | - ->link( $permalinkTitle, $linkText, array(), $query ); |
| 265 | + ->link( $permalinkTitle, $linkText ); |
259 | 266 | return Xml::tags( 'div', array( 'class' => 'fbd-item-show' ), "($link)" ); |
260 | 267 | } |
261 | 268 | } |
— | — | @@ -304,6 +311,26 @@ |
305 | 312 | $newerRow = $res['newerRow']; |
306 | 313 | $html = "<ul id=\"fbd-list\">$list</ul>"; |
307 | 314 | |
| 315 | + // Only set for showing an individual row. |
| 316 | + $form = null; |
| 317 | + if ( $this->action == 'restore' ) { |
| 318 | + $form = new MBRestoreForm( $row->mbf_id ); |
| 319 | + } elseif ( $this->action == 'hide' ) { |
| 320 | + $form = new MBHideForm( $row->mbf_id ); |
| 321 | + } |
| 322 | + |
| 323 | + if ( $form ) { |
| 324 | + $result = $form->show(); |
| 325 | + if ( $result === true ) { |
| 326 | + global $wgOut; |
| 327 | + $title = SpecialPage::getTitleFor( 'FeedbackDashboard', |
| 328 | + $row->mbf_id ); |
| 329 | + $wgOut->redirect( $title->getFullURL() ); |
| 330 | + } else { |
| 331 | + $html .= "\n$result\n"; |
| 332 | + } |
| 333 | + } |
| 334 | + |
308 | 335 | // Output the "More" link |
309 | 336 | $moreText = wfMessage( 'moodbar-feedback-more' )->escaped(); |
310 | 337 | $attribs = array( 'id' => 'fbd-list-more' ); |
Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -96,6 +96,12 @@ |
97 | 97 | 'moodbar-feedback-hide' => 'hide feedback', |
98 | 98 | 'moodbar-hidden-footer' => 'Hidden Feedback $1', |
99 | 99 | 'moodbar-feedback-restore' => 'restore hidden feedback', |
| 100 | + 'moodbar-action-item' => 'Feedback item:', |
| 101 | + 'moodbar-hide-header' => 'Hide this item from view', |
| 102 | + 'moodbar-hide-intro' => '', |
| 103 | + 'moodbar-restore-header' => "Restore this item's visibility", |
| 104 | + 'moodbar-restore-intro' => '', |
| 105 | + 'moodbar-invalid-item' => 'The system was unable to find the correct feedback item.', |
100 | 106 | // Mood types |
101 | 107 | 'moodbar-type-happy' => 'Happy', |
102 | 108 | 'moodbar-type-sad' => 'Sad', |
— | — | @@ -104,6 +110,13 @@ |
105 | 111 | 'moodbar-user-anonymized' => 'Anonymized', |
106 | 112 | 'moodbar-user-ip' => 'IP Address', |
107 | 113 | 'moodbar-user-user' => 'Registered user', |
| 114 | + // Log types |
| 115 | + 'moodbar-log-name' => 'Feedback log', |
| 116 | + 'moodbar-log-header' => 'This is the log of actions taken on feedback items listed |
| 117 | +on the [[Special:FeedbackDashboard|feedback dashboard]].', |
| 118 | + |
| 119 | + 'moodbar-log-hide' => 'hid [[$1]]', |
| 120 | + 'moodbar-log-restore' => 'restored the visibility for [[$1]]', |
108 | 121 | ); |
109 | 122 | |
110 | 123 | /** Message documentation (Message documentation) |
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.css |
— | — | @@ -84,6 +84,7 @@ |
85 | 85 | #fbd-list { |
86 | 86 | margin: 0 0 0 13em; |
87 | 87 | padding: 0; |
| 88 | + min-height: 20em; |
88 | 89 | list-style: none; |
89 | 90 | } |
90 | 91 | |
Index: trunk/extensions/MoodBar/FeedbackItem.php |
— | — | @@ -205,11 +205,6 @@ |
206 | 206 | * @return The MBFeedbackItem's new ID. |
207 | 207 | */ |
208 | 208 | public function save() { |
209 | | - |
210 | | - if ( $this->getProperty('id') ) { |
211 | | - throw new MWException( "This ".__CLASS__." is already in the database." ); |
212 | | - } |
213 | | - |
214 | 209 | // Add edit count if necessary |
215 | 210 | if ( $this->getProperty('user-editcount') === null && |
216 | 211 | $this->getProperty('user') ) |
— | — | @@ -254,14 +249,14 @@ |
255 | 250 | } |
256 | 251 | |
257 | 252 | if ( $this->getProperty('id') ) { |
| 253 | + $row['mbf_id'] = $this->getProperty('id'); |
258 | 254 | $dbw->replace( 'moodbar_feedback', array('mbf_id'), $row, __METHOD__ ); |
259 | 255 | } else { |
260 | 256 | $row['mbf_id'] = $dbw->nextSequenceValue( 'moodbar_feedback_mbf_id' ); |
261 | 257 | $dbw->insert( 'moodbar_feedback', $row, __METHOD__ ); |
| 258 | + $this->setProperty( 'id', $dbw->insertId() ); |
262 | 259 | } |
263 | 260 | |
264 | | - $this->setProperty( 'id', $dbw->insertId() ); |
265 | | - |
266 | 261 | return $this->getProperty('id'); |
267 | 262 | } |
268 | 263 | |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -36,6 +36,20 @@ |
37 | 37 | $wgAutoloadClasses['SpecialFeedbackDashboard'] = dirname( __FILE__ ) . '/SpecialFeedbackDashboard.php'; |
38 | 38 | $wgSpecialPages['FeedbackDashboard'] = 'SpecialFeedbackDashboard'; |
39 | 39 | |
| 40 | +$dashboardFormsPath = dirname(__FILE__) . '/DashboardForms.php'; |
| 41 | +$wgAutoloadClasses['MBDashboardForm'] = $dashboardFormsPath; |
| 42 | +$wgAutoloadClasses['MBActionForm'] = $dashboardFormsPath; |
| 43 | +$wgAutoloadClasses['MBHideForm'] = $dashboardFormsPath; |
| 44 | +$wgAutoloadClasses['MBRestoreForm'] = $dashboardFormsPath; |
| 45 | + |
| 46 | +$wgLogTypes[] = 'moodbar'; |
| 47 | +$wgLogNames['moodbar'] = 'moodbar-log-name'; |
| 48 | +$wgLogHeaders['moodbar'] = 'moodbar-log-header'; |
| 49 | +$wgLogActions += array( |
| 50 | + 'moodbar/hide' => 'moodbar-log-hide', |
| 51 | + 'moodbar/restore' => 'moodbar-log-restore', |
| 52 | +); |
| 53 | + |
40 | 54 | // User rights |
41 | 55 | $wgAvailableRights[] = 'moodbar-view'; |
42 | 56 | $wgAvailableRights[] = 'moodbar-admin'; |