Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js |
— | — | @@ -8,29 +8,58 @@ |
9 | 9 | |
10 | 10 | (function( $ ){ $.fn.watchlistcondition = function( group, options ) { |
11 | 11 | |
12 | | - this.html( $( '<legend />' ).text( group.name ) ); |
| 12 | + var self = this; |
13 | 13 | |
14 | | - var table = $( '<table />' ).attr( { 'class': 'swltable' } ); |
15 | | - |
16 | | - var nameInput = $( '<input />' ).attr( { 'type': 'text', 'value': group.name } ); |
17 | | - |
18 | | - table.html( $( '<tr />' ).html( $( '<td />' ).attr( 'colspan', 2 ).html( |
19 | | - $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) ).append( nameInput ) |
20 | | - ) ) ); |
21 | | - |
22 | | - var propTd = $( '<td />' ); |
23 | | - |
24 | | - propTd.html( mediaWiki.msg( 'swl-group-properties' ) ); |
25 | | - |
26 | | - for ( i in group.properties ) { |
27 | | - propTd.append( getPropertyDiv( group.properties[i] ) ); |
| 14 | + this.buildHtml = function() { |
| 15 | + this.html( $( '<legend />' ).text( group.name ) ); |
| 16 | + |
| 17 | + var table = $( '<table />' ).attr( { 'class': 'swltable' } ); |
| 18 | + |
| 19 | + var propTd = $( '<td />' ).attr( { |
| 20 | + //'bgcolor': 'gray', |
| 21 | + 'rowspan': 2 |
| 22 | + } ); |
| 23 | + |
| 24 | + propTd.html( mediaWiki.msg( 'swl-group-properties' ) ); |
| 25 | + |
| 26 | + for ( i in group.properties ) { |
| 27 | + propTd.append( this.getPropertyDiv( group.properties[i] ) ); |
| 28 | + } |
| 29 | + |
| 30 | + table.append( $( '<tr />' ).html( $( '<td />' ) ).append( propTd ) ); |
| 31 | + |
| 32 | + var nameInput = $( '<input />' ).attr( { |
| 33 | + 'type': 'text', |
| 34 | + 'value': group.name, |
| 35 | + 'size': 30 |
| 36 | + } ); |
| 37 | + var nameTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) ).append( nameInput ) ); |
| 38 | + table.append( $( '<tr />' ).html( nameTd ) ); |
| 39 | + |
| 40 | + var conditionNameInput = $( '<input />' ).attr( { |
| 41 | + 'type': 'text', |
| 42 | + 'value': group.name, |
| 43 | + 'size': 30 |
| 44 | + } ); |
| 45 | + var conditionTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-page-selection' ) ).append( conditionNameInput ) ); |
| 46 | + table.append( $( '<tr />' ).html( conditionTd ) ); |
| 47 | + |
| 48 | + this.append( table ); |
| 49 | + |
| 50 | + this.append( |
| 51 | + $( '<input />' ).attr( { |
| 52 | + 'type': 'button', |
| 53 | + 'value': mediaWiki.msg( 'save' ) |
| 54 | + } ).click( function() { |
| 55 | + this.disabled = true; |
| 56 | + self.doSave( function() { this.disabled = false; } ); |
| 57 | + } ) |
| 58 | + ); |
28 | 59 | } |
29 | 60 | |
30 | | - table.append( $( '<tr />' ).attr( 'colspan', 2 ).append( propTd ) ); |
31 | | - |
32 | | - this.append( table ); |
33 | | - |
34 | | - function getPropertyDiv( property ) { |
| 61 | + this.getPropertyDiv = function( property ) { |
| 62 | + var propDiv = $( '<div />' ).attr( 'class', 'propid' ); |
| 63 | + |
35 | 64 | var propInput = $( '<input />' ).attr( { |
36 | 65 | 'type': 'text', |
37 | 66 | 'value': property, |
— | — | @@ -42,9 +71,19 @@ |
43 | 72 | value: mediaWiki.msg( 'swl-group-remove-property' ) |
44 | 73 | } ); |
45 | 74 | |
46 | | - return $( '<div />' ).attr( 'class', 'propid' ).html( propInput ).append( removeButton ); |
| 75 | + removeButton.click( function() { |
| 76 | + propDiv.remove(); |
| 77 | + } ); |
| 78 | + |
| 79 | + return propDiv.html( propInput ).append( removeButton ); |
47 | 80 | } |
48 | 81 | |
| 82 | + this.doSave = function( callback ) { |
| 83 | + |
| 84 | + } |
| 85 | + |
| 86 | + this.buildHtml(); |
| 87 | + |
49 | 88 | return this; |
50 | 89 | |
51 | 90 | }; })( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php |
— | — | @@ -30,6 +30,7 @@ |
31 | 31 | 'swl-group-name' => 'Group name: ', |
32 | 32 | 'swl-group-properties' => 'Properties covered by this group:', |
33 | 33 | 'swl-group-remove-property' => 'Remove property', |
| 34 | + 'swl-group-page-selection' => 'Pages in ', |
34 | 35 | ); |
35 | 36 | |
36 | 37 | /** German (Deutsch) |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php |
— | — | @@ -97,7 +97,9 @@ |
98 | 98 | 'messages' => array( |
99 | 99 | 'swl-group-name', |
100 | 100 | 'swl-group-properties', |
101 | | - 'swl-group-remove-property', |
| 101 | + 'swl-group-remove-property', |
| 102 | + 'swl-group-page-selection', |
| 103 | + 'save', |
102 | 104 | ) |
103 | 105 | ); |
104 | 106 | |