Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/controller/post/PhamePostViewController.php
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$blogger = id(new PhabricatorPeopleQuery()) | $blogger = id(new PhabricatorPeopleQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array($post->getBloggerPHID())) | ->withPHIDs(array($post->getBloggerPHID())) | ||||
->needProfileImage(true) | ->needProfileImage(true) | ||||
->executeOne(); | ->executeOne(); | ||||
$blogger_profile = $blogger->loadUserProfile(); | $blogger_profile = $blogger->loadUserProfile(); | ||||
$author_uri = '/p/'.$blogger->getUsername().'/'; | |||||
$author_uri = PhabricatorEnv::getURI($author_uri); | |||||
$author = phutil_tag( | $author = phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => '/p/'.$blogger->getUsername().'/', | 'href' => $author_uri, | ||||
), | ), | ||||
$blogger->getUsername()); | $blogger->getUsername()); | ||||
$date = phabricator_datetime($post->getDatePublished(), $viewer); | $date = phabricator_datetime($post->getDatePublished(), $viewer); | ||||
if ($post->isDraft()) { | if ($post->isDraft()) { | ||||
$subtitle = pht('Unpublished draft by %s.', $author); | $subtitle = pht('Unpublished draft by %s.', $author); | ||||
} else { | } else { | ||||
$subtitle = pht('Written by %s on %s.', $author, $date); | $subtitle = pht('Written by %s on %s.', $author, $date); | ||||
} | } | ||||
$user_icon = $blogger_profile->getIcon(); | $user_icon = $blogger_profile->getIcon(); | ||||
$user_icon = PhabricatorPeopleIconSet::getIconIcon($user_icon); | $user_icon = PhabricatorPeopleIconSet::getIconIcon($user_icon); | ||||
$user_icon = id(new PHUIIconView())->setIcon($user_icon); | $user_icon = id(new PHUIIconView())->setIcon($user_icon); | ||||
$about = id(new PhameDescriptionView()) | $about = id(new PhameDescriptionView()) | ||||
->setTitle($subtitle) | ->setTitle($subtitle) | ||||
->setDescription( | ->setDescription( | ||||
array( | array( | ||||
$user_icon, | $user_icon, | ||||
' ', | ' ', | ||||
$blogger_profile->getTitle(), | $blogger_profile->getTitle(), | ||||
)) | )) | ||||
->setImage($blogger->getProfileImageURI()) | ->setImage($blogger->getProfileImageURI()) | ||||
->setImageHref('/p/'.$blogger->getUsername()); | ->setImageHref($author_uri); | ||||
$timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
$post, | $post, | ||||
id(new PhamePostTransactionQuery()) | id(new PhamePostTransactionQuery()) | ||||
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); | ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); | ||||
$timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); | $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); | ||||
if ($is_external) { | if ($is_external) { | ||||
$add_comment = null; | $add_comment = null; | ||||
} else { | } else { | ||||
$add_comment = $this->buildCommentForm($post); | $add_comment = $this->buildCommentForm($post); | ||||
$add_comment = phutil_tag_div('mlb mlt', $add_comment); | $add_comment = phutil_tag_div('mlb mlt', $add_comment); | ||||
} | } | ||||
list($prev, $next) = $this->loadAdjacentPosts($post); | list($prev, $next) = $this->loadAdjacentPosts($post); | ||||
$properties = id(new PHUIPropertyListView()) | $properties = id(new PHUIPropertyListView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setObject($post); | ->setObject($post); | ||||
$next_view = new PhameNextPostView(); | $next_view = new PhameNextPostView(); | ||||
if ($next) { | if ($next) { | ||||
$next_view->setNext($next->getTitle(), $next->getViewURI()); | $next_view->setNext($next->getTitle(), $next->getLiveURI()); | ||||
} | } | ||||
if ($prev) { | if ($prev) { | ||||
$next_view->setPrevious($prev->getTitle(), $prev->getViewURI()); | $next_view->setPrevious($prev->getTitle(), $prev->getLiveURI()); | ||||
} | } | ||||
$document->setFoot($next_view); | $document->setFoot($next_view); | ||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
$properties = phutil_tag_div('phui-document-view-pro-box', $properties); | $properties = phutil_tag_div('phui-document-view-pro-box', $properties); | ||||
$page = $this->newPage() | $page = $this->newPage() | ||||
->setTitle($post->getTitle()) | ->setTitle($post->getTitle()) | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |