2012-12-30 15:36:06 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
final class PhabricatorConfigGroupController
|
|
|
|
|
extends PhabricatorConfigController {
|
|
|
|
|
|
2015-07-27 09:06:26 -07:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
|
$viewer = $request->getViewer();
|
|
|
|
|
$group_key = $request->getURIData('key');
|
2012-12-30 15:36:06 -08:00
|
|
|
|
|
|
|
|
$groups = PhabricatorApplicationConfigOptions::loadAll();
|
2015-07-27 09:06:26 -07:00
|
|
|
$options = idx($groups, $group_key);
|
2012-12-30 15:36:06 -08:00
|
|
|
if (!$options) {
|
|
|
|
|
return new Aphront404Response();
|
|
|
|
|
}
|
|
|
|
|
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
$group_uri = PhabricatorConfigGroupConstants::getGroupURI(
|
|
|
|
|
$options->getGroup());
|
|
|
|
|
$group_name = PhabricatorConfigGroupConstants::getGroupShortName(
|
|
|
|
|
$options->getGroup());
|
|
|
|
|
|
|
|
|
|
$nav = $this->buildSideNavView();
|
|
|
|
|
$nav->selectFilter($group_uri);
|
|
|
|
|
|
2012-12-30 15:36:06 -08:00
|
|
|
$title = pht('%s Configuration', $options->getName());
|
|
|
|
|
$list = $this->buildOptionList($options->getOptions());
|
|
|
|
|
|
|
|
|
|
$crumbs = $this
|
|
|
|
|
->buildApplicationCrumbs()
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
->addTextCrumb($group_name, $this->getApplicationURI($group_uri))
|
|
|
|
|
->addTextCrumb($options->getName())
|
2016-04-03 00:27:39 +00:00
|
|
|
->setBorder(true);
|
2012-12-30 15:36:06 -08:00
|
|
|
|
2016-04-03 00:27:39 +00:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
|
->setHeader($title)
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
->setProfileHeader(true);
|
2016-04-03 00:27:39 +00:00
|
|
|
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
$content = id(new PhabricatorConfigPageView())
|
2016-04-03 00:27:39 +00:00
|
|
|
->setHeader($header)
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
->setContent($list);
|
2016-04-03 00:27:39 +00:00
|
|
|
|
|
|
|
|
return $this->newPage()
|
|
|
|
|
->setTitle($title)
|
|
|
|
|
->setCrumbs($crumbs)
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
->setNavigation($nav)
|
|
|
|
|
->appendChild($content)
|
|
|
|
|
->addClass('white-background');
|
2012-12-30 15:36:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function buildOptionList(array $options) {
|
|
|
|
|
assert_instances_of($options, 'PhabricatorConfigOption');
|
|
|
|
|
|
2013-01-01 14:11:39 -08:00
|
|
|
require_celerity_resource('config-options-css');
|
|
|
|
|
|
|
|
|
|
$db_values = array();
|
|
|
|
|
if ($options) {
|
|
|
|
|
$db_values = id(new PhabricatorConfigEntry())->loadAllWhere(
|
|
|
|
|
'configKey IN (%Ls) AND namespace = %s',
|
|
|
|
|
mpull($options, 'getKey'),
|
|
|
|
|
'default');
|
|
|
|
|
$db_values = mpull($db_values, null, 'getConfigKey');
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-16 09:08:13 -08:00
|
|
|
$engine = id(new PhabricatorMarkupEngine())
|
|
|
|
|
->setViewer($this->getRequest()->getUser());
|
|
|
|
|
foreach ($options as $option) {
|
|
|
|
|
$engine->addObject($option, 'summary');
|
|
|
|
|
}
|
|
|
|
|
$engine->process();
|
2013-01-01 14:11:39 -08:00
|
|
|
|
2013-09-09 14:14:34 -07:00
|
|
|
$list = new PHUIObjectItemListView();
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
$list->setBig(true);
|
2012-12-30 15:36:06 -08:00
|
|
|
foreach ($options as $option) {
|
2013-01-16 09:08:13 -08:00
|
|
|
$summary = $engine->getOutput($option, 'summary');
|
|
|
|
|
|
2013-09-09 14:14:34 -07:00
|
|
|
$item = id(new PHUIObjectItemView())
|
2012-12-30 15:36:06 -08:00
|
|
|
->setHeader($option->getKey())
|
|
|
|
|
->setHref('/config/edit/'.$option->getKey().'/')
|
2013-01-16 09:08:13 -08:00
|
|
|
->addAttribute($summary);
|
2013-01-03 06:01:14 -08:00
|
|
|
|
2015-02-13 10:59:50 -08:00
|
|
|
if (!$option->getHidden()) {
|
2013-01-03 06:01:14 -08:00
|
|
|
$current_value = PhabricatorEnv::getEnvConfig($option->getKey());
|
2013-01-11 15:28:33 -08:00
|
|
|
$current_value = PhabricatorConfigJSON::prettyPrintJSON(
|
|
|
|
|
$current_value);
|
2013-01-18 00:32:58 -08:00
|
|
|
$current_value = phutil_tag(
|
2013-01-03 06:01:14 -08:00
|
|
|
'div',
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'config-options-current-value',
|
|
|
|
|
),
|
2013-01-18 00:32:58 -08:00
|
|
|
array(
|
|
|
|
|
phutil_tag('span', array(), pht('Current Value:')),
|
|
|
|
|
' '.$current_value,
|
|
|
|
|
));
|
2013-01-03 06:01:14 -08:00
|
|
|
|
|
|
|
|
$item->appendChild($current_value);
|
|
|
|
|
}
|
2013-01-01 14:11:39 -08:00
|
|
|
|
|
|
|
|
$db_value = idx($db_values, $option->getKey());
|
|
|
|
|
if ($db_value && !$db_value->getIsDeleted()) {
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
$item->addIcon('fa-edit', pht('Customized'));
|
2013-01-01 14:11:39 -08:00
|
|
|
}
|
|
|
|
|
|
2013-01-03 06:01:14 -08:00
|
|
|
if ($option->getHidden()) {
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
$item->addIcon('fa-eye-slash', pht('Hidden'));
|
2013-01-03 06:01:14 -08:00
|
|
|
} else if ($option->getLocked()) {
|
Redesign Config Application
Summary: Ref T11132, significantly cleans up the Config app, new layout, icons, spacing, etc. Some minor todos around re-designing "issues", mobile support, and maybe another pass at actual Group pages.
Test Plan: Visit and test every page in the config app, set new items, resolve setup issues, etc.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam, Korvin
Maniphest Tasks: T11132
Differential Revision: https://secure.phabricator.com/D16468
2016-08-29 15:36:13 -07:00
|
|
|
$item->addIcon('fa-lock', pht('Locked'));
|
2013-01-02 14:02:43 -08:00
|
|
|
}
|
|
|
|
|
|
2012-12-30 15:36:06 -08:00
|
|
|
$list->addItem($item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|