r88426 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88425‎ | r88426 | r88427 >
Date:20:27, 19 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on watchlist groups management
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.js (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
@@ -9,6 +9,7 @@
1010 (function( $ ){ $.fn.watchlistcondition = function( group, options ) {
1111
1212 var self = this;
 13+ this.group = group;
1314
1415 this.buildHtml = function() {
1516 this.html( $( '<legend />' ).text( group.name ) );
@@ -25,12 +26,12 @@
2627 propTd.append( this.getPropertyDiv( group.properties[i] ) );
2728 }
2829
29 - var nameInput = $( '<input />' ).attr( {
 30+ this.nameInput = $( '<input />' ).attr( {
3031 'type': 'text',
3132 'value': group.name,
3233 'size': 30
3334 } );
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 ) );
3536 table.append( $( '<tr />' ).html( nameTd ).append( propTd ) );
3637
3738 var conditionValue, conditionType;
@@ -71,6 +72,7 @@
7273 var conditionTd = $( '<td />' ).html(
7374 $( '<p />' ).text( mediaWiki.msg( 'swl-group-page-selection' ) + ' ' )
7475 .append( conditionTypeInput )
 76+ .append( '&nbsp;' )
7577 .append( conditionNameInput )
7678 );
7779
@@ -86,7 +88,21 @@
8789 this.disabled = true;
8890 self.doSave( function() { this.disabled = false; } );
8991 } )
90 - );
 92+ );
 93+
 94+ this.append( '&nbsp;' );
 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+ );
91107 }
92108
93109 this.getPropertyDiv = function( property ) {
@@ -114,18 +130,29 @@
115131 $.getJSON(
116132 wgScriptPath + '/api.php',
117133 {
118 - 'action': 'semanticwatchlist',
 134+ 'action': 'editswlgroup',
119135 'format': 'json',
120 - 'images': images.join( '|' ),
121 - 'targets': targetUrl
122136 },
123137 function( data ) {
124138 callback();
125139 }
126140 );
127 -
128141 }
129142
 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+
130157 this.buildHtml();
131158
132159 return this;
Index: trunk/extensions/SemanticWatchlist/specials/SpecialWatchlistConditions.php
@@ -95,6 +95,7 @@
9696 'fieldset',
9797 array(
9898 'id' => 'swl_group_' . $group->getId(),
 99+ 'groupid' => $group->getId(),
99100 'class' => 'swl_group',
100101 'groupname' => $group->getName(),
101102 'categories' => implode( '|', $group->getCategories() ),
Index: trunk/extensions/SemanticWatchlist/specials/ext.swl.watchlistconditions.js
@@ -23,6 +23,7 @@
2424 element.watchlistcondition(
2525 {
2626 name: element.attr( 'groupname' ),
 27+ id: element.attr( 'groupid' ),
2728 categories: getSplitAttrValue( element, 'categories', '|' ),
2829 namespaces: getSplitAttrValue( element, 'namespaces', '|' ),
2930 properties: getSplitAttrValue( element, 'properties', '|' ),
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
@@ -32,9 +32,11 @@
3333 'swl-group-remove-property' => 'Remove property',
3434 'swl-group-page-selection' => 'Pages in',
3535 'swl-group-save' => 'Save',
 36+ 'swl-group-delete' => 'Delete',
3637 'swl-group-category' => 'category',
3738 'swl-group-namespace' => 'namespace',
3839 'swl-group-concept' => 'concept',
 40+ 'swl-group-confirmdelete' => 'Are you sure you want to delete the "$1" watchlist group?',
3941
4042 // Special:SemanticWatchlist
4143 'swl-watchlist-position' => "Showing '''$1''' of the last changes starting with '''#$2'''.",
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php
@@ -117,9 +117,11 @@
118118 'swl-group-remove-property',
119119 'swl-group-page-selection',
120120 'swl-group-save',
 121+ 'swl-group-delete',
121122 'swl-group-category',
122123 'swl-group-namespace',
123124 'swl-group-concept',
 125+ 'swl-group-confirmdelete',
124126 )
125127 );
126128

Status & tagging log