r41674 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41673‎ | r41674 | r41675 >
Date:23:20, 4 October 2008
Author:aaron
Status:old
Tags:
Comment:
* Add recent comments page
* Add some handy links to repo list
* Move some files/classes
* Add special page group
* Add header to author list
* "comment" -> "summary"
Modified paths:
  • /trunk/extensions/CodeReview/CodeAuthorListView.php (added) (history)
  • /trunk/extensions/CodeReview/CodeCommentsListView.php (added) (history)
  • /trunk/extensions/CodeReview/CodeRepoListView.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevisionAuthorListView.php (deleted) (history)
  • /trunk/extensions/CodeReview/CodeRevisionStatusListView.php (deleted) (history)
  • /trunk/extensions/CodeReview/CodeRevisionTagListView.php (deleted) (history)
  • /trunk/extensions/CodeReview/CodeStatusListView.php (added) (history)
  • /trunk/extensions/CodeReview/CodeTagListView.php (added) (history)
  • /trunk/extensions/CodeReview/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevisionAuthorListView.php
@@ -1,22 +0,0 @@
2 -<?php
3 -
4 -// Special:Code/MediaWiki/author
5 -class CodeRevisionAuthorListView extends CodeView {
6 - function __construct( $repoName ) {
7 - parent::__construct();
8 - $this->mRepo = CodeRepository::newFromName( $repoName );
9 - }
10 -
11 - function execute() {
12 - global $wgOut;
13 - $authors = $this->mRepo->getAuthorList();
14 - $name = $this->mRepo->getName();
15 - $text = '';
16 - foreach( $authors as $user ) {
17 - if( $user )
18 - $text .= "* [[Special:Code/$name/author/$user|$user]]\n";
19 - }
20 - $wgOut->addWikiText( $text );
21 - }
22 -}
23 -
Index: trunk/extensions/CodeReview/CodeRevisionTagListView.php
@@ -1,21 +0,0 @@
2 -<?php
3 -
4 -// Special:Code/MediaWiki/tag
5 -class CodeRevisionTagListView extends CodeView {
6 - function __construct( $repoName ) {
7 - parent::__construct();
8 - $this->mRepo = CodeRepository::newFromName( $repoName );
9 - }
10 -
11 - function execute() {
12 - global $wgOut;
13 - $tags = $this->mRepo->getTagList();
14 - $name = $this->mRepo->getName();
15 - $text = '';
16 - foreach( $tags as $tag ) {
17 - $text .= "* [[Special:Code/$name/tag/$tag|$tag]]\n";
18 - }
19 - $wgOut->addWikiText( $text );
20 - }
21 -}
22 -
Index: trunk/extensions/CodeReview/CodeRevisionStatusListView.php
@@ -1,21 +0,0 @@
2 -<?php
3 -
4 -// Special:Code/MediaWiki/status
5 -class CodeRevisionStatusListView extends CodeView {
6 - function __construct( $repoName ) {
7 - parent::__construct();
8 - $this->mRepo = CodeRepository::newFromName( $repoName );
9 - }
10 -
11 - function execute() {
12 - global $wgOut;
13 - $name = $this->mRepo->getName();
14 - $states = CodeRevision::getPossibleStates();
15 - $text = '';
16 - foreach( $states as $state ) {
17 - $text .= "* [[Special:Code/$name/status/$state|$state]]\n";
18 - }
19 - $wgOut->addWikiText( $text );
20 - }
21 -}
22 -
Index: trunk/extensions/CodeReview/CodeReview.php
@@ -51,9 +51,10 @@
5252 $wgAutoloadClasses['CodeRevisionTagger'] = $dir . 'CodeRevisionTagger.php';
5353 $wgAutoloadClasses['CodeRevisionTagView'] = $dir . 'CodeRevisionTagView.php';
5454 $wgAutoloadClasses['CodeRevisionView'] = $dir . 'CodeRevisionView.php';
55 -$wgAutoloadClasses['CodeRevisionAuthorListView'] = $dir . 'CodeRevisionAuthorListView.php';
56 -$wgAutoloadClasses['CodeRevisionStatusListView'] = $dir . 'CodeRevisionStatusListView.php';
57 -$wgAutoloadClasses['CodeRevisionTagListView'] = $dir . 'CodeRevisionTagListView.php';
 55+$wgAutoloadClasses['CodeAuthorListView'] = $dir . 'CodeAuthorListView.php';
 56+$wgAutoloadClasses['CodeStatusListView'] = $dir . 'CodeStatusListView.php';
 57+$wgAutoloadClasses['CodeTagListView'] = $dir . 'CodeTagListView.php';
 58+$wgAutoloadClasses['CodeCommentsListView'] = $dir . 'CodeCommentsListView.php';
5859 $wgAutoloadClasses['CodeComment'] = $dir . 'CodeComment.php';
5960 $wgAutoloadClasses['SpecialCode'] = $dir . 'SpecialCode.php';
6061 $wgAutoloadClasses['CodeView'] = $dir . 'SpecialCode.php';
@@ -61,7 +62,9 @@
6263 $wgAutoloadClasses['SubversionAdaptor'] = $dir . 'Subversion.php';
6364
6465 $wgSpecialPages['Code'] = 'SpecialCode';
 66+$wgSpecialPageGroups['Code'] = 'developer';
6567 $wgSpecialPages['RepoAdmin'] = 'SpecialRepoAdmin';
 68+$wgSpecialPageGroups['RepoAdmin'] = 'developer';
6669
6770 $wgAPIModules['codeupdate'] = 'ApiCodeUpdate';
6871
Index: trunk/extensions/CodeReview/CodeTagListView.php
@@ -0,0 +1,21 @@
 2+<?php
 3+
 4+// Special:Code/MediaWiki/tag
 5+class CodeTagListView extends CodeView {
 6+ function __construct( $repoName ) {
 7+ parent::__construct();
 8+ $this->mRepo = CodeRepository::newFromName( $repoName );
 9+ }
 10+
 11+ function execute() {
 12+ global $wgOut;
 13+ $tags = $this->mRepo->getTagList();
 14+ $name = $this->mRepo->getName();
 15+ $text = '';
 16+ foreach( $tags as $tag ) {
 17+ $text .= "* [[Special:Code/$name/tag/$tag|$tag]]\n";
 18+ }
 19+ $wgOut->addWikiText( $text );
 20+ }
 21+}
 22+
Property changes on: trunk/extensions/CodeReview/CodeTagListView.php
___________________________________________________________________
Added: svn:eol-style
123 + native
Index: trunk/extensions/CodeReview/CodeStatusListView.php
@@ -0,0 +1,21 @@
 2+<?php
 3+
 4+// Special:Code/MediaWiki/status
 5+class CodeStatusListView extends CodeView {
 6+ function __construct( $repoName ) {
 7+ parent::__construct();
 8+ $this->mRepo = CodeRepository::newFromName( $repoName );
 9+ }
 10+
 11+ function execute() {
 12+ global $wgOut;
 13+ $name = $this->mRepo->getName();
 14+ $states = CodeRevision::getPossibleStates();
 15+ $text = '';
 16+ foreach( $states as $state ) {
 17+ $text .= "* [[Special:Code/$name/status/$state|$state]]\n";
 18+ }
 19+ $wgOut->addWikiText( $text );
 20+ }
 21+}
 22+
Property changes on: trunk/extensions/CodeReview/CodeStatusListView.php
___________________________________________________________________
Added: svn:eol-style
123 + native
Index: trunk/extensions/CodeReview/CodeCommentsListView.php
@@ -0,0 +1,114 @@
 2+<?php
 3+
 4+// Special:Code/MediaWiki
 5+class CodeCommentsListView extends CodeView {
 6+ function __construct( $repoName ) {
 7+ parent::__construct();
 8+ $this->mRepo = CodeRepository::newFromName( $repoName );
 9+ }
 10+
 11+ function execute() {
 12+ global $wgOut;
 13+ $pager = $this->getPager();
 14+ $wgOut->addHtml(
 15+ $pager->getNavigationBar() .
 16+ $pager->getLimitForm() .
 17+ $pager->getBody() .
 18+ $pager->getNavigationBar()
 19+ );
 20+ }
 21+
 22+ function getPager() {
 23+ return new CodeCommentsTablePager( $this );
 24+ }
 25+}
 26+
 27+// Pager for CodeRevisionListView
 28+class CodeCommentsTablePager extends TablePager {
 29+
 30+ function __construct( CodeCommentsListView $view ){
 31+ global $IP;
 32+ $this->mView = $view;
 33+ $this->mRepo = $view->mRepo;
 34+ $this->mDefaultDirection = true;
 35+ $this->mCurSVN = SpecialVersion::getSvnRevision( $IP );
 36+ parent::__construct();
 37+ }
 38+
 39+ function isFieldSortable( $field ){
 40+ return $field == 'cr_timestamp';
 41+ }
 42+
 43+ function getDefaultSort(){ return 'cc_timestamp'; }
 44+
 45+ function getQueryInfo(){
 46+ return array(
 47+ 'tables' => array( 'code_comment', 'code_rev' ),
 48+ 'fields' => array_keys( $this->getFieldNames() ),
 49+ 'conds' => array( 'cc_repo_id' => $this->mRepo->getId() ),
 50+ 'join_conds' => array(
 51+ 'code_rev' => array( 'LEFT JOIN', 'cc_repo_id = cr_repo_id AND cc_rev_id = cr_id' )
 52+ )
 53+ );
 54+ }
 55+
 56+ function getFieldNames(){
 57+ return array(
 58+ 'cc_timestamp' => wfMsg( 'code-field-timestamp' ),
 59+ 'cc_user_text' => wfMsg( 'code-field-user' ),
 60+ 'cc_rev_id' => wfMsg( 'code-field-id' ),
 61+ 'cr_status' => wfMsg( 'code-field-status' ),
 62+ 'cr_message' => wfMsg( 'code-field-message' ),
 63+ 'cc_text' => wfMsg( 'code-field-text' ),
 64+ );
 65+ }
 66+
 67+ function formatValue( $name, $value ){
 68+ global $wgUser, $wgLang;
 69+ switch( $name ){
 70+ case 'cc_rev_id':
 71+ return $this->mView->mSkin->link(
 72+ SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $value ),
 73+ htmlspecialchars( $value ) );
 74+ case 'cr_status':
 75+ return $this->mView->mSkin->link(
 76+ SpecialPage::getTitleFor( 'Code',
 77+ $this->mRepo->getName() . '/status/' . $value ),
 78+ htmlspecialchars( $this->mView->statusDesc( $value ) ) );
 79+ case 'cc_user_text':
 80+ return $this->mView->mSkin->userLink( -1, $value );
 81+ case 'cr_message':
 82+ return $this->mView->messageFragment( $value );
 83+ case 'cc_text':
 84+ # Truncate this, blah blah...
 85+ $text = htmlspecialchars($value);
 86+ $preview = $wgLang->truncate( $text, 400 );
 87+ if( strlen($preview) < strlen($text) ) {
 88+ $preview = substr( $preview, 0, strrpos($preview,' ') );
 89+ $preview .= " . . .";
 90+ }
 91+ return $preview;
 92+ case 'cc_timestamp':
 93+ global $wgLang;
 94+ return $wgLang->timeanddate( $value );
 95+ }
 96+ }
 97+
 98+ // Note: this function is poorly factored in the parent class
 99+ function formatRow( $row ) {
 100+ global $wgWikiSVN;
 101+ $class = "mw-codereview-status-{$row->cr_status}";
 102+ if($this->mRepo->mName == $wgWikiSVN){
 103+ $class .= " mw-codereview-" . ( $row->cc_rev_id <= $this->mCurSVN ? 'live' : 'notlive' );
 104+ }
 105+ return str_replace(
 106+ '<tr>',
 107+ Xml::openElement( 'tr',
 108+ array( 'class' => $class ) ),
 109+ parent::formatRow( $row ) );
 110+ }
 111+
 112+ function getTitle(){
 113+ return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/comments' );
 114+ }
 115+}
Property changes on: trunk/extensions/CodeReview/CodeCommentsListView.php
___________________________________________________________________
Added: svn:eol-style
1116 + native
Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -13,6 +13,10 @@
1414 'code-comments' => 'Comments',
1515 'code-desc' => '[[Special:Code|Code review tool]] with [[Special:RepoAdmin|Subversion support]]',
1616 'code-no-repo' => 'No repository configured!',
 17+ 'code-comments' => 'review notes',
 18+ 'code-authors' => 'authors',
 19+ 'code-tags' => 'tags',
 20+ 'code-authors-text' => 'Below is a list of repo authors in order of recent commits.',
1721 'code-author-haslink' => 'This author is linked to the wiki user $1',
1822 'code-author-orphan' => 'This author has no link with a wiki account',
1923 'code-author-dolink' => 'Link this author to a wiki user:',
@@ -25,10 +29,12 @@
2630 'code-author-unlinksuccess' => 'Author $1 has been unlinked',
2731 'code-field-id' => 'Revision',
2832 'code-field-author' => 'Author',
29 - 'code-field-message' => 'Comment',
 33+ 'code-field-user' => 'Commentor',
 34+ 'code-field-message' => 'Summary',
3035 'code-field-status' => 'Status',
3136 'code-field-timestamp' => 'Date',
3237 'code-field-comments' => 'Notes',
 38+ 'code-field-text' => 'Note',
3339 'code-rev-author' => 'Author:',
3440 'code-rev-message' => 'Comment:',
3541 'code-rev-repo' => 'Repository:',
@@ -73,6 +79,8 @@
7480 'right-codereview-remove-tag' => 'Remove tags from revisions',
7581 'right-codereview-post-comment' => 'Add comments on revisions',
7682 'right-codereview-set-status' => 'Change revisions status',
 83+
 84+ 'specialpages-group-developer' => 'Developer tools',
7785 );
7886
7987 /** Arabic (العربية)
Index: trunk/extensions/CodeReview/SpecialCode.php
@@ -34,14 +34,17 @@
3535 $view = new CodeRevisionView( $params[0], $params[1] );
3636 break;
3737 } else if( $params[1] === 'tag' ) {
38 - $view = new CodeRevisionTagListView( $params[0] );
 38+ $view = new CodeTagListView( $params[0] );
3939 break;
4040 } elseif( $params[1] === 'author' ) {
41 - $view = new CodeRevisionAuthorListView( $params[0] );
 41+ $view = new CodeAuthorListView( $params[0] );
4242 break;
4343 } elseif( $params[1] === 'status' ) {
44 - $view = new CodeRevisionStatusListView( $params[0] );
 44+ $view = new CodeStatusListView( $params[0] );
4545 break;
 46+ } elseif( $params[1] === 'comments' ) {
 47+ $view = new CodeCommentsListView( $params[0] );
 48+ break;
4649 } else {
4750 $view = new CodeRevisionView( $params[0], $params[1] );
4851 break;
Index: trunk/extensions/CodeReview/CodeAuthorListView.php
@@ -0,0 +1,22 @@
 2+<?php
 3+
 4+// Special:Code/MediaWiki/author
 5+class CodeAuthorListView extends CodeView {
 6+ function __construct( $repoName ) {
 7+ parent::__construct();
 8+ $this->mRepo = CodeRepository::newFromName( $repoName );
 9+ }
 10+
 11+ function execute() {
 12+ global $wgOut;
 13+ $authors = $this->mRepo->getAuthorList();
 14+ $name = $this->mRepo->getName();
 15+ $text = wfMsg( 'code-authors-text' ) . "\n";
 16+ foreach( $authors as $user ) {
 17+ if( $user )
 18+ $text .= "* [[Special:Code/$name/author/$user|$user]]\n";
 19+ }
 20+ $wgOut->addWikiText( $text );
 21+ }
 22+}
 23+
Property changes on: trunk/extensions/CodeReview/CodeAuthorListView.php
___________________________________________________________________
Added: svn:eol-style
124 + native
Index: trunk/extensions/CodeReview/CodeRepoListView.php
@@ -13,7 +13,11 @@
1414 $text = '';
1515 foreach( $repos as $repo ){
1616 $name = $repo->getName();
17 - $text .= "* [[Special:Code/$name|$name]]\n";
 17+ $text .= "* '''[[Special:Code/$name|$name]]''' (";
 18+ $text .= "[[Special:Code/$name/comments|".wfMsgHtml( 'code-comments' )."]]";
 19+ $text .= " | [[Special:Code/$name/tag|".wfMsgHtml( 'code-tags' )."]]";
 20+ $text .= " | [[Special:Code/$name/author|".wfMsgHtml( 'code-authors' )."]]";
 21+ $text .= ")\n";
1822 }
1923 $wgOut->addWikiText( $text );
2024 }

Status & tagging log