Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/bulk/PhabricatorBulkEngine.php
Show First 20 Lines • Show All 297 Lines • ▼ Show 20 Lines | private function newBulkActionForm() { | ||||
$edit_engine = id($this->newEditEngine()) | $edit_engine = id($this->newEditEngine()) | ||||
->setViewer($viewer); | ->setViewer($viewer); | ||||
$edit_map = $edit_engine->newBulkEditMap(); | $edit_map = $edit_engine->newBulkEditMap(); | ||||
$groups = $edit_engine->newBulkEditGroupMap(); | $groups = $edit_engine->newBulkEditGroupMap(); | ||||
$spec = array(); | $spec = array(); | ||||
$option_groups = igroup($edit_map, 'group'); | $option_groups = igroup($edit_map, 'group'); | ||||
$default_value = null; | |||||
foreach ($groups as $group_key => $group) { | foreach ($groups as $group_key => $group) { | ||||
$options = idx($option_groups, $group_key, array()); | $options = idx($option_groups, $group_key, array()); | ||||
if (!$options) { | if (!$options) { | ||||
continue; | continue; | ||||
} | } | ||||
$option_map = array(); | $option_map = array(); | ||||
foreach ($options as $option) { | foreach ($options as $option) { | ||||
$option_map[] = array( | $option_map[] = array( | ||||
'key' => $option['xaction'], | 'key' => $option['xaction'], | ||||
'label' => $option['label'], | 'label' => $option['label'], | ||||
); | ); | ||||
if ($default_value === null) { | |||||
$default_value = $option['xaction']; | |||||
} | |||||
} | } | ||||
$spec[] = array( | $spec[] = array( | ||||
'label' => $group->getLabel(), | 'label' => $group->getLabel(), | ||||
'options' => $option_map, | 'options' => $option_map, | ||||
); | ); | ||||
} | } | ||||
require_celerity_resource('phui-bulk-editor-css'); | require_celerity_resource('phui-bulk-editor-css'); | ||||
Javelin::initBehavior( | Javelin::initBehavior( | ||||
'bulk-editor', | 'bulk-editor', | ||||
array( | array( | ||||
'rootNodeID' => $this->getRootFormID(), | 'rootNodeID' => $this->getRootFormID(), | ||||
'inputNodeID' => $input_id, | 'inputNodeID' => $input_id, | ||||
'edits' => $edit_map, | 'edits' => $edit_map, | ||||
'optgroups' => array( | 'optgroups' => array( | ||||
'value' => $default_value, | |||||
'groups' => $spec, | 'groups' => $spec, | ||||
), | ), | ||||
)); | )); | ||||
$cancel_uri = $this->getCancelURI(); | $cancel_uri = $this->getCancelURI(); | ||||
return id(new PHUIFormLayoutView()) | return id(new PHUIFormLayoutView()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines |