diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index e2c82e9318..1b7baa2505 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -1,428 +1,467 @@ getUser(); $conpherence_id = $request->getURIData('id'); if (!$conpherence_id) { return new Aphront404Response(); } $needed_capabilities = array(PhabricatorPolicyCapability::CAN_VIEW); $action = $request->getStr('action', ConpherenceUpdateActions::METADATA); switch ($action) { case ConpherenceUpdateActions::REMOVE_PERSON: $person_phid = $request->getStr('remove_person'); if ($person_phid != $user->getPHID()) { $needed_capabilities[] = PhabricatorPolicyCapability::CAN_EDIT; } break; case ConpherenceUpdateActions::ADD_PERSON: case ConpherenceUpdateActions::METADATA: $needed_capabilities[] = PhabricatorPolicyCapability::CAN_EDIT; break; case ConpherenceUpdateActions::JOIN_ROOM: $needed_capabilities[] = PhabricatorPolicyCapability::CAN_JOIN; break; } $conpherence = id(new ConpherenceThreadQuery()) ->setViewer($user) ->withIDs(array($conpherence_id)) ->needFilePHIDs(true) ->needParticipantCache(true) ->requireCapabilities($needed_capabilities) ->executeOne(); $latest_transaction_id = null; $response_mode = $request->isAjax() ? 'ajax' : 'redirect'; $error_view = null; $e_file = array(); $errors = array(); $delete_draft = false; $xactions = array(); if ($request->isFormPost() || ($action == ConpherenceUpdateActions::LOAD)) { $editor = id(new ConpherenceEditor()) ->setContinueOnNoEffect($request->isContinueRequest()) ->setContentSourceFromRequest($request) ->setActor($user); switch ($action) { case ConpherenceUpdateActions::DRAFT: $draft = PhabricatorDraft::newFromUserAndKey( $user, $conpherence->getPHID()); $draft->setDraft($request->getStr('text')); $draft->replaceOrDelete(); return new AphrontAjaxResponse(); case ConpherenceUpdateActions::JOIN_ROOM: $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType( ConpherenceTransactionType::TYPE_PARTICIPANTS) ->setNewValue(array('+' => array($user->getPHID()))); $delete_draft = true; $message = $request->getStr('text'); if ($message) { $message_xactions = $editor->generateTransactionsFromText( $user, $conpherence, $message); $xactions = array_merge($xactions, $message_xactions); } // for now, just redirect back to the conpherence so everything // will work okay...! $response_mode = 'redirect'; break; case ConpherenceUpdateActions::MESSAGE: $message = $request->getStr('text'); $xactions = $editor->generateTransactionsFromText( $user, $conpherence, $message); $delete_draft = true; break; case ConpherenceUpdateActions::ADD_PERSON: $person_phids = $request->getArr('add_person'); if (!empty($person_phids)) { $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType( ConpherenceTransactionType::TYPE_PARTICIPANTS) ->setNewValue(array('+' => $person_phids)); } break; case ConpherenceUpdateActions::REMOVE_PERSON: if (!$request->isContinueRequest()) { // do nothing; we'll display a confirmation dialogue instead break; } $person_phid = $request->getStr('remove_person'); if ($person_phid && $person_phid == $user->getPHID()) { $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType( ConpherenceTransactionType::TYPE_PARTICIPANTS) ->setNewValue(array('-' => array($person_phid))); $response_mode = 'go-home'; } break; case ConpherenceUpdateActions::NOTIFICATIONS: $notifications = $request->getStr('notifications'); $participant = $conpherence->getParticipantIfExists($user->getPHID()); if (!$participant) { return id(new Aphront404Response()); } $participant->setSettings(array('notifications' => $notifications)); $participant->save(); $result = pht( 'Updated notification settings to "%s".', ConpherenceSettings::getHumanString($notifications)); return id(new AphrontAjaxResponse()) ->setContent($result); break; case ConpherenceUpdateActions::METADATA: - $updated = false; // all metadata updates are continue requests if (!$request->isContinueRequest()) { break; } $title = $request->getStr('title'); - if ($title != $conpherence->getTitle()) { + $xactions[] = id(new ConpherenceTransaction()) + ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) + ->setNewValue($title); + if ($conpherence->getIsRoom()) { + $xactions[] = id(new ConpherenceTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) + ->setNewValue($request->getStr('viewPolicy')); + $xactions[] = id(new ConpherenceTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) + ->setNewValue($request->getStr('editPolicy')); $xactions[] = id(new ConpherenceTransaction()) - ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) - ->setNewValue($title); - $updated = true; - if (!$request->getExists('force_ajax')) { - $response_mode = 'redirect'; - } + ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) + ->setNewValue($request->getStr('joinPolicy')); } - if (!$updated) { - $errors[] = pht( - 'That was a non-update. Try cancel.'); + if (!$request->getExists('force_ajax')) { + $response_mode = 'redirect'; } break; case ConpherenceUpdateActions::LOAD: $updated = false; $response_mode = 'ajax'; break; default: throw new Exception('Unknown action: '.$action); break; } if ($xactions) { try { $xactions = $editor->applyTransactions($conpherence, $xactions); if ($delete_draft) { $draft = PhabricatorDraft::newFromUserAndKey( $user, $conpherence->getPHID()); $draft->delete(); } } catch (PhabricatorApplicationTransactionNoEffectException $ex) { return id(new PhabricatorApplicationTransactionNoEffectResponse()) ->setCancelURI($this->getApplicationURI($conpherence_id.'/')) ->setException($ex); } + // xactions had no effect...! + if (empty($xactions)) { + $errors[] = pht( + 'That was a non-update. Try cancel.'); + } } if ($xactions || ($action == ConpherenceUpdateActions::LOAD)) { switch ($response_mode) { case 'ajax': $latest_transaction_id = $request->getInt('latest_transaction_id'); $content = $this->loadAndRenderUpdates( $action, $conpherence_id, $latest_transaction_id); return id(new AphrontAjaxResponse()) ->setContent($content); break; case 'go-home': return id(new AphrontRedirectResponse()) ->setURI($this->getApplicationURI()); break; case 'redirect': default: return id(new AphrontRedirectResponse()) ->setURI($this->getApplicationURI($conpherence->getID().'/')); break; } } } if ($errors) { $error_view = id(new PHUIInfoView()) ->setErrors($errors); } switch ($action) { case ConpherenceUpdateActions::ADD_PERSON: $dialogue = $this->renderAddPersonDialogue($conpherence); break; case ConpherenceUpdateActions::REMOVE_PERSON: $dialogue = $this->renderRemovePersonDialogue($conpherence); break; case ConpherenceUpdateActions::METADATA: default: $dialogue = $this->renderMetadataDialogue($conpherence, $error_view); break; } return id(new AphrontDialogResponse()) ->setDialog($dialogue ->setUser($user) ->setWidth(AphrontDialogView::WIDTH_FORM) ->setSubmitURI($this->getApplicationURI('update/'.$conpherence_id.'/')) ->addSubmitButton() ->addCancelButton($this->getApplicationURI($conpherence->getID().'/'))); } private function renderAddPersonDialogue( ConpherenceThread $conpherence) { $request = $this->getRequest(); $user = $request->getUser(); $add_person = $request->getStr('add_person'); $form = id(new AphrontFormView()) ->setUser($user) ->setFullWidth(true) ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('add_person') ->setUser($user) ->setDatasource(new PhabricatorPeopleDatasource())); require_celerity_resource('conpherence-update-css'); $view = id(new AphrontDialogView()) ->setTitle(pht('Add Participants')) ->addHiddenInput('action', 'add_person') ->addHiddenInput( 'latest_transaction_id', $request->getInt('latest_transaction_id')) ->appendForm($form); if ($request->getExists('minimal_display')) { $view->addHiddenInput('minimal_display', true); } return $view; } private function renderRemovePersonDialogue( ConpherenceThread $conpherence) { $request = $this->getRequest(); $user = $request->getUser(); $remove_person = $request->getStr('remove_person'); $participants = $conpherence->getParticipants(); if ($conpherence->getIsRoom()) { $message = pht( 'Are you sure you want to remove yourself from this room?'); } else { $message = pht( 'Are you sure you want to remove yourself from this thread?'); if (count($participants) == 1) { $message .= pht( 'The thread will be inaccessible forever and ever.'); } else { $message .= pht( 'Someone else in the thread can add you back later.'); } } $body = phutil_tag( 'p', array( ), $message); require_celerity_resource('conpherence-update-css'); return id(new AphrontDialogView()) ->setTitle(pht('Remove Participants')) ->addHiddenInput('action', 'remove_person') ->addHiddenInput('remove_person', $remove_person) ->addHiddenInput( 'latest_transaction_id', $request->getInt('latest_transaction_id')) ->addHiddenInput('__continue__', true) ->appendChild($body); } private function renderMetadataDialogue( ConpherenceThread $conpherence, $error_view) { $request = $this->getRequest(); + $user = $request->getUser(); + $form = id(new PHUIFormLayoutView()) ->appendChild($error_view) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Title')) ->setName('title') ->setValue($conpherence->getTitle())); + if ($conpherence->getIsRoom()) { + $title = pht('Update Room'); + $policies = id(new PhabricatorPolicyQuery()) + ->setViewer($user) + ->setObject($conpherence) + ->execute(); + + $form->appendChild( + id(new AphrontFormPolicyControl()) + ->setName('viewPolicy') + ->setPolicyObject($conpherence) + ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) + ->setPolicies($policies)) + ->appendChild( + id(new AphrontFormPolicyControl()) + ->setName('editPolicy') + ->setPolicyObject($conpherence) + ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) + ->setPolicies($policies)) + ->appendChild( + id(new AphrontFormPolicyControl()) + ->setName('joinPolicy') + ->setPolicyObject($conpherence) + ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) + ->setPolicies($policies)); + } else { + $title = pht('Update Thread'); + } + require_celerity_resource('conpherence-update-css'); $view = id(new AphrontDialogView()) - ->setTitle(pht('Update Conpherence')) + ->setTitle($title) ->addHiddenInput('action', 'metadata') ->addHiddenInput( 'latest_transaction_id', $request->getInt('latest_transaction_id')) ->addHiddenInput('__continue__', true) ->appendChild($form); if ($request->getExists('minimal_display')) { $view->addHiddenInput('minimal_display', true); } if ($request->getExists('force_ajax')) { $view->addHiddenInput('force_ajax', true); } return $view; } private function loadAndRenderUpdates( $action, $conpherence_id, $latest_transaction_id) { $need_widget_data = false; $need_transactions = false; $need_participant_cache = false; switch ($action) { case ConpherenceUpdateActions::METADATA: $need_participant_cache = true; $need_transactions = true; break; case ConpherenceUpdateActions::LOAD: $need_transactions = true; break; case ConpherenceUpdateActions::MESSAGE: case ConpherenceUpdateActions::ADD_PERSON: $need_transactions = true; $need_widget_data = true; break; case ConpherenceUpdateActions::REMOVE_PERSON: case ConpherenceUpdateActions::NOTIFICATIONS: default: break; } $user = $this->getRequest()->getUser(); $conpherence = id(new ConpherenceThreadQuery()) ->setViewer($user) ->setAfterTransactionID($latest_transaction_id) ->needParticipantCache($need_participant_cache) ->needWidgetData($need_widget_data) ->needTransactions($need_transactions) ->withIDs(array($conpherence_id)) ->executeOne(); if ($need_transactions) { $data = ConpherenceTransactionView::renderTransactions( $user, $conpherence, !$this->getRequest()->getExists('minimal_display')); $participant_obj = $conpherence->getParticipant($user->getPHID()); $participant_obj->markUpToDate($conpherence, $data['latest_transaction']); } else { $data = array(); } $rendered_transactions = idx($data, 'transactions'); $new_latest_transaction_id = idx($data, 'latest_transaction_id'); $widget_uri = $this->getApplicationURI('update/'.$conpherence->getID().'/'); $nav_item = null; $header = null; $people_widget = null; $file_widget = null; switch ($action) { case ConpherenceUpdateActions::METADATA: $policy_objects = id(new PhabricatorPolicyQuery()) ->setViewer($user) ->setObject($conpherence) ->execute(); $header = $this->buildHeaderPaneContent($conpherence, $policy_objects); $nav_item = id(new ConpherenceThreadListView()) ->setUser($user) ->setBaseURI($this->getApplicationURI()) ->renderSingleThread($conpherence); break; case ConpherenceUpdateActions::MESSAGE: $file_widget = id(new ConpherenceFileWidgetView()) ->setUser($this->getRequest()->getUser()) ->setConpherence($conpherence) ->setUpdateURI($widget_uri); break; case ConpherenceUpdateActions::ADD_PERSON: $people_widget = id(new ConpherencePeopleWidgetView()) ->setUser($user) ->setConpherence($conpherence) ->setUpdateURI($widget_uri); break; case ConpherenceUpdateActions::REMOVE_PERSON: case ConpherenceUpdateActions::NOTIFICATIONS: default: break; } $people_html = null; if ($people_widget) { $people_html = hsprintf('%s', $people_widget->render()); } $data = $conpherence->getDisplayData($user); $content = array( 'transactions' => hsprintf('%s', $rendered_transactions), 'conpherence_title' => (string) $data['title'], 'latest_transaction_id' => $new_latest_transaction_id, 'nav_item' => hsprintf('%s', $nav_item), 'conpherence_phid' => $conpherence->getPHID(), 'header' => hsprintf('%s', $header), 'file_widget' => $file_widget ? $file_widget->render() : null, 'people_widget' => $people_html, ); return $content; } } diff --git a/src/applications/conpherence/view/ConpherenceDurableColumnView.php b/src/applications/conpherence/view/ConpherenceDurableColumnView.php index 7fd765ad0b..fd0cba5c0d 100644 --- a/src/applications/conpherence/view/ConpherenceDurableColumnView.php +++ b/src/applications/conpherence/view/ConpherenceDurableColumnView.php @@ -1,526 +1,526 @@ conpherences = $conpherences; return $this; } public function getConpherences() { return $this->conpherences; } public function setDraft(PhabricatorDraft $draft) { $this->draft = $draft; return $this; } public function getDraft() { return $this->draft; } public function setSelectedConpherence( ConpherenceThread $conpherence = null) { $this->selectedConpherence = $conpherence; return $this; } public function getSelectedConpherence() { return $this->selectedConpherence; } public function setTransactions(array $transactions) { assert_instances_of($transactions, 'ConpherenceTransaction'); $this->transactions = $transactions; return $this; } public function getTransactions() { return $this->transactions; } public function setVisible($visible) { $this->visible = $visible; return $this; } public function getVisible() { return $this->visible; } public function setInitialLoad($bool) { $this->initialLoad = $bool; return $this; } public function getInitialLoad() { return $this->initialLoad; } public function setPolicyObjects(array $objects) { assert_instances_of($objects, 'PhabricatorPolicy'); $this->policyObjects = $objects; return $this; } public function getPolicyObjects() { return $this->policyObjects; } protected function getTagAttributes() { if ($this->getVisible()) { $style = null; } else { $style = 'display: none;'; } $classes = array('conpherence-durable-column'); if ($this->getInitialLoad()) { $classes[] = 'loading'; } return array( 'id' => 'conpherence-durable-column', 'class' => implode(' ', $classes), 'style' => $style, 'sigil' => 'conpherence-durable-column', ); } protected function getTagContent() { $column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN; require_celerity_resource('font-source-sans-pro'); Javelin::initBehavior( 'durable-column', array( 'visible' => $this->getVisible(), 'settingsURI' => '/settings/adjust/?key='.$column_key, )); $policies = array(); $conpherences = $this->getConpherences(); foreach ($conpherences as $conpherence) { if (!$conpherence->getIsRoom()) { continue; } $policies[] = $conpherence->getViewPolicy(); } $policy_objects = array(); if ($policies) { $policy_objects = id(new PhabricatorPolicyQuery()) ->setViewer($this->getUser()) ->withPHIDs($policies) ->execute(); } $this->setPolicyObjects($policy_objects); $classes = array(); $classes[] = 'conpherence-durable-column-header'; $classes[] = 'sprite-main-header'; $classes[] = 'main-header-'.PhabricatorEnv::getEnvConfig('ui.header-color'); $loading_mask = phutil_tag( 'div', array( 'class' => 'loading-mask', ), ''); $header = phutil_tag( 'div', array( 'class' => implode(' ', $classes), ), $this->buildHeader()); $icon_bar = phutil_tag( 'div', array( 'class' => 'conpherence-durable-column-icon-bar', ), $this->buildIconBar()); $transactions = $this->buildTransactions(); $content = javelin_tag( 'div', array( 'class' => 'conpherence-durable-column-main', 'sigil' => 'conpherence-durable-column-main', ), phutil_tag( 'div', array( 'id' => 'conpherence-durable-column-content', 'class' => 'conpherence-durable-column-frame', ), javelin_tag( 'div', array( 'class' => 'conpherence-durable-column-transactions', 'sigil' => 'conpherence-durable-column-transactions', ), $transactions))); $input = $this->buildTextInput(); $footer = phutil_tag( 'div', array( 'class' => 'conpherence-durable-column-footer', ), array( $this->buildSendButton(), phutil_tag( 'div', array( 'class' => 'conpherence-durable-column-status', ), $this->buildStatusText()), )); return array( $loading_mask, $header, javelin_tag( 'div', array( 'class' => 'conpherence-durable-column-body', 'sigil' => 'conpherence-durable-column-body', ), array( $icon_bar, $content, $input, $footer, )), ); } private function getPolicyIcon( ConpherenceThread $conpherence, array $policy_objects) { assert_instances_of($policy_objects, 'PhabricatorPolicy'); $icon = null; if ($conpherence->getIsRoom()) { $icon = $conpherence->getPolicyIconName($policy_objects); $icon = id(new PHUIIconView()) ->addClass('mmr') ->setIconFont($icon); } return $icon; } private function buildIconBar() { $icons = array(); $selected_conpherence = $this->getSelectedConpherence(); $conpherences = $this->getConpherences(); foreach ($conpherences as $conpherence) { $classes = array('conpherence-durable-column-thread-icon'); if ($selected_conpherence->getID() == $conpherence->getID()) { $classes[] = 'selected'; } $data = $conpherence->getDisplayData($this->getUser()); $icon = $this->getPolicyIcon($conpherence, $this->getPolicyObjects()); $thread_title = phutil_tag( 'span', array(), array( $icon, $data['js_title'], )); $image = $data['image']; Javelin::initBehavior('phabricator-tooltips'); $icons[] = javelin_tag( 'a', array( 'href' => '/conpherence/columnview/', 'class' => implode(' ', $classes), 'sigil' => 'conpherence-durable-column-thread-icon has-tooltip', 'meta' => array( 'threadID' => $conpherence->getID(), 'threadTitle' => hsprintf('%s', $thread_title), 'tip' => $data['js_title'], 'align' => 'S', ), ), phutil_tag( 'span', array( 'style' => 'background-image: url('.$image.')', ), '')); } $icons[] = $this->buildSearchButton(); return $icons; } private function buildSearchButton() { return phutil_tag( 'div', array( 'class' => 'conpherence-durable-column-search-button', ), id(new PHUIButtonBarView()) ->addButton( id(new PHUIButtonView()) ->setTag('a') ->setHref('/conpherence/search/') ->setColor(PHUIButtonView::GREY) ->setIcon( id(new PHUIIconView()) ->setIconFont('fa-search')))); } private function buildHeader() { $conpherence = $this->getSelectedConpherence(); if (!$conpherence) { $header = null; $settings_button = null; $settings_menu = null; } else { $bubble_id = celerity_generate_unique_node_id(); $dropdown_id = celerity_generate_unique_node_id(); $settings_list = new PHUIListView(); $header_actions = $this->getHeaderActionsConfig($conpherence); foreach ($header_actions as $action) { $settings_list->addMenuItem( id(new PHUIListItemView()) ->setHref($action['href']) ->setName($action['name']) ->setIcon($action['icon']) ->setDisabled($action['disabled']) ->addSigil('conpherence-durable-column-header-action') ->setMetadata(array( 'action' => $action['key'], ))); } $settings_menu = phutil_tag( 'div', array( 'id' => $dropdown_id, 'class' => 'phabricator-main-menu-dropdown phui-list-sidenav '. 'conpherence-settings-dropdown', 'sigil' => 'phabricator-notification-menu', 'style' => 'display: none', ), $settings_list); Javelin::initBehavior( 'aphlict-dropdown', array( 'bubbleID' => $bubble_id, 'dropdownID' => $dropdown_id, 'local' => true, 'containerDivID' => 'conpherence-durable-column', )); $item = id(new PHUIListItemView()) ->setName(pht('Settings')) ->setIcon('fa-bars') ->addClass('core-menu-item') ->addSigil('conpherence-settings-menu') ->setID($bubble_id) ->setHref('#') ->setAural(pht('Settings')) ->setOrder(300); $settings_button = id(new PHUIListView()) ->addMenuItem($item) ->addClass('phabricator-dark-menu') ->addClass('phabricator-application-menu'); $data = $conpherence->getDisplayData($this->getUser()); $header = phutil_tag( 'span', array(), array( $this->getPolicyIcon($conpherence, $this->getPolicyObjects()), $data['title'], )); } return phutil_tag( 'div', array( 'class' => 'conpherence-durable-column-header', ), array( javelin_tag( 'div', array( 'sigil' => 'conpherence-durable-column-header-text', 'class' => 'conpherence-durable-column-header-text', ), $header), $settings_button, $settings_menu,)); } private function getHeaderActionsConfig(ConpherenceThread $conpherence) { if ($conpherence->getIsRoom()) { - $rename_label = pht('Rename Room'); + $rename_label = pht('Edit Room'); } else { $rename_label = pht('Rename Thread'); } $can_edit = PhabricatorPolicyFilter::hasCapability( $this->getUser(), $conpherence, PhabricatorPolicyCapability::CAN_EDIT); return array( array( 'name' => pht('Add Participants'), 'disabled' => !$can_edit, 'href' => '/conpherence/update/'.$conpherence->getID().'/', 'icon' => 'fa-plus', 'key' => ConpherenceUpdateActions::ADD_PERSON, ), array( 'name' => $rename_label, 'disabled' => !$can_edit, 'href' => '/conpherence/update/'.$conpherence->getID().'/', 'icon' => 'fa-pencil', 'key' => ConpherenceUpdateActions::METADATA, ), array( 'name' => pht('View in Conpherence'), 'disabled' => false, 'href' => '/conpherence/'.$conpherence->getID().'/', 'icon' => 'fa-comments', 'key' => 'go_conpherence', ), array( 'name' => pht('Hide Column'), 'disabled' => false, 'href' => '#', 'icon' => 'fa-times', 'key' => 'hide_column', ),); } private function buildTransactions() { $conpherence = $this->getSelectedConpherence(); if (!$conpherence) { if (!$this->getVisible() || $this->getInitialLoad()) { return pht('Loading...'); } return array( phutil_tag( 'div', array( 'class' => 'mmb', ), pht('You do not have any messages yet.')), javelin_tag( 'a', array( 'href' => '/conpherence/new/', 'class' => 'button grey', 'sigil' => 'workflow', ), pht('Send a Message')),); } $data = ConpherenceTransactionView::renderTransactions( $this->getUser(), $conpherence, $full_display = false); $messages = ConpherenceTransactionView::renderMessagePaneContent( $data['transactions'], $data['oldest_transaction_id']); return $messages; } private function buildTextInput() { $conpherence = $this->getSelectedConpherence(); if (!$conpherence) { return null; } $draft = $this->getDraft(); $draft_value = null; if ($draft) { $draft_value = $draft->getDraft(); } $textarea_id = celerity_generate_unique_node_id(); $textarea = javelin_tag( 'textarea', array( 'id' => $textarea_id, 'name' => 'text', 'class' => 'conpherence-durable-column-textarea', 'sigil' => 'conpherence-durable-column-textarea', 'placeholder' => pht('Send a message...'), ), $draft_value); Javelin::initBehavior( 'aphront-drag-and-drop-textarea', array( 'target' => $textarea_id, 'activatedClass' => 'aphront-textarea-drag-and-drop', 'uri' => '/file/dropupload/', )); $id = $conpherence->getID(); return phabricator_form( $this->getUser(), array( 'method' => 'POST', 'action' => '/conpherence/update/'.$id.'/', 'sigil' => 'conpherence-message-form', ), array( $textarea, phutil_tag( 'input', array( 'type' => 'hidden', 'name' => 'action', 'value' => ConpherenceUpdateActions::MESSAGE, )),)); } private function buildStatusText() { return null; } private function buildSendButton() { $conpherence = $this->getSelectedConpherence(); if (!$conpherence) { return null; } return javelin_tag( 'button', array( 'class' => 'grey', 'sigil' => 'conpherence-send-message', ), pht('Send')); } }