diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 383edbc0ea..ead5c3bebd 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3245,6 +3245,7 @@ phutil_register_library_map(array( 'PhameBasicBlogSkin' => 'applications/phame/skins/PhameBasicBlogSkin.php', 'PhameBasicTemplateBlogSkin' => 'applications/phame/skins/PhameBasicTemplateBlogSkin.php', 'PhameBlog' => 'applications/phame/storage/PhameBlog.php', + 'PhameBlogController' => 'applications/phame/controller/blog/PhameBlogController.php', 'PhameBlogDeleteController' => 'applications/phame/controller/blog/PhameBlogDeleteController.php', 'PhameBlogEditController' => 'applications/phame/controller/blog/PhameBlogEditController.php', 'PhameBlogEditor' => 'applications/phame/editor/PhameBlogEditor.php', @@ -3263,6 +3264,7 @@ phutil_register_library_map(array( 'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php', 'PhameDAO' => 'applications/phame/storage/PhameDAO.php', 'PhamePost' => 'applications/phame/storage/PhamePost.php', + 'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php', 'PhamePostDeleteController' => 'applications/phame/controller/post/PhamePostDeleteController.php', 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', 'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', @@ -7503,18 +7505,19 @@ phutil_register_library_map(array( 'PhabricatorProjectInterface', 'PhabricatorApplicationTransactionInterface', ), - 'PhameBlogDeleteController' => 'PhameController', - 'PhameBlogEditController' => 'PhameController', + 'PhameBlogController' => 'PhameController', + 'PhameBlogDeleteController' => 'PhameBlogController', + 'PhameBlogEditController' => 'PhameBlogController', 'PhameBlogEditor' => 'PhabricatorApplicationTransactionEditor', - 'PhameBlogFeedController' => 'PhameController', - 'PhameBlogListController' => 'PhameController', - 'PhameBlogLiveController' => 'PhameController', + 'PhameBlogFeedController' => 'PhameBlogController', + 'PhameBlogListController' => 'PhameBlogController', + 'PhameBlogLiveController' => 'PhameBlogController', 'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhameBlogSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhameBlogSite' => 'PhameSite', 'PhameBlogSkin' => 'PhabricatorController', 'PhameBlogTransaction' => 'PhabricatorApplicationTransaction', - 'PhameBlogViewController' => 'PhameController', + 'PhameBlogViewController' => 'PhameBlogController', 'PhameCelerityResources' => 'CelerityResources', 'PhameConduitAPIMethod' => 'ConduitAPIMethod', 'PhameController' => 'PhabricatorController', @@ -7530,22 +7533,23 @@ phutil_register_library_map(array( 'PhabricatorSubscribableInterface', 'PhabricatorTokenReceiverInterface', ), - 'PhamePostDeleteController' => 'PhameController', - 'PhamePostEditController' => 'PhameController', + 'PhamePostController' => 'PhameController', + 'PhamePostDeleteController' => 'PhamePostController', + 'PhamePostEditController' => 'PhamePostController', 'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', - 'PhamePostFramedController' => 'PhameController', - 'PhamePostListController' => 'PhameController', - 'PhamePostNewController' => 'PhameController', - 'PhamePostNotLiveController' => 'PhameController', - 'PhamePostPreviewController' => 'PhameController', - 'PhamePostPublishController' => 'PhameController', + 'PhamePostFramedController' => 'PhamePostController', + 'PhamePostListController' => 'PhamePostController', + 'PhamePostNewController' => 'PhamePostController', + 'PhamePostNotLiveController' => 'PhamePostController', + 'PhamePostPreviewController' => 'PhamePostController', + 'PhamePostPublishController' => 'PhamePostController', 'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhamePostSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhamePostTransaction' => 'PhabricatorApplicationTransaction', 'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'PhamePostUnpublishController' => 'PhameController', + 'PhamePostUnpublishController' => 'PhamePostController', 'PhamePostView' => 'AphrontView', - 'PhamePostViewController' => 'PhameController', + 'PhamePostViewController' => 'PhamePostController', 'PhameQueryConduitAPIMethod' => 'PhameConduitAPIMethod', 'PhameQueryPostsConduitAPIMethod' => 'PhameConduitAPIMethod', 'PhameResourceController' => 'CelerityResourceController', diff --git a/src/applications/phame/controller/PhameController.php b/src/applications/phame/controller/PhameController.php index fba717e8d9..0cfe877898 100644 --- a/src/applications/phame/controller/PhameController.php +++ b/src/applications/phame/controller/PhameController.php @@ -2,27 +2,6 @@ abstract class PhameController extends PhabricatorController { - protected function renderSideNavFilterView() { - - $base_uri = new PhutilURI($this->getApplicationURI()); - - $nav = new AphrontSideNavFilterView(); - $nav->setBaseURI($base_uri); - - $nav->addLabel(pht('Posts')); - $nav->addFilter('post/all', pht('Latest Posts')); - $nav->addFilter('post/draft', pht('My Drafts')); - $nav->addFilter('post', pht('My Posts')); - - $nav->addLabel(pht('Blogs')); - $nav->addFilter('blog/user', pht('Joinable Blogs')); - $nav->addFilter('blog/all', pht('All Blogs')); - - $nav->selectFilter(null); - - return $nav; - } - protected function renderPostList( array $posts, PhabricatorUser $viewer, @@ -111,10 +90,6 @@ abstract class PhameController extends PhabricatorController { return $stories; } - public function buildApplicationMenu() { - return $this->renderSideNavFilterView()->getMenu(); - } - protected function buildApplicationCrumbs() { $crumbs = parent::buildApplicationCrumbs(); $crumbs->addAction( diff --git a/src/applications/phame/controller/blog/PhameBlogController.php b/src/applications/phame/controller/blog/PhameBlogController.php new file mode 100644 index 0000000000..97152e5813 --- /dev/null +++ b/src/applications/phame/controller/blog/PhameBlogController.php @@ -0,0 +1,10 @@ +newApplicationMenu() + ->setSearchEngine(new PhameBlogSearchEngine()); + } + +} diff --git a/src/applications/phame/controller/blog/PhameBlogDeleteController.php b/src/applications/phame/controller/blog/PhameBlogDeleteController.php index 33282582ae..c60e27b2d7 100644 --- a/src/applications/phame/controller/blog/PhameBlogDeleteController.php +++ b/src/applications/phame/controller/blog/PhameBlogDeleteController.php @@ -1,13 +1,13 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( @@ -27,7 +27,7 @@ final class PhameBlogDeleteController extends PhameController { $cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/'); $dialog = id(new AphrontDialogView()) - ->setUser($user) + ->setUser($viewer) ->setTitle(pht('Delete Blog?')) ->appendChild( pht( diff --git a/src/applications/phame/controller/blog/PhameBlogEditController.php b/src/applications/phame/controller/blog/PhameBlogEditController.php index 19862fbfbe..24c5681583 100644 --- a/src/applications/phame/controller/blog/PhameBlogEditController.php +++ b/src/applications/phame/controller/blog/PhameBlogEditController.php @@ -1,15 +1,15 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); if ($id) { $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( @@ -30,7 +30,7 @@ final class PhameBlogEditController $v_projects = array_reverse($v_projects); } else { - $blog = PhameBlog::initializeNewBlog($user); + $blog = PhameBlog::initializeNewBlog($viewer); $submit_button = pht('Create Blog'); $page_title = pht('Create Blog'); @@ -90,7 +90,7 @@ final class PhameBlogEditController ->setNewValue(array('=' => array_fuse($v_projects))); $editor = id(new PhameBlogEditor()) - ->setActor($user) + ->setActor($viewer) ->setContentSourceFromRequest($request) ->setContinueOnNoEffect(true); @@ -111,7 +111,7 @@ final class PhameBlogEditController } $policies = id(new PhabricatorPolicyQuery()) - ->setViewer($user) + ->setViewer($viewer) ->setObject($blog) ->execute(); @@ -119,7 +119,7 @@ final class PhameBlogEditController $skins = mpull($skins, 'getName'); $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Name')) @@ -129,16 +129,16 @@ final class PhameBlogEditController ->setError($e_name)) ->appendChild( id(new PhabricatorRemarkupControl()) - ->setUser($user) + ->setUser($viewer) ->setLabel(pht('Description')) ->setName('description') ->setValue($description) ->setID('blog-description') - ->setUser($user) + ->setUser($viewer) ->setDisableMacros(true)) ->appendChild( id(new AphrontFormPolicyControl()) - ->setUser($user) + ->setUser($viewer) ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setPolicyObject($blog) ->setPolicies($policies) @@ -147,7 +147,7 @@ final class PhameBlogEditController ->setName('can_view')) ->appendChild( id(new AphrontFormPolicyControl()) - ->setUser($user) + ->setUser($viewer) ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) ->setPolicyObject($blog) ->setPolicies($policies) @@ -155,7 +155,7 @@ final class PhameBlogEditController ->setName('can_edit')) ->appendChild( id(new AphrontFormPolicyControl()) - ->setUser($user) + ->setUser($viewer) ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) ->setPolicyObject($blog) ->setPolicies($policies) @@ -195,13 +195,12 @@ final class PhameBlogEditController $crumbs->addTextCrumb(pht('Blogs'), $this->getApplicationURI('blog/')); $crumbs->addTextCrumb($page_title, $this->getApplicationURI('blog/new')); - return $this->buildApplicationPage( - array( - $crumbs, - $form_box, - ), - array( - 'title' => $page_title, + return $this->newPage() + ->setTitle($page_title) + ->setCrumbs($crumbs) + ->appendChild( + array( + $form_box, )); } } diff --git a/src/applications/phame/controller/blog/PhameBlogFeedController.php b/src/applications/phame/controller/blog/PhameBlogFeedController.php index fc8c1c48da..0941555ed2 100644 --- a/src/applications/phame/controller/blog/PhameBlogFeedController.php +++ b/src/applications/phame/controller/blog/PhameBlogFeedController.php @@ -1,17 +1,17 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$blog) { @@ -19,7 +19,7 @@ final class PhameBlogFeedController extends PhameController { } $posts = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withBlogPHIDs(array($blog->getPHID())) ->withVisibility(PhamePost::VISIBILITY_PUBLISHED) ->execute(); @@ -47,7 +47,7 @@ final class PhameBlogFeedController extends PhameController { $content[] = phutil_tag('subtitle', array(), $description); } - $engine = id(new PhabricatorMarkupEngine())->setViewer($user); + $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer); foreach ($posts as $post) { $engine->addObject($post, PhamePost::MARKUP_FIELD_BODY); } @@ -55,7 +55,7 @@ final class PhameBlogFeedController extends PhameController { $blogger_phids = mpull($posts, 'getBloggerPHID'); $bloggers = id(new PhabricatorHandleQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withPHIDs($blogger_phids) ->execute(); diff --git a/src/applications/phame/controller/blog/PhameBlogListController.php b/src/applications/phame/controller/blog/PhameBlogListController.php index 965e1eec49..c162b82b6b 100644 --- a/src/applications/phame/controller/blog/PhameBlogListController.php +++ b/src/applications/phame/controller/blog/PhameBlogListController.php @@ -1,6 +1,6 @@ getUser(); + $viewer = $request->getViewer(); $site = $request->getSite(); if ($site instanceof PhameBlogSite) { @@ -16,7 +16,7 @@ final class PhameBlogLiveController extends PhameController { $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$blog) { @@ -38,7 +38,7 @@ final class PhameBlogLiveController extends PhameController { $dialog = id(new AphrontDialogView()) ->setTitle(pht('Blog Moved')) - ->setUser($user) + ->setUser($viewer) ->appendParagraph(pht('This blog is now hosted here:')) ->appendParagraph( phutil_tag( diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php index c8eddfbad3..03dfc8c1c6 100644 --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -1,13 +1,13 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$blog) { @@ -18,20 +18,20 @@ final class PhameBlogViewController extends PhameController { ->readFromRequest($request); $posts = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withBlogPHIDs(array($blog->getPHID())) ->executeWithCursorPager($pager); $header = id(new PHUIHeaderView()) ->setHeader($blog->getName()) - ->setUser($user) + ->setUser($viewer) ->setPolicyObject($blog); - $actions = $this->renderActions($blog, $user); - $properties = $this->renderProperties($blog, $user, $actions); + $actions = $this->renderActions($blog, $viewer); + $properties = $this->renderProperties($blog, $viewer, $actions); $post_list = $this->renderPostList( $posts, - $user, + $viewer, pht('This blog has no visible posts.')); $post_list = id(new PHUIObjectBoxView()) @@ -46,27 +46,26 @@ final class PhameBlogViewController extends PhameController { ->setHeader($header) ->addPropertyList($properties); - return $this->buildApplicationPage( - array( - $crumbs, - $object_box, - $post_list, - ), - array( - 'title' => $blog->getName(), + return $this->newPage() + ->setTitle($blog->getName()) + ->setCrumbs($crumbs) + ->appendChild( + array( + $object_box, + $post_list, )); } private function renderProperties( PhameBlog $blog, - PhabricatorUser $user, + PhabricatorUser $viewer, PhabricatorActionListView $actions) { require_celerity_resource('aphront-tooltip-css'); Javelin::initBehavior('phabricator-tooltips'); $properties = id(new PHUIPropertyListView()) - ->setUser($user) + ->setUser($viewer) ->setObject($blog) ->setActionList($actions); @@ -94,7 +93,7 @@ final class PhameBlogViewController extends PhameController { $feed_uri)); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( - $user, + $viewer, $blog); $properties->addProperty( @@ -106,7 +105,7 @@ final class PhameBlogViewController extends PhameController { $descriptions[PhabricatorPolicyCapability::CAN_JOIN]); $engine = id(new PhabricatorMarkupEngine()) - ->setViewer($user) + ->setViewer($viewer) ->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION) ->process(); @@ -116,7 +115,7 @@ final class PhameBlogViewController extends PhameController { $description = PhabricatorMarkupEngine::renderOneObject( id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 'default', - $user); + $viewer); $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); @@ -126,19 +125,19 @@ final class PhameBlogViewController extends PhameController { return $properties; } - private function renderActions(PhameBlog $blog, PhabricatorUser $user) { + private function renderActions(PhameBlog $blog, PhabricatorUser $viewer) { $actions = id(new PhabricatorActionListView()) ->setObject($blog) ->setObjectURI($this->getRequest()->getRequestURI()) - ->setUser($user); + ->setUser($viewer); $can_edit = PhabricatorPolicyFilter::hasCapability( - $user, + $viewer, $blog, PhabricatorPolicyCapability::CAN_EDIT); $can_join = PhabricatorPolicyFilter::hasCapability( - $user, + $viewer, $blog, PhabricatorPolicyCapability::CAN_JOIN); @@ -152,7 +151,7 @@ final class PhameBlogViewController extends PhameController { $actions->addAction( id(new PhabricatorActionView()) - ->setUser($user) + ->setUser($viewer) ->setIcon('fa-globe') ->setHref($blog->getLiveURI()) ->setName(pht('View Live'))); diff --git a/src/applications/phame/controller/post/PhamePostController.php b/src/applications/phame/controller/post/PhamePostController.php new file mode 100644 index 0000000000..c6ee2fb86b --- /dev/null +++ b/src/applications/phame/controller/post/PhamePostController.php @@ -0,0 +1,10 @@ +newApplicationMenu() + ->setSearchEngine(new PhamePostSearchEngine()); + } + +} diff --git a/src/applications/phame/controller/post/PhamePostDeleteController.php b/src/applications/phame/controller/post/PhamePostDeleteController.php index 80038edd1d..292fa6c18c 100644 --- a/src/applications/phame/controller/post/PhamePostDeleteController.php +++ b/src/applications/phame/controller/post/PhamePostDeleteController.php @@ -1,12 +1,12 @@ getUser(); + $viewer = $request->getViewer(); $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($request->getURIData('id'))) ->requireCapabilities( array( @@ -26,7 +26,7 @@ final class PhamePostDeleteController extends PhameController { $cancel_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); $dialog = id(new AphrontDialogView()) - ->setUser($user) + ->setUser($viewer) ->setTitle(pht('Delete Post?')) ->appendChild( pht( diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php index 023040996a..3de92906a8 100644 --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -1,6 +1,6 @@ getViewer(); diff --git a/src/applications/phame/controller/post/PhamePostFramedController.php b/src/applications/phame/controller/post/PhamePostFramedController.php index 46f723aa81..180eca0849 100644 --- a/src/applications/phame/controller/post/PhamePostFramedController.php +++ b/src/applications/phame/controller/post/PhamePostFramedController.php @@ -1,13 +1,13 @@ getViewer(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( diff --git a/src/applications/phame/controller/post/PhamePostListController.php b/src/applications/phame/controller/post/PhamePostListController.php index fb38a830bb..71e73f1dc6 100644 --- a/src/applications/phame/controller/post/PhamePostListController.php +++ b/src/applications/phame/controller/post/PhamePostListController.php @@ -1,6 +1,6 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $post = null; $view_uri = null; if ($id) { $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( @@ -26,7 +26,7 @@ final class PhamePostNewController extends PhameController { if ($request->isFormPost()) { $blog = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($request->getInt('blog'))) ->requireCapabilities( array( @@ -49,7 +49,7 @@ final class PhamePostNewController extends PhameController { } $blogs = id(new PhameBlogQuery()) - ->setViewer($user) + ->setViewer($viewer) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_JOIN, @@ -58,9 +58,9 @@ final class PhamePostNewController extends PhameController { $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb($title, $view_uri); - $display = array(); - $display[] = $crumbs; + $notification = null; + $form_box = null; if (!$blogs) { $notification = id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_NODATA) @@ -68,7 +68,6 @@ final class PhamePostNewController extends PhameController { pht('You do not have permission to join any blogs. Create a blog '. 'first, then you can post to it.')); - $display[] = $notification; } else { $options = mpull($blogs, 'getName', 'getID'); asort($options); @@ -79,7 +78,7 @@ final class PhamePostNewController extends PhameController { } $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Blog')) @@ -102,19 +101,20 @@ final class PhamePostNewController extends PhameController { ->setValue(pht('Continue'))); } - $form_box = id(new PHUIObjectBoxView()) ->setHeaderText($title) ->setForm($form); - - $display[] = $form_box; } - return $this->buildApplicationPage( - $display, - array( - 'title' => $title, + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->appendChild( + array( + $notification, + $form_box, )); - } + + } } diff --git a/src/applications/phame/controller/post/PhamePostNotLiveController.php b/src/applications/phame/controller/post/PhamePostNotLiveController.php index 3f69860003..c0f986ffda 100644 --- a/src/applications/phame/controller/post/PhamePostNotLiveController.php +++ b/src/applications/phame/controller/post/PhamePostNotLiveController.php @@ -1,13 +1,13 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$post) { @@ -32,7 +32,7 @@ final class PhamePostNotLiveController extends PhameController { $cancel_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); $dialog = id(new AphrontDialogView()) - ->setUser($user) + ->setUser($viewer) ->setTitle(pht('Post Not Live')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phame/controller/post/PhamePostPreviewController.php b/src/applications/phame/controller/post/PhamePostPreviewController.php index 0140e48fe6..3f81481576 100644 --- a/src/applications/phame/controller/post/PhamePostPreviewController.php +++ b/src/applications/phame/controller/post/PhamePostPreviewController.php @@ -1,6 +1,6 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( @@ -29,7 +29,7 @@ final class PhamePostPublishController extends PhameController { } $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Publish Post')) @@ -44,35 +44,30 @@ final class PhamePostPublishController extends PhameController { $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Preview'), $view_uri); - $nav = $this->renderSideNavFilterView(null); - $nav->appendChild( - array( - $crumbs, - $form_box, - $frame, - )); - - return $this->buildApplicationPage( - $nav, - array( - 'title' => pht('Preview Post'), + return $this->newPage() + ->setTitle(pht('Preview Post')) + ->setCrumbs($crumbs) + ->appendChild( + array( + $form_box, + $frame, )); } private function renderPreviewFrame(PhamePost $post) { - // TODO: Clean up this CSS. - return phutil_tag( 'div', array( - 'style' => 'text-align: center; padding: 1em;', + 'style' => 'text-align: center; padding: 16px;', ), phutil_tag( 'iframe', array( 'style' => 'width: 100%; height: 600px; '. - 'border: 1px solid #303030;', + 'border: 1px solid #BFCFDA; '. + 'background-color: #fff; '. + 'border-radius: 3px; ', 'src' => $this->getApplicationURI('/post/framed/'.$post->getID().'/'), ), '')); diff --git a/src/applications/phame/controller/post/PhamePostUnpublishController.php b/src/applications/phame/controller/post/PhamePostUnpublishController.php index e2634e710e..80a320344d 100644 --- a/src/applications/phame/controller/post/PhamePostUnpublishController.php +++ b/src/applications/phame/controller/post/PhamePostUnpublishController.php @@ -1,13 +1,13 @@ getUser(); + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $post = id(new PhamePostQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( @@ -30,7 +30,7 @@ final class PhamePostUnpublishController extends PhameController { $cancel_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); $dialog = id(new AphrontDialogView()) - ->setUser($user) + ->setUser($viewer) ->setTitle(pht('Unpublish Post?')) ->appendChild( pht( diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index cc389568a6..3afdf5401d 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -1,6 +1,6 @@ getViewer(); diff --git a/src/applications/phame/query/PhameBlogSearchEngine.php b/src/applications/phame/query/PhameBlogSearchEngine.php index 18871ebefe..25a0ab515d 100644 --- a/src/applications/phame/query/PhameBlogSearchEngine.php +++ b/src/applications/phame/query/PhameBlogSearchEngine.php @@ -30,7 +30,7 @@ final class PhameBlogSearchEngine protected function getBuiltinQueryNames() { $names = array( - 'all' => pht('All'), + 'all' => pht('All Blogs'), ); return $names; } diff --git a/src/applications/phame/query/PhamePostSearchEngine.php b/src/applications/phame/query/PhamePostSearchEngine.php index cedc02cc7a..d832b08192 100644 --- a/src/applications/phame/query/PhamePostSearchEngine.php +++ b/src/applications/phame/query/PhamePostSearchEngine.php @@ -44,9 +44,9 @@ final class PhamePostSearchEngine protected function getBuiltinQueryNames() { $names = array( - 'all' => pht('All'), - 'live' => pht('Live'), - 'draft' => pht('Draft'), + 'all' => pht('All Posts'), + 'live' => pht('Live Posts'), + 'draft' => pht('Draft Posts'), ); return $names; }