Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1202,6 +1202,7 @@ |
1203 | 1203 | 'protect-locked-access', |
1204 | 1204 | 'protect-cascadeon', |
1205 | 1205 | 'protect-default', |
| 1206 | + 'protect-fallback', |
1206 | 1207 | 'protect-level-autoconfirmed', |
1207 | 1208 | 'protect-level-sysop', |
1208 | 1209 | 'protect-summary-cascade', |
Index: trunk/phase3/includes/ProtectionForm.php |
— | — | @@ -278,22 +278,28 @@ |
279 | 279 | |
280 | 280 | $out = wfOpenElement( 'select', $attribs ); |
281 | 281 | foreach( $wgRestrictionLevels as $key ) { |
282 | | - $out .= $this->buildOption( $key, $selected ); |
| 282 | + $out .= Xml::option( $this->getOptionLabel( $key ), $key, $key == $selected ); |
283 | 283 | } |
284 | 284 | $out .= "</select>\n"; |
285 | 285 | return $out; |
286 | 286 | } |
287 | 287 | |
288 | | - function buildOption( $key, $selected ) { |
289 | | - $text = ( $key == '' ) |
290 | | - ? wfMsg( 'protect-default' ) |
291 | | - : wfMsg( "protect-level-$key" ); |
292 | | - $selectedAttrib = ($selected == $key) |
293 | | - ? array( 'selected' => 'selected' ) |
294 | | - : array(); |
295 | | - return wfElement( 'option', |
296 | | - array( 'value' => $key ) + $selectedAttrib, |
297 | | - $text ); |
| 288 | + /** |
| 289 | + * Prepare the label for a protection selector option |
| 290 | + * |
| 291 | + * @param string $permission Permission required |
| 292 | + * @return string |
| 293 | + */ |
| 294 | + private function getOptionLabel( $permission ) { |
| 295 | + if( $permission == '' ) { |
| 296 | + return wfMsg( 'protect-default' ); |
| 297 | + } else { |
| 298 | + $key = "protect-level-{$permission}"; |
| 299 | + $msg = wfMsg( $key ); |
| 300 | + if( wfEmptyMsg( $key, $msg ) ) |
| 301 | + $msg = wfMsg( 'protect-fallback', $permission ); |
| 302 | + return $msg; |
| 303 | + } |
298 | 304 | } |
299 | 305 | |
300 | 306 | function buildReasonInput() { |
— | — | @@ -376,6 +382,5 @@ |
377 | 383 | 'type' => 'protect' ) ) ) ); |
378 | 384 | $logViewer->showList( $out ); |
379 | 385 | } |
380 | | -} |
381 | 386 | |
382 | | - |
| 387 | +} |
\ No newline at end of file |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1861,6 +1861,7 @@ |
1862 | 1862 | Here are the current settings for the page <strong>$1</strong>:', |
1863 | 1863 | 'protect-cascadeon' => "This page is currently protected because it is included in the following {{PLURAL:$1|page, which has|pages, which have}} cascading protection turned on. You can change this page's protection level, but it will not affect the cascading protection.", |
1864 | 1864 | 'protect-default' => '(default)', |
| 1865 | +'protect-fallback' => 'Require "$1" permission', |
1865 | 1866 | 'protect-level-autoconfirmed' => 'Block unregistered users', |
1866 | 1867 | 'protect-level-sysop' => 'Sysops only', |
1867 | 1868 | 'protect-summary-cascade' => 'cascading', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -170,6 +170,8 @@ |
171 | 171 | * (bug 10859) Introduce 'UserGetImplicitGroups' hook; see docs/hooks.txt for |
172 | 172 | more information |
173 | 173 | * (bug 10832) Include user information when viewing a deleted revision |
| 174 | +* (bug 10872) Fall back to sane defaults when generating protection selector |
| 175 | + labels for custom restriction levels |
174 | 176 | |
175 | 177 | == Bugfixes since 1.10 == |
176 | 178 | |