Index: trunk/extensions/PageTriage/SpecialPageTriage.php |
— | — | @@ -25,13 +25,14 @@ |
26 | 26 | */ |
27 | 27 | public function execute( $sub ) { |
28 | 28 | global $wgOut; |
29 | | - |
| 29 | + |
30 | 30 | // Initialize variable to hold list view options |
31 | 31 | $opts = new FormOptions(); |
32 | 32 | |
33 | 33 | // Set the defaults for the list view options |
34 | 34 | $opts->add( 'showbots', true ); |
35 | 35 | $opts->add( 'showredirs', false ); |
| 36 | + $opts->add( 'showtriaged', false ); |
36 | 37 | $opts->add( 'limit', (int)$this->getUser()->getOption( 'rclimit' ) ); |
37 | 38 | $opts->add( 'offset', '' ); |
38 | 39 | $opts->add( 'namespace', '0' ); |
— | — | @@ -96,9 +97,13 @@ |
97 | 98 | $htmlOut = ''; |
98 | 99 | |
99 | 100 | if ( $pageList ) { |
| 101 | + $articleMetadata = new ArticleMetadata( $pageList ); |
| 102 | + $metaData = $articleMetadata->getMetadata(); |
100 | 103 | foreach ( $pageList as $pageId ) { |
101 | | - $formattedRow = $this->buildRow( $pageId ); |
102 | | - $htmlOut .= $formattedRow; |
| 104 | + if ( isset( $metaData[$pageId] ) ) { |
| 105 | + $formattedRow = $this->buildRow( $pageId, $metaData[$pageId] ); |
| 106 | + $htmlOut .= $formattedRow; |
| 107 | + } |
103 | 108 | } |
104 | 109 | } else { |
105 | 110 | $htmlOut .= wfMessage( 'specialpage-empty' ); |
— | — | @@ -110,14 +115,18 @@ |
111 | 116 | /** |
112 | 117 | * Builds a single row for the article list. |
113 | 118 | * @param $pageId integer ID for a single page |
| 119 | + * @param $metaData array the meta data for $pageId |
114 | 120 | * @return string HTML for the row |
115 | 121 | */ |
116 | | - protected function buildRow( $pageId ) { |
| 122 | + protected function buildRow( $pageId, $metaData ) { |
117 | 123 | |
118 | | - // TODO: get all the metadata for the page |
| 124 | + // TODO: Build the row from metadata provided |
| 125 | + return '<div>' |
| 126 | + . $pageId . ' ' |
| 127 | + . htmlspecialchars( $metaData['title'] ) . ' ' |
| 128 | + . htmlspecialchars( $metaData['user_name'] ) . |
| 129 | + '</div>'; |
119 | 130 | |
120 | | - return '<div>'.$pageId.'</div>'; |
121 | | - |
122 | 131 | } |
123 | 132 | |
124 | 133 | } |
Index: trunk/extensions/PageTriage/api/ApiPageTriageList.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | * @return an array of ids |
29 | 29 | */ |
30 | 30 | public static function getPageIds( $opts = array() ) { |
31 | | - |
| 31 | + |
32 | 32 | // Initialize required variables |
33 | 33 | $pages = array(); |
34 | 34 | $conds = array(); |
— | — | @@ -42,10 +42,32 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | // TODO: Handle filtering options |
| 46 | + $tables = array( 'pagetriage_page', 'page' ); |
| 47 | + $conds[] = 'ptrp_page_id = page_id'; |
| 48 | + |
| 49 | + if ( $opts['namespace'] ) { |
| 50 | + $conds['page_namespace'] = $opts['namespace']; |
| 51 | + } |
| 52 | + if ( $opts['showredirs'] ) { |
| 53 | + $conds['page_is_redirect'] = 1; |
| 54 | + } |
| 55 | + if ( $opts['showbots'] ) { |
| 56 | + $conds[] = 'ptrp_page_id = ptrpt_page_id AND ptrpt_tag_id = ptrt_tag_id'; |
| 57 | + $conds['ptrt_tag_name'] = 'user_bot'; |
| 58 | + $conds['ptrpt_value'] = '1'; |
| 59 | + $tables[] = 'pagetriage_page_tags'; |
| 60 | + $tables[] = 'pagetriage_tags'; |
| 61 | + } |
46 | 62 | |
| 63 | + if ( $opts['showtriaged'] ) { |
| 64 | + $conds['ptrp_triaged'] = array( 0, 1 ); |
| 65 | + } else { |
| 66 | + $conds['ptrp_triaged'] = 0; |
| 67 | + } |
| 68 | + |
47 | 69 | // Pull page IDs from database |
48 | 70 | $res = $dbr->select( |
49 | | - 'pagetriage_page', |
| 71 | + $tables, |
50 | 72 | 'ptrp_page_id', |
51 | 73 | $conds, |
52 | 74 | __METHOD__, |
— | — | @@ -68,6 +90,9 @@ |
69 | 91 | 'showredirs' => array( |
70 | 92 | ApiBase::PARAM_TYPE => 'boolean', |
71 | 93 | ), |
| 94 | + 'showtriaged'=> array( |
| 95 | + ApiBase::PARAM_TYPE => 'boolean', |
| 96 | + ), |
72 | 97 | 'limit' => array( |
73 | 98 | ApiBase::PARAM_DFLT => '5000', |
74 | 99 | ApiBase::PARAM_TYPE => 'integer', |
— | — | @@ -83,6 +108,7 @@ |
84 | 109 | return array( |
85 | 110 | 'showbots' => 'Whether to include bot edits or not', |
86 | 111 | 'showredirs' => 'Whether to include redirects or not', |
| 112 | + 'showtriaged' => 'Whether to include triaged or not', |
87 | 113 | 'limit' => 'The maximum number of results to return', |
88 | 114 | 'namespace' => 'What namespace to pull pages from', |
89 | 115 | ); |