public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $application = $request->getURIData('application');
     $selected = id(new PhabricatorApplicationQuery())->setViewer($viewer)->withClasses(array($application))->executeOne();
     if (!$selected) {
         return new Aphront404Response();
     }
     $title = $selected->getName();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($selected->getName());
     $crumbs->setBorder(true);
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($selected)->setHeaderIcon($selected->getIcon());
     if ($selected->isInstalled()) {
         $header->setStatus('fa-check', 'bluegrey', pht('Installed'));
     } else {
         $header->setStatus('fa-ban', 'dark', pht('Uninstalled'));
     }
     $curtain = $this->buildCurtain($selected);
     $details = $this->buildPropertySectionView($selected);
     $policies = $this->buildPolicyView($selected);
     $configs = PhabricatorApplicationConfigurationPanel::loadAllPanelsForApplication($selected);
     $panels = array();
     foreach ($configs as $config) {
         $config->setViewer($viewer);
         $config->setApplication($selected);
         $panel = $config->buildConfigurationPagePanel();
         $panel->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
         $panels[] = $panel;
     }
     $view = id(new PHUITwoColumnView())->setHeader($header)->setCurtain($curtain)->setMainColumn(array($policies, $panels))->addPropertySection(pht('Details'), $details);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($view));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $application = $request->getURIData('application');
     $selected = id(new PhabricatorApplicationQuery())->setViewer($viewer)->withClasses(array($application))->executeOne();
     if (!$selected) {
         return new Aphront404Response();
     }
     $title = $selected->getName();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($selected->getName());
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($selected);
     if ($selected->isInstalled()) {
         $header->setStatus('fa-check', 'bluegrey', pht('Installed'));
     } else {
         $header->setStatus('fa-ban', 'dark', pht('Uninstalled'));
     }
     $actions = $this->buildActionView($viewer, $selected);
     $properties = $this->buildPropertyView($selected, $actions);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $configs = PhabricatorApplicationConfigurationPanel::loadAllPanelsForApplication($selected);
     $panels = array();
     foreach ($configs as $config) {
         $config->setViewer($viewer);
         $config->setApplication($selected);
         $panels[] = $config->buildConfigurationPagePanel();
     }
     return $this->buildApplicationPage(array($crumbs, $object_box, $panels), array('title' => $title));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $application = $request->getURIData('application');
     $panel_key = $request->getURIData('panel');
     $selected = id(new PhabricatorApplicationQuery())->setViewer($viewer)->withClasses(array($application))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
     if (!$selected) {
         return new Aphront404Response();
     }
     $panels = PhabricatorApplicationConfigurationPanel::loadAllPanelsForApplication($selected);
     if (empty($panels[$panel_key])) {
         return new Aphront404Response();
     }
     $panel = $panels[$panel_key];
     if (!$panel->shouldShowForApplication($selected)) {
         return new Aphront404Response();
     }
     $panel->setViewer($viewer);
     $panel->setApplication($selected);
     $this->application = $selected;
     return $panel->handlePanelRequest($request, $this);
 }