r74079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74078‎ | r74079 | r74080 >
Date:17:39, 1 October 2010
Author:reedy
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeAuthorListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeCommentsListView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -44,6 +44,7 @@
4545 'code-author-unlinksuccess' => 'Author $1 has been unlinked',
4646 'code-author-badtoken' => 'Session error trying to perform the action.',
4747 'code-author-total' => 'Total number of authors: $1',
 48+ 'code-author-lastcommit' => 'Last commit date',
4849 'code-browsing-path' => "Browsing revisions in '''$1'''",
4950 'code-field-id' => 'Revision',
5051 'code-field-author' => 'Author',
Index: trunk/extensions/CodeReview/backend/CodeRepository.php
@@ -113,20 +113,22 @@
114114 $dbr = wfGetDB( DB_SLAVE );
115115 $res = $dbr->select(
116116 'code_rev',
117 - array( 'cr_author' ),
 117+ array( 'cr_author', 'MAX(cr_timestamp) AS time' ),
118118 array( 'cr_repo_id' => $this->getId() ),
119119 __METHOD__,
120120 array( 'GROUP BY' => 'cr_author',
121121 'ORDER BY' => 'cr_author', 'LIMIT' => 500 )
122122 );
123123 $authors = array();
124 - while ( $row = $dbr->fetchObject( $res ) ) {
125 - $authors[] = $row->cr_author;
 124+ foreach( $res as $row ) {
 125+ if ( $row->cr_author !== null ) {
 126+ $authors[] = array( 'author' => $row->cr_author, 'lastcommit' => $row->time );
 127+ }
126128 }
127129 $wgMemc->set( $key, $authors, 3600 * 24 );
128130 return $authors;
129131 }
130 -
 132+
131133 public function getAuthorCount() {
132134 return count( $this->getAuthorList() );
133135 }
Index: trunk/extensions/CodeReview/ui/CodeCommentsListView.php
@@ -36,7 +36,9 @@
3737 return $field == 'cr_timestamp';
3838 }
3939
40 - function getDefaultSort() { return 'cc_timestamp'; }
 40+ function getDefaultSort() {
 41+ return 'cc_timestamp';
 42+ }
4143
4244 function getQueryInfo() {
4345 return array(
Index: trunk/extensions/CodeReview/ui/CodeAuthorListView.php
@@ -13,18 +13,30 @@
1414 $repo = $this->mRepo->getName();
1515 $text = wfMsg( 'code-authors-text' ) . "\n\n";
1616 $text .= '<strong>' . wfMsg( 'code-author-total', $wgLang->formatNum( $this->mRepo->getAuthorCount() ) ) . "</strong>\n";
 17+
 18+ $wgOut->addWikiText( $text );
 19+
 20+ $wgOut->addHTML( '<table class="TablePager">'
 21+ . '<tr><th>' . wfMsgHtml( 'code-field-author' )
 22+ . '</th><th>' . wfMsgHtml( 'code-author-lastcommit' ) . '</th></tr>' );
 23+
1724 foreach ( $authors as $committer ) {
1825 if ( $committer ) {
19 - $text .= "* [[Special:Code/$repo/author/$committer|$committer]]";
20 - $user = $this->mRepo->authorWikiUser( $committer );
 26+ $wgOut->addHTML( "<tr><td>" );
 27+ $author = $committer["author"];
 28+ $text = "[[Special:Code/$repo/author/$committer|$author]]";
 29+ $user = $this->mRepo->authorWikiUser( $author );
2130 if ( $user ) {
2231 $title = htmlspecialchars( $user->getUserPage()->getPrefixedText() );
2332 $name = htmlspecialchars( $user->getName() );
2433 $text .= " ([[$title|$name]])";
2534 }
26 - $text .= "\n";
 35+ $wgOut->addWikiText( $text );
 36+
 37+ $wgOut->addHTML( "</td><td>{$wgLang->timeanddate( $committer["lastcommit"], true )}</td></tr>" );
2738 }
2839 }
29 - $wgOut->addWikiText( $text );
 40+
 41+ $wgOut->addHTML( '</table>' );
3042 }
31 -}
 43+}
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69934Switch CodeRepository->getAuthorList() to return ordered by commit name, rath...reedy08:20, 26 July 2010

Status & tagging log