3 final class ConpherenceLayoutView
extends AphrontTagView
{
13 private $theme = ConpherenceRoomSettings
::COLOR_LIGHT
;
14 private $latestTransactionID;
16 public function setMessages($messages) {
17 $this->messages
= $messages;
21 public function setReplyForm($reply_form) {
22 $this->replyForm
= $reply_form;
26 public function setHeader($header) {
27 $this->header
= $header;
31 public function setSearch($search) {
32 $this->search
= $search;
36 public function setRole($role) {
41 public function getThreadView() {
42 return $this->threadView
;
45 public function setBaseURI($base_uri) {
46 $this->baseURI
= $base_uri;
50 public function setThread(ConpherenceThread
$thread) {
51 $this->thread
= $thread;
55 public function setThreadView(ConpherenceThreadListView
$thead_view) {
56 $this->threadView
= $thead_view;
60 public function setTheme($theme) {
61 $this->theme
= $theme;
65 public function setLatestTransactionID($id) {
66 $this->latestTransactionID
= $id;
70 protected function getTagAttributes() {
72 $classes[] = 'conpherence-layout';
73 $classes[] = 'hide-widgets';
74 $classes[] = 'conpherence-role-'.$this->role
;
75 $classes[] = ConpherenceRoomSettings
::getThemeClass($this->theme
);
78 'id' => 'conpherence-main-layout',
79 'sigil' => 'conpherence-layout',
80 'class' => implode(' ', $classes),
84 protected function getTagContent() {
85 require_celerity_resource('conpherence-menu-css');
86 require_celerity_resource('conpherence-message-pane-css');
87 require_celerity_resource('conpherence-participant-pane-css');
90 $selected_thread_id = null;
91 $selected_thread_phid = null;
92 $can_edit_selected = null;
95 $selected_id = $this->thread
->getPHID().'-nav-item';
96 $selected_thread_id = $this->thread
->getID();
97 $selected_thread_phid = $this->thread
->getPHID();
98 $can_edit_selected = PhabricatorPolicyFilter
::hasCapability(
101 PhabricatorPolicyCapability
::CAN_EDIT
);
103 $nux = $this->buildNUXView();
105 $this->initBehavior('conpherence-menu',
107 'baseURI' => $this->baseURI
,
108 'layoutID' => 'conpherence-main-layout',
109 'selectedID' => $selected_id,
110 'selectedThreadID' => $selected_thread_id,
111 'selectedThreadPHID' => $selected_thread_phid,
112 'canEditSelectedThread' => $can_edit_selected,
113 'latestTransactionID' => $this->latestTransactionID
,
114 'role' => $this->role
,
115 'theme' => ConpherenceRoomSettings
::getThemeClass($this->theme
),
116 'hasThreadList' => (bool)$this->threadView
,
117 'hasThread' => (bool)$this->messages
,
118 'hasWidgets' => false,
121 $this->initBehavior('conpherence-participant-pane');
128 'id' => 'conpherence-menu-pane',
129 'class' => 'conpherence-menu-pane phabricator-side-menu',
130 'sigil' => 'conpherence-menu-pane',
136 'class' => 'conpherence-content-pane',
142 'class' => 'conpherence-loading-mask',
148 'class' => 'conpherence-header-pane',
149 'id' => 'conpherence-header-pane',
150 'sigil' => 'conpherence-header-pane',
152 nonempty($this->header
, '')),
156 'class' => 'conpherence-no-threads',
157 'sigil' => 'conpherence-no-threads',
158 'style' => 'display: none;',
164 'class' => 'conpherence-participant-pane',
165 'id' => 'conpherence-participant-pane',
166 'sigil' => 'conpherence-participant-pane',
172 'class' => 'widgets-loading-mask',
178 'sigil' => 'conpherence-widgets-holder',
185 'class' => 'conpherence-message-pane',
186 'id' => 'conpherence-message-pane',
187 'sigil' => 'conpherence-message-pane',
193 'class' => 'conpherence-messages',
194 'id' => 'conpherence-messages',
195 'sigil' => 'conpherence-messages',
197 nonempty($this->messages
, '')),
201 'class' => 'conpherence-search-main',
202 'id' => 'conpherence-search-main',
203 'sigil' => 'conpherence-search-main',
205 nonempty($this->search
, '')),
209 'class' => 'messages-loading-mask',
215 'id' => 'conpherence-form',
216 'sigil' => 'conpherence-form',
218 nonempty($this->replyForm
, '')),
224 private function buildNUXView() {
225 $viewer = $this->getViewer();
227 $engine = id(new ConpherenceThreadSearchEngine())
228 ->setViewer($viewer);
229 $saved = $engine->buildSavedQueryFromBuiltin('all');
230 $query = $engine->buildQueryFromSavedQuery($saved);
231 $pager = $engine->newPagerForSavedQuery($saved)
233 $results = $engine->executeQuery($query, $pager);
234 $view = $engine->renderResults($results, $saved);
236 $create_button = id(new PHUIButtonView())
238 ->setText(pht('New Room'))
239 ->setHref('/conpherence/new/')
241 ->setColor(PHUIButtonView
::GREEN
);
244 $create_button->setIcon('fa-comments');
246 $header = id(new PHUIHeaderView())
247 ->setHeader(pht('Joinable Rooms'))
248 ->addActionLink($create_button);
250 $box = id(new PHUIObjectBoxView())
252 ->setObjectList($view->getContent());
257 $view = id(new PHUIBigInfoView())
258 ->setIcon('fa-comments')
259 ->setTitle(pht('Welcome to Conpherence'))
261 pht('Conpherence lets you create public or private rooms to '.
262 'communicate with others.'))
263 ->addAction($create_button);