mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 01:48:23 +01:00
Initial Commint
Summary: Created "Applications" application which lists all the installed applications in phabricator. Test Plan: Navigated to localphabricatorinstall.com/applications and check whether it actually shows the list of all installed applications. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2352 Differential Revision: https://secure.phabricator.com/D4548
This commit is contained in:
parent
06fa724280
commit
5815c7e51b
4 changed files with 100 additions and 5 deletions
|
@ -648,6 +648,8 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationTransactionView' => 'applications/transactions/view/PhabricatorApplicationTransactionView.php',
|
||||
'PhabricatorApplicationTransactions' => 'applications/transactions/application/PhabricatorApplicationTransactions.php',
|
||||
'PhabricatorApplicationUIExamples' => 'applications/uiexample/application/PhabricatorApplicationUIExamples.php',
|
||||
'PhabricatorApplicationsController' => 'applications/meta/controller/PhabricatorApplicationsController.php',
|
||||
'PhabricatorApplicationsListController' => 'applications/meta/controller/PhabricatorApplicationsListController.php',
|
||||
'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php',
|
||||
'PhabricatorAuditAddCommentController' => 'applications/audit/controller/PhabricatorAuditAddCommentController.php',
|
||||
'PhabricatorAuditComment' => 'applications/audit/storage/PhabricatorAuditComment.php',
|
||||
|
@ -2037,6 +2039,8 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationTransactionView' => 'AphrontView',
|
||||
'PhabricatorApplicationTransactions' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationUIExamples' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationsController' => 'PhabricatorController',
|
||||
'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController',
|
||||
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
|
||||
'PhabricatorAuditComment' =>
|
||||
array(
|
||||
|
|
|
@ -7,17 +7,13 @@ final class PhabricatorApplicationApplications extends PhabricatorApplication {
|
|||
}
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Manage Applications';
|
||||
return 'Installed Applications';
|
||||
}
|
||||
|
||||
public function getIconName() {
|
||||
return 'applications';
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getTitleGlyph() {
|
||||
return "\xE0\xBC\x84";
|
||||
}
|
||||
|
@ -26,5 +22,15 @@ final class PhabricatorApplicationApplications extends PhabricatorApplication {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
'/applications/' => array(
|
||||
'' => 'PhabricatorApplicationsListController',
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorApplicationsController extends PhabricatorController {
|
||||
|
||||
public function shouldRequireAdmin() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function buildSideNavView($filter = null, $for_app = false) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||
$nav->addLabel(pht('Installed Applications'));
|
||||
$nav->addFilter('/', pht('Applications'));
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
return $this->buildSideNavView(null, true)->getMenu();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorApplicationsListController
|
||||
extends PhabricatorApplicationsController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('/');
|
||||
|
||||
$applications = PhabricatorApplication::getAllInstalledApplications();
|
||||
|
||||
$list = $this->buildInstalledApplicationsList($applications);
|
||||
|
||||
$title = pht('Installed Applications');
|
||||
|
||||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader($title);
|
||||
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$header,
|
||||
$list
|
||||
));
|
||||
|
||||
$crumbs = $this
|
||||
->buildApplicationCrumbs()
|
||||
->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName(pht('Applications'))
|
||||
->setHref($this->getApplicationURI()));
|
||||
|
||||
$nav->setCrumbs($crumbs);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private function buildInstalledApplicationsList(array $applications) {
|
||||
|
||||
$list = new PhabricatorObjectItemListView();
|
||||
foreach ($applications as $applications) {
|
||||
$item = id(new PhabricatorObjectItemView())
|
||||
->setHeader($applications->getName())
|
||||
->addAttribute(
|
||||
phutil_escape_html($applications->getShortDescription()));
|
||||
$list->addItem($item);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue