private function buildActionView(PhabricatorUser $viewer, PhabricatorPaste $paste, PhabricatorFile $file) { $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $paste, PhabricatorPolicyCapability::CAN_EDIT); $can_fork = $viewer->isLoggedIn(); $fork_uri = $this->getApplicationURI('/create/?parent=' . $paste->getID()); return id(new PhabricatorActionListView())->setUser($viewer)->setObject($paste)->setObjectURI($this->getRequest()->getRequestURI())->addAction(id(new PhabricatorActionView())->setName(pht('Edit Paste'))->setIcon('fa-pencil')->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref($this->getApplicationURI('/edit/' . $paste->getID() . '/')))->addAction(id(new PhabricatorActionView())->setName(pht('Fork This Paste'))->setIcon('fa-code-fork')->setDisabled(!$can_fork)->setWorkflow(!$can_fork)->setHref($fork_uri))->addAction(id(new PhabricatorActionView())->setName(pht('View Raw File'))->setIcon('fa-file-text-o')->setHref($file->getBestURI())); }
private function renderFileLink(PhabricatorFile $file, PhabricatorObjectHandle $handle, array $options) { return id(new PhabricatorFileLinkView())->setFilePHID($file->getPHID())->setFileName($this->assertFlatText($options['name']))->setFileDownloadURI($file->getDownloadURI())->setFileViewURI($file->getBestURI())->setFileViewable((bool) $options['viewable']); }
private function buildActionView(PhabricatorPaste $paste, PhabricatorFile $file) { return id(new PhabricatorActionListView())->addAction(id(new PhabricatorActionView())->setName(pht('Fork This Paste'))->setIcon('fork')->setHref($this->getApplicationURI('?fork=' . $paste->getID())))->addAction(id(new PhabricatorActionView())->setName(pht('View Raw File'))->setIcon('file')->setHref($file->getBestURI())); }
private function getFileDictionary(PhabricatorFile $file) { return array('id' => $file->getID(), 'phid' => $file->getPHID(), 'uri' => $file->getBestURI()); }
protected function renderImageStage(PhabricatorFile $file) { return phutil_tag('div', array('class' => 'differential-image-stage'), phutil_tag('img', array('src' => $file->getBestURI()))); }
private function buildActionView(PhabricatorUser $user, PhabricatorPaste $paste, PhabricatorFile $file) { $can_edit = PhabricatorPolicyFilter::hasCapability($user, $paste, PhabricatorPolicyCapability::CAN_EDIT); return id(new PhabricatorActionListView())->setUser($user)->setObject($paste)->addAction(id(new PhabricatorActionView())->setName(pht('Fork This Paste'))->setIcon('fork')->setHref($this->getApplicationURI('?parent=' . $paste->getID())))->addAction(id(new PhabricatorActionView())->setName(pht('View Raw File'))->setIcon('file')->setHref($file->getBestURI()))->addAction(id(new PhabricatorActionView())->setName(pht('Edit Paste'))->setIcon('edit')->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref($this->getApplicationURI('/edit/' . $paste->getID() . '/'))); }