r114774 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114773‎ | r114774 | r114775 >
Date:21:07, 6 April 2012
Author:raindrift
Status:deferred
Tags:
Comment:
added deleted status checking to api
added username checking to filter list
small api bugfix for filter by tag
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)
  • /trunk/extensions/PageTriage/sql/PageTriagePage.sql (modified) (history)
  • /trunk/extensions/PageTriage/sql/PageTriagePageDeleted.sql (added) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/SpecialPageTriage.php
@@ -219,7 +219,7 @@
220220 <input type="radio" name="mwe-pt-filter-radio" id="mwe-pt-filter-bot-edits" /> <%= gM( 'pagetriage-filter-bot-edits' ) %> <br/>
221221 <input type="radio" name="mwe-pt-filter-radio" id="mwe-pt-filter-user-selected" /> <%= gM( 'pagetriage-filter-user-heading' ) %>
222222 <div class="mwe-pt-control-options">
223 - <span class="mwe-pt-filter-sub-input"><input type=text id="mwe-pt-filter-username" /></span>
 223+ <span class="mwe-pt-filter-sub-input"><input type=text id="mwe-pt-filter-user" /></span>
224224 </div>
225225 </div>
226226 </div>
Index: trunk/extensions/PageTriage/sql/PageTriagePage.sql
@@ -2,8 +2,10 @@
33 CREATE TABLE /*_*/pagetriage_page (
44 ptrp_page_id int unsigned NOT NULL PRIMARY KEY,
55 ptrp_reviewed tinyint unsigned not null default 0,
 6+ ptrp_deleted tinyint unsigned not null default 0,
67 ptrp_timestamp varbinary(14) NOT NULL COMMENT 'when the page was created'
78 ) /*$wgDBTableOptions*/;
89
9 -CREATE INDEX /*i*/ptrp_reviewed_timestamp_page_id ON /*_*/pagetriage_page (ptrp_reviewed, ptrp_timestamp, ptrp_page_id);
10 -CREATE INDEX /*i*/ptrp_timestamp_page_id ON /*_*/pagetriage_page (ptrp_timestamp, ptrp_page_id);
 10+CREATE INDEX /*i*/ptrp_reviewed_timestamp_page_id ON /*_*/pagetriage_page (ptrp_reviewed, ptrp_timestamp, ptrp_page_id, ptrp_deleted);
 11+CREATE INDEX /*i*/ptrp_timestamp_page_id ON /*_*/pagetriage_page (ptrp_timestamp, ptrp_page_id, ptrp_deleted);
 12+CREATE INDEX /*i*/ptrp_deleted_reviewed_etc ON /*_*/pagetriage_page (ptrp_deleted, ptrp_timestamp, ptrp_page_id, ptrp_reviewed);
Index: trunk/extensions/PageTriage/sql/PageTriagePageDeleted.sql
@@ -0,0 +1,9 @@
 2+-- temporary patch for devs who don't want to replace their tables. will delete this later.
 3+
 4+alter table pagetriage_page add ptrp_deleted tinyint unsigned not null default 0 after ptrp_reviewed;
 5+alter table pagetriage_page drop index /*i*/ptrp_reviewed_timestamp_page_id;
 6+alter table pagetriage_page drop index /*i*/ptrp_timestamp_page_id;
 7+
 8+CREATE INDEX /*i*/ptrp_reviewed_timestamp_page_id ON /*_*/pagetriage_page (ptrp_reviewed, ptrp_timestamp, ptrp_page_id, ptrp_deleted);
 9+CREATE INDEX /*i*/ptrp_deleted_reviewed_etc ON /*_*/pagetriage_page (ptrp_deleted, ptrp_timestamp, ptrp_page_id, ptrp_reviewed);
 10+CREATE INDEX /*i*/ptrp_timestamp_page_id ON /*_*/pagetriage_page (ptrp_timestamp, ptrp_page_id, ptrp_deleted);
Property changes on: trunk/extensions/PageTriage/sql/PageTriagePageDeleted.sql
___________________________________________________________________
Added: svn:eol-style
111 + native
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.js
@@ -140,11 +140,9 @@
141141 apiParams['showreviewed'] = '1';
142142 }
143143
144 - /*
145144 if( $('#mwe-pt-filter-nominated-for-deletion').prop('checked') ) {
146 - apiParams[''] = '1';
 145+ apiParams['showdeleted'] = '1';
147146 }
148 - */
149147
150148 if( $('#mwe-pt-filter-bot-edits').prop('checked') ) {
151149 apiParams['showbots'] = '1';
@@ -153,13 +151,12 @@
154152 if( $('#mwe-pt-filter-redirects').prop('checked') ) {
155153 apiParams['showredirs'] = '1';
156154 }
 155+
 156+ if( $('#mwe-pt-filter-user-selected').prop('checked') && $('#mwe-pt-filter-user').val() ) {
 157+ apiParams['username'] = $('#mwe-pt-filter-user').val();
 158+ }
157159
158 - /*
159 - api doesn't support these.
160 - if( $('#mwe-pt-filter-user').val() ) {
161 - apiParams[''] = $('#mwe-pt-filter-user').val();
162 - }
163 -
 160+ /* api doesn't support this yet
164161 if( $('#mwe-pt-filter-tag').val() ) {
165162 apiParams[''] = $('#mwe-pt-filter-tag').val();
166163 }
@@ -210,13 +207,18 @@
211208 }
212209
213210 this.menuCheckboxUpdate( $( '#mwe-pt-filter-reviewed-edits' ), 'showreviewed', 'pagetriage-filter-stat-reviewed');
214 - // api doesn't suppor this one.
215 - //this.menuCheckboxUpdate( $( '#mwe-pt-filter-nominated-for-deletion' ' ), '', '');
 211+ this.menuCheckboxUpdate( $( '#mwe-pt-filter-nominated-for-deletion' ), 'showdeleted', 'pagetriage-filter-stat-nominated-for-deletion');
216212 this.menuCheckboxUpdate( $( '#mwe-pt-filter-bot-edits' ), 'showbots', 'pagetriage-filter-stat-bots');
217213 this.menuCheckboxUpdate( $( '#mwe-pt-filter-redirects' ), 'showredirs', 'pagetriage-filter-stat-redirects');
218214
219 - /* api doesn't support these
220 - $( '#mwe-pt-filter-user' ).val( this.model.getParam('') );
 215+ var username = this.model.getParam( 'username' );
 216+ if( username ) {
 217+ this.newFilterStatus.push( gM( 'pagetriage-filter-stat-username', username ) );
 218+ $( '#mwe-pt-filter-user-selected' ).prop( 'checked', true );
 219+ }
 220+ $( '#mwe-pt-filter-user' ).val( username );
 221+
 222+ /* api doesn't support this
221223 $( '#mwe-pt-filter-tag' ).val( this.model.getParam('') );
222224 */
223225
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.models/ext.pageTriage.article.js
@@ -63,11 +63,11 @@
6464 initialize: function( options ) {
6565 this.eventBus = options.eventBus;
6666 this.eventBus.bind( "filterSet", this.setParams );
67 - //this.eventBus.bind( "paramsSet", this.fetch );
6867 },
6968
7069 url: function() {
7170 var url = mw.util.wikiScript( 'api' ) + '?action=pagetriagelist&format=json&' + $.param( this.apiParams );
 71+ console.log( 'fetch url: ' + url );
7272 return url;
7373 },
7474
Index: trunk/extensions/PageTriage/api/ApiPageTriageList.php
@@ -57,7 +57,7 @@
5858 // Start building the massive filter which includes meta data
5959 $tables = array( 'pagetriage_page', 'page' );
6060 $conds = array( 'ptrp_page_id = page_id' );
61 -
 61+
6262 // Include reviewed
6363 if ( !$opts['showreviewed'] ) {
6464 $conds['ptrp_reviewed'] = 0;
@@ -66,6 +66,10 @@
6767 if ( !$opts['showredirs'] ) {
6868 $conds['page_is_redirect'] = 0;
6969 }
 70+ // Include marked for deletion
 71+ if ( !$opts['showdeleted'] ) {
 72+ $conds['ptrp_deleted'] = 0;
 73+ }
7074 // Show by namespace
7175 if ( array_key_exists( 'namespace', $opts ) ) {
7276 $conds['page_namespace'] = $opts['namespace'];
@@ -117,7 +121,7 @@
118122 // bots
119123 'showbots' => array( 'name' => 'user_bot', 'op' => '=', 'val' => '1' ),
120124 // user name
121 - 'username' => array( 'name' => 'user_name', 'op' => '=', 'val' => $opts['username'] )
 125+ 'username' => array( 'name' => 'user_name', 'op' => '=', 'val' => false ) // false means use the actual value
122126 );
123127
124128 $tags = ArticleMetadata::getValidTags();
@@ -125,8 +129,14 @@
126130 // only single tag search is allowed
127131 foreach ( $searchableTags as $key => $val ) {
128132 if ( $opts[$key] ) {
129 - $tagConds = " ptrpt_page_id = ptrp_page_id AND ptrpt_tag_id = '" . $tags[$val['name']] . "' AND
130 - ptrpt_value " . $val['op'] . " " . $dbr->addQuotes( $val['val'] );
 133+ if( $val['val'] === false ) {
 134+ // if val is false, use the value that was supplied via the api call
 135+ $tagConds = " ptrpt_page_id = ptrp_page_id AND ptrpt_tag_id = '" . $tags[$val['name']] . "' AND
 136+ ptrpt_value " . $val['op'] . " " . $dbr->addQuotes( $opts['key'] );
 137+ } else {
 138+ $tagConds = " ptrpt_page_id = ptrp_page_id AND ptrpt_tag_id = '" . $tags[$val['name']] . "' AND
 139+ ptrpt_value " . $val['op'] . " " . $dbr->addQuotes( $val['val'] );
 140+ }
131141 break;
132142 }
133143 }
Index: trunk/extensions/PageTriage/PageTriage.i18n.php
@@ -62,13 +62,15 @@
6363 'pagetriage-more' => 'More',
6464 'pagetriage-filter-stat-all' => 'All',
6565 'pagetriage-filter-stat-namespace' => 'Namespace: $1',
66 - 'pagetriage-filter-stat-reviewed' => 'Reviewed',
 66+ 'pagetriage-filter-stat-reviewed' => 'Include reviewed',
6767 'pagetriage-filter-stat-bots' => 'Bots',
68 - 'pagetriage-filter-stat-redirects' => 'Redirects',
 68+ 'pagetriage-filter-stat-redirects' => 'Include redirects',
 69+ 'pagetriage-filter-stat-nominated-for-deletion' => 'Include deleted',
6970 'pagetriage-filter-stat-no-categories' => 'No categories',
7071 'pagetriage-filter-stat-orphan' => 'Orphans',
7172 'pagetriage-filter-stat-non-autoconfirmed' => 'New editors',
7273 'pagetriage-filter-stat-blocked' => 'Blocked users',
 74+ 'pagetriage-filter-stat-username' => 'Username: $1',
7375
7476 );
7577
@@ -127,10 +129,12 @@
128130 'pagetriage-filter-stat-reviewed' => 'Status display component for reviewed pages',
129131 'pagetriage-filter-stat-bots' => 'Status display component for bot-created pages',
130132 'pagetriage-filter-stat-redirects' => 'Status display component for redirects',
 133+ 'pagetriage-filter-stat-nominated-for-deletion' => 'Status dispay component for articles nominated for deletion',
131134 'pagetriage-filter-stat-no-categories' => 'Status display component for articles with no categories',
132135 'pagetriage-filter-stat-orphan' => 'Status display component for orphan articles',
133136 'pagetriage-filter-stat-non-autoconfirmed' => 'Status display component for articles by non-autoconfirmed editors',
134137 'pagetriage-filter-stat-blocked' => 'Status display component for articles by blocked users',
 138+ 'pagetriage-filter-stat-username' => 'Status display component for filter by username. $1 is the username.',
135139
136140
137141
Index: trunk/extensions/PageTriage/PageTriage.php
@@ -258,6 +258,7 @@
259259 'pagetriage-filter-stat-reviewed',
260260 'pagetriage-filter-stat-bots',
261261 'pagetriage-filter-stat-redirects',
 262+ 'pagetriage-filter-stat-nominated-for-deletion',
262263 'pagetriage-filter-stat-all',
263264 'pagetriage-filter-stat-no-categories',
264265 'pagetriage-filter-stat-orphan',

Status & tagging log