r88578 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88577‎ | r88578 | r88579 >
Date:15:02, 22 May 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 26754) Support for path and author on CR-specific pages (comments, statuschanges, tags etc.)

Make /comments filterable by path
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeCommentsListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeCommentsListView.php
@@ -1,36 +1,10 @@
22 <?php
33
44 // 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 {
286 function getPager() {
297 return new CodeCommentsTablePager( $this );
308 }
31 -
32 - function getRepo() {
33 - return $this->mRepo;
34 - }
359 }
3610
3711 // Pager for CodeCommentsListView
@@ -51,9 +25,15 @@
5226 'conds' => array( 'cc_repo_id' => $this->mRepo->getId() ),
5327 'join_conds' => array(
5428 'code_rev' => array( 'LEFT JOIN', 'cc_repo_id = cr_repo_id AND cc_rev_id = cr_id' )
55 - )
 29+ ),
 30+ 'options' => array(),
5631 );
5732
 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+ }
5838 if( $this->mView->mAuthor ) {
5939 $query['conds']['cc_user_text'] = $this->mView->mAuthor;
6040 }
@@ -61,6 +41,14 @@
6242 return $query;
6343 }
6444
 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+
6553 function getFieldNames() {
6654 return array(
6755 'cc_timestamp' => wfMsg( 'code-field-timestamp' ),
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -100,8 +100,15 @@
101101
102102 $wgOut->addHTML(
103103 $navBar .
104 - '<table><tr><td>' . $pager->getLimitForm() . '</td>' .
105 - '<td>&#160;<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>&#160;<strong>' . wfMsgHtml( 'code-rev-total', $wgLang->formatNum( $revCount ) ) . '</strong></td>'
 109+ );
 110+ }
 111+
 112+ $wgOut->addHTML(
106113 '</tr></table>' .
107114 Xml::openElement( 'form',
108115 array( 'action' => $pager->getTitle()->getLocalURL(), 'method' => 'post' )

Follow-up revisions

RevisionCommit summaryAuthorDate
r88579* (bug 26754) Support for path and author on CR-specific pages (comments, sta...reedy15:06, 22 May 2011

Status & tagging log