http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88578

Revision: 88578
Author:   reedy
Date:     2011-05-22 15:02:42 +0000 (Sun, 22 May 2011)
Log Message:
-----------
* (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
    trunk/extensions/CodeReview/ui/CodeRevisionListView.php

Modified: trunk/extensions/CodeReview/ui/CodeCommentsListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeCommentsListView.php     2011-05-22 
14:35:06 UTC (rev 88577)
+++ trunk/extensions/CodeReview/ui/CodeCommentsListView.php     2011-05-22 
15:02:42 UTC (rev 88578)
@@ -1,36 +1,10 @@
 <?php
 
 // Special:Code/MediaWiki/comments
-class CodeCommentsListView extends CodeView {
-       public $mRepo;
-
-       function __construct( $repo ) {
-               parent::__construct( $repo );
-
-               global $wgRequest;
-               $this->mAuthor = $wgRequest->getText( 'author' );
-       }
-
-       function execute() {
-               global $wgOut;
-               $pager = $this->getPager();
-               $limitForm = $pager->getLimitForm();
-               $wgOut->addHTML(
-                       $pager->getNavigationBar() .
-                       $limitForm .
-                       $pager->getBody() .
-                       $limitForm .
-                       $pager->getNavigationBar()
-               );
-       }
-
+class CodeCommentsListView extends CodeRevisionListView {
        function getPager() {
                return new CodeCommentsTablePager( $this );
        }
-
-       function getRepo() {
-               return $this->mRepo;
-       }
 }
 
 // Pager for CodeCommentsListView
@@ -51,9 +25,15 @@
                        'conds' => array( 'cc_repo_id' => $this->mRepo->getId() 
),
                        'join_conds' => array(
                                'code_rev' => array( 'LEFT JOIN', 'cc_repo_id = 
cr_repo_id AND cc_rev_id = cr_id' )
-                       )
+                       ),
+                       'options' => array(),
                );
 
+               if( count( $this->mView->mPath ) ) {
+                       $query['tables'][] = 'code_paths';
+                       $query['join_conds']['code_paths'] = array( 'INNER 
JOIN', 'cc_repo_id = cp_repo_id AND cc_rev_id = cp_rev_id' );
+                       $query['conds']['cp_path'] = $this->mView->mPath;
+               }
                if( $this->mView->mAuthor ) {
                        $query['conds']['cc_user_text'] = $this->mView->mAuthor;
                }
@@ -61,6 +41,14 @@
            return $query;
        }
 
+       function getCountQuery() {
+               $query = $this->getQueryInfo();
+
+               $query['fields'] = array( 'COUNT( DISTINCT cc_id ) AS 
rev_count' );
+               unset( $query['options']['GROUP BY'] );
+               return $query;
+       }
+
        function getFieldNames() {
                return array(
                        'cc_timestamp' => wfMsg( 'code-field-timestamp' ),

Modified: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2011-05-22 
14:35:06 UTC (rev 88577)
+++ trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2011-05-22 
15:02:42 UTC (rev 88578)
@@ -100,8 +100,15 @@
 
                $wgOut->addHTML(
                        $navBar .
-                       '<table><tr><td>' . $pager->getLimitForm() . '</td>' .
-                       '<td>&#160;<strong>' . wfMsgHtml( 'code-rev-total', 
$wgLang->formatNum( $revCount ) ) . '</strong></td>' .
+                       '<table><tr><td>' . $pager->getLimitForm() . '</td>'
+               );
+               if ( $revCount !== -1 ) {
+                       $wgOut->addHTML(
+                               '<td>&#160;<strong>' . wfMsgHtml( 
'code-rev-total', $wgLang->formatNum( $revCount ) ) . '</strong></td>'
+                       );
+               }
+
+               $wgOut->addHTML(
                        '</tr></table>' .
                        Xml::openElement( 'form',
                                array( 'action' => 
$pager->getTitle()->getLocalURL(), 'method' => 'post' )


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to