Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | $wgExtensionCredits['specialpage'][] = array( |
16 | 16 | 'name' => 'Flagged Revisions', |
17 | 17 | 'author' => array( 'Aaron Schulz', 'Joerg Baach' ), |
18 | | - 'version' => '1.026', |
| 18 | + 'version' => '1.027', |
19 | 19 | 'url' => 'http://www.mediawiki.org/wiki/Extension:FlaggedRevs', |
20 | 20 | 'descriptionmsg' => 'flaggedrevs-desc', |
21 | 21 | ); |
— | — | @@ -340,11 +340,12 @@ |
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Should this be using a simple icon-based UI? |
| 344 | + * Check the user's preferences first, using the site settings as the default. |
344 | 345 | */ |
345 | 346 | public static function useSimpleUI() { |
346 | | - global $wgSimpleFlaggedRevsUI; |
| 347 | + global $wgUser, $wgSimpleFlaggedRevsUI; |
347 | 348 | |
348 | | - return $wgSimpleFlaggedRevsUI; |
| 349 | + return $wgUser->getOption( 'flaggedrevssimpleui', intval($wgSimpleFlaggedRevsUI) ); |
349 | 350 | } |
350 | 351 | |
351 | 352 | /** |
— | — | @@ -1757,17 +1758,46 @@ |
1758 | 1759 | * Add user preference to form HTML |
1759 | 1760 | */ |
1760 | 1761 | public static function injectPreferences( $form, $out ) { |
| 1762 | + global $wgUser; |
| 1763 | + |
1761 | 1764 | $out->addHTML( |
1762 | 1765 | Xml::openElement( 'fieldset' ) . |
1763 | 1766 | Xml::element( 'legend', null, wfMsgHtml('flaggedrevs-prefs') ) . |
1764 | | - Xml::openElement( 'table' ) . Xml::openElement( 'tr' ) . |
1765 | | - '<td>'.wfCheck( 'wpFlaggedRevsStable', $form->mFlaggedRevsStable, |
1766 | | - array('id' => 'wpFlaggedRevsStable') ) . '</td>' . |
1767 | | - '<td>' . wfLabel( wfMsg( 'flaggedrevs-prefs-stable' ), 'wpFlaggedRevsStable' ) . '</td>' . |
1768 | | - Xml::closeElement( 'tr' ) . Xml::closeElement( 'table' ) . |
| 1767 | + Xml::openElement( 'table' ) . |
| 1768 | + Xml::openElement( 'tr' ) . |
| 1769 | + '<td>' . wfCheck( 'wpFlaggedRevsStable', $form->mFlaggedRevsStable, |
| 1770 | + array('id' => 'wpFlaggedRevsStable') ) . '</td><td> ' . |
| 1771 | + wfLabel( wfMsg( 'flaggedrevs-prefs-stable' ), 'wpFlaggedRevsStable' ) . '</td>' . |
| 1772 | + Xml::closeElement( 'tr' ) . |
| 1773 | + Xml::openElement( 'tr' ) . |
| 1774 | + '<td>' . |
| 1775 | + Xml::radio( 'wpFlaggedRevsSUI', 0, $form->mFlaggedRevsSUI==0, array('id' => 'standardUI') ) . |
| 1776 | + '</td><td> ' . |
| 1777 | + Xml::label( wfMsgHtml('flaggedrevs-pref-UI-0'), 'standardUI' ) . |
| 1778 | + '</td>' . |
| 1779 | + Xml::closeElement( 'tr' ) . |
| 1780 | + Xml::openElement( 'tr' ) . |
| 1781 | + '<td>' . |
| 1782 | + Xml::radio( 'wpFlaggedRevsSUI', 1, $form->mFlaggedRevsSUI==1, array('id' => 'simpleUI') ) . |
| 1783 | + '</td><td> ' . |
| 1784 | + Xml::label( wfMsgHtml('flaggedrevs-pref-UI-1'), 'simpleUI' ) . |
| 1785 | + '</td>' |
| 1786 | + ); |
| 1787 | + if( $wgUser->isAllowed( 'review' ) ) { |
| 1788 | + $out->addHTML( |
| 1789 | + Xml::closeElement( 'tr' ) . |
| 1790 | + Xml::openElement( 'tr' ) . '<td><br/></td>' . Xml::closeElement( 'tr' ) . |
| 1791 | + Xml::openElement( 'tr' ) . |
| 1792 | + '<td>' . wfCheck( 'wpFlaggedRevsWatch', $form->mFlaggedRevsWatch, array('id' => 'wpFlaggedRevsWatch') ) . |
| 1793 | + '</td><td> ' . wfLabel( wfMsg( 'flaggedrevs-prefs-watch' ), 'wpFlaggedRevsWatch' ) . '</td>' |
| 1794 | + ); |
| 1795 | + } |
| 1796 | + $out->addHTML( |
| 1797 | + Xml::closeElement( 'tr' ) . |
| 1798 | + Xml::closeElement( 'table' ) . |
1769 | 1799 | Xml::closeElement( 'fieldset' ) |
1770 | 1800 | ); |
1771 | | - |
| 1801 | + |
1772 | 1802 | return true; |
1773 | 1803 | } |
1774 | 1804 | |
— | — | @@ -1775,8 +1805,10 @@ |
1776 | 1806 | * Add user preference to form object based on submission |
1777 | 1807 | */ |
1778 | 1808 | public static function injectFormPreferences( $form, $request ) { |
| 1809 | + global $wgUser; |
1779 | 1810 | $form->mFlaggedRevsStable = $request->getInt( 'wpFlaggedRevsStable' ); |
1780 | | - |
| 1811 | + $form->mFlaggedRevsSUI = $request->getInt( 'wpFlaggedRevsSUI' ); |
| 1812 | + $form->mFlaggedRevsWatch = $wgUser->isAllowed( 'review' ) ? $request->getInt( 'wpFlaggedRevsWatch' ) : 0; |
1781 | 1813 | return true; |
1782 | 1814 | } |
1783 | 1815 | |
— | — | @@ -1784,8 +1816,10 @@ |
1785 | 1817 | * Set preferences on form based on user settings |
1786 | 1818 | */ |
1787 | 1819 | public static function resetPreferences( $form, $user ) { |
| 1820 | + global $wgSimpleFlaggedRevsUI; |
1788 | 1821 | $form->mFlaggedRevsStable = $user->getOption( 'flaggedrevsstable' ); |
1789 | | - |
| 1822 | + $form->mFlaggedRevsSUI = $user->getOption( 'flaggedrevssimpleui', intval($wgSimpleFlaggedRevsUI) ); |
| 1823 | + $form->mFlaggedRevsWatch = $user->getOption( 'flaggedrevswatch' ); |
1790 | 1824 | return true; |
1791 | 1825 | } |
1792 | 1826 | |
— | — | @@ -1794,7 +1828,8 @@ |
1795 | 1829 | */ |
1796 | 1830 | public static function savePreferences( $form, $user, &$msg ) { |
1797 | 1831 | $user->setOption( 'flaggedrevsstable', $form->validateInt( $form->mFlaggedRevsStable, 0, 1 ) ); |
1798 | | - |
| 1832 | + $user->setOption( 'flaggedrevssimpleui', $form->validateInt( $form->mFlaggedRevsSUI, 0, 1 ) ); |
| 1833 | + $user->setOption( 'flaggedrevswatch', $form->validateInt( $form->mFlaggedRevsWatch, 0, 1 ) ); |
1799 | 1834 | return true; |
1800 | 1835 | } |
1801 | 1836 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php |
— | — | @@ -220,6 +220,9 @@ |
221 | 221 | |
222 | 222 | 'flaggedrevs-prefs' => 'Stability', |
223 | 223 | 'flaggedrevs-prefs-stable' => 'Always show the stable version of content pages by default (if there is one)', |
| 224 | + 'flaggedrevs-prefs-watch' => 'Add pages I review to my watchlist', |
| 225 | + 'flaggedrevs-pref-UI-0' => 'Use detailed stable version user interface', |
| 226 | + 'flaggedrevs-pref-UI-1' => 'Use simple stable version user interface', |
224 | 227 | ); |
225 | 228 | |
226 | 229 | /** Aragonese (Aragonés) |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -345,18 +345,20 @@ |
346 | 346 | global $wgFlaggedRevsOverride; |
347 | 347 | |
348 | 348 | $wgOut->setPageTitle( wfMsgHtml('actioncomplete') ); |
349 | | - |
| 349 | + # Show success message |
350 | 350 | $msg = $approved ? 'revreview-successful' : 'revreview-successful2'; |
351 | 351 | $wgOut->addHtml( "<span class='plainlinks'>" .wfMsgExt( $msg, array('parseinline'), |
352 | 352 | $this->page->getPrefixedText(), $this->page->getPrefixedUrl() ) . "</span>" ); |
353 | | - |
354 | 353 | if( $wgFlaggedRevsOverride ) { |
355 | 354 | $wgOut->addHtml( '<p>'.wfMsgExt( 'revreview-text', array('parseinline') ).'</p>' ); |
356 | 355 | } else { |
357 | 356 | $wgOut->addHtml( '<p>'.wfMsgExt( 'revreview-text2', array('parseinline') ).'</p>' ); |
358 | 357 | } |
359 | | - |
360 | 358 | $wgOut->returnToMain( false, SpecialPage::getTitleFor( 'Recentchanges' ) ); |
| 359 | + # Watch page if set to do so |
| 360 | + if( $wgUser->getOption('flaggedrevswatch') && !$this->page->userIsWatching() ) { |
| 361 | + $wgUser->addWatch( $this->page ); |
| 362 | + } |
361 | 363 | } else { |
362 | 364 | $wgOut->showErrorPage( 'internalerror', 'revreview-changed', array($this->page->getPrefixedText()) ); |
363 | 365 | } |