1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +01:00

Paginate Diffusion history views, respect 'pagesize' parameter.

This commit is contained in:
epriestley 2011-03-31 18:46:53 -07:00
parent f76c3bbc22
commit 3369147cab
4 changed files with 22 additions and 3 deletions

View file

@ -20,12 +20,28 @@ class DiffusionHistoryController extends DiffusionController {
public function processRequest() {
$drequest = $this->diffusionRequest;
$request = $this->getRequest();
$page_size = $request->getInt('pagesize', 100);
$offset = $request->getInt('page', 0);
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest(
$drequest);
$history_query->setOffset($offset);
$history_query->setLimit($page_size + 1);
$history = $history_query->loadHistory();
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
if (count($history) == $page_size + 1) {
array_pop($history);
$pager->setHasMorePages(true);
} else {
$pager->setHasMorePages(false);
}
$pager->setURI($request->getRequestURI(), 'page');
$content = array();
$content[] = $this->buildCrumbs(
@ -41,6 +57,7 @@ class DiffusionHistoryController extends DiffusionController {
$history_panel = new AphrontPanelView();
$history_panel->appendChild($history_table);
$history_panel->appendChild($pager);
$content[] = $history_panel;

View file

@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
phutil_require_module('phabricator', 'applications/diffusion/query/history/base');
phutil_require_module('phabricator', 'applications/diffusion/view/historytable');
phutil_require_module('phabricator', 'view/control/pager');
phutil_require_module('phabricator', 'view/layout/panel');

View file

@ -43,11 +43,12 @@ final class DiffusionSvnHistoryQuery extends DiffusionHistoryQuery {
'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d
AND commitSequence <= %d
ORDER BY commitSequence DESC
LIMIT %d',
LIMIT %d, %d',
PhabricatorRepository::TABLE_PATHCHANGE,
$repository->getID(),
$path_id,
$commit ? $commit : 0x7FFFFFFF,
$this->getOffset(),
$this->getLimit());
$commits = array();

View file

@ -34,7 +34,7 @@ class PhabricatorUser extends PhabricatorUserDAO {
protected $conduitCertificate;
protected $preferences = null;
private $preferences = null;
public function getProfileImagePHID() {
return nonempty(