コード例 #1
0
 protected function buildHeaderPaneContent(ConpherenceThread $conpherence, array $policy_objects)
 {
     assert_instances_of($policy_objects, 'PhabricatorPolicy');
     $crumbs = $this->buildApplicationCrumbs();
     $data = $conpherence->getDisplayData($this->getViewer());
     if ($conpherence->getID() && $conpherence->getIsRoom()) {
         $icon = $conpherence->getPolicyIconName($policy_objects);
     } else {
         $icon = null;
     }
     $crumbs->addCrumb(id(new PHUICrumbView())->setIcon($icon)->setName($data['title'])->setHref($this->getApplicationURI('update/' . $conpherence->getID() . '/'))->setWorkflow(true));
     return hsprintf('%s', array(phutil_tag('div', array('class' => 'header-loading-mask'), ''), $crumbs));
 }
コード例 #2
0
 private function renderThread(ConpherenceThread $thread, array $policy_objects)
 {
     $user = $this->getUser();
     $uri = '/' . $thread->getMonogram();
     $data = $thread->getDisplayData($user);
     $icon = null;
     if ($thread->getIsRoom()) {
         $icon = id(new PHUIIconView())->addClass('msr')->setIconFont($thread->getPolicyIconName($policy_objects));
     }
     $title = phutil_tag('span', array(), array($icon, $data['title']));
     $subtitle = $data['subtitle'];
     $unread_count = $data['unread_count'];
     $epoch = $data['epoch'];
     $image = $data['image'];
     $dom_id = $thread->getPHID() . '-nav-item';
     $glyph_pref = PhabricatorUserPreferences::PREFERENCE_TITLES;
     $preferences = $user->loadPreferences();
     if ($preferences->getPreference($glyph_pref) == 'glyph') {
         $glyph = id(new PhabricatorConpherenceApplication())->getTitleGlyph() . ' ';
     } else {
         $glyph = null;
     }
     return id(new ConpherenceMenuItemView())->setUser($user)->setTitle($title)->setSubtitle($subtitle)->setHref($uri)->setEpoch($epoch)->setImageURI($image)->setUnreadCount($unread_count)->setID($thread->getPHID() . '-nav-item')->addSigil('conpherence-menu-click')->setMetadata(array('title' => $glyph . $data['title'], 'id' => $dom_id, 'threadID' => $thread->getID()));
 }
コード例 #3
0
 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()));
     $nopic = $this->getRequest()->getExists('nopic');
     $image = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG);
     if ($nopic) {
         // do not render any pic related controls
     } else {
         if ($image) {
             $crop_uri = $conpherence->loadImageURI(ConpherenceImageData::SIZE_CROP);
             $form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Image'))->setValue(phutil_tag('img', array('src' => $crop_uri))))->appendChild(id(new ConpherencePicCropControl())->setLabel(pht('Crop Image'))->setValue($image))->appendChild(id(new ConpherenceFormDragAndDropUploadControl())->setLabel(pht('Change Image')));
         } else {
             $form->appendChild(id(new ConpherenceFormDragAndDropUploadControl())->setLabel(pht('Image')));
         }
     }
     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($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;
 }
コード例 #4
0
 private function getHeaderActionsConfig(ConpherenceThread $conpherence)
 {
     if ($conpherence->getIsRoom()) {
         $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() . '/?nopic', 'icon' => 'fa-pencil', 'key' => ConpherenceUpdateActions::METADATA), array('name' => pht('View in Conpherence'), 'disabled' => false, 'href' => '/' . $conpherence->getMonogram(), 'icon' => 'fa-comments', 'key' => 'go_conpherence'), array('name' => pht('Hide Column'), 'disabled' => false, 'href' => '#', 'icon' => 'fa-times', 'key' => 'hide_column'));
 }