r87816 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87815‎ | r87816 | r87817 >
Date:12:47, 10 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some work on special page ui
Modified paths:
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.css (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.js (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
@@ -8,12 +8,43 @@
99
1010 (function( $ ){ $.fn.watchlistcondition = function( group, options ) {
1111
12 - this.html( $( '<h3 />' ).text( group.name ) );
 12+ this.html( $( '<legend />' ).text( group.name ) );
1313
14 - nameInput = $( '<input />' ).attr( 'type', 'text' ).attr( 'value', group.name );
 14+ var table = $( '<table />' ).attr( { 'class': 'swltable' } );
1515
16 - this.append( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) ).append( nameInput ) );
 16+ var nameInput = $( '<input />' ).attr( { 'type': 'text', 'value': group.name } );
1717
 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+
1849 return this;
1950
2051 }; })( jQuery );
\ No newline at end of file
Index: trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php
@@ -76,8 +76,8 @@
7777 }
7878
7979 protected function getGroupHtml( SWLGroup $group ) {
80 - return Html::element(
81 - 'div',
 80+ return Html::rawElement(
 81+ 'fieldset',
8282 array(
8383 'id' => 'swl_group_' . $group->getId(),
8484 'class' => 'swl_group',
@@ -86,6 +86,11 @@
8787 'namespaces' => implode( '|', $group->getNamespaces() ),
8888 'properties' => implode( '|', $group->getProperties() ),
8989 'concepts' => implode( '|', $group->getConcepts() ),
 90+ ),
 91+ Html::element(
 92+ 'legend',
 93+ array(),
 94+ $group->getName()
9095 )
9196 );
9297 }
Index: trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.css
@@ -8,8 +8,18 @@
99 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
1010 */
1111
12 -div .swl_group {
 12+fieldset .swl_group {
1313 width: 100%;
1414 border: 1px solid black;
1515 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;
1626 }
\ No newline at end of file
Index: trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.js
@@ -8,16 +8,25 @@
99
1010 (function($) { $( document ).ready( function() {
1111
 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+
1221 $( '.swl_group' ).each(function( index, domElement ) {
1322 var element = $( domElement );
1423
1524 element.watchlistcondition(
1625 {
1726 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', '|' )
2231 },
2332 {}
2433 );
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
@@ -25,6 +25,11 @@
2626
2727 'special-semanticwatchlist' => 'Semantic Watchlist',
2828 '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',
2934 );
3035
3136 /** German (Deutsch)
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php
@@ -94,7 +94,11 @@
9595 'specials/ext.swl.watchlistconditions.js'
9696 ),
9797 'dependencies' => array(),
98 - 'messages' => array()
 98+ 'messages' => array(
 99+ 'swl-group-name',
 100+ 'swl-group-properties',
 101+ 'swl-group-remove-property',
 102+ )
99103 );
100104
101105 require_once 'SemanticWatchlist.settings.php';

Status & tagging log