Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | (function( $ ){ $.fn.watchlistcondition = function( group, options ) { |
11 | 11 | |
12 | 12 | var self = this; |
| 13 | + this.group = group; |
13 | 14 | |
14 | 15 | this.buildHtml = function() { |
15 | 16 | this.html( $( '<legend />' ).text( group.name ) ); |
— | — | @@ -25,12 +26,12 @@ |
26 | 27 | propTd.append( this.getPropertyDiv( group.properties[i] ) ); |
27 | 28 | } |
28 | 29 | |
29 | | - var nameInput = $( '<input />' ).attr( { |
| 30 | + this.nameInput = $( '<input />' ).attr( { |
30 | 31 | 'type': 'text', |
31 | 32 | 'value': group.name, |
32 | 33 | 'size': 30 |
33 | 34 | } ); |
34 | | - var nameTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) + ' ' ).append( nameInput ) ); |
| 35 | + var nameTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) + ' ' ).append( this.nameInput ) ); |
35 | 36 | table.append( $( '<tr />' ).html( nameTd ).append( propTd ) ); |
36 | 37 | |
37 | 38 | var conditionValue, conditionType; |
— | — | @@ -71,6 +72,7 @@ |
72 | 73 | var conditionTd = $( '<td />' ).html( |
73 | 74 | $( '<p />' ).text( mediaWiki.msg( 'swl-group-page-selection' ) + ' ' ) |
74 | 75 | .append( conditionTypeInput ) |
| 76 | + .append( ' ' ) |
75 | 77 | .append( conditionNameInput ) |
76 | 78 | ); |
77 | 79 | |
— | — | @@ -86,7 +88,21 @@ |
87 | 89 | this.disabled = true; |
88 | 90 | self.doSave( function() { this.disabled = false; } ); |
89 | 91 | } ) |
90 | | - ); |
| 92 | + ); |
| 93 | + |
| 94 | + this.append( ' ' ); |
| 95 | + |
| 96 | + this.append( |
| 97 | + $( '<input />' ).attr( { |
| 98 | + 'type': 'button', |
| 99 | + 'value': mediaWiki.msg( 'swl-group-delete' ) |
| 100 | + } ).click( function() { |
| 101 | + if ( confirm( mediaWiki.msg( 'swl-group-confirmdelete', self.nameInput.val() ) ) ) { |
| 102 | + this.disabled = true; |
| 103 | + self.doDelete( function() { this.disabled = false; } ); |
| 104 | + } |
| 105 | + } ) |
| 106 | + ); |
91 | 107 | } |
92 | 108 | |
93 | 109 | this.getPropertyDiv = function( property ) { |
— | — | @@ -114,18 +130,29 @@ |
115 | 131 | $.getJSON( |
116 | 132 | wgScriptPath + '/api.php', |
117 | 133 | { |
118 | | - 'action': 'semanticwatchlist', |
| 134 | + 'action': 'editswlgroup', |
119 | 135 | 'format': 'json', |
120 | | - 'images': images.join( '|' ), |
121 | | - 'targets': targetUrl |
122 | 136 | }, |
123 | 137 | function( data ) { |
124 | 138 | callback(); |
125 | 139 | } |
126 | 140 | ); |
127 | | - |
128 | 141 | } |
129 | 142 | |
| 143 | + this.doDelete = function( callback ) { |
| 144 | + $.getJSON( |
| 145 | + wgScriptPath + '/api.php', |
| 146 | + { |
| 147 | + 'action': 'deleteswlgroup', |
| 148 | + 'format': 'json', |
| 149 | + 'ids': this.group.id |
| 150 | + }, |
| 151 | + function( data ) { |
| 152 | + callback(); |
| 153 | + } |
| 154 | + ); |
| 155 | + } |
| 156 | + |
130 | 157 | this.buildHtml(); |
131 | 158 | |
132 | 159 | return this; |
Index: trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php |
— | — | @@ -95,6 +95,7 @@ |
96 | 96 | 'fieldset', |
97 | 97 | array( |
98 | 98 | 'id' => 'swl_group_' . $group->getId(), |
| 99 | + 'groupid' => $group->getId(), |
99 | 100 | 'class' => 'swl_group', |
100 | 101 | 'groupname' => $group->getName(), |
101 | 102 | 'categories' => implode( '|', $group->getCategories() ), |
Index: trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.js |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | element.watchlistcondition( |
25 | 25 | { |
26 | 26 | name: element.attr( 'groupname' ), |
| 27 | + id: element.attr( 'groupid' ), |
27 | 28 | categories: getSplitAttrValue( element, 'categories', '|' ), |
28 | 29 | namespaces: getSplitAttrValue( element, 'namespaces', '|' ), |
29 | 30 | properties: getSplitAttrValue( element, 'properties', '|' ), |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php |
— | — | @@ -32,9 +32,11 @@ |
33 | 33 | 'swl-group-remove-property' => 'Remove property', |
34 | 34 | 'swl-group-page-selection' => 'Pages in', |
35 | 35 | 'swl-group-save' => 'Save', |
| 36 | + 'swl-group-delete' => 'Delete', |
36 | 37 | 'swl-group-category' => 'category', |
37 | 38 | 'swl-group-namespace' => 'namespace', |
38 | 39 | 'swl-group-concept' => 'concept', |
| 40 | + 'swl-group-confirmdelete' => 'Are you sure you want to delete the "$1" watchlist group?', |
39 | 41 | |
40 | 42 | // Special:SemanticWatchlist |
41 | 43 | 'swl-watchlist-position' => "Showing '''$1''' of the last changes starting with '''#$2'''.", |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php |
— | — | @@ -117,9 +117,11 @@ |
118 | 118 | 'swl-group-remove-property', |
119 | 119 | 'swl-group-page-selection', |
120 | 120 | 'swl-group-save', |
| 121 | + 'swl-group-delete', |
121 | 122 | 'swl-group-category', |
122 | 123 | 'swl-group-namespace', |
123 | 124 | 'swl-group-concept', |
| 125 | + 'swl-group-confirmdelete', |
124 | 126 | ) |
125 | 127 | ); |
126 | 128 | |