public function browseDirectory(DiffusionBrowseResultSet $results, PHUIPagerView $pager)
 {
     $request = $this->getRequest();
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     $reason = $results->getReasonForEmptyResultSet();
     $content = array();
     $actions = $this->buildActionView($drequest);
     $properties = $this->buildPropertyView($drequest, $actions);
     $object_box = id(new PHUIObjectBoxView())->setHeader($this->buildHeaderView($drequest))->addPropertyList($properties);
     $content[] = $object_box;
     $content[] = $this->renderSearchForm($collapsed = true);
     if (!$results->isValidResults()) {
         $empty_result = new DiffusionEmptyResultView();
         $empty_result->setDiffusionRequest($drequest);
         $empty_result->setDiffusionBrowseResultSet($results);
         $empty_result->setView($request->getStr('view'));
         $content[] = $empty_result;
     } else {
         $phids = array();
         foreach ($results->getPaths() as $result) {
             $data = $result->getLastCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
             }
         }
         $phids = array_keys($phids);
         $handles = $this->loadViewerHandles($phids);
         $browse_table = new DiffusionBrowseTableView();
         $browse_table->setDiffusionRequest($drequest);
         $browse_table->setHandles($handles);
         $browse_table->setPaths($results->getPaths());
         $browse_table->setUser($request->getUser());
         $browse_panel = new PHUIObjectBoxView();
         $browse_panel->setHeaderText($drequest->getPath(), '/');
         $browse_panel->setTable($browse_table);
         $content[] = $browse_panel;
     }
     $content[] = $this->buildOpenRevisions();
     $content[] = $this->renderDirectoryReadme($results);
     $crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'browse'));
     $pager_box = $this->renderTablePagerBox($pager);
     return $this->newPage()->setTitle(array(nonempty(basename($drequest->getPath()), '/'), $repository->getDisplayName()))->setCrumbs($crumbs)->appendChild(array($content, $pager_box));
 }
 public function browseDirectory(DiffusionBrowseResultSet $results, PHUIPagerView $pager)
 {
     $request = $this->getRequest();
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     $reason = $results->getReasonForEmptyResultSet();
     $curtain = $this->buildCurtain($drequest);
     $details = $this->buildPropertyView($drequest);
     $header = $this->buildHeaderView($drequest);
     $header->setHeaderIcon('fa-folder-open');
     $search_form = $this->renderSearchForm();
     $empty_result = null;
     $browse_panel = null;
     if (!$results->isValidResults()) {
         $empty_result = new DiffusionEmptyResultView();
         $empty_result->setDiffusionRequest($drequest);
         $empty_result->setDiffusionBrowseResultSet($results);
         $empty_result->setView($request->getStr('view'));
     } else {
         $phids = array();
         foreach ($results->getPaths() as $result) {
             $data = $result->getLastCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
             }
         }
         $phids = array_keys($phids);
         $handles = $this->loadViewerHandles($phids);
         $browse_table = id(new DiffusionBrowseTableView())->setDiffusionRequest($drequest)->setHandles($handles)->setPaths($results->getPaths())->setUser($request->getUser());
         $browse_header = id(new PHUIHeaderView())->setHeader(nonempty(basename($drequest->getPath()), '/'))->setHeaderIcon('fa-folder-open');
         $browse_panel = id(new PHUIObjectBoxView())->setHeader($browse_header)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setTable($browse_table);
         $browse_panel->setShowHide(array(pht('Show Search')), pht('Hide Search'), $search_form, '#');
     }
     $open_revisions = $this->buildOpenRevisions();
     $readme = $this->renderDirectoryReadme($results);
     $crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'browse'));
     $pager_box = $this->renderTablePagerBox($pager);
     $crumbs->setBorder(true);
     $view = id(new PHUITwoColumnView())->setHeader($header)->setCurtain($curtain)->setMainColumn(array($empty_result, $browse_panel))->setFooter(array($open_revisions, $readme, $pager_box));
     if ($details) {
         $view->addPropertySection(pht('Details'), $details);
     }
     return $this->newPage()->setTitle(array(nonempty(basename($drequest->getPath()), '/'), $repository->getDisplayName()))->setCrumbs($crumbs)->appendChild(array($view));
 }