[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorConfigGroupController 4 extends PhabricatorConfigController { 5 6 private $groupKey; 7 8 public function willProcessRequest(array $data) { 9 $this->groupKey = $data['key']; 10 } 11 12 public function processRequest() { 13 $request = $this->getRequest(); 14 $user = $request->getUser(); 15 16 $groups = PhabricatorApplicationConfigOptions::loadAll(); 17 $options = idx($groups, $this->groupKey); 18 if (!$options) { 19 return new Aphront404Response(); 20 } 21 22 $title = pht('%s Configuration', $options->getName()); 23 $list = $this->buildOptionList($options->getOptions()); 24 25 $box = id(new PHUIObjectBoxView()) 26 ->setHeaderText($title) 27 ->appendChild($list); 28 29 $crumbs = $this 30 ->buildApplicationCrumbs() 31 ->addTextCrumb(pht('Config'), $this->getApplicationURI()) 32 ->addTextCrumb($options->getName(), $this->getApplicationURI()); 33 34 return $this->buildApplicationPage( 35 array( 36 $crumbs, 37 $box, 38 ), 39 array( 40 'title' => $title, 41 )); 42 } 43 44 private function buildOptionList(array $options) { 45 assert_instances_of($options, 'PhabricatorConfigOption'); 46 47 require_celerity_resource('config-options-css'); 48 49 $db_values = array(); 50 if ($options) { 51 $db_values = id(new PhabricatorConfigEntry())->loadAllWhere( 52 'configKey IN (%Ls) AND namespace = %s', 53 mpull($options, 'getKey'), 54 'default'); 55 $db_values = mpull($db_values, null, 'getConfigKey'); 56 } 57 58 $engine = id(new PhabricatorMarkupEngine()) 59 ->setViewer($this->getRequest()->getUser()); 60 foreach ($options as $option) { 61 $engine->addObject($option, 'summary'); 62 } 63 $engine->process(); 64 65 $list = new PHUIObjectItemListView(); 66 $list->setStackable(true); 67 foreach ($options as $option) { 68 $summary = $engine->getOutput($option, 'summary'); 69 70 $item = id(new PHUIObjectItemView()) 71 ->setHeader($option->getKey()) 72 ->setHref('/config/edit/'.$option->getKey().'/') 73 ->addAttribute($summary); 74 75 if (!$option->getHidden() && !$option->getMasked()) { 76 $current_value = PhabricatorEnv::getEnvConfig($option->getKey()); 77 $current_value = PhabricatorConfigJSON::prettyPrintJSON( 78 $current_value); 79 $current_value = phutil_tag( 80 'div', 81 array( 82 'class' => 'config-options-current-value', 83 ), 84 array( 85 phutil_tag('span', array(), pht('Current Value:')), 86 ' '.$current_value, 87 )); 88 89 $item->appendChild($current_value); 90 } 91 92 $db_value = idx($db_values, $option->getKey()); 93 if ($db_value && !$db_value->getIsDeleted()) { 94 $item->addIcon('edit', pht('Customized')); 95 } 96 97 if ($option->getHidden()) { 98 $item->addIcon('unpublish', pht('Hidden')); 99 } else if ($option->getMasked()) { 100 $item->addIcon('unpublish-grey', pht('Masked')); 101 } else if ($option->getLocked()) { 102 $item->addIcon('lock', pht('Locked')); 103 } 104 105 $list->addItem($item); 106 } 107 108 return $list; 109 } 110 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |