Index: trunk/extensions/PageTriage/SpecialPageTriage.php |
— | — | @@ -33,26 +33,6 @@ |
34 | 34 | $wgUser->saveSettings(); |
35 | 35 | $wgUser->invalidateCache(); |
36 | 36 | |
37 | | - // Initialize variable to hold list view options |
38 | | - $opts = new FormOptions(); |
39 | | - |
40 | | - // Set the defaults for the list view options |
41 | | - $opts->add( 'showbots', true ); |
42 | | - $opts->add( 'showredirs', false ); |
43 | | - $opts->add( 'showtriaged', false ); |
44 | | - $opts->add( 'limit', (int)$this->getUser()->getOption( 'rclimit' ) ); |
45 | | - $opts->add( 'offset', '' ); |
46 | | - $opts->add( 'namespace', '0' ); |
47 | | - |
48 | | - // Get the option values from the page request |
49 | | - $opts->fetchValuesFromRequest( $this->getRequest() ); |
50 | | - |
51 | | - // Validate the data for the options |
52 | | - $opts->validateIntBounds( 'limit', 0, 5000 ); |
53 | | - |
54 | | - // Bind options to member variable |
55 | | - $this->opts = $opts; |
56 | | - |
57 | 37 | // Output the title of the page |
58 | 38 | $out->setPageTitle( wfMessage( 'pagetriage' ) ); |
59 | 39 | |
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listView.js |
— | — | @@ -10,11 +10,6 @@ |
11 | 11 | // grab pageTriage statistics |
12 | 12 | var stats = new mw.pageTriage.Stats( { eventBus: eventBus } ); |
13 | 13 | |
14 | | - // set the default sort order. |
15 | | - articles.comparator = function( article ) { |
16 | | - return -article.get( "creation_date" ); |
17 | | - }; |
18 | | - |
19 | 14 | // overall list view |
20 | 15 | // currently, this is the main application view. |
21 | 16 | mw.pageTriage.ListView = Backbone.View.extend( { |
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.models/ext.pageTriage.article.js |
— | — | @@ -48,12 +48,12 @@ |
49 | 49 | apiParams: { |
50 | 50 | namespace: 0, |
51 | 51 | limit: 50, |
| 52 | + offset: 0, |
| 53 | + dir: 'oldestfirst', |
52 | 54 | /* |
53 | 55 | showbots: null, |
54 | 56 | showredirs: null, |
55 | 57 | showtriaged: null, |
56 | | - limit: 10, |
57 | | - namespace: 0, |
58 | 58 | no_category: 1, |
59 | 59 | no_inbound_links: 1, |
60 | 60 | non_autoconfirmed_users: 1, |
— | — | @@ -69,7 +69,6 @@ |
70 | 70 | |
71 | 71 | url: function() { |
72 | 72 | var url = mw.util.wikiScript( 'api' ) + '?action=pagetriagelist&format=json&' + $.param( this.apiParams ); |
73 | | - console.log('fetching ' + url); |
74 | 73 | return url; |
75 | 74 | }, |
76 | 75 | |
Index: trunk/extensions/PageTriage/api/ApiPageTriageList.php |
— | — | @@ -20,15 +20,17 @@ |
21 | 21 | // fetch metadata for those pages |
22 | 22 | $articleMetadata = new ArticleMetadata( $pages ); |
23 | 23 | $metaData = $articleMetadata->getMetadata(); |
24 | | - |
25 | | - // convert this to a slightly different format that's more Backbone-friendly |
26 | | - foreach( $metaData as $pageId => $attrs ) { |
27 | | - $metaDataSend[] = $attrs + array( 'pageid' => $pageId ); |
| 24 | + |
| 25 | + // Sort data according to page order returned by our query. Also convert it to a |
| 26 | + // slightly different format that's more Backbone-friendly. |
| 27 | + $sortedMetaData = array(); |
| 28 | + foreach ( $pages as $page ) { |
| 29 | + $sortedMetaData[] = array( 'pageid' => $page ) + $metaData[ $page ]; |
28 | 30 | } |
29 | 31 | } |
30 | 32 | |
31 | 33 | // Output the results |
32 | | - $result = array( 'result' => 'success', 'pages' => $metaDataSend, 'userpagestatus' => PageTriageUtil::pageStatusForUser( $metaDataSend ) ); |
| 34 | + $result = array( 'result' => 'success', 'pages' => $sortedMetaData, 'userpagestatus' => PageTriageUtil::pageStatusForUser( $metaDataSend ) ); |
33 | 35 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
34 | 36 | } |
35 | 37 | |
— | — | @@ -44,7 +46,13 @@ |
45 | 47 | $pages = $options = array(); |
46 | 48 | |
47 | 49 | // Get the expected limit as defined in getAllowedParams |
48 | | - $options = array( 'LIMIT' => $opts['limit'] ); |
| 50 | + $options['LIMIT'] = $opts['limit']; |
| 51 | + |
| 52 | + if ( strtolower( $opts['dir'] ) === 'oldestfirst' ) { |
| 53 | + $options['ORDER BY'] = 'ptrp_timestamp ASC'; |
| 54 | + } else { |
| 55 | + $options['ORDER BY'] = 'ptrp_timestamp DESC'; |
| 56 | + } |
49 | 57 | |
50 | 58 | // Start building the massive filter which includes meta data |
51 | 59 | $tagConds = self::buildTagQuery( $opts ); |
— | — | @@ -102,7 +110,7 @@ |
103 | 111 | // no inbound links |
104 | 112 | 'no_inbound_links' => array( 'name' => 'linkcount', 'op' => '=', 'val' => '0' ), |
105 | 113 | // non auto confirmed users |
106 | | - 'non_auto_confirmed_users' => array( 'name' => 'user_autoconfirmed', 'op' => '=', 'val' => '0' ), |
| 114 | + 'non_autoconfirmed_users' => array( 'name' => 'user_autoconfirmed', 'op' => '=', 'val' => '0' ), |
107 | 115 | // blocked users |
108 | 116 | 'blocked_users' => array( 'name' => 'user_block_status', 'op' => '=', 'val' => '1' ), |
109 | 117 | // show bots |
— | — | @@ -137,6 +145,9 @@ |
138 | 146 | ApiBase::PARAM_MIN => '10', |
139 | 147 | ApiBase::PARAM_TYPE => 'integer', |
140 | 148 | ), |
| 149 | + 'dir' => array( |
| 150 | + ApiBase::PARAM_TYPE => 'string', |
| 151 | + ), |
141 | 152 | 'namespace' => array( |
142 | 153 | ApiBase::PARAM_DFLT => '0', |
143 | 154 | ApiBase::PARAM_TYPE => 'integer', |
— | — | @@ -147,7 +158,7 @@ |
148 | 159 | 'no_inbound_links' => array( |
149 | 160 | ApiBase::PARAM_TYPE => 'boolean', |
150 | 161 | ), |
151 | | - 'non_auto_confirmed_users' => array( |
| 162 | + 'non_autoconfirmed_users' => array( |
152 | 163 | ApiBase::PARAM_TYPE => 'boolean', |
153 | 164 | ), |
154 | 165 | 'blocked_users' => array( |
— | — | @@ -163,10 +174,11 @@ |
164 | 175 | 'showredirs' => 'Whether to include redirects or not', // default is not to show redirects |
165 | 176 | 'showtriaged' => 'Whether to include triaged or not', // default is not to show triaged |
166 | 177 | 'limit' => 'The maximum number of results to return', |
| 178 | + 'dir' => 'The direction the list should be sorted in - oldestfirst or newestfirst', |
167 | 179 | 'namespace' => 'What namespace to pull pages from', |
168 | 180 | 'no_category' => 'Whether to show only pages with no category', |
169 | 181 | 'no_inbound_links' => 'Whether to show only pages with no inbound links', |
170 | | - 'non_auto_confirmed_users' => 'Whether to show only pages created by non auto confirmed users', |
| 182 | + 'non_autoconfirmed_users' => 'Whether to show only pages created by non auto confirmed users', |
171 | 183 | 'blocked_users' => 'Whether to show only pages created by blocked users' |
172 | 184 | ); |
173 | 185 | } |