r54210 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54209‎ | r54210 | r54211 >
Date:14:48, 2 August 2009
Author:aaron
Status:ok
Tags:
Comment:
Fixed CSS for some of the table pagers
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeCommentsListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeStatusChangeListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeCommentsListView.php
@@ -29,17 +29,8 @@
3030 }
3131
3232 // Pager for CodeRevisionListView
33 -class CodeCommentsTablePager extends TablePager {
 33+class CodeCommentsTablePager extends SvnTablePager {
3434
35 - function __construct( CodeCommentsListView $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 -
4435 function isFieldSortable( $field ) {
4536 return $field == 'cr_timestamp';
4637 }
@@ -93,20 +84,6 @@
9485 }
9586 }
9687
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->cc_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 -
11188 function getTitle() {
11289 return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/comments' );
11390 }
Index: trunk/extensions/CodeReview/ui/CodeStatusChangeListView.php
@@ -29,17 +29,8 @@
3030 }
3131
3232 // Pager for CodeRevisionListView
33 -class CodeStatusChangeTablePager extends TablePager {
 33+class CodeStatusChangeTablePager extends SvnTablePager {
3434
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 -
4435 function isFieldSortable( $field ) {
4536 return $field == 'cpc_timestamp';
4637 }
@@ -92,20 +83,6 @@
9384 }
9485 }
9586
96 - // Note: this function is poorly factored in the parent class
97 - function formatRow( $row ) {
98 - global $wgWikiSVN;
99 - $class = "mw-codereview-status-{$row->cr_status}";
100 - if ( $this->mRepo->mName == $wgWikiSVN ) {
101 - $class .= " mw-codereview-" . ( $row->cpc_rev_id <= $this->mCurSVN ? 'live' : 'notlive' );
102 - }
103 - return str_replace(
104 - '<tr>',
105 - Xml::openElement( 'tr',
106 - array( 'class' => $class ) ),
107 - parent::formatRow( $row ) );
108 - }
109 -
11087 function getTitle() {
11188 return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/statuschanges' );
11289 }
Index: trunk/extensions/CodeReview/ui/SpecialCode.php
@@ -174,6 +174,46 @@
175175 }
176176 }
177177
 178+abstract class SvnTablePager extends TablePager {
 179+
 180+ function __construct( $view ) {
 181+ global $IP;
 182+ $this->mView = $view;
 183+ $this->mRepo = $view->mRepo;
 184+ $this->mDefaultDirection = true;
 185+ $this->mCurSVN = SpecialVersion::getSvnRevision( $IP );
 186+ parent::__construct();
 187+ }
 188+
 189+ function isFieldSortable( $field ) {
 190+ return $field == $this->getDefaultSort();
 191+ }
 192+
 193+ // Note: this function is poorly factored in the parent class
 194+ function formatRow( $row ) {
 195+ global $wgWikiSVN;
 196+ $css = "mw-codereview-status-{$row->cr_status}";
 197+ if ( $this->mRepo->mName == $wgWikiSVN ) {
 198+ $css .= " mw-codereview-" . ( $row-> { $this->getDefaultSort() } <= $this->mCurSVN ? 'live' : 'notlive' );
 199+ }
 200+ $s = "<tr class=\"$css\">\n";
 201+ // Some of this stolen from Pager.php...sigh
 202+ $fieldNames = $this->getFieldNames();
 203+ $this->mCurrentRow = $row; # In case formatValue needs to know
 204+ foreach ( $fieldNames as $field => $name ) {
 205+ $value = isset( $row->$field ) ? $row->$field : null;
 206+ $formatted = strval( $this->formatValue( $field, $value, $row ) );
 207+ if ( $formatted == '' ) {
 208+ $formatted = '&nbsp;';
 209+ }
 210+ $class = 'TablePager_col_' . htmlspecialchars( $field );
 211+ $s .= "<td class=\"$class\">$formatted</td>\n";
 212+ }
 213+ $s .= "</tr>\n";
 214+ return $s;
 215+ }
 216+}
 217+
178218 class CodeCommentLinker {
179219 function __construct( $repo ) {
180220 global $wgUser;
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -149,17 +149,8 @@
150150 }
151151
152152 // Pager for CodeRevisionListView
153 -class SvnRevTablePager extends TablePager {
 153+class SvnRevTablePager extends SvnTablePager {
154154
155 - function __construct( $view ) {
156 - global $IP;
157 - $this->mView = $view;
158 - $this->mRepo = $view->mRepo;
159 - $this->mDefaultDirection = true;
160 - $this->mCurSVN = SpecialVersion::getSvnRevision( $IP );
161 - parent::__construct();
162 - }
163 -
164155 function getSVNPath() {
165156 return $this->mView->mPath;
166157 }

Status & tagging log