r53520 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53519‎ | r53520 | r53521 >
Date:02:40, 20 July 2009
Author:aaron
Status:ok
Tags:
Comment:
bug 18480 Status change feed for CodeReview
Modified paths:
  • /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/CodeStatusChangeListView.php (added) (history)
  • /trunk/extensions/CodeReview/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -17,13 +17,16 @@
1818 'code-change-tags' => 'changed the \'\'\'tags\'\'\' for r$1',
1919 'code-change-removed' => 'removed:',
2020 'code-change-added' => 'added:',
 21+ 'code-old-status' => 'Old status',
 22+ 'code-new-status' => 'New status',
2123 'code-prop-changes' => 'Status & tagging log',
2224 'code-desc' => '[[Special:Code|Code review tool]] with [[Special:RepoAdmin|Subversion support]]',
2325 'code-no-repo' => 'No repository configured!',
2426 'code-load-diff' => 'Loading diff…',
2527 'code-notes' => 'recent comments',
 28+ 'code-statuschanges' => 'status changes',
2629 'code-authors' => 'authors',
27 - 'code-status' => 'status',
 30+ 'code-status' => 'states',
2831 'code-tags' => 'tags',
2932 'code-authors-text' => 'Below is a list of repo authors in order of recent commits.',
3033 'code-author-haslink' => 'This author is linked to the wiki user $1',
Index: trunk/extensions/CodeReview/SpecialCode.php
@@ -42,6 +42,9 @@
4343 } elseif ( $params[1] === 'comments' ) {
4444 $view = new CodeCommentsListView( $params[0] );
4545 break;
 46+ } elseif ( $params[1] === 'statuschanges' ) {
 47+ $view = new CodeStatusChangeListView( $params[0] );
 48+ break;
4649 } elseif ( $params[1] === 'releasenotes' ) {
4750 $view = new CodeReleaseNotes( $params[0] );
4851 break;
Index: trunk/extensions/CodeReview/CodeStatusChangeListView.php
@@ -0,0 +1,113 @@
 2+<?php
 3+
 4+// Special:Code/MediaWiki
 5+class CodeStatusChangeListView extends CodeView {
 6+ public $mRepo;
 7+
 8+ function __construct( $repoName ) {
 9+ parent::__construct();
 10+ $this->mRepo = CodeRepository::newFromName( $repoName );
 11+ }
 12+
 13+ function execute() {
 14+ global $wgOut;
 15+ $pager = $this->getPager();
 16+ $wgOut->addHTML(
 17+ $pager->getNavigationBar() .
 18+ $pager->getLimitForm() .
 19+ $pager->getBody() .
 20+ $pager->getNavigationBar()
 21+ );
 22+ }
 23+
 24+ function getPager() {
 25+ return new CodeStatusChangeTablePager( $this );
 26+ }
 27+ function getRepo() {
 28+ return $this->mRepo;
 29+ }
 30+}
 31+
 32+// Pager for CodeRevisionListView
 33+class CodeStatusChangeTablePager extends TablePager {
 34+
 35+ function __construct( CodeStatusChangeListView $view ) {
 36+ global $IP;
 37+ $this->mView = $view;
 38+ $this->mRepo = $view->mRepo;
 39+ $this->mDefaultDirection = true;
 40+ $this->mCurSVN = SpecialVersion::getSvnRevision( $IP );
 41+ parent::__construct();
 42+ }
 43+
 44+ function isFieldSortable( $field ) {
 45+ return $field == 'cpc_timestamp';
 46+ }
 47+
 48+ function getDefaultSort() { return 'cpc_timestamp'; }
 49+
 50+ function getQueryInfo() {
 51+ return array(
 52+ 'tables' => array( 'code_prop_changes', 'code_rev' ),
 53+ 'fields' => array_keys( $this->getFieldNames() ),
 54+ 'conds' => array( 'cpc_repo_id' => $this->mRepo->getId() ),
 55+ 'join_conds' => array(
 56+ 'code_rev' => array( 'LEFT JOIN', 'cpc_repo_id = cr_repo_id AND cpc_rev_id = cr_id' )
 57+ )
 58+ );
 59+ }
 60+
 61+ function getFieldNames() {
 62+ return array(
 63+ 'cpc_timestamp' => wfMsg( 'code-field-timestamp' ),
 64+ 'cpc_user_text' => wfMsg( 'code-field-user' ),
 65+ 'cpc_rev_id' => wfMsg( 'code-field-id' ),
 66+ 'cpc_removed' => wfMsg( 'code-field-text' ),
 67+ 'cpc_removed' => wfMsg( 'code-old-status' ),
 68+ 'cpc_added' => wfMsg( 'code-new-status' ),
 69+ 'cr_status' => wfMsg( 'code-field-status' ),
 70+ );
 71+ }
 72+
 73+ function formatValue( $name, $value ) {
 74+ global $wgUser, $wgLang;
 75+ switch( $name ) {
 76+ case 'cpc_rev_id':
 77+ return $this->mView->mSkin->link(
 78+ SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $value . '#code-changes' ),
 79+ htmlspecialchars( $value ) );
 80+ case 'cr_status':
 81+ return $this->mView->mSkin->link(
 82+ SpecialPage::getTitleFor( 'Code',
 83+ $this->mRepo->getName() . '/status/' . $value ),
 84+ htmlspecialchars( $this->mView->statusDesc( $value ) ) );
 85+ case 'cpc_user_text':
 86+ return $this->mView->mSkin->userLink( -1, $value );
 87+ case 'cpc_removed':
 88+ return wfMsgHtml( $value ? "code-status-$value" : "code-status-new" );
 89+ case 'cpc_added':
 90+ return wfMsgHtml( "code-status-$value" );
 91+ case 'cpc_timestamp':
 92+ global $wgLang;
 93+ return $wgLang->timeanddate( $value, true );
 94+ }
 95+ }
 96+
 97+ // Note: this function is poorly factored in the parent class
 98+ function formatRow( $row ) {
 99+ global $wgWikiSVN;
 100+ $class = "mw-codereview-status-{$row->cr_status}";
 101+ if ( $this->mRepo->mName == $wgWikiSVN ) {
 102+ $class .= " mw-codereview-" . ( $row->cpc_rev_id <= $this->mCurSVN ? 'live' : 'notlive' );
 103+ }
 104+ return str_replace(
 105+ '<tr>',
 106+ Xml::openElement( 'tr',
 107+ array( 'class' => $class ) ),
 108+ parent::formatRow( $row ) );
 109+ }
 110+
 111+ function getTitle() {
 112+ return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/statuschanges' );
 113+ }
 114+}
Index: trunk/extensions/CodeReview/CodeRepoListView.php
@@ -22,9 +22,10 @@
2323 global $wgLang;
2424 $text = "'''[[Special:Code/$name|$name]]''' (";
2525 $links[] = "[[Special:Code/$name/comments|" . wfMsgHtml( 'code-notes' ) . "]]";
26 - $links[] = "[[Special:Code/$name/status|" . wfMsgHtml( 'code-status' ) . "]]";
 26+ $links[] = "[[Special:Code/$name/statuschanges|" . wfMsgHtml( 'code-statuschanges' ) . "]]";
2727 $links[] = "[[Special:Code/$name/tag|" . wfMsgHtml( 'code-tags' ) . "]]";
2828 $links[] = "[[Special:Code/$name/author|" . wfMsgHtml( 'code-authors' ) . "]]";
 29+ $links[] = "[[Special:Code/$name/status|" . wfMsgHtml( 'code-status' ) . "]]";
2930 $links[] = "[[Special:Code/$name/releasenotes|" . wfMsgHtml( 'code-releasenotes' ) . "]]";
3031 $text .= $wgLang->pipeList( $links );
3132 $text .= ")";
Index: trunk/extensions/CodeReview/CodeReview.php
@@ -40,10 +40,13 @@
4141 $wgAutoloadClasses['ApiCodeUpdate'] = $dir . 'ApiCodeUpdate.php';
4242 $wgAutoloadClasses['ApiCodeDiff'] = $dir . 'ApiCodeDiff.php';
4343 $wgAutoloadClasses['ApiCodeComments'] = $dir . 'ApiCodeComments.php';
 44+
4445 $wgAutoloadClasses['CodeDiffHighlighter'] = $dir . 'DiffHighlighter.php';
4546 $wgAutoloadClasses['CodeRepository'] = $dir . 'CodeRepository.php';
4647 $wgAutoloadClasses['CodeRepoListView'] = $dir . 'CodeRepoListView.php';
4748 $wgAutoloadClasses['CodeRevision'] = $dir . 'CodeRevision.php';
 49+$wgAutoloadClasses['SubversionAdaptor'] = $dir . 'Subversion.php';
 50+
4851 $wgAutoloadClasses['CodeRevisionAuthorView'] = $dir . 'CodeRevisionAuthorView.php';
4952 $wgAutoloadClasses['CodeRevisionAuthorLink'] = $dir . 'CodeRevisionAuthorLink.php';
5053 $wgAutoloadClasses['CodeRevisionListView'] = $dir . 'CodeRevisionListView.php';
@@ -55,13 +58,13 @@
5659 $wgAutoloadClasses['CodeStatusListView'] = $dir . 'CodeStatusListView.php';
5760 $wgAutoloadClasses['CodeTagListView'] = $dir . 'CodeTagListView.php';
5861 $wgAutoloadClasses['CodeCommentsListView'] = $dir . 'CodeCommentsListView.php';
 62+$wgAutoloadClasses['CodeStatusChangeListView'] = $dir . 'CodeStatusChangeListView.php';
5963 $wgAutoloadClasses['CodeReleaseNotes'] = $dir . 'CodeReleaseNotes.php';
6064 $wgAutoloadClasses['CodeComment'] = $dir . 'CodeComment.php';
6165 $wgAutoloadClasses['CodePropChange'] = $dir . 'CodePropChange.php';
6266 $wgAutoloadClasses['SpecialCode'] = $dir . 'SpecialCode.php';
6367 $wgAutoloadClasses['CodeView'] = $dir . 'SpecialCode.php';
6468 $wgAutoloadClasses['SpecialRepoAdmin'] = $dir . 'SpecialRepoAdmin.php';
65 -$wgAutoloadClasses['SubversionAdaptor'] = $dir . 'Subversion.php';
6669
6770 $wgSpecialPages['Code'] = 'SpecialCode';
6871 $wgSpecialPageGroups['Code'] = 'developer';

Status & tagging log