Index: trunk/extensions/CodeReview/ui/CodeCommentsListView.php |
— | — | @@ -1,36 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | // Special:Code/MediaWiki/comments |
5 | | -class CodeCommentsListView extends CodeView { |
6 | | - public $mRepo; |
7 | | - |
8 | | - function __construct( $repo ) { |
9 | | - parent::__construct( $repo ); |
10 | | - |
11 | | - global $wgRequest; |
12 | | - $this->mAuthor = $wgRequest->getText( 'author' ); |
13 | | - } |
14 | | - |
15 | | - function execute() { |
16 | | - global $wgOut; |
17 | | - $pager = $this->getPager(); |
18 | | - $limitForm = $pager->getLimitForm(); |
19 | | - $wgOut->addHTML( |
20 | | - $pager->getNavigationBar() . |
21 | | - $limitForm . |
22 | | - $pager->getBody() . |
23 | | - $limitForm . |
24 | | - $pager->getNavigationBar() |
25 | | - ); |
26 | | - } |
27 | | - |
| 5 | +class CodeCommentsListView extends CodeRevisionListView { |
28 | 6 | function getPager() { |
29 | 7 | return new CodeCommentsTablePager( $this ); |
30 | 8 | } |
31 | | - |
32 | | - function getRepo() { |
33 | | - return $this->mRepo; |
34 | | - } |
35 | 9 | } |
36 | 10 | |
37 | 11 | // Pager for CodeCommentsListView |
— | — | @@ -51,9 +25,15 @@ |
52 | 26 | 'conds' => array( 'cc_repo_id' => $this->mRepo->getId() ), |
53 | 27 | 'join_conds' => array( |
54 | 28 | 'code_rev' => array( 'LEFT JOIN', 'cc_repo_id = cr_repo_id AND cc_rev_id = cr_id' ) |
55 | | - ) |
| 29 | + ), |
| 30 | + 'options' => array(), |
56 | 31 | ); |
57 | 32 | |
| 33 | + if( count( $this->mView->mPath ) ) { |
| 34 | + $query['tables'][] = 'code_paths'; |
| 35 | + $query['join_conds']['code_paths'] = array( 'INNER JOIN', 'cc_repo_id = cp_repo_id AND cc_rev_id = cp_rev_id' ); |
| 36 | + $query['conds']['cp_path'] = $this->mView->mPath; |
| 37 | + } |
58 | 38 | if( $this->mView->mAuthor ) { |
59 | 39 | $query['conds']['cc_user_text'] = $this->mView->mAuthor; |
60 | 40 | } |
— | — | @@ -61,6 +41,14 @@ |
62 | 42 | return $query; |
63 | 43 | } |
64 | 44 | |
| 45 | + function getCountQuery() { |
| 46 | + $query = $this->getQueryInfo(); |
| 47 | + |
| 48 | + $query['fields'] = array( 'COUNT( DISTINCT cc_id ) AS rev_count' ); |
| 49 | + unset( $query['options']['GROUP BY'] ); |
| 50 | + return $query; |
| 51 | + } |
| 52 | + |
65 | 53 | function getFieldNames() { |
66 | 54 | return array( |
67 | 55 | 'cc_timestamp' => wfMsg( 'code-field-timestamp' ), |
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -100,8 +100,15 @@ |
101 | 101 | |
102 | 102 | $wgOut->addHTML( |
103 | 103 | $navBar . |
104 | | - '<table><tr><td>' . $pager->getLimitForm() . '</td>' . |
105 | | - '<td> <strong>' . wfMsgHtml( 'code-rev-total', $wgLang->formatNum( $revCount ) ) . '</strong></td>' . |
| 104 | + '<table><tr><td>' . $pager->getLimitForm() . '</td>' |
| 105 | + ); |
| 106 | + if ( $revCount !== -1 ) { |
| 107 | + $wgOut->addHTML( |
| 108 | + '<td> <strong>' . wfMsgHtml( 'code-rev-total', $wgLang->formatNum( $revCount ) ) . '</strong></td>' |
| 109 | + ); |
| 110 | + } |
| 111 | + |
| 112 | + $wgOut->addHTML( |
106 | 113 | '</tr></table>' . |
107 | 114 | Xml::openElement( 'form', |
108 | 115 | array( 'action' => $pager->getTitle()->getLocalURL(), 'method' => 'post' ) |