Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/view/ConpherenceLayoutView.php
<?php | <?php | ||||
final class ConpherenceLayoutView extends AphrontView { | final class ConpherenceLayoutView extends AphrontTagView { | ||||
private $thread; | private $thread; | ||||
private $baseURI; | private $baseURI; | ||||
private $threadView; | private $threadView; | ||||
private $role; | private $role; | ||||
private $header; | private $header; | ||||
private $messages; | private $messages; | ||||
private $replyForm; | private $replyForm; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | final class ConpherenceLayoutView extends AphrontTagView { | ||||
} | } | ||||
public function getWidgetColumnVisible() { | public function getWidgetColumnVisible() { | ||||
$widget_key = PhabricatorConpherenceWidgetVisibleSetting::SETTINGKEY; | $widget_key = PhabricatorConpherenceWidgetVisibleSetting::SETTINGKEY; | ||||
$user = $this->getUser(); | $user = $this->getUser(); | ||||
return (bool)$user->getUserSetting($widget_key, false); | return (bool)$user->getUserSetting($widget_key, false); | ||||
} | } | ||||
public function render() { | protected function getTagAttributes() { | ||||
$classes = array(); | |||||
if (!$this->getWidgetColumnVisible()) { | |||||
$classes[] = 'hide-widgets'; | |||||
} | |||||
return array( | |||||
'id' => 'conpherence-main-layout', | |||||
'sigil' => 'conpherence-layout', | |||||
'class' => 'conpherence-layout '. | |||||
implode(' ', $classes). | |||||
' conpherence-role-'.$this->role, | |||||
); | |||||
} | |||||
protected function getTagContent() { | |||||
require_celerity_resource('conpherence-menu-css'); | require_celerity_resource('conpherence-menu-css'); | ||||
require_celerity_resource('conpherence-message-pane-css'); | require_celerity_resource('conpherence-message-pane-css'); | ||||
require_celerity_resource('conpherence-participant-pane-css'); | require_celerity_resource('conpherence-participant-pane-css'); | ||||
$layout_id = 'conpherence-main-layout'; | |||||
$selected_id = null; | $selected_id = null; | ||||
$selected_thread_id = null; | $selected_thread_id = null; | ||||
$selected_thread_phid = null; | $selected_thread_phid = null; | ||||
$can_edit_selected = null; | $can_edit_selected = null; | ||||
$nux = null; | $nux = null; | ||||
if ($this->thread) { | if ($this->thread) { | ||||
$selected_id = $this->thread->getPHID().'-nav-item'; | $selected_id = $this->thread->getPHID().'-nav-item'; | ||||
$selected_thread_id = $this->thread->getID(); | $selected_thread_id = $this->thread->getID(); | ||||
$selected_thread_phid = $this->thread->getPHID(); | $selected_thread_phid = $this->thread->getPHID(); | ||||
$can_edit_selected = PhabricatorPolicyFilter::hasCapability( | $can_edit_selected = PhabricatorPolicyFilter::hasCapability( | ||||
$this->getUser(), | $this->getUser(), | ||||
$this->thread, | $this->thread, | ||||
PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
} else { | } else { | ||||
$nux = $this->buildNUXView(); | $nux = $this->buildNUXView(); | ||||
} | } | ||||
$this->initBehavior('conpherence-menu', | $this->initBehavior('conpherence-menu', | ||||
array( | array( | ||||
'baseURI' => $this->baseURI, | 'baseURI' => $this->baseURI, | ||||
'layoutID' => $layout_id, | 'layoutID' => 'conpherence-main-layout', | ||||
'selectedID' => $selected_id, | 'selectedID' => $selected_id, | ||||
'selectedThreadID' => $selected_thread_id, | 'selectedThreadID' => $selected_thread_id, | ||||
'selectedThreadPHID' => $selected_thread_phid, | 'selectedThreadPHID' => $selected_thread_phid, | ||||
'canEditSelectedThread' => $can_edit_selected, | 'canEditSelectedThread' => $can_edit_selected, | ||||
'latestTransactionID' => $this->latestTransactionID, | 'latestTransactionID' => $this->latestTransactionID, | ||||
'role' => $this->role, | 'role' => $this->role, | ||||
'hasThreadList' => (bool)$this->threadView, | 'hasThreadList' => (bool)$this->threadView, | ||||
'hasThread' => (bool)$this->messages, | 'hasThread' => (bool)$this->messages, | ||||
'hasWidgets' => false, | 'hasWidgets' => false, | ||||
)); | )); | ||||
$classes = array(); | |||||
if (!$this->getUser()->isLoggedIn()) { | |||||
$classes[] = 'conpherence-logged-out'; | |||||
} | |||||
if (!$this->getWidgetColumnVisible()) { | |||||
$classes[] = 'hide-widgets'; | |||||
} | |||||
$this->initBehavior('conpherence-participant-pane'); | $this->initBehavior('conpherence-participant-pane'); | ||||
return javelin_tag( | return | ||||
'div', | |||||
array( | |||||
'id' => $layout_id, | |||||
'sigil' => 'conpherence-layout', | |||||
'class' => 'conpherence-layout '. | |||||
implode(' ', $classes). | |||||
' conpherence-role-'.$this->role, | |||||
), | |||||
array( | array( | ||||
javelin_tag( | javelin_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'id' => 'conpherence-menu-pane', | 'id' => 'conpherence-menu-pane', | ||||
'class' => 'conpherence-menu-pane phabricator-side-menu', | 'class' => 'conpherence-menu-pane phabricator-side-menu', | ||||
'sigil' => 'conpherence-menu-pane', | 'sigil' => 'conpherence-menu-pane', | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | return | ||||
'div', | 'div', | ||||
array( | array( | ||||
'id' => 'conpherence-form', | 'id' => 'conpherence-form', | ||||
'sigil' => 'conpherence-form', | 'sigil' => 'conpherence-form', | ||||
), | ), | ||||
nonempty($this->replyForm, '')), | nonempty($this->replyForm, '')), | ||||
)), | )), | ||||
)), | )), | ||||
)); | ); | ||||
} | } | ||||
private function buildNUXView() { | private function buildNUXView() { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$engine = new ConpherenceThreadSearchEngine(); | $engine = new ConpherenceThreadSearchEngine(); | ||||
$engine->setViewer($viewer); | $engine->setViewer($viewer); | ||||
$saved = $engine->buildSavedQueryFromBuiltin('all'); | $saved = $engine->buildSavedQueryFromBuiltin('all'); | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |