1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Application Detail View

Summary:
Added Applications Details View

Applications Detail View

Test Plan: In "Applications" application, clicked on each application to check whether the each application detail view is displayed.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4615
This commit is contained in:
Afaque Hussain 2013-01-24 12:13:31 -08:00 committed by epriestley
parent e990488889
commit 5660c901ef
4 changed files with 86 additions and 5 deletions

View file

@ -603,6 +603,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationConfigOptions' => 'applications/config/option/PhabricatorApplicationConfigOptions.php',
'PhabricatorApplicationCountdown' => 'applications/countdown/application/PhabricatorApplicationCountdown.php',
'PhabricatorApplicationDaemons' => 'applications/daemon/application/PhabricatorApplicationDaemons.php',
'PhabricatorApplicationDetailViewController' => 'applications/meta/controller/PhabricatorApplicationDetailViewController.php',
'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php',
'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php',
'PhabricatorApplicationDiviner' => 'applications/diviner/application/PhabricatorApplicationDiviner.php',
@ -1997,6 +1998,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationConfigOptions' => 'Phobject',
'PhabricatorApplicationCountdown' => 'PhabricatorApplication',
'PhabricatorApplicationDaemons' => 'PhabricatorApplication',
'PhabricatorApplicationDetailViewController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationDifferential' => 'PhabricatorApplication',
'PhabricatorApplicationDiffusion' => 'PhabricatorApplication',
'PhabricatorApplicationDiviner' => 'PhabricatorApplication',

View file

@ -26,6 +26,8 @@ final class PhabricatorApplicationApplications extends PhabricatorApplication {
return array(
'/applications/' => array(
'' => 'PhabricatorApplicationsListController',
'view/(?P<application>\w+)/' =>
'PhabricatorApplicationDetailViewController',
),

View file

@ -0,0 +1,77 @@
<?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 = null;
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $application) {
if (get_class($application) == $this->application) {
$selected = $application;
break;
}
}
if (!$selected) {
return new Aphront404Response();
}
$title = $selected->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('Applications'))
->setHref($this->getApplicationURI()));
$properties = $this->buildPropertyView($selected);
$actions = $this->buildActionView($user);
return $this->buildApplicationPage(
array(
$crumbs,
id(new PhabricatorHeaderView())->setHeader($title),
$actions,
$properties,
),
array(
'title' => $title,
'device' => true,
));
}
private function buildPropertyView(PhabricatorApplication $selected) {
$properties = new PhabricatorPropertyListView();
$properties->addProperty(
pht('Status'), pht('Installed'));
$properties->addProperty(
pht('Description'), $selected->getShortDescription());
return $properties;
}
private function buildActionView(PhabricatorUser $user) {
return id(new PhabricatorActionListView())
->setUser($user)
->addAction(
id(new PhabricatorActionView())
->setName(pht('Uninstall'))
->setIcon('delete')
);
}
}

View file

@ -45,16 +45,16 @@ final class PhabricatorApplicationsListController
private function buildInstalledApplicationsList(array $applications) {
$list = new PhabricatorObjectItemListView();
foreach ($applications as $applications) {
foreach ($applications as $application) {
$item = id(new PhabricatorObjectItemView())
->setHeader($applications->getName())
->setHeader($application->getName())
->setHref('/applications/view/'.get_class($application).'/')
->addAttribute(
phutil_escape_html($applications->getShortDescription()));
phutil_escape_html($application->getShortDescription()));
$list->addItem($item);
}
return $list;
}