2012-08-05 14:12:43 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2012 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
final class PhabricatorApplicationPeople extends PhabricatorApplication {
|
|
|
|
|
|
|
|
public function getShortDescription() {
|
|
|
|
return 'User Accounts';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBaseURI() {
|
|
|
|
return '/people/';
|
|
|
|
}
|
|
|
|
|
2012-08-13 15:27:21 -07:00
|
|
|
public function getTitleGlyph() {
|
|
|
|
return "\xE2\x99\x9F";
|
|
|
|
}
|
|
|
|
|
2012-08-14 14:23:55 -07:00
|
|
|
public function getAutospriteName() {
|
|
|
|
return 'people';
|
2012-08-05 14:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getRoutes() {
|
|
|
|
return array(
|
|
|
|
'/people/' => array(
|
|
|
|
'' => 'PhabricatorPeopleListController',
|
|
|
|
'logs/' => 'PhabricatorPeopleLogsController',
|
|
|
|
'edit/(?:(?P<id>\d+)/(?:(?P<view>\w+)/)?)?'
|
|
|
|
=> 'PhabricatorPeopleEditController',
|
|
|
|
'ldap/' => 'PhabricatorPeopleLdapController',
|
|
|
|
),
|
|
|
|
'/p/(?P<username>[\w._-]+)/(?:(?P<page>\w+)/)?'
|
|
|
|
=> 'PhabricatorPeopleProfileController',
|
2012-08-13 15:27:21 -07:00
|
|
|
'/emailverify/(?P<code>[^/]+)/' =>
|
|
|
|
'PhabricatorEmailVerificationController',
|
2012-08-05 14:12:43 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildMainMenuItems(
|
|
|
|
PhabricatorUser $user,
|
2012-08-06 12:46:51 -07:00
|
|
|
PhabricatorController $controller = null) {
|
2012-08-05 14:12:43 -07:00
|
|
|
|
|
|
|
$items = array();
|
|
|
|
|
2012-08-10 12:11:24 -07:00
|
|
|
if (($controller instanceof PhabricatorPeopleProfileController) &&
|
|
|
|
($controller->getProfileUser()) &&
|
|
|
|
($controller->getProfileUser()->getPHID() == $user->getPHID())) {
|
|
|
|
$class = 'main-menu-item-icon-profile-selected';
|
|
|
|
} else {
|
|
|
|
$class = 'main-menu-item-icon-profile-not-selected';
|
|
|
|
}
|
|
|
|
|
2012-08-05 14:12:43 -07:00
|
|
|
if ($user->isLoggedIn()) {
|
2012-08-10 12:11:24 -07:00
|
|
|
$image = $user->loadProfileImageURI();
|
|
|
|
|
2012-08-05 14:12:43 -07:00
|
|
|
$item = new PhabricatorMainMenuIconView();
|
|
|
|
$item->setName($user->getUsername());
|
2012-08-10 12:11:24 -07:00
|
|
|
$item->addClass('main-menu-item-icon-profile '.$class);
|
|
|
|
$item->addStyle('background-image: url('.$image.')');
|
2012-08-05 14:12:43 -07:00
|
|
|
$item->setHref('/p/'.$user->getUsername().'/');
|
|
|
|
$item->setSortOrder(0.0);
|
|
|
|
$items[] = $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|