Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
index 6b6e3a26fa..a8631347fe 100644
--- a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
+++ b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
@@ -1,159 +1,152 @@
<?php
final class PhabricatorApplicationDetailViewController
extends PhabricatorApplicationsController{
private $application;
public function willProcessRequest(array $data) {
$this->application = $data['application'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$selected = id(new PhabricatorApplicationQuery())
->setViewer($user)
->withClasses(array($this->application))
->executeOne();
if (!$selected) {
return new Aphront404Response();
}
$title = $selected->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName($selected->getName()));
$header = id(new PHUIHeaderView())
- ->setHeader($title);
-
- $status_tag = id(new PhabricatorTagView())
- ->setType(PhabricatorTagView::TYPE_STATE);
+ ->setHeader($title)
+ ->setUser($user)
+ ->setPolicyObject($selected);
if ($selected->isInstalled()) {
- $status_tag->setName(pht('Installed'));
- $status_tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN);
+ $header->setStatus('open', 'green', pht('Installed'));
} else {
- $status_tag->setName(pht('Uninstalled'));
- $status_tag->setBackgroundColor(PhabricatorTagView::COLOR_RED);
- }
-
- if ($selected->isBeta()) {
- $beta_tag = id(new PhabricatorTagView())
- ->setType(PhabricatorTagView::TYPE_STATE)
- ->setName(pht('Beta'))
- ->setBackgroundColor(PhabricatorTagView::COLOR_GREY);
- $header->addTag($beta_tag);
+ $header->setStatus('open', 'red', pht('Uninstalled'));
}
- $header->addTag($status_tag);
-
$properties = $this->buildPropertyView($selected);
$actions = $this->buildActionView($user, $selected);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->setActionList($actions)
->setPropertyList($properties);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
'device' => true,
));
}
private function buildPropertyView(PhabricatorApplication $application) {
$viewer = $this->getRequest()->getUser();
$properties = id(new PhabricatorPropertyListView())
->addProperty(pht('Description'), $application->getShortDescription());
+ if ($application->isBeta()) {
+ $properties->addProperty(
+ pht('Release'),
+ pht('Beta'));
+ }
+
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer,
$application);
$properties->addSectionHeader(pht('Policies'));
foreach ($application->getCapabilities() as $capability) {
$properties->addProperty(
$application->getCapabilityLabel($capability),
idx($descriptions, $capability));
}
return $properties;
}
private function buildActionView(
PhabricatorUser $user,
PhabricatorApplication $selected) {
$view = id(new PhabricatorActionListView())
->setUser($user)
->setObjectURI($this->getRequest()->getRequestURI());
$can_edit = PhabricatorPolicyFilter::hasCapability(
$user,
$selected,
PhabricatorPolicyCapability::CAN_EDIT);
$edit_uri = $this->getApplicationURI('edit/'.get_class($selected).'/');
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Policies'))
->setIcon('edit')
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit)
->setHref($edit_uri));
if ($selected->canUninstall()) {
if ($selected->isInstalled()) {
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Uninstall'))
->setIcon('delete')
->setDisabled(!$can_edit)
->setWorkflow(true)
->setHref(
$this->getApplicationURI(get_class($selected).'/uninstall/')));
} else {
$action = id(new PhabricatorActionView())
->setName(pht('Install'))
->setIcon('new')
->setDisabled(!$can_edit)
->setWorkflow(true)
->setHref(
$this->getApplicationURI(get_class($selected).'/install/'));
$beta_enabled = PhabricatorEnv::getEnvConfig(
'phabricator.show-beta-applications');
if ($selected->isBeta() && !$beta_enabled) {
$action->setDisabled(true);
}
$view->addAction($action);
}
} else {
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Uninstall'))
->setIcon('delete')
->setWorkflow(true)
->setDisabled(true)
->setHref(
$this->getApplicationURI(get_class($selected).'/uninstall/')));
}
return $view;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jul 27, 2:03 PM (1 w, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
185794
Default Alt Text
(5 KB)

Event Timeline