Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -24,9 +24,7 @@ |
25 | 25 | public static $builderValues = array( |
26 | 26 | 'op-arithmetic' => array( |
27 | 27 | '+' => 'addition', |
28 | | - '-' => 'subtraction', |
29 | | - '*' => 'multiplication', |
30 | | - '/' => 'divide', |
| 28 | + '-' => 'subtraction', '*' => 'multiplication', '/' => 'divide', |
31 | 29 | '%' => 'modulo', |
32 | 30 | '**' => 'pow' |
33 | 31 | ), |
— | — | @@ -1318,45 +1316,47 @@ |
1319 | 1317 | $rules = rtrim( $rules ) . "\n"; |
1320 | 1318 | $rules = Xml::textarea( $textName, $rules, 40, 5, $textareaAttrib ); |
1321 | 1319 | |
1322 | | - $dropDown = self::getBuilderValues(); |
1323 | | - // Generate builder drop-down |
1324 | | - $builder = ''; |
| 1320 | + if ( $canEdit ) { |
| 1321 | + $dropDown = self::getBuilderValues(); |
| 1322 | + // Generate builder drop-down |
| 1323 | + $builder = ''; |
1325 | 1324 | |
1326 | | - $builder .= Xml::option( wfMsg( 'abusefilter-edit-builder-select' ) ); |
| 1325 | + $builder .= Xml::option( wfMsg( 'abusefilter-edit-builder-select' ) ); |
1327 | 1326 | |
1328 | | - foreach ( $dropDown as $group => $values ) { |
1329 | | - $builder .= |
1330 | | - Xml::openElement( |
1331 | | - 'optgroup', |
1332 | | - array( 'label' => wfMsg( "abusefilter-edit-builder-group-$group" ) ) |
1333 | | - ) . "\n"; |
1334 | | - |
1335 | | - foreach ( $values as $content => $name ) { |
| 1327 | + foreach ( $dropDown as $group => $values ) { |
1336 | 1328 | $builder .= |
1337 | | - Xml::option( |
1338 | | - wfMsg( "abusefilter-edit-builder-$group-$name" ), |
1339 | | - $content |
| 1329 | + Xml::openElement( |
| 1330 | + 'optgroup', |
| 1331 | + array( 'label' => wfMsg( "abusefilter-edit-builder-group-$group" ) ) |
1340 | 1332 | ) . "\n"; |
| 1333 | + |
| 1334 | + foreach ( $values as $content => $name ) { |
| 1335 | + $builder .= |
| 1336 | + Xml::option( |
| 1337 | + wfMsg( "abusefilter-edit-builder-$group-$name" ), |
| 1338 | + $content |
| 1339 | + ) . "\n"; |
| 1340 | + } |
| 1341 | + |
| 1342 | + $builder .= Xml::closeElement( 'optgroup' ) . "\n"; |
1341 | 1343 | } |
1342 | 1344 | |
1343 | | - $builder .= Xml::closeElement( 'optgroup' ) . "\n"; |
| 1345 | + $rules .= |
| 1346 | + Xml::tags( |
| 1347 | + 'select', |
| 1348 | + array( 'id' => 'wpFilterBuilder', ), |
| 1349 | + $builder |
| 1350 | + ) . ' '; |
| 1351 | + |
| 1352 | + // Add syntax checking |
| 1353 | + $rules .= Xml::element( 'input', |
| 1354 | + array( |
| 1355 | + 'type' => 'button', |
| 1356 | + 'value' => wfMsg( 'abusefilter-edit-check' ), |
| 1357 | + 'id' => 'mw-abusefilter-syntaxcheck' |
| 1358 | + ) + $noTestAttrib ); |
1344 | 1359 | } |
1345 | 1360 | |
1346 | | - $rules .= |
1347 | | - Xml::tags( |
1348 | | - 'select', |
1349 | | - array( 'id' => 'wpFilterBuilder', ), |
1350 | | - $builder |
1351 | | - ) . ' '; |
1352 | | - |
1353 | | - // Add syntax checking |
1354 | | - $rules .= Xml::element( 'input', |
1355 | | - array( |
1356 | | - 'type' => 'button', |
1357 | | - 'value' => wfMsg( 'abusefilter-edit-check' ), |
1358 | | - 'id' => 'mw-abusefilter-syntaxcheck' |
1359 | | - ) + $noTestAttrib ); |
1360 | | - |
1361 | 1361 | if ( $addResultDiv ) |
1362 | 1362 | $rules .= Xml::element( 'div', |
1363 | 1363 | array( 'id' => 'mw-abusefilter-syntaxresult', 'style' => 'display: none;' ), |