当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorDraft::newFromUserAndKey方法代码示例

本文整理汇总了PHP中PhabricatorDraft::newFromUserAndKey方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorDraft::newFromUserAndKey方法的具体用法?PHP PhabricatorDraft::newFromUserAndKey怎么用?PHP PhabricatorDraft::newFromUserAndKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorDraft的用法示例。


在下文中一共展示了PhabricatorDraft::newFromUserAndKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildCommentForm

 private function buildCommentForm(PhamePost $post)
 {
     $viewer = $this->getViewer();
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $post->getPHID());
     $box = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($post->getPHID())->setDraft($draft)->setHeaderText(pht('Add Comment'))->setAction($this->getApplicationURI('post/comment/' . $post->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return phutil_tag_div('phui-document-view-pro-box', $box);
 }
开发者ID:miaokuan,项目名称:phabricator,代码行数:7,代码来源:PhamePostViewController.php

示例2: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $timeline = null;
     $url = id(new PhabricatorPhurlURLQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$url) {
         return new Aphront404Response();
     }
     $title = $url->getMonogram();
     $page_title = $title . ' ' . $url->getName();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($title, $url->getURI());
     $timeline = $this->buildTransactionTimeline($url, new PhabricatorPhurlURLTransactionQuery());
     $header = $this->buildHeaderView($url);
     $actions = $this->buildActionView($url);
     $properties = $this->buildPropertyView($url);
     $properties->setActionList($actions);
     $url_error = id(new PHUIInfoView())->setErrors(array(pht('This URL is invalid due to a bad protocol.')))->setIsHidden($url->isValid());
     $box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties)->setInfoView($url_error);
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('More Cowbell');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $url->getPHID());
     $comment_uri = $this->getApplicationURI('/phurl/comment/' . $url->getID() . '/');
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($url->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($comment_uri)->setSubmitButtonName(pht('Add Comment'));
     return $this->buildApplicationPage(array($crumbs, $box, $timeline, $add_comment_form), array('title' => $page_title, 'pageObjects' => array($url->getPHID())));
 }
开发者ID:hamilyjing,项目名称:phabricator,代码行数:27,代码来源:PhabricatorPhurlURLViewController.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $macro = id(new PhabricatorMacroQuery())->setViewer($viewer)->withIDs(array($id))->needFiles(true)->executeOne();
     if (!$macro) {
         return new Aphront404Response();
     }
     $title_short = pht('Macro "%s"', $macro->getName());
     $title_long = pht('Image Macro "%s"', $macro->getName());
     $curtain = $this->buildCurtain($macro);
     $subheader = $this->buildSubheaderView($macro);
     $file = $this->buildFileView($macro);
     $details = $this->buildPropertySectionView($macro);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($macro->getName());
     $crumbs->setBorder(true);
     $timeline = $this->buildTransactionTimeline($macro, new PhabricatorMacroTransactionQuery());
     $header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($macro)->setHeader($macro->getName())->setHeaderIcon('fa-file-image-o');
     if (!$macro->getIsDisabled()) {
         $header->setStatus('fa-check', 'bluegrey', pht('Active'));
     } else {
         $header->setStatus('fa-ban', 'red', pht('Archived'));
     }
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $comment_header = $is_serious ? pht('Add Comment') : pht('Grovel in Awe');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $macro->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($macro->getPHID())->setDraft($draft)->setHeaderText($comment_header)->setAction($this->getApplicationURI('/comment/' . $macro->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     $view = id(new PHUITwoColumnView())->setHeader($header)->setSubheader($subheader)->setCurtain($curtain)->setMainColumn(array($timeline, $add_comment_form))->addPropertySection(pht('Macro'), $file)->addPropertySection(pht('Details'), $details);
     return $this->newPage()->setTitle($title_short)->setCrumbs($crumbs)->setPageObjectPHIDs(array($macro->getPHID()))->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:31,代码来源:PhabricatorMacroViewController.php

示例4: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $paste = id(new PhabricatorPasteQuery())->setViewer($viewer)->withIDs(array($id))->needContent(true)->executeOne();
     if (!$paste) {
         return new Aphront404Response();
     }
     $file = id(new PhabricatorFileQuery())->setViewer($viewer)->withPHIDs(array($paste->getFilePHID()))->executeOne();
     if (!$file) {
         return new Aphront400Response();
     }
     $forks = id(new PhabricatorPasteQuery())->setViewer($viewer)->withParentPHIDs(array($paste->getPHID()))->execute();
     $fork_phids = mpull($forks, 'getPHID');
     $header = $this->buildHeaderView($paste);
     $actions = $this->buildActionView($viewer, $paste, $file);
     $properties = $this->buildPropertyView($paste, $fork_phids, $actions);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $source_code = $this->buildSourceCodeView($paste, null, $this->highlightMap);
     $source_code = id(new PHUIBoxView())->appendChild($source_code)->addMargin(PHUI::MARGIN_LARGE_LEFT)->addMargin(PHUI::MARGIN_LARGE_RIGHT)->addMargin(PHUI::MARGIN_LARGE_TOP);
     $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())->addTextCrumb('P' . $paste->getID(), '/P' . $paste->getID());
     $timeline = $this->buildTransactionTimeline($paste, new PhabricatorPasteTransactionQuery());
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Eat Paste');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $paste->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($paste->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $paste->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return $this->buildApplicationPage(array($crumbs, $object_box, $source_code, $timeline, $add_comment_form), array('title' => $paste->getFullName(), 'pageObjects' => array($paste->getPHID())));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:28,代码来源:PhabricatorPasteViewController.php

示例5: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $sequence = $request->getURIData('sequence');
     $timeline = null;
     $event = id(new PhabricatorCalendarEventQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$event) {
         return new Aphront404Response();
     }
     if ($sequence) {
         $result = $this->getEventAtIndexForGhostPHID($viewer, $event->getPHID(), $sequence);
         if ($result) {
             $parent_event = $event;
             $event = $result;
             $event->attachParentEvent($parent_event);
             return id(new AphrontRedirectResponse())->setURI('/E' . $result->getID());
         } else {
             if ($sequence && $event->getIsRecurring()) {
                 $parent_event = $event;
                 $event = $event->generateNthGhost($sequence, $viewer);
                 $event->attachParentEvent($parent_event);
             } else {
                 if ($sequence) {
                     return new Aphront404Response();
                 }
             }
         }
         $title = $event->getMonogram() . ' (' . $sequence . ')';
         $page_title = $title . ' ' . $event->getName();
         $crumbs = $this->buildApplicationCrumbs();
         $crumbs->addTextCrumb($title, '/' . $event->getMonogram() . '/' . $sequence);
     } else {
         $title = 'E' . $event->getID();
         $page_title = $title . ' ' . $event->getName();
         $crumbs = $this->buildApplicationCrumbs();
         $crumbs->addTextCrumb($title);
         $crumbs->setBorder(true);
     }
     if (!$event->getIsGhostEvent()) {
         $timeline = $this->buildTransactionTimeline($event, new PhabricatorCalendarEventTransactionQuery());
     }
     $header = $this->buildHeaderView($event);
     $actions = $this->buildActionView($event);
     $properties = $this->buildPropertyListView($event);
     $details = $this->buildPropertySection($event);
     $description = $this->buildDescriptionView($event);
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Add To Plate');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $event->getPHID());
     if ($sequence) {
         $comment_uri = $this->getApplicationURI('/event/comment/' . $event->getID() . '/' . $sequence . '/');
     } else {
         $comment_uri = $this->getApplicationURI('/event/comment/' . $event->getID() . '/');
     }
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($event->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($comment_uri)->setSubmitButtonName(pht('Add Comment'));
     $view = id(new PHUITwoColumnView())->setHeader($header)->setMainColumn($timeline)->setPropertyList($properties)->addPropertySection(pht('DETAILS'), $details)->addPropertySection(pht('DESCRIPTION'), $description)->setActionList($actions);
     return $this->newPage()->setTitle($page_title)->setCrumbs($crumbs)->setPageObjectPHIDs(array($event->getPHID()))->appendChild(array($view));
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:59,代码来源:PhabricatorCalendarEventViewController.php

示例6: buildCommentForm

 private function buildCommentForm(PhabricatorBadgesBadge $badge)
 {
     $viewer = $this->getViewer();
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Render Honors');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $badge->getPHID());
     return id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($badge->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $badge->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:8,代码来源:PhabricatorBadgesViewController.php

示例7: buildCommentForm

 private function buildCommentForm(PhabricatorSlowvotePoll $poll)
 {
     $viewer = $this->getRequest()->getUser();
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Enter Deliberations');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $poll->getPHID());
     return id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($poll->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $poll->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:8,代码来源:PhabricatorSlowvotePollController.php

示例8: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $sequence = $request->getURIData('sequence');
     $timeline = null;
     $event = id(new PhabricatorCalendarEventQuery())->setViewer($viewer)->withIDs(array($this->id))->executeOne();
     if (!$event) {
         return new Aphront404Response();
     }
     if ($sequence) {
         $result = $this->getEventAtIndexForGhostPHID($viewer, $event->getPHID(), $sequence);
         if ($result) {
             $parent_event = $event;
             $event = $result;
             $event->attachParentEvent($parent_event);
             return id(new AphrontRedirectResponse())->setURI('/E' . $result->getID());
         } else {
             if ($sequence && $event->getIsRecurring()) {
                 $parent_event = $event;
                 $event = $event->generateNthGhost($sequence, $viewer);
                 $event->attachParentEvent($parent_event);
             } else {
                 if ($sequence) {
                     return new Aphront404Response();
                 }
             }
         }
         $title = $event->getMonogram() . ' (' . $sequence . ')';
         $page_title = $title . ' ' . $event->getName();
         $crumbs = $this->buildApplicationCrumbs();
         $crumbs->addTextCrumb($title, '/' . $event->getMonogram() . '/' . $sequence);
     } else {
         $title = 'E' . $event->getID();
         $page_title = $title . ' ' . $event->getName();
         $crumbs = $this->buildApplicationCrumbs();
         $crumbs->addTextCrumb($title, '/E' . $event->getID());
     }
     if (!$event->getIsGhostEvent()) {
         $timeline = $this->buildTransactionTimeline($event, new PhabricatorCalendarEventTransactionQuery());
     }
     $header = $this->buildHeaderView($event);
     $actions = $this->buildActionView($event);
     $properties = $this->buildPropertyView($event);
     $properties->setActionList($actions);
     $box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Add To Plate');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $event->getPHID());
     if ($sequence) {
         $comment_uri = $this->getApplicationURI('/event/comment/' . $event->getID() . '/' . $sequence . '/');
     } else {
         $comment_uri = $this->getApplicationURI('/event/comment/' . $event->getID() . '/');
     }
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($event->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($comment_uri)->setSubmitButtonName(pht('Add Comment'));
     return $this->buildApplicationPage(array($crumbs, $box, $timeline, $add_comment_form), array('title' => $page_title));
 }
开发者ID:kalbasit,项目名称:phabricator,代码行数:57,代码来源:PhabricatorCalendarEventViewController.php

示例9: buildAddCommentView

 private function buildAddCommentView(LegalpadDocument $document, $comment_form_id)
 {
     $viewer = $this->getViewer();
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $document->getPHID());
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $title = $is_serious ? pht('Add Comment') : pht('Debate Legislation');
     $form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($document->getPHID())->setFormID($comment_form_id)->setHeaderText($title)->setDraft($draft)->setSubmitButtonName(pht('Add Comment'))->setAction($this->getApplicationURI('/comment/' . $document->getID() . '/'))->setRequestURI($this->getRequest()->getRequestURI());
     return $form;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:9,代码来源:LegalpadDocumentManageController.php

示例10: buildTransactionView

 private function buildTransactionView(PhabricatorFile $file)
 {
     $viewer = $this->getViewer();
     $timeline = $this->buildTransactionTimeline($file, new PhabricatorFileTransactionQuery());
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Question File Integrity');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $file->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($file->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $file->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return array($timeline, $add_comment_form);
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:10,代码来源:PhabricatorFileInfoController.php

示例11: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $latest_conpherences = array();
     $latest_participant = id(new ConpherenceParticipantQuery())->withParticipantPHIDs(array($user->getPHID()))->setLimit(6)->execute();
     if ($latest_participant) {
         $conpherence_phids = mpull($latest_participant, 'getConpherencePHID');
         $latest_conpherences = id(new ConpherenceThreadQuery())->setViewer($user)->withPHIDs($conpherence_phids)->needCropPics(true)->needParticipantCache(true)->execute();
         $latest_conpherences = mpull($latest_conpherences, null, 'getPHID');
         $latest_conpherences = array_select_keys($latest_conpherences, $conpherence_phids);
     }
     $conpherence = null;
     $should_404 = false;
     if ($request->getInt('id')) {
         $conpherence = id(new ConpherenceThreadQuery())->setViewer($user)->withIDs(array($request->getInt('id')))->needCropPics(true)->needTransactions(true)->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT)->executeOne();
         $should_404 = true;
     } else {
         if ($latest_participant) {
             $participant = head($latest_participant);
             $conpherence = id(new ConpherenceThreadQuery())->setViewer($user)->withPHIDs(array($participant->getConpherencePHID()))->needCropPics(true)->needTransactions(true)->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT)->executeOne();
             $should_404 = true;
         }
     }
     $durable_column = id(new ConpherenceDurableColumnView())->setUser($user)->setVisible(true);
     if (!$conpherence) {
         if ($should_404) {
             return new Aphront404Response();
         }
         $conpherence_id = null;
         $conpherence_phid = null;
         $latest_transaction_id = null;
         $can_edit = false;
     } else {
         $this->setConpherence($conpherence);
         $participant = $conpherence->getParticipant($user->getPHID());
         $transactions = $conpherence->getTransactions();
         $latest_transaction = head($transactions);
         $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
         $participant->markUpToDate($conpherence, $latest_transaction);
         unset($write_guard);
         $draft = PhabricatorDraft::newFromUserAndKey($user, $conpherence->getPHID());
         $durable_column->setDraft($draft)->setSelectedConpherence($conpherence)->setConpherences($latest_conpherences);
         $conpherence_id = $conpherence->getID();
         $conpherence_phid = $conpherence->getPHID();
         $latest_transaction_id = $latest_transaction->getID();
         $can_edit = PhabricatorPolicyFilter::hasCapability($user, $conpherence, PhabricatorPolicyCapability::CAN_EDIT);
     }
     $dropdown_query = id(new AphlictDropdownDataQuery())->setViewer($user);
     $dropdown_query->execute();
     $response = array('content' => hsprintf('%s', $durable_column), 'threadID' => $conpherence_id, 'threadPHID' => $conpherence_phid, 'latestTransactionID' => $latest_transaction_id, 'canEdit' => $can_edit, 'aphlictDropdownData' => array($dropdown_query->getNotificationData(), $dropdown_query->getConpherenceData()));
     return id(new AphrontAjaxResponse())->setContent($response);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:52,代码来源:ConpherenceColumnViewController.php

示例12: renderCommentForm

 private function renderCommentForm(PhabricatorFile $file)
 {
     $viewer = $this->getViewer();
     if (!$viewer->isLoggedIn()) {
         $login_href = id(new PhutilURI('/auth/start/'))->setQueryParam('next', '/' . $file->getMonogram());
         return id(new PHUIFormLayoutView())->addClass('phui-comment-panel-empty')->appendChild(id(new PHUIButtonView())->setTag('a')->setText(pht('Login to Comment'))->setHref((string) $login_href));
     }
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $file->getPHID());
     $post_uri = $this->getApplicationURI('thread/' . $file->getPHID() . '/');
     $form = id(new AphrontFormView())->setUser($viewer)->setAction($post_uri)->addSigil('lightbox-comment-form')->addClass('lightbox-comment-form')->setWorkflow(true)->appendChild(id(new PhabricatorRemarkupControl())->setUser($viewer)->setName('comment')->setValue($draft->getDraft()))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Comment')));
     $view = phutil_tag_div('phui-comment-panel', $form);
     return $view;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:13,代码来源:PhabricatorFileLightboxController.php

示例13: buildTransactionView

 private function buildTransactionView(PhabricatorFile $file, array $xactions)
 {
     $user = $this->getRequest()->getUser();
     $engine = id(new PhabricatorMarkupEngine())->setViewer($user);
     foreach ($xactions as $xaction) {
         if ($xaction->getComment()) {
             $engine->addObject($xaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
         }
     }
     $engine->process();
     $timeline = id(new PhabricatorApplicationTransactionView())->setUser($user)->setObjectPHID($file->getPHID())->setTransactions($xactions)->setMarkupEngine($engine);
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Question File Integrity');
     $draft = PhabricatorDraft::newFromUserAndKey($user, $file->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($user)->setObjectPHID($file->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $file->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return array($timeline, $add_comment_form);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:17,代码来源:PhabricatorFileInfoController.php

示例14: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $macro = id(new PhabricatorMacroQuery())->setViewer($user)->withIDs(array($this->id))->needFiles(true)->executeOne();
     if (!$macro) {
         return new Aphront404Response();
     }
     $file = $macro->getFile();
     $title_short = pht('Macro "%s"', $macro->getName());
     $title_long = pht('Image Macro "%s"', $macro->getName());
     $actions = $this->buildActionView($macro);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->setActionList($actions);
     $crumbs->addTextCrumb($title_short, $this->getApplicationURI('/view/' . $macro->getID() . '/'));
     $properties = $this->buildPropertyView($macro, $actions);
     if ($file) {
         $file_view = new PHUIPropertyListView();
         $file_view->addImageContent(phutil_tag('img', array('src' => $file->getViewURI(), 'class' => 'phabricator-image-macro-hero')));
     }
     $xactions = id(new PhabricatorMacroTransactionQuery())->setViewer($request->getUser())->withObjectPHIDs(array($macro->getPHID()))->execute();
     $engine = id(new PhabricatorMarkupEngine())->setViewer($user);
     foreach ($xactions as $xaction) {
         if ($xaction->getComment()) {
             $engine->addObject($xaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
         }
     }
     $engine->process();
     $timeline = id(new PhabricatorApplicationTransactionView())->setUser($user)->setObjectPHID($macro->getPHID())->setTransactions($xactions)->setMarkupEngine($engine);
     $header = id(new PHUIHeaderView())->setUser($user)->setPolicyObject($macro)->setHeader($title_long);
     if ($macro->getIsDisabled()) {
         $header->addTag(id(new PHUITagView())->setType(PHUITagView::TYPE_STATE)->setName(pht('Macro Disabled'))->setBackgroundColor(PHUITagView::COLOR_BLACK));
     }
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $comment_header = $is_serious ? pht('Add Comment') : pht('Grovel in Awe');
     $draft = PhabricatorDraft::newFromUserAndKey($user, $macro->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($user)->setObjectPHID($macro->getPHID())->setDraft($draft)->setHeaderText($comment_header)->setAction($this->getApplicationURI('/comment/' . $macro->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     if ($file_view) {
         $object_box->addPropertyList($file_view);
     }
     return $this->buildApplicationPage(array($crumbs, $object_box, $timeline, $add_comment_form), array('title' => $title_short));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:43,代码来源:PhabricatorMacroViewController.php

示例15: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $id = $request->getURIData('requestID');
     $viewer = $request->getViewer();
     $pull = id(new ReleephRequestQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$pull) {
         return new Aphront404Response();
     }
     $this->setBranch($pull->getBranch());
     // Redirect older URIs to new "Y" URIs.
     // TODO: Get rid of this eventually.
     $actual_path = $request->getRequestURI()->getPath();
     $expect_path = '/' . $pull->getMonogram();
     if ($actual_path != $expect_path) {
         return id(new AphrontRedirectResponse())->setURI($expect_path);
     }
     // TODO: Break this 1:1 stuff?
     $branch = $pull->getBranch();
     $field_list = PhabricatorCustomField::getObjectFields($pull, PhabricatorCustomField::ROLE_VIEW);
     $field_list->setViewer($viewer)->readFieldsFromStorage($pull);
     // TODO: This should be more modern and general.
     $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer);
     foreach ($field_list->getFields() as $field) {
         if ($field->shouldMarkup()) {
             $field->setMarkupEngine($engine);
         }
     }
     $engine->process();
     $pull_box = id(new ReleephRequestView())->setUser($viewer)->setCustomFields($field_list)->setPullRequest($pull);
     $timeline = $this->buildTransactionTimeline($pull, new ReleephRequestTransactionQuery());
     $add_comment_header = pht('Plea or Yield');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $pull->getPHID());
     $title = hsprintf('%s %s', $pull->getMonogram(), $pull->getSummaryForDisplay());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($pull->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/request/comment/' . $pull->getID() . '/'))->setSubmitButtonName(pht('Comment'));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($pull->getMonogram(), '/' . $pull->getMonogram());
     $crumbs->setBorder(true);
     $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-flag-checkered');
     $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($pull_box, $timeline, $add_comment_form));
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:41,代码来源:ReleephRequestViewController.php


注:本文中的PhabricatorDraft::newFromUserAndKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。