r60181 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60180‎ | r60181 | r60182 >
Date:22:12, 17 December 2009
Author:aaron
Status:ok
Tags:
Comment:
* Added stableOnlyIfConfigured()
* Fixed $this->override type
* Tweaked protect page messages
* Tweaked some comments
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -210,8 +210,9 @@
211211 'tooltip-ca-stable' => 'View the stable version of this page',
212212 'tooltip-ca-default' => 'Quality assurance settings',
213213
214 - 'flaggedrevs-protect-legend' => 'Edit approval',
215 - 'flaggedrevs-protect-none' => 'No additional restrictions',
 214+ 'flaggedrevs-protect-legend' => 'Publish edits',
 215+ 'flaggedrevs-protect-none' => 'Allow all users',
 216+ 'flaggedrevs-protect-basic' => 'Default settings',
216217
217218 'revreview-locked-title' => 'Edits must be reviewed before being displayed on this page.',
218219 'revreview-unlocked-title' => 'Edits do not require review before being displayed on this page.',
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -186,13 +186,21 @@
187187 }
188188
189189 /**
190 - * Does the review form only show for pages were the stable version is the default?
 190+ * Does FlaggedRevs only show for pages were the stable version is the default?
191191 * @returns bool
192192 */
193193 public static function forDefaultVersionOnly() {
194194 global $wgFlaggedRevsReviewForDefault;
195195 return (bool)$wgFlaggedRevsReviewForDefault;
196196 }
 197+
 198+ /**
 199+ * Does FLaggedRevs only show for pages that have been set to do so?
 200+ * @returns bool
 201+ */
 202+ public static function stableOnlyIfConfigured() {
 203+ return self::forDefaultVersionOnly() && !self::showStableByDefault();
 204+ }
197205
198206 /**
199207 * Should this user ignore the site and page default version settings?
@@ -1503,7 +1511,7 @@
15041512 }
15051513
15061514 /**
1507 - * Get JS script params for onloading
 1515+ * Get JS script params
15081516 */
15091517 public static function getJSTagParams() {
15101518 self::load();
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1889,21 +1889,32 @@
18901890 $output .= "<tr><td>";
18911891 $output .= Xml::openElement( 'fieldset' );
18921892 $output .= Xml::element( 'legend', null, wfMsg('flaggedrevs-protect-legend') );
1893 - $output .= "<table>";
18941893 # Add a "no restrictions" level
18951894 $effectiveLevels = array( "none" => null );
18961895 $effectiveLevels += FlaggedRevs::getProtectionLevels();
1897 - # Show all restriction levels as radios...
 1896+
 1897+ $attribs = array(
 1898+ 'id' => 'mwStabilityConfig',
 1899+ 'name' => 'mwStabilityConfig',
 1900+ 'size' => count( $effectiveLevels ),
 1901+ ) + $disabledAttrib;
 1902+ $output .= Xml::openElement( 'select', $attribs );
 1903+ # Show all restriction levels in a select...
18981904 foreach( $effectiveLevels as $level => $x ) {
1899 - $label = wfMsg( 'flaggedrevs-protect-'.$level );
 1905+ if( $level == 'none' ) {
 1906+ $label = FlaggedRevs::stableOnlyIfConfigured()
 1907+ ? wfMsg( 'flaggedrevs-protect-none' )
 1908+ : wfMsg( 'flaggedrevs-protect-basic' );
 1909+ } else {
 1910+ $label = wfMsg( 'flaggedrevs-protect-'.$level );
 1911+ }
19001912 // Default to the key itself if no UI message
19011913 if( wfEmptyMsg('flaggedrevs-protect-'.$level,$label) ) {
19021914 $label = 'flaggedrevs-protect-'.$level;
19031915 }
1904 - $output .= "<tr><td>" . Xml::radioLabel( $label, 'wpStabilityConfig', $level,
1905 - 'wpStabilityConfig-'.$level, $level == $selected, $disabledAttrib ) . "</td></tr>";
 1916+ $output .= Xml::option( $label, $level, $level == $selected );
19061917 }
1907 - $output .= "</table>";
 1918+ $output .= Xml::closeElement( 'select' );
19081919 # Get expiry dropdown
19091920 $scExpiryOptions = wfMsgForContent( 'protect-expiry-options' );
19101921 $showProtectOptions = ($scExpiryOptions !== '-' && $isAllowed);
@@ -2013,10 +2024,10 @@
20142025 $form->expiry = $wgRequest->getText( 'mwStabilize-expiry' ); # Expiry
20152026 $form->expirySelection = $wgRequest->getVal( 'wpExpirySelection' ); # Expiry dropdown
20162027 # Fill in config from the protection level...
2017 - $selected = $wgRequest->getVal( 'wpStabilityConfig' );
 2028+ $selected = $wgRequest->getVal( 'mwStabilityConfig' );
20182029 if( $selected == "none" ) {
20192030 $form->select = FlaggedRevs::getPrecedence(); // default
2020 - $form->override = FlaggedRevs::showStableByDefault(); // default
 2031+ $form->override = (int)FlaggedRevs::showStableByDefault(); // default
20212032 $form->autoreview = ''; // default
20222033 } else if( isset($levels[$selected]) ) {
20232034 $form->select = $levels[$selected]['select'];

Status & tagging log