Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionHistoryController.php
<?php | <?php | ||||
final class DiffusionHistoryController extends DiffusionController { | final class DiffusionHistoryController extends DiffusionController { | ||||
public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
return true; | return true; | ||||
} | } | ||||
protected function processDiffusionRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$drequest = $this->diffusionRequest; | $response = $this->loadDiffusionContext(); | ||||
$viewer = $request->getUser(); | if ($response) { | ||||
return $response; | |||||
} | |||||
$viewer = $this->getViewer(); | |||||
$drequest = $this->getDiffusionRequest(); | |||||
$repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
$page_size = $request->getInt('pagesize', 100); | $pager = id(new PHUIPagerView()) | ||||
$offset = $request->getInt('offset', 0); | ->readFromRequest($request); | ||||
$params = array( | $params = array( | ||||
'commit' => $drequest->getCommit(), | 'commit' => $drequest->getCommit(), | ||||
'path' => $drequest->getPath(), | 'path' => $drequest->getPath(), | ||||
'offset' => $offset, | 'offset' => $pager->getOffset(), | ||||
'limit' => $page_size + 1, | 'limit' => $pager->getPageSize() + 1, | ||||
); | ); | ||||
if (!$request->getBool('copies')) { | if (!$request->getBool('copies')) { | ||||
$params['needDirectChanges'] = true; | $params['needDirectChanges'] = true; | ||||
$params['needChildChanges'] = true; | $params['needChildChanges'] = true; | ||||
} | } | ||||
$history_results = $this->callConduitWithDiffusionRequest( | $history_results = $this->callConduitWithDiffusionRequest( | ||||
'diffusion.historyquery', | 'diffusion.historyquery', | ||||
$params); | $params); | ||||
$history = DiffusionPathChange::newFromConduit( | $history = DiffusionPathChange::newFromConduit( | ||||
$history_results['pathChanges']); | $history_results['pathChanges']); | ||||
$pager = new PHUIPagerView(); | |||||
$pager->setPageSize($page_size); | |||||
$pager->setOffset($offset); | |||||
$history = $pager->sliceResults($history); | $history = $pager->sliceResults($history); | ||||
$pager->setURI($request->getRequestURI(), 'offset'); | |||||
$show_graph = !strlen($drequest->getPath()); | $show_graph = !strlen($drequest->getPath()); | ||||
$content = array(); | $content = array(); | ||||
$history_table = id(new DiffusionHistoryTableView()) | $history_table = id(new DiffusionHistoryTableView()) | ||||
->setUser($request->getUser()) | ->setUser($request->getUser()) | ||||
->setDiffusionRequest($drequest) | ->setDiffusionRequest($drequest) | ||||
->setHistory($history); | ->setHistory($history); | ||||
$history_table->loadRevisions(); | $history_table->loadRevisions(); | ||||
if ($show_graph) { | if ($show_graph) { | ||||
$history_table->setParents($history_results['parents']); | $history_table->setParents($history_results['parents']); | ||||
$history_table->setIsHead($offset == 0); | $history_table->setIsHead(!$pager->getOffset()); | ||||
} | } | ||||
$history_panel = new PHUIObjectBoxView(); | $history_panel = new PHUIObjectBoxView(); | ||||
$history_panel->setHeaderText(pht('History')); | $history_panel->setHeaderText(pht('History')); | ||||
$history_panel->setTable($history_table); | $history_panel->setTable($history_table); | ||||
$content[] = $history_panel; | $content[] = $history_panel; | ||||
Show All 11 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$crumbs = $this->buildCrumbs( | $crumbs = $this->buildCrumbs( | ||||
array( | array( | ||||
'branch' => true, | 'branch' => true, | ||||
'path' => true, | 'path' => true, | ||||
'view' => 'history', | 'view' => 'history', | ||||
)); | )); | ||||
$pager = id(new PHUIBoxView()) | $pager_box = $this->renderTablePagerBox($pager); | ||||
->addClass('ml') | |||||
->appendChild($pager); | |||||
return $this->buildApplicationPage( | return $this->newPage() | ||||
->setTitle( | |||||
array( | |||||
pht('History'), | |||||
$repository->getDisplayName(), | |||||
)) | |||||
->setCrumbs($crumbs) | |||||
->appendChild( | |||||
array( | array( | ||||
$crumbs, | |||||
$object_box, | $object_box, | ||||
$content, | $content, | ||||
$pager, | $pager_box, | ||||
), | |||||
array( | |||||
'title' => array( | |||||
pht('History'), | |||||
$drequest->getRepository()->getDisplayName(), | |||||
), | |||||
)); | )); | ||||
} | } | ||||
private function buildActionView(DiffusionRequest $drequest) { | private function buildActionView(DiffusionRequest $drequest) { | ||||
$viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
$view = id(new PhabricatorActionListView()) | $view = id(new PhabricatorActionListView()) | ||||
->setUser($viewer); | ->setUser($viewer); | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |