Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js |
— | — | @@ -8,12 +8,43 @@ |
9 | 9 | |
10 | 10 | (function( $ ){ $.fn.watchlistcondition = function( group, options ) { |
11 | 11 | |
12 | | - this.html( $( '<h3 />' ).text( group.name ) ); |
| 12 | + this.html( $( '<legend />' ).text( group.name ) ); |
13 | 13 | |
14 | | - nameInput = $( '<input />' ).attr( 'type', 'text' ).attr( 'value', group.name ); |
| 14 | + var table = $( '<table />' ).attr( { 'class': 'swltable' } ); |
15 | 15 | |
16 | | - this.append( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) ).append( nameInput ) ); |
| 16 | + var nameInput = $( '<input />' ).attr( { 'type': 'text', 'value': group.name } ); |
17 | 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] ) ); |
| 28 | + } |
| 29 | + |
| 30 | + table.append( $( '<tr />' ).attr( 'colspan', 2 ).append( propTd ) ); |
| 31 | + |
| 32 | + this.append( table ); |
| 33 | + |
| 34 | + function getPropertyDiv( property ) { |
| 35 | + var propInput = $( '<input />' ).attr( { |
| 36 | + 'type': 'text', |
| 37 | + 'value': property, |
| 38 | + 'size': 30 |
| 39 | + } ); |
| 40 | + |
| 41 | + var removeButton = $( '<input />' ).attr( { |
| 42 | + 'type': 'button', |
| 43 | + value: mediaWiki.msg( 'swl-group-remove-property' ) |
| 44 | + } ); |
| 45 | + |
| 46 | + return $( '<div />' ).attr( 'class', 'propid' ).html( propInput ).append( removeButton ); |
| 47 | + } |
| 48 | + |
18 | 49 | return this; |
19 | 50 | |
20 | 51 | }; })( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php |
— | — | @@ -76,8 +76,8 @@ |
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function getGroupHtml( SWLGroup $group ) { |
80 | | - return Html::element( |
81 | | - 'div', |
| 80 | + return Html::rawElement( |
| 81 | + 'fieldset', |
82 | 82 | array( |
83 | 83 | 'id' => 'swl_group_' . $group->getId(), |
84 | 84 | 'class' => 'swl_group', |
— | — | @@ -86,6 +86,11 @@ |
87 | 87 | 'namespaces' => implode( '|', $group->getNamespaces() ), |
88 | 88 | 'properties' => implode( '|', $group->getProperties() ), |
89 | 89 | 'concepts' => implode( '|', $group->getConcepts() ), |
| 90 | + ), |
| 91 | + Html::element( |
| 92 | + 'legend', |
| 93 | + array(), |
| 94 | + $group->getName() |
90 | 95 | ) |
91 | 96 | ); |
92 | 97 | } |
Index: trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.css |
— | — | @@ -8,8 +8,18 @@ |
9 | 9 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
10 | 10 | */ |
11 | 11 | |
12 | | -div .swl_group { |
| 12 | +fieldset .swl_group { |
13 | 13 | width: 100%; |
14 | 14 | border: 1px solid black; |
15 | 15 | min-height: 60px; |
| 16 | +} |
| 17 | + |
| 18 | +/*table .swltable { |
| 19 | + width: 100%; |
| 20 | + border: 1px solid black; |
| 21 | +} |
| 22 | + |
| 23 | +*/div .propid { |
| 24 | + width: 100%; |
| 25 | + border: 1px solid black; |
16 | 26 | } |
\ No newline at end of file |
Index: trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.js |
— | — | @@ -8,16 +8,25 @@ |
9 | 9 | |
10 | 10 | (function($) { $( document ).ready( function() { |
11 | 11 | |
| 12 | + function getSplitAttrValue( element, attribute, separator ) { |
| 13 | + if ( typeof element.attr( attribute ) == 'undefined' |
| 14 | + || element.attr( attribute ) == '' ) { |
| 15 | + return []; |
| 16 | + } |
| 17 | + |
| 18 | + return element.attr( attribute ).split( separator ); |
| 19 | + } |
| 20 | + |
12 | 21 | $( '.swl_group' ).each(function( index, domElement ) { |
13 | 22 | var element = $( domElement ); |
14 | 23 | |
15 | 24 | element.watchlistcondition( |
16 | 25 | { |
17 | 26 | name: element.attr( 'groupname' ), |
18 | | - categories: element.attr( 'categories' ).split( '|' ), |
19 | | - namespaces: element.attr( 'namespaces' ).split( '|' ), |
20 | | - properties: element.attr( 'properties' ).split( '|' ), |
21 | | - concepts: element.attr( 'concepts' ).split( '|' ), |
| 27 | + categories: getSplitAttrValue( element, 'categories', '|' ), |
| 28 | + namespaces: getSplitAttrValue( element, 'namespaces', '|' ), |
| 29 | + properties: getSplitAttrValue( element, 'properties', '|' ), |
| 30 | + concepts: getSplitAttrValue( element, 'concepts', '|' ) |
22 | 31 | }, |
23 | 32 | {} |
24 | 33 | ); |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php |
— | — | @@ -25,6 +25,11 @@ |
26 | 26 | |
27 | 27 | 'special-semanticwatchlist' => 'Semantic Watchlist', |
28 | 28 | 'special-watchlistconditions' => 'Semantic watchlist conditions', |
| 29 | + |
| 30 | + // Special:WatchlistConditions |
| 31 | + 'swl-group-name' => 'Group name: ', |
| 32 | + 'swl-group-properties' => 'Properties covered by this group:', |
| 33 | + 'swl-group-remove-property' => 'Remove property', |
29 | 34 | ); |
30 | 35 | |
31 | 36 | /** German (Deutsch) |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php |
— | — | @@ -94,7 +94,11 @@ |
95 | 95 | 'specials/ext.swl.watchlistconditions.js' |
96 | 96 | ), |
97 | 97 | 'dependencies' => array(), |
98 | | - 'messages' => array() |
| 98 | + 'messages' => array( |
| 99 | + 'swl-group-name', |
| 100 | + 'swl-group-properties', |
| 101 | + 'swl-group-remove-property', |
| 102 | + ) |
99 | 103 | ); |
100 | 104 | |
101 | 105 | require_once 'SemanticWatchlist.settings.php'; |