Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
index 71a50c61c1..bc45f37c0a 100644
--- a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
+++ b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
@@ -1,200 +1,218 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorPeopleProfileController extends PhabricatorPeopleController {
private $username;
private $page;
public function willProcessRequest(array $data) {
$this->username = idx($data, 'username');
$this->page = idx($data, 'page');
}
public function processRequest() {
$viewer = $this->getRequest()->getUser();
$user = id(new PhabricatorUser())->loadOneWhere(
'userName = %s',
$this->username);
if (!$user) {
return new Aphront404Response();
}
+ require_celerity_resource('phabricator-profile-css');
+
$profile = id(new PhabricatorUserProfile())->loadOneWhere(
'userPHID = %s',
$user->getPHID());
if (!$profile) {
$profile = new PhabricatorUserProfile();
}
- $links = array();
+ $nav = new AphrontSideNavFilterView();
+ $nav->setBaseURI(new PhutilURI('/p/'.$user->getUserName().'/'));
+ $nav->addFilter('feed', 'Feed');
+ $nav->addFilter('about', 'About');
- if ($user->getPHID() == $viewer->getPHID()) {
- $links[] = phutil_render_tag(
- 'a',
- array(
- 'href' => '/settings/page/profile/',
- ),
- 'Edit Profile');
- }
+ $nav->addSpacer();
+ $nav->addLabel('Activity');
+
+ $external_arrow = "\xE2\x86\x97";
+ $nav->addFilter(
+ null,
+ "Revisions {$external_arrow}",
+ '/differential/filter/revisions/?phid='.$user->getPHID());
+
+ $nav->addFilter(
+ null,
+ "Tasks {$external_arrow}",
+ '/maniphest/view/action/?users='.$user->getPHID());
+
+ $nav->addFilter(
+ null,
+ "Commits {$external_arrow}",
+ '/diffusion/author/'.$user->getUserName().'/');
$oauths = id(new PhabricatorUserOAuthInfo())->loadAllWhere(
'userID = %d',
$user->getID());
$oauths = mpull($oauths, null, 'getOAuthProvider');
$providers = PhabricatorOAuthProvider::getAllProviders();
+ $added_spacer = false;
foreach ($providers as $provider) {
if (!$provider->isProviderEnabled()) {
continue;
}
$provider_key = $provider->getProviderKey();
if (!isset($oauths[$provider_key])) {
continue;
}
$name = $provider->getProviderName().' Profile';
$href = $oauths[$provider_key]->getAccountURI();
if ($href) {
- $links[] = phutil_render_tag(
- 'a',
- array(
- 'href' => $href,
- ),
- phutil_escape_html($name));
+ if (!$added_spacer) {
+ $nav->addSpacer();
+ $nav->addLabel('Linked Accounts');
+ $added_spacer = true;
+ }
+ $nav->addFilter(null, $name.' '.$external_arrow, $href);
}
}
- // TODO: perhaps, if someone wants to add to the profile of the user the
- // ability to show the task/revisions where he is working/commenting
- // on, this has to be changed to something like
- // |$this->page = key($pages)|, since the "page" regexp was added to
- // the aphrontconfiguration.
- if (empty($links[$this->page])) {
- $this->page = 'action';
- }
+ $this->page = $nav->selectFilter($this->page, 'feed');
switch ($this->page) {
- default:
+ case 'feed':
+ $content = $this->renderUserFeed($user);
+ break;
+ case 'about':
$content = $this->renderBasicInformation($user, $profile);
break;
+ default:
+ throw new Exception("Unknown page '{$this->page}'!");
}
$src_phid = $profile->getProfileImagePHID();
if (!$src_phid) {
$src_phid = $user->getProfileImagePHID();
}
$picture = PhabricatorFileURI::getViewURIForPHID($src_phid);
- $title = nonempty($profile->getTitle(), 'Untitled Document');
- $realname = '('.$user->getRealName().')';
-
- $profile = new PhabricatorProfileView();
- $profile->setProfilePicture($picture);
- $profile->setProfileNames(
- $user->getUserName(),
- $realname,
- $title);
- foreach ($links as $page => $name) {
- if (is_integer($page)) {
- $profile->addProfileItem(
- phutil_render_tag(
- 'span',
- array(),
- $name));
- } else {
- $profile->addProfileItem($page);
- }
+
+ $header = new PhabricatorProfileHeaderView();
+ $header
+ ->setProfilePicture($picture)
+ ->setName($user->getUserName().' ('.$user->getRealName().')')
+ ->setDescription($profile->getTitle());
+
+ $header->appendChild($nav);
+ $nav->appendChild(
+ '<div style="padding: 1em;">'.$content.'</div>');
+
+ if ($user->getPHID() == $viewer->getPHID()) {
+ $nav->addSpacer();
+ $nav->addFilter(null, 'Edit Profile...', '/settings/page/profile/');
}
- $profile->appendChild($content);
return $this->buildStandardPageResponse(
- $profile,
+ $header,
array(
'title' => $user->getUsername(),
));
}
private function renderBasicInformation($user, $profile) {
+
$blurb = nonempty(
$profile->getBlurb(),
'//Nothing is known about this rare specimen.//');
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
$blurb = $engine->markupText($blurb);
$commit_list =
phutil_render_tag(
'a',
array(
'href' => '/diffusion/author/'.
phutil_escape_uri($user->getUsername()),
),
'Recent Commits');
$viewer = $this->getRequest()->getUser();
$content =
'<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Basic Information</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>PHID</th>
<td>'.phutil_escape_html($user->getPHID()).'</td>
</tr>
<tr>
<th>User Since</th>
<td>'.phabricator_datetime($user->getDateCreated(),
$viewer).
'</td>
</tr>
</table>
</div>
</div>';
$content .=
'<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Flavor Text</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>Blurb</th>
<td>'.$blurb.'</td>
</tr>
</table>
</div>
</div>';
- $content .=
+
+ return $content;
+ }
+
+ private function renderUserFeed(PhabricatorUser $user) {
+ $query = new PhabricatorFeedQuery();
+ $query->setFilterPHIDs(
+ array(
+ $user->getPHID(),
+ ));
+ $stories = $query->execute();
+
+ $builder = new PhabricatorFeedBuilder($stories);
+ $builder->setUser($this->getRequest()->getUser());
+ $view = $builder->buildView();
+
+ return
'<div class="phabricator-profile-info-group">
- <h1 class="phabricator-profile-info-header">Recent Activities</h1>
+ <h1 class="phabricator-profile-info-header">Activity Feed</h1>
<div class="phabricator-profile-info-pane">
- <table class="phabricator-profile-info-table">
- <tr>
- <th>Commits</th>
- <td>'.$commit_list.'</td>
- </tr>
- </table>
+ '.$view->render().'
</div>
</div>';
-
- return $content;
}
}
diff --git a/src/applications/people/controller/profile/__init__.php b/src/applications/people/controller/profile/__init__.php
index 9f271cdce8..1793969090 100644
--- a/src/applications/people/controller/profile/__init__.php
+++ b/src/applications/people/controller/profile/__init__.php
@@ -1,24 +1,29 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'applications/auth/oauth/provider/base');
+phutil_require_module('phabricator', 'applications/feed/builder/feed');
+phutil_require_module('phabricator', 'applications/feed/query');
phutil_require_module('phabricator', 'applications/files/uri');
phutil_require_module('phabricator', 'applications/markup/engine');
phutil_require_module('phabricator', 'applications/people/controller/base');
phutil_require_module('phabricator', 'applications/people/storage/profile');
phutil_require_module('phabricator', 'applications/people/storage/user');
phutil_require_module('phabricator', 'applications/people/storage/useroauthinfo');
-phutil_require_module('phabricator', 'view/layout/profile');
+phutil_require_module('phabricator', 'infrastructure/celerity/api');
+phutil_require_module('phabricator', 'view/layout/profileheader');
+phutil_require_module('phabricator', 'view/layout/sidenavfilter');
phutil_require_module('phabricator', 'view/utils');
phutil_require_module('phutil', 'markup');
+phutil_require_module('phutil', 'parser/uri');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorPeopleProfileController.php');

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 12:27 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124570
Default Alt Text
(10 KB)

Event Timeline