diff --git a/src/view/control/objectselector/PhabricatorObjectSelectorDialog.php b/src/view/control/objectselector/PhabricatorObjectSelectorDialog.php index 466058bc26..eebf98632a 100644 --- a/src/view/control/objectselector/PhabricatorObjectSelectorDialog.php +++ b/src/view/control/objectselector/PhabricatorObjectSelectorDialog.php @@ -1,161 +1,162 @@ user = $user; return $this; } public function setFilters(array $filters) { $this->filters = $filters; return $this; } public function setHandles(array $handles) { $this->handles = $handles; return $this; } public function setCancelURI($cancel_uri) { $this->cancelURI = $cancel_uri; return $this; } public function setSubmitURI($submit_uri) { $this->submitURI = $submit_uri; return $this; } public function setSearchURI($search_uri) { $this->searchURI = $search_uri; return $this; } public function setNoun($noun) { $this->noun = $noun; return $this; } public function buildDialog() { $user = $this->user; $filter_id = celerity_generate_unique_node_id(); $query_id = celerity_generate_unique_node_id(); $results_id = celerity_generate_unique_node_id(); $current_id = celerity_generate_unique_node_id(); $search_id = celerity_generate_unique_node_id(); $form_id = celerity_generate_unique_node_id(); require_celerity_resource('phabricator-object-selector-css'); $options = array(); foreach ($this->filters as $key => $label) { $options[] = phutil_render_tag( 'option', array( 'value' => $key ), $label); } $options = implode("\n", $options); $search_box = phabricator_render_form( $user, array( 'method' => 'POST', 'action' => $this->submitURI, 'id' => $search_id, ), ''); $result_box = '
'. '
'; $attached_box = '
'. '
'. '
'. 'Currently Attached '.$this->noun. '
'. '
'. '
'. '
'. '
'; $dialog = new AphrontDialogView(); $dialog ->setUser($this->user) ->setTitle('Manage Attached '.$this->noun) ->setClass('phabricator-object-selector-dialog') ->appendChild($search_box) ->appendChild($result_box) ->appendChild($attached_box) ->setRenderDialogAsDiv() ->setFormID($form_id) ->addSubmitButton('Save '.$this->noun); if ($this->cancelURI) { $dialog->addCancelButton($this->cancelURI); } $handle_views = array(); - foreach ($this->handles as $phid => $handle) { + foreach ($this->handles as $handle) { + $phid = $handle->getPHID(); $view = new PhabricatorHandleObjectSelectorDataView($handle); $handle_views[$phid] = $view->renderData(); } $dialog->addHiddenInput('phids', implode(';', array_keys($this->handles))); Javelin::initBehavior( 'phabricator-object-selector', array( 'filter' => $filter_id, 'query' => $query_id, 'search' => $search_id, 'results' => $results_id, 'current' => $current_id, 'form' => $form_id, 'uri' => $this->searchURI, 'handles' => $handle_views, )); return $dialog; } }