Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php |
— | — | @@ -43,6 +43,10 @@ |
44 | 44 | |
45 | 45 | parent::execute(); |
46 | 46 | } |
| 47 | + |
| 48 | + function getSpecializedWhereClause($dbr) { |
| 49 | + return ' AND cr_author = ' . $dbr->addQuotes($this->mAuthor); |
| 50 | + } |
47 | 51 | |
48 | 52 | } |
49 | 53 | |
Index: trunk/extensions/CodeReview/ui/SpecialCode.php |
— | — | @@ -20,13 +20,13 @@ |
21 | 21 | $wgOut->addStyle( "$wgScriptPath/extensions/CodeReview/codereview.css?$wgCodeReviewStyleVersion" ); |
22 | 22 | # Remove stray slashes |
23 | 23 | $subpage = preg_replace( '/\/$/', '', $subpage ); |
24 | | - |
25 | 24 | if ( $subpage == '' ) { |
26 | 25 | $view = new CodeRepoListView(); |
27 | 26 | } else { |
28 | 27 | $params = explode( '/', $subpage ); |
29 | 28 | switch( count( $params ) ) { |
30 | 29 | case 1: |
| 30 | + echo "WHY ARE WE HERE "; |
31 | 31 | $view = new CodeRevisionListView( $params[0] ); |
32 | 32 | break; |
33 | 33 | case 2: |
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | return $wgRequest->wasPosted() |
121 | 121 | && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) |
122 | 122 | && $wgUser->isAllowed( $permission ); |
123 | | - } |
| 123 | + } |
124 | 124 | |
125 | 125 | abstract function execute(); |
126 | 126 | |
— | — | @@ -131,10 +131,10 @@ |
132 | 132 | return $this->mRepo->authorWikiUser( $author ); |
133 | 133 | } |
134 | 134 | |
135 | | - function authorLink( $author ) { |
| 135 | + function authorLink( $author, $extraParams=array() ) { |
136 | 136 | $repo = $this->mRepo->getName(); |
137 | | - $special = SpecialPage::getTitleFor( 'Code', "$repo/author/$author" ); |
138 | | - return $this->mSkin->link( $special, htmlspecialchars( $author ) ); |
| 137 | + $special = SpecialPage::getTitleFor( 'Code', "$repo/author/$author" ); |
| 138 | + return $this->mSkin->link( $special, htmlspecialchars( $author ), array(), $extraParams); |
139 | 139 | } |
140 | 140 | |
141 | 141 | function statusDesc( $status ) { |
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -28,8 +28,18 @@ |
29 | 29 | $this->doBatchChange(); |
30 | 30 | return; |
31 | 31 | } |
32 | | - |
| 32 | + |
33 | 33 | $this->showForm(); |
| 34 | + |
| 35 | + //get the total count across all pages |
| 36 | + $dbr =& wfGetDB(DB_SLAVE); |
| 37 | + $revCountRes = $this->getRevCountQuery($dbr); |
| 38 | + $revCount = 0; |
| 39 | + if ($dbr->numRows($revCountRes) > 0){ |
| 40 | + $row = $dbr->fetchObject($revCountRes); |
| 41 | + $revCount = $row->rev_count; |
| 42 | + } |
| 43 | + |
34 | 44 | $pager = $this->getPager(); |
35 | 45 | |
36 | 46 | // Build batch change interface as needed |
— | — | @@ -37,11 +47,15 @@ |
38 | 48 | $wgUser->isAllowed( 'codereview-add-tag' ); |
39 | 49 | |
40 | 50 | $wgOut->addHTML( |
| 51 | + '<table><tr><td>' . |
41 | 52 | $pager->getNavigationBar() . |
42 | 53 | $pager->getLimitForm() . |
| 54 | + '</td><td style="padding-left: 2em;">' . |
| 55 | + ' Total number of results: <span style="font-weight: bold;">' . $revCount . '</span>' . |
| 56 | + '</td></tr></table>' . |
43 | 57 | Xml::openElement( 'form', |
44 | 58 | array( 'action' => $pager->getTitle()->getLocalURL(), 'method' => 'post' ) |
45 | | - ) . |
| 59 | + ) . |
46 | 60 | $pager->getBody() . |
47 | 61 | $pager->getNavigationBar() . |
48 | 62 | ( $this->batchForm ? $this->buildBatchInterface( $pager ) : "" ) . |
— | — | @@ -146,6 +160,33 @@ |
147 | 161 | function getPager() { |
148 | 162 | return new SvnRevTablePager( $this ); |
149 | 163 | } |
| 164 | + |
| 165 | + function getRevCountQuery($dbr) { |
| 166 | + $sql = 'SELECT COUNT(cr_id) AS rev_count' . |
| 167 | + ' FROM ' . $dbr->tableName('code_rev') . ' '; |
| 168 | + // count if code_rev where path matches |
| 169 | + if ( $this->mPath ) { |
| 170 | + $sql .= ' WHERE cr_id in' . |
| 171 | + ' (SELECT cp_rev_id from code_paths' . |
| 172 | + ' WHERE' . |
| 173 | + ' cp_repo_id = ' . $this->mRepo->getId(). ' AND' . |
| 174 | + ' cp_path LIKE ' . $dbr->addQuotes( $this->mPath . '%') . ' AND' . |
| 175 | + // performance |
| 176 | + ' cp_rev_id > ' . ($this->mRepo->getLastStoredRev() - 20000) . |
| 177 | + $this->getSpecializedWhereClause($dbr) . |
| 178 | + ')'; |
| 179 | + // No path; count of code_rev |
| 180 | + } else { |
| 181 | + $sql .= ' WHERE cr_repo_id = ' . $this->mRepo->getId() . |
| 182 | + $this->getSpecializedWhereClause($dbr); |
| 183 | + } |
| 184 | + return $dbr->query($sql); |
| 185 | + } |
| 186 | + |
| 187 | + function getSpecializedWhereClause($dbr) { |
| 188 | + return ''; |
| 189 | + } |
| 190 | + |
150 | 191 | } |
151 | 192 | |
152 | 193 | // Pager for CodeRevisionListView |
— | — | @@ -225,11 +266,13 @@ |
226 | 267 | } |
227 | 268 | return $fields; |
228 | 269 | } |
229 | | - |
| 270 | + |
230 | 271 | function formatValue( $name, $value ) { } // unused |
231 | 272 | |
232 | 273 | function formatRevValue( $name, $value, $row ) { |
233 | 274 | global $wgUser, $wgLang; |
| 275 | + $pathQuery = (empty($this->mView->mPath)) ? array() : array('path' => $this->mView->mPath); |
| 276 | + |
234 | 277 | switch( $name ) { |
235 | 278 | case 'selectforchange': |
236 | 279 | $sort = $this->getDefaultSort(); |
— | — | @@ -245,10 +288,12 @@ |
246 | 289 | case 'cr_status': |
247 | 290 | return $this->mView->mSkin->link( |
248 | 291 | SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/status/' . $value ), |
249 | | - htmlspecialchars( $this->mView->statusDesc( $value ) ) |
| 292 | + htmlspecialchars( $this->mView->statusDesc( $value ) ), |
| 293 | + array(), |
| 294 | + $pathQuery |
250 | 295 | ); |
251 | 296 | case 'cr_author': |
252 | | - return $this->mView->authorLink( $value ); |
| 297 | + return $this->mView->authorLink( $value, $pathQuery ); |
253 | 298 | case 'cr_message': |
254 | 299 | return $this->mView->messageFragment( $value ); |
255 | 300 | case 'cr_timestamp': |
Index: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php |
— | — | @@ -9,6 +9,10 @@ |
10 | 10 | function getPager() { |
11 | 11 | return new SvnRevStatusTablePager( $this, $this->mStatus ); |
12 | 12 | } |
| 13 | + |
| 14 | + function getSpecializedWhereClause($dbr) { |
| 15 | + return ' AND cr_status = ' . $dbr->addQuotes($this->mStatus); |
| 16 | + } |
13 | 17 | } |
14 | 18 | |
15 | 19 | class SvnRevStatusTablePager extends SvnRevTablePager { |