2012-12-30 15:36:06 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
final class PhabricatorConfigGroupController
|
|
|
|
|
extends PhabricatorConfigController {
|
|
|
|
|
|
|
|
|
|
private $groupKey;
|
|
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
|
$this->groupKey = $data['key'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
|
|
$groups = PhabricatorApplicationConfigOptions::loadAll();
|
|
|
|
|
$options = idx($groups, $this->groupKey);
|
|
|
|
|
if (!$options) {
|
|
|
|
|
return new Aphront404Response();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$title = pht('%s Configuration', $options->getName());
|
|
|
|
|
$list = $this->buildOptionList($options->getOptions());
|
|
|
|
|
|
2014-06-27 08:28:33 -07:00
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
|
|
|
->setHeaderText($title)
|
[Redesign] New PHUIObjectItemListView
Summary:
New, cleaner, ObjectItemLists. Lots of minor style tweaks, basic overview:
- Remove FootIcons
- Remove Stackable
- Remove Plain List
- Add StatusIcon
- Add setting ObjectList to an ObjectBox
- Minor retouches to Headers
Mostly, this should give us an idea of life with the new Object Lists. I'll take another application by application pass down the road. This mostly looks at implementation in Maniphest, Differential, Audit, Workboards. Checked a few other areas and dialogs while testing, and everything looks square.
Test Plan: Maniphest, Differential, Homepage, Audit, People, and other applications. Drag reorder, etc.
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12865
2015-05-15 13:28:59 -07:00
|
|
|
->setObjectList($list);
|
2014-06-27 08:28:33 -07:00
|
|
|
|
2012-12-30 15:36:06 -08:00
|
|
|
$crumbs = $this
|
|
|
|
|
->buildApplicationCrumbs()
|
2013-12-18 17:47:34 -08:00
|
|
|
->addTextCrumb(pht('Config'), $this->getApplicationURI())
|
|
|
|
|
->addTextCrumb($options->getName(), $this->getApplicationURI());
|
2012-12-30 15:36:06 -08:00
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
|
array(
|
|
|
|
|
$crumbs,
|
2014-06-27 08:28:33 -07:00
|
|
|
$box,
|
2012-12-30 15:36:06 -08:00
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
'title' => $title,
|
2013-02-19 13:33:10 -08:00
|
|
|
));
|
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();
|
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()) {
|
|
|
|
|
$item->addIcon('edit', pht('Customized'));
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-03 06:01:14 -08:00
|
|
|
if ($option->getHidden()) {
|
|
|
|
|
$item->addIcon('unpublish', pht('Hidden'));
|
|
|
|
|
} else if ($option->getLocked()) {
|
2013-01-02 14:02:43 -08:00
|
|
|
$item->addIcon('lock', pht('Locked'));
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-30 15:36:06 -08:00
|
|
|
$list->addItem($item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|