From c864a73ad22b551b606280a055fc4d3ece1f2ef4 Mon Sep 17 00:00:00 2001 From: Afaque Hussain Date: Fri, 22 Feb 2013 11:10:47 -0800 Subject: [PATCH] UI Improvements to Chatlog Application Summary: Made improvements to the Chatlog application UI. Added Header & crumbs. Added service name and service type to the channel list table.Also made it less ugly :P Test Plan: By checking out the chatlog application. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5081 --- .../PhabricatorChatLogChannelQuery.php | 14 +++++++++++++ ...habricatorChatLogChannelListController.php | 13 +++++------- ...PhabricatorChatLogChannelLogController.php | 20 ++++++++----------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/applications/chatlog/PhabricatorChatLogChannelQuery.php b/src/applications/chatlog/PhabricatorChatLogChannelQuery.php index e1f38f3562..0930423fcb 100644 --- a/src/applications/chatlog/PhabricatorChatLogChannelQuery.php +++ b/src/applications/chatlog/PhabricatorChatLogChannelQuery.php @@ -4,12 +4,18 @@ final class PhabricatorChatLogChannelQuery extends PhabricatorCursorPagedPolicyAwareQuery { private $channels; + private $channelIDs; public function withChannelNames(array $channels) { $this->channels = $channels; return $this; } + public function withIDs(array $channel_ids) { + $this->channelIDs = $channel_ids; + return $this; + } + public function loadPage() { $table = new PhabricatorChatLogChannel(); $conn_r = $table->establishConnection('r'); @@ -32,6 +38,14 @@ final class PhabricatorChatLogChannelQuery $where[] = $this->buildPagingClause($conn_r); + if ($this->channelIDs) { + $where[] = qsprintf( + $conn_r, + 'id IN (%Ld)', + $this->channelIDs); + + } + if ($this->channels) { $where[] = qsprintf( $conn_r, diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php index 13469f5b5e..5db5cd0bee 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php @@ -39,12 +39,13 @@ final class PhabricatorChatLogChannelListController '', )); - $title = pht('Channel List.'); + $title = pht('Channel List'); $header = id(new PhabricatorHeaderView()) ->setHeader($title); $panel = id(new AphrontPanelView()) + ->appendChild($table) ->setNoBackground(true); $crumbs = $this @@ -54,16 +55,12 @@ final class PhabricatorChatLogChannelListController ->setName(pht('Channel List')) ->setHref($this->getApplicationURI())); - $panel->appendChild( + return $this->buildStandardPageResponse( array( $crumbs, $header, - $table - )); - - - return $this->buildStandardPageResponse( - $panel, + $panel, + ), array( 'title' => 'Channel List', )); diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php index 1e1cb1a3e2..1e98428f96 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -4,11 +4,9 @@ final class PhabricatorChatLogChannelLogController extends PhabricatorChatLogController { private $channelID; - private $channelName; public function willProcessRequest(array $data) { $this->channelID = $data['channelID']; - $this->channelName = $data['channelName']; } public function processRequest() { @@ -26,15 +24,13 @@ final class PhabricatorChatLogChannelLogController ->setViewer($user) ->withChannelIDs(array($this->channelID)); - $channels = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->execute(); + $channel = id(new PhabricatorChatLogChannelQuery()) + ->setViewer($user) + ->withIDs(array($this->channelID)) + ->executeOne(); - foreach ($channels as $channel) { - if ($channel->getID() == $this->channelID) { - $this->channelName = $channel->getChannelName(); - break; - } + if (!$channel) { + return new Aphront404Response(); } list($after, $before, $map) = $this->getPagingParameters($request, $query); @@ -138,14 +134,13 @@ final class PhabricatorChatLogChannelLogController ->buildApplicationCrumbs() ->addCrumb( id(new PhabricatorCrumbView()) - ->setName($this->channelName) + ->setName($channel->getChannelName()) ->setHref($uri)); $form = id(new AphrontFormView()) ->setUser($user) ->setMethod('GET') ->setAction($uri) - ->appendChild($crumbs) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Date') @@ -158,6 +153,7 @@ final class PhabricatorChatLogChannelLogController return $this->buildStandardPageResponse( array( + $crumbs, hsprintf( '
%s
%s%s
', $form->render(),