Index: trunk/extensions/CodeReview/CodeRevisionListView.php |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | } |
76 | 76 | |
77 | 77 | function getDefaultSort() { |
78 | | - return strlen( $this->getSVNPath() ) ? 'cp_rev_id' : 'cr_id'; |
| 78 | + return strlen( $this->mView->mPath ) ? 'cp_rev_id' : 'cr_id'; |
79 | 79 | } |
80 | 80 | |
81 | 81 | function getQueryInfo() { |
— | — | @@ -126,8 +126,10 @@ |
127 | 127 | 'cr_timestamp' => wfMsg( 'code-field-timestamp' ), |
128 | 128 | ); |
129 | 129 | } |
130 | | - |
131 | | - function formatValue( $name, $value ) { |
| 130 | + |
| 131 | + function formatValue( $name, $value ) {} // unused |
| 132 | + |
| 133 | + function formatRevValue( $name, $value, $row ) { |
132 | 134 | global $wgUser, $wgLang; |
133 | 135 | switch( $name ) { |
134 | 136 | case 'cp_rev_id': |
— | — | @@ -137,9 +139,9 @@ |
138 | 140 | htmlspecialchars( $value ) ); |
139 | 141 | case 'cr_status': |
140 | 142 | return $this->mView->mSkin->link( |
141 | | - SpecialPage::getTitleFor( 'Code', |
142 | | - $this->mRepo->getName() . '/status/' . $value ), |
143 | | - htmlspecialchars( $this->mView->statusDesc( $value ) ) ); |
| 143 | + SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/status/' . $value ), |
| 144 | + htmlspecialchars( $this->mView->statusDesc( $value ) ) |
| 145 | + ); |
144 | 146 | case 'cr_author': |
145 | 147 | return $this->mView->authorLink( $value ); |
146 | 148 | case 'cr_message': |
— | — | @@ -148,7 +150,13 @@ |
149 | 151 | global $wgLang; |
150 | 152 | return $wgLang->timeanddate( $value, true ); |
151 | 153 | case 'comments': |
152 | | - return intval( $value ); |
| 154 | + if( $value ) { |
| 155 | + $special = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName().'/'.$row->{$this->getDefaultSort()} ); |
| 156 | + $special->setFragment( '#code-comments' ); |
| 157 | + return $this->mView->mSkin->link( $special, htmlspecialchars( $value ) ); |
| 158 | + } else { |
| 159 | + return intval( $value ); |
| 160 | + } |
153 | 161 | case 'cr_path': |
154 | 162 | return Xml::element('div', array( 'title' => (string)$value ), |
155 | 163 | $wgLang->truncate( (string)$value, 30 ) ); |
— | — | @@ -158,14 +166,28 @@ |
159 | 167 | // Note: this function is poorly factored in the parent class |
160 | 168 | function formatRow( $row ) { |
161 | 169 | global $wgWikiSVN; |
| 170 | + $rowClass = $this->getRowClass( $row ); |
162 | 171 | $css = "mw-codereview-status-{$row->cr_status}"; |
163 | 172 | if( $this->mRepo->mName == $wgWikiSVN ) { |
164 | 173 | $css .= " mw-codereview-" . ( $row->{$this->getDefaultSort()} <= $this->mCurSVN ? 'live' : 'notlive' ); |
165 | 174 | } |
166 | | - return str_replace( '<tr>', Xml::openElement( 'tr', array( 'class' => $css ) ), |
167 | | - parent::formatRow( $row ) ); |
| 175 | + $s = "<tr class=\"$css\">\n"; |
| 176 | + // Some of this stolen from Pager.php...sigh |
| 177 | + $fieldNames = $this->getFieldNames(); |
| 178 | + $this->mCurrentRow = $row; # In case formatValue needs to know |
| 179 | + foreach( $fieldNames as $field => $name ) { |
| 180 | + $value = isset( $row->$field ) ? $row->$field : null; |
| 181 | + $formatted = strval( $this->formatRevValue( $field, $value, $row ) ); |
| 182 | + if( $formatted == '' ) { |
| 183 | + $formatted = ' '; |
| 184 | + } |
| 185 | + $class = 'TablePager_col_' . htmlspecialchars( $field ); |
| 186 | + $s .= "<td class=\"$class\">$formatted</td>\n"; |
| 187 | + } |
| 188 | + $s .= "</tr>\n"; |
| 189 | + return $s; |
168 | 190 | } |
169 | | - |
| 191 | + |
170 | 192 | function getTitle() { |
171 | 193 | return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ); |
172 | 194 | } |