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

Revision: 74079
Author:   reedy
Date:     2010-10-01 17:39:06 +0000 (Fri, 01 Oct 2010)

Log Message:
-----------
Followup r69934, show list of last commit dates also.

Table pager is a <insert word here>, and didn't want to play ball

Open to suggestions to have the columns sortable

Modified Paths:
--------------
    trunk/extensions/CodeReview/CodeReview.i18n.php
    trunk/extensions/CodeReview/backend/CodeRepository.php
    trunk/extensions/CodeReview/ui/CodeAuthorListView.php
    trunk/extensions/CodeReview/ui/CodeCommentsListView.php

Modified: trunk/extensions/CodeReview/CodeReview.i18n.php
===================================================================
--- trunk/extensions/CodeReview/CodeReview.i18n.php     2010-10-01 16:31:10 UTC 
(rev 74078)
+++ trunk/extensions/CodeReview/CodeReview.i18n.php     2010-10-01 17:39:06 UTC 
(rev 74079)
@@ -44,6 +44,7 @@
        'code-author-unlinksuccess' => 'Author $1 has been unlinked',
        'code-author-badtoken' => 'Session error trying to perform the action.',
        'code-author-total' => 'Total number of authors: $1',
+       'code-author-lastcommit' => 'Last commit date',
        'code-browsing-path' => "Browsing revisions in '''$1'''",
        'code-field-id' => 'Revision',
        'code-field-author' => 'Author',

Modified: trunk/extensions/CodeReview/backend/CodeRepository.php
===================================================================
--- trunk/extensions/CodeReview/backend/CodeRepository.php      2010-10-01 
16:31:10 UTC (rev 74078)
+++ trunk/extensions/CodeReview/backend/CodeRepository.php      2010-10-01 
17:39:06 UTC (rev 74079)
@@ -113,20 +113,22 @@
                $dbr = wfGetDB( DB_SLAVE );
                $res = $dbr->select(
                        'code_rev',
-                       array( 'cr_author' ),
+                       array( 'cr_author', 'MAX(cr_timestamp) AS time' ),
                        array( 'cr_repo_id' => $this->getId() ),
                        __METHOD__,
                        array( 'GROUP BY' => 'cr_author',
                                'ORDER BY' => 'cr_author', 'LIMIT' => 500 )
                );
                $authors = array();
-               while ( $row = $dbr->fetchObject( $res ) ) {
-                       $authors[] = $row->cr_author;
+               foreach( $res as $row ) {
+                       if ( $row->cr_author !== null ) {
+                               $authors[] = array( 'author' => 
$row->cr_author, 'lastcommit' => $row->time );
+                       }
                }
                $wgMemc->set( $key, $authors, 3600 * 24 );
                return $authors;
        }
-       
+
        public function getAuthorCount() {
                return count( $this->getAuthorList() );
        }

Modified: trunk/extensions/CodeReview/ui/CodeAuthorListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeAuthorListView.php       2010-10-01 
16:31:10 UTC (rev 74078)
+++ trunk/extensions/CodeReview/ui/CodeAuthorListView.php       2010-10-01 
17:39:06 UTC (rev 74079)
@@ -13,18 +13,30 @@
                $repo = $this->mRepo->getName();
                $text = wfMsg( 'code-authors-text' ) . "\n\n";
                $text .= '<strong>' . wfMsg( 'code-author-total', 
$wgLang->formatNum( $this->mRepo->getAuthorCount() ) )  . "</strong>\n";
+
+               $wgOut->addWikiText( $text );
+
+               $wgOut->addHTML( '<table class="TablePager">'
+                               . '<tr><th>' . wfMsgHtml( 'code-field-author' )
+                               . '</th><th>' . wfMsgHtml( 
'code-author-lastcommit' ) . '</th></tr>' );
+
                foreach ( $authors as $committer ) {
                        if ( $committer ) {
-                               $text .= "* 
[[Special:Code/$repo/author/$committer|$committer]]";
-                               $user = $this->mRepo->authorWikiUser( 
$committer );
+                               $wgOut->addHTML( "<tr><td>" );
+                               $author = $committer["author"];
+                               $text = 
"[[Special:Code/$repo/author/$committer|$author]]";
+                               $user = $this->mRepo->authorWikiUser( $author );
                                if ( $user ) {
                                        $title = htmlspecialchars( 
$user->getUserPage()->getPrefixedText() );
                                        $name = htmlspecialchars( 
$user->getName() );
                                        $text .= " ([[$title|$name]])";
                                }
-                               $text .= "\n";
+                               $wgOut->addWikiText( $text );
+
+                           $wgOut->addHTML( "</td><td>{$wgLang->timeanddate( 
$committer["lastcommit"], true )}</td></tr>" );
                        }
                }
-               $wgOut->addWikiText( $text );
+
+           $wgOut->addHTML( '</table>' );
        }
-}
+}
\ No newline at end of file

Modified: trunk/extensions/CodeReview/ui/CodeCommentsListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeCommentsListView.php     2010-10-01 
16:31:10 UTC (rev 74078)
+++ trunk/extensions/CodeReview/ui/CodeCommentsListView.php     2010-10-01 
17:39:06 UTC (rev 74079)
@@ -36,7 +36,9 @@
                return $field == 'cr_timestamp';
        }
 
-       function getDefaultSort() { return 'cc_timestamp'; }
+       function getDefaultSort() {
+               return 'cc_timestamp';
+       }
 
        function getQueryInfo() {
                return array(



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to