Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/PhabricatorConfigController.php
<?php | <?php | ||||
abstract class PhabricatorConfigController extends PhabricatorController { | abstract class PhabricatorConfigController extends PhabricatorController { | ||||
public function shouldRequireAdmin() { | public function shouldRequireAdmin() { | ||||
return true; | return true; | ||||
} | } | ||||
public function buildSideNavView($filter = null, $for_app = false) { | public function buildSideNavView($filter = null, $for_app = false) { | ||||
$guide_href = new PhutilURI('/guides/'); | $guide_href = new PhutilURI('/guides/'); | ||||
$nav = new AphrontSideNavFilterView(); | $nav = new AphrontSideNavFilterView(); | ||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI())); | $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); | ||||
$nav->addLabel(pht('Configuration')); | |||||
$nav->addFilter('/', | $nav->addFilter('/', | ||||
pht('Core Settings'), null, 'fa-gear'); | pht('Core Settings')); | ||||
$nav->addFilter('application/', | $nav->addFilter('application/', | ||||
pht('Application Settings'), null, 'fa-globe'); | pht('Application Settings')); | ||||
$nav->addFilter('history/', | |||||
pht('Settings History'), null, 'fa-history'); | |||||
$nav->addFilter('version/', | |||||
pht('Version Information'), null, 'fa-download'); | |||||
$nav->addFilter('all/', | $nav->addFilter('all/', | ||||
pht('All Settings'), null, 'fa-list-ul'); | pht('All Settings')); | ||||
$nav->addFilter('version/', | |||||
pht('Version Information')); | |||||
$nav->addFilter('history/', | |||||
pht('Settings History')); | |||||
$nav->addLabel(pht('Setup')); | $nav->addLabel(pht('Setup')); | ||||
$nav->addFilter('issue/', | $nav->addFilter('issue/', | ||||
pht('Setup Issues'), null, 'fa-warning'); | pht('Setup Issues')); | ||||
$nav->addFilter(null, | $nav->addFilter(null, | ||||
pht('Installation Guide'), $guide_href, 'fa-book'); | pht('Installation Guide'), $guide_href); | ||||
$nav->addLabel(pht('Database')); | $nav->addLabel(pht('Database')); | ||||
$nav->addFilter('database/', | $nav->addFilter('database/', | ||||
pht('Database Status'), null, 'fa-heartbeat'); | pht('Database Status')); | ||||
$nav->addFilter('dbissue/', | $nav->addFilter('dbissue/', | ||||
pht('Database Issues'), null, 'fa-exclamation-circle'); | pht('Database Issues')); | ||||
$nav->addLabel(pht('Cache')); | $nav->addLabel(pht('Cache')); | ||||
$nav->addFilter('cache/', | $nav->addFilter('cache/', | ||||
pht('Cache Status'), null, 'fa-home'); | pht('Cache Status')); | ||||
$nav->addLabel(pht('Cluster')); | $nav->addLabel(pht('Cluster')); | ||||
$nav->addFilter('cluster/databases/', | $nav->addFilter('cluster/databases/', | ||||
pht('Database Servers'), null, 'fa-database'); | pht('Database Servers')); | ||||
$nav->addFilter('cluster/notifications/', | $nav->addFilter('cluster/notifications/', | ||||
pht('Notification Servers'), null, 'fa-bell-o'); | pht('Notification Servers')); | ||||
$nav->addFilter('cluster/repositories/', | $nav->addFilter('cluster/repositories/', | ||||
pht('Repository Servers'), null, 'fa-code'); | pht('Repository Servers')); | ||||
$nav->addFilter('cluster/search/', | $nav->addFilter('cluster/search/', | ||||
pht('Search Servers'), null, 'fa-search'); | pht('Search Servers')); | ||||
$nav->addLabel(pht('Modules')); | $nav->addLabel(pht('Modules')); | ||||
$modules = PhabricatorConfigModule::getAllModules(); | $modules = PhabricatorConfigModule::getAllModules(); | ||||
foreach ($modules as $key => $module) { | foreach ($modules as $key => $module) { | ||||
$nav->addFilter('module/'.$key.'/', | $nav->addFilter('module/'.$key.'/', | ||||
$module->getModuleName(), null, 'fa-puzzle-piece'); | $module->getModuleName()); | ||||
} | } | ||||
return $nav; | return $nav; | ||||
} | } | ||||
public function buildApplicationMenu() { | public function buildApplicationMenu() { | ||||
return $this->buildSideNavView(null, true)->getMenu(); | return $this->buildSideNavView(null, true)->getMenu(); | ||||
} | } | ||||
public function buildHeaderView($text, $action = null) { | |||||
$viewer = $this->getViewer(); | |||||
$file = PhabricatorFile::loadBuiltin($viewer, 'projects/v3/manage.png'); | |||||
$image = $file->getBestURI($file); | |||||
$header = id(new PHUIHeaderView()) | |||||
->setHeader($text) | |||||
->setProfileHeader(true) | |||||
->setImage($image); | |||||
if ($action) { | |||||
$header->addActionLink($action); | |||||
} | |||||
return $header; | |||||
} | |||||
public function buildConfigBoxView($title, $content, $action = null) { | |||||
$header = id(new PHUIHeaderView()) | |||||
->setHeader($title); | |||||
if ($action) { | |||||
$header->addActionItem($action); | |||||
} | |||||
$view = id(new PHUIObjectBoxView()) | |||||
->setHeader($header) | |||||
->appendChild($content) | |||||
->setBackground(PHUIObjectBoxView::WHITE_CONFIG); | |||||
return $view; | |||||
} | |||||
} | } |