r114686 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114685‎ | r114686 | r114687 >
Date:23:38, 3 April 2012
Author:raindrift
Status:deferred
Tags:
Comment:
filters are now sorta working. they still need some cleanup on the api end, at least
Modified paths:
  • /trunk/extensions/PageTriage/PageTriage.i18n.php (modified) (history)
  • /trunk/extensions/PageTriage/PageTriage.php (modified) (history)
  • /trunk/extensions/PageTriage/SpecialPageTriage.php (modified) (history)
  • /trunk/extensions/PageTriage/api/ApiPageTriageList.php (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.models/ext.pageTriage.article.js (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.js (modified) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/SpecialPageTriage.php
@@ -173,16 +173,17 @@
174174 <div class="mwe-pt-control-section">
175175 <span class="mwe-pt-control-label"><b><%= gM( 'pagetriage-filter-show-heading' ) %></b></span>
176176 <div class="mwe-pt-control-options">
177 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-triaged-edits' ) %> <br/>
178 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-nominated-for-deletion' ) %> <br/>
179 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-bot-edits' ) %> <br/>
180 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-redirects' ) %> <br/>
 177+ <input type="checkbox" id="mwe-pt-filter-triaged-edits" /> <%= gM( 'pagetriage-filter-triaged-edits' ) %> <br/>
 178+ <input type="checkbox" id="mwe-pt-filter-nominated-for-deletion" /> <%= gM( 'pagetriage-filter-nominated-for-deletion' ) %> <br/>
 179+ <input type="checkbox" id="mwe-pt-filter-bot-edits" /> <%= gM( 'pagetriage-filter-bot-edits' ) %> <br/>
 180+ <input type="checkbox" id="mwe-pt-filter-redirects" /> <%= gM( 'pagetriage-filter-redirects' ) %> <br/>
181181 </div>
182182 </div>
183183 <div class="mwe-pt-control-section">
184184 <span class="mwe-pt-control-label"><b><%= gM( 'pagetriage-filter-namespace-heading' ) %></b></span>
185185 <div class="mwe-pt-control-options">
186186 <select id="mwe-pt-filter-namespace">
 187+ <option value=""><%= gM( 'pagetriage-filter-ns-all' ) %></option>
187188 <%
188189 var wgFormattedNamespaces = mw.config.get( 'wgFormattedNamespaces' );
189190 var nsOptions = '';
@@ -213,10 +214,10 @@
214215 <div class="mwe-pt-control-section">
215216 <span class="mwe-pt-control-label"><b><%= gM( 'pagetriage-filter-second-show-heading' ) %></b></span>
216217 <div class="mwe-pt-control-options">
217 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-no-categories' ) %> <br/>
218 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-orphan' ) %> <br/>
219 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-non-autoconfirmed' ) %> <br/>
220 - <input type="checkbox" /> <%= gM( 'pagetriage-filter-blocked' ) %> <br/>
 218+ <input type="checkbox" id="mwe-pt-filter-no-categories" /> <%= gM( 'pagetriage-filter-no-categories' ) %> <br/>
 219+ <input type="checkbox" id="mwe-pt-filter-orphan" /> <%= gM( 'pagetriage-filter-orphan' ) %> <br/>
 220+ <input type="checkbox" id="mwe-pt-filter-non-autoconfirmed" /> <%= gM( 'pagetriage-filter-non-autoconfirmed' ) %> <br/>
 221+ <input type="checkbox" id="mwe-pt-filter-blocked" /> <%= gM( 'pagetriage-filter-blocked' ) %> <br/>
221222 </div>
222223 </div>
223224 <div class="mwe-pt-control-buttons">
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.js
@@ -56,7 +56,7 @@
5757 icons: { secondary:'ui-icon-triangle-1-e' }
5858 } );
5959 $( ".mwe-pt-filter-set-button" ).click( function( e ) {
60 - _this.filterSet();
 60+ _this.filterSync();
6161 _this.toggleFilterMenu();
6262 e.stopPropagation();
6363 } );
@@ -93,23 +93,96 @@
9494 $( '#mwe-pt-control-dropdown' ).css( 'visibility', 'hidden' );
9595 this.filterMenuVisible = 0;
9696 } else {
 97+ this.menuSync();
9798 $( '#mwe-pt-control-dropdown' ).css( 'visibility', 'visible' );
9899 $( '#mwe-pt-dropdown-arrow' ).html( '&#x25be;' );
99100 this.filterMenuVisible = 1;
100101 }
101102 },
102103
103 - filterSet: function() {
104 - console.log('clicked');
105 -
 104+ // sync the filters with the contents of the menu
 105+ filterSync: function() {
106106 // fetch the values from the menu
107107 var apiParams = {};
108108 if( $('#mwe-pt-filter-namespace').val() ) {
109109 apiParams['namespace'] = $('#mwe-pt-filter-namespace').val();
110110 }
111111
112 - this.model.apiParams = apiParams;
 112+ // these are conditionals because the keys shouldn't exist if the checkbox isn't checked.
 113+ if( $('#mwe-pt-filter-triaged-edits').prop('checked') ) {
 114+ apiParams['showtriaged'] = '1';
 115+ }
 116+
 117+ /*
 118+ if( $('#mwe-pt-filter-nominated-for-deletion').prop('checked') ) {
 119+ apiParams[''] = '1';
 120+ }
 121+ */
 122+
 123+ if( $('#mwe-pt-filter-bot-edits').prop('checked') ) {
 124+ apiParams['showbots'] = '1';
 125+ }
 126+
 127+ if( $('#mwe-pt-filter-redirects').prop('checked') ) {
 128+ apiParams['showredirs'] = '1';
 129+ }
 130+
 131+ /*
 132+ api doesn't support these.
 133+ if( $('#mwe-pt-filter-user').val() ) {
 134+ apiParams[''] = $('#mwe-pt-filter-user').val();
 135+ }
 136+
 137+ if( $('#mwe-pt-filter-tag').val() ) {
 138+ apiParams[''] = $('#mwe-pt-filter-tag').val();
 139+ }
 140+ */
 141+
 142+ if( $('#mwe-pt-filter-no-categories').prop('checked') ) {
 143+ apiParams['no_category'] = '1';
 144+ }
 145+
 146+ if( $('#mwe-pt-filter-orphan').prop('checked') ) {
 147+ apiParams['no_inbound_links'] = '1';
 148+ }
 149+
 150+ if( $('#mwe-pt-filter-non-autoconfirmed').prop('checked') ) {
 151+ apiParams['non_autoconfirmed_users'] = '1';
 152+ }
 153+
 154+ if( $('#mwe-pt-filter-blocked').prop('checked') ) {
 155+ apiParams['blocked_users'] = '1';
 156+ }
 157+
 158+ // persist the limit parameter
 159+ apiParams['limit'] = this.model.getParam('limit');
 160+
 161+ this.model.setParams( apiParams );
113162 this.model.fetch();
 163+ this.render();
 164+ },
 165+
 166+ // sync the menu with the contents of the filters
 167+ menuSync: function() {
 168+ $( '#mwe-pt-filter-namespace' ).val( this.model.getParam( 'namespace' ) );
 169+
 170+ $( '#mwe-pt-filter-triaged-edits' ).prop( 'checked', this.model.getParam( 'showtriaged' )=="1"?true:false );
 171+ // api doesn't support this?
 172+ //$( '#mwe-pt-filter-nominated-for-deletion' ).prop( 'checked', this.model.getParam('')=="1"?true:false );
 173+ $( '#mwe-pt-filter-bot-edits' ).prop( 'checked', this.model.getParam( 'showbots' )=="1"?true:false );
 174+ $( '#mwe-pt-filter-redirects' ).prop( 'checked', this.model.getParam( 'showredirs' )=="1"?true:false );
 175+
 176+ /* api doesn't support these
 177+ $( '#mwe-pt-filter-user' ).val( this.model.getParam('') );
 178+ $( '#mwe-pt-filter-tag' ).val( this.model.getParam('') );
 179+ */
 180+
 181+ $( '#mwe-pt-filter-no-categories' ).prop( 'checked', this.model.getParam( 'no_category' )=="1"?true:false );
 182+ $( '#mwe-pt-filter-orphan' ).prop( 'checked', this.model.getParam( 'no_inbound_links' )=="1"?true:false );
 183+ $( '#mwe-pt-filter-non-autoconfirmed' ).prop( 'checked', this.model.getParam( 'non_autoconfirmed_users' )=="1"?true:false );
 184+ $( '#mwe-pt-filter-blocked' ).prop( 'checked', this.model.getParam( 'blocked_users' )=="1"?true:false );
 185+
 186+
114187 }
115188
116189 } );
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.models/ext.pageTriage.article.js
@@ -44,6 +44,7 @@
4545
4646 apiParams: {
4747 namespace: 0,
 48+ limit: 50,
4849 /*
4950 showbots: null,
5051 showredirs: null,
@@ -78,11 +79,13 @@
7980 return response.pagetriagelist.pages;
8081 },
8182
82 - setParams: function( apiParams ) {
83 - console.log('setParams called with ' + apiParams);
84 -
 83+ setParams: function( apiParams ) {
8584 this.apiParams = apiParams;
8685 this.eventBus.trigger( "paramsSet", this.apiParams );
 86+ },
 87+
 88+ getParam: function( key ) {
 89+ return this.apiParams[key];
8790 }
8891
8992 } );
Index: trunk/extensions/PageTriage/api/ApiPageTriageList.php
@@ -132,7 +132,7 @@
133133 ApiBase::PARAM_TYPE => 'boolean',
134134 ),
135135 'limit' => array(
136 - ApiBase::PARAM_MAX => '50',
 136+ ApiBase::PARAM_MAX => '200',
137137 ApiBase::PARAM_DFLT => '20',
138138 ApiBase::PARAM_MIN => '10',
139139 ApiBase::PARAM_TYPE => 'integer',
Index: trunk/extensions/PageTriage/PageTriage.i18n.php
@@ -54,6 +54,7 @@
5555 'pagetriage-stats-less-than-a-day' => 'less than one day',
5656 'pagetriage-stats-top-triagers' => 'Top {{PLURAL:$1|triager|$1 triagers}}: $2',
5757 'pagetriage-filter-ns-article' => 'Article',
 58+ 'pagetriage-filter-ns-all' => 'All',
5859 );
5960
6061 /**
@@ -99,5 +100,6 @@
100101 'pagetriage-stats-untriaged-age' => 'Navigation text displaying triage stats, $1 and $2 are the ages of average and oldest articles respectively',
101102 'pagetriage-stats-less-than-a-day' => 'show this message if the article age is less than one day, part of variable $1 and $2 of {{msg-pagetriage|pagetriage-stats-untriaged-age}} ',
102103 'pagetriage-stats-top-triagers' => 'Text that shows top triagers, $1 is the total number, $2 shows the detail',
103 - 'pagetriage-filter-ns-article' => 'The name of the main article namespace',
 104+ 'pagetriage-filter-ns-article' => 'The name of the main article namespace, for the namespace filter select list',
 105+ 'pagetriage-filter-ns-all' => 'For the namespace filter select list, text indicating that all namespaces will be selected',
104106 );
Index: trunk/extensions/PageTriage/PageTriage.php
@@ -242,6 +242,7 @@
243243 'pagetriage-stats-top-triagers',
244244 'days',
245245 'pagetriage-filter-ns-article',
 246+ 'pagetriage-filter-ns-all',
246247 )
247248 );
248249

Status & tagging log