Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | |
19 | 19 | var propTd = $( '<td />' ).attr( { |
20 | 20 | //'bgcolor': 'gray', |
21 | | - 'rowspan': 2 |
| 21 | + 'rowspan': 3 |
22 | 22 | } ); |
23 | 23 | |
24 | 24 | propTd.html( mediaWiki.msg( 'swl-group-properties' ) ); |
— | — | @@ -36,12 +36,47 @@ |
37 | 37 | var nameTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) + ' ' ).append( nameInput ) ); |
38 | 38 | table.append( $( '<tr />' ).html( nameTd ) ); |
39 | 39 | |
| 40 | + var conditionValue, conditionType; |
| 41 | + |
| 42 | + switch ( true ) { |
| 43 | + case group.categories.length > 0: |
| 44 | + conditionValue = group.categories[0]; |
| 45 | + conditionType = 'category'; |
| 46 | + break; |
| 47 | + case group.namespaces.length > 0: |
| 48 | + conditionValue = group.namespaces[0]; |
| 49 | + conditionType = 'namespace'; |
| 50 | + break; |
| 51 | + case group.concepts.length > 0: |
| 52 | + conditionValue = group.concepts[0]; |
| 53 | + conditionType = 'concept'; |
| 54 | + break; |
| 55 | + } |
| 56 | + |
| 57 | + var conditionTypeInput = $( '<select />' ); |
| 58 | + var conditionTypes = [ 'category', 'namespace', 'concept' ]; |
| 59 | + |
| 60 | + for ( i in conditionTypes ) { |
| 61 | + var optionElement = $( '<option />' ).text( mediaWiki.msg( 'swl-group-' + conditionTypes[i] ) ).attr( 'value', conditionTypes[i] ); |
| 62 | + |
| 63 | + if ( conditionType == conditionTypes[i] ) { |
| 64 | + optionElement.attr( 'selected', 'selected' ); |
| 65 | + } |
| 66 | + |
| 67 | + conditionTypeInput.append( optionElement ); |
| 68 | + } |
| 69 | + |
40 | 70 | var conditionNameInput = $( '<input />' ).attr( { |
41 | 71 | 'type': 'text', |
42 | | - 'value': group.name, |
| 72 | + 'value': conditionValue, |
43 | 73 | 'size': 30 |
44 | 74 | } ); |
45 | | - var conditionTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-page-selection' ) + ' ' ).append( conditionNameInput ) ); |
| 75 | + var conditionTd = $( '<td />' ).html( |
| 76 | + $( '<p />' ).text( mediaWiki.msg( 'swl-group-page-selection' ) + ' ' ) |
| 77 | + .append( conditionTypeInput ) |
| 78 | + .append( conditionNameInput ) |
| 79 | + ); |
| 80 | + |
46 | 81 | table.append( $( '<tr />' ).html( conditionTd ) ); |
47 | 82 | |
48 | 83 | this.append( table ); |
— | — | @@ -49,7 +84,7 @@ |
50 | 85 | this.append( |
51 | 86 | $( '<input />' ).attr( { |
52 | 87 | 'type': 'button', |
53 | | - 'value': mediaWiki.msg( 'save' ) |
| 88 | + 'value': mediaWiki.msg( 'swl-group-save' ) |
54 | 89 | } ).click( function() { |
55 | 90 | this.disabled = true; |
56 | 91 | self.doSave( function() { this.disabled = false; } ); |
Index: trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $groupsHtml[] = $this->getGroupHtml( $group ); |
72 | 72 | } |
73 | 73 | |
74 | | - $wgOut->addHTML( implode( '<br />', $groupsHtml ) ); |
| 74 | + $wgOut->addHTML( implode( '', $groupsHtml ) ); |
75 | 75 | |
76 | 76 | $wgOut->addModules( 'ext.swl.watchlistconditions' ); |
77 | 77 | } |
— | — | @@ -85,6 +85,12 @@ |
86 | 86 | * @return string |
87 | 87 | */ |
88 | 88 | protected function getGroupHtml( SWLGroup $group ) { |
| 89 | + $namespaces = $group->getNamespaces(); |
| 90 | + |
| 91 | + foreach ( $namespaces as &$ns ) { |
| 92 | + $ns = MWNamespace::getCanonicalName( $ns ); |
| 93 | + } |
| 94 | + |
89 | 95 | return Html::rawElement( |
90 | 96 | 'fieldset', |
91 | 97 | array( |
— | — | @@ -92,7 +98,7 @@ |
93 | 99 | 'class' => 'swl_group', |
94 | 100 | 'groupname' => $group->getName(), |
95 | 101 | 'categories' => implode( '|', $group->getCategories() ), |
96 | | - 'namespaces' => implode( '|', $group->getNamespaces() ), |
| 102 | + 'namespaces' => implode( '|', $namespaces ), |
97 | 103 | 'properties' => implode( '|', $group->getProperties() ), |
98 | 104 | 'concepts' => implode( '|', $group->getConcepts() ), |
99 | 105 | ), |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php |
— | — | @@ -31,6 +31,10 @@ |
32 | 32 | 'swl-group-properties' => 'Properties covered by this group:', |
33 | 33 | 'swl-group-remove-property' => 'Remove property', |
34 | 34 | 'swl-group-page-selection' => 'Pages in', |
| 35 | + 'swl-group-save' => 'Save', |
| 36 | + 'swl-group-category' => 'category', |
| 37 | + 'swl-group-namespace' => 'namespace', |
| 38 | + 'swl-group-concept' => 'concept', |
35 | 39 | |
36 | 40 | // Special:SemanticWatchlist |
37 | 41 | 'swl-watchlist-position' => "Showing '''$1''' of the last changes starting with '''#$2'''.", |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php |
— | — | @@ -112,7 +112,10 @@ |
113 | 113 | 'swl-group-properties', |
114 | 114 | 'swl-group-remove-property', |
115 | 115 | 'swl-group-page-selection', |
116 | | - 'save', |
| 116 | + 'swl-group-save', |
| 117 | + 'swl-group-category', |
| 118 | + 'swl-group-namespace', |
| 119 | + 'swl-group-concept', |
117 | 120 | ) |
118 | 121 | ); |
119 | 122 | |