2012-08-05 14:12:43 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorApplicationPeople extends PhabricatorApplication {
|
|
|
|
|
|
|
|
public function getShortDescription() {
|
2014-02-24 10:04:23 -08:00
|
|
|
return pht('User Accounts');
|
2012-08-05 14:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getBaseURI() {
|
|
|
|
return '/people/';
|
|
|
|
}
|
|
|
|
|
2012-08-13 15:27:21 -07:00
|
|
|
public function getTitleGlyph() {
|
|
|
|
return "\xE2\x99\x9F";
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 13:37:28 -08:00
|
|
|
public function getIconName() {
|
2012-08-14 14:23:55 -07:00
|
|
|
return 'people';
|
2012-08-05 14:12:43 -07:00
|
|
|
}
|
|
|
|
|
2012-10-03 15:16:26 -07:00
|
|
|
public function getFlavorText() {
|
|
|
|
return pht('Sort of a social utility.');
|
|
|
|
}
|
|
|
|
|
2012-10-03 15:46:19 -07:00
|
|
|
public function getApplicationGroup() {
|
2013-05-31 10:51:20 -07:00
|
|
|
return self::GROUP_ORGANIZATION;
|
2012-10-03 15:46:19 -07:00
|
|
|
}
|
|
|
|
|
2013-01-29 09:14:03 -08:00
|
|
|
public function canUninstall() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-05 17:01:54 -07:00
|
|
|
public function getEventListeners() {
|
|
|
|
return array(
|
|
|
|
new PhabricatorPeopleHovercardEventListener(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-08-05 14:12:43 -07:00
|
|
|
public function getRoutes() {
|
|
|
|
return array(
|
|
|
|
'/people/' => array(
|
2013-05-31 10:51:20 -07:00
|
|
|
'(query/(?P<key>[^/]+)/)?' => 'PhabricatorPeopleListController',
|
2012-08-05 14:12:43 -07:00
|
|
|
'logs/' => 'PhabricatorPeopleLogsController',
|
2013-11-13 11:24:18 -08:00
|
|
|
'approve/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleApproveController',
|
2014-04-02 12:05:49 -07:00
|
|
|
'(?P<via>disapprove)/(?P<id>[1-9]\d*)/'
|
|
|
|
=> 'PhabricatorPeopleDisableController',
|
|
|
|
'(?P<via>disable)/(?P<id>[1-9]\d*)/'
|
|
|
|
=> 'PhabricatorPeopleDisableController',
|
|
|
|
'empower/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleEmpowerController',
|
2014-04-02 12:05:07 -07:00
|
|
|
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleDeleteController',
|
2014-04-02 12:05:19 -07:00
|
|
|
'rename/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleRenameController',
|
2014-04-02 12:06:17 -07:00
|
|
|
'welcome/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleWelcomeController',
|
|
|
|
'edit/' => 'PhabricatorPeopleEditController',
|
2012-08-05 14:12:43 -07:00
|
|
|
'ldap/' => 'PhabricatorPeopleLdapController',
|
2013-06-07 09:55:55 -07:00
|
|
|
'editprofile/(?P<id>[1-9]\d*)/' =>
|
|
|
|
'PhabricatorPeopleProfileEditController',
|
2013-07-09 16:23:54 -07:00
|
|
|
'picture/(?P<id>[1-9]\d*)/' =>
|
|
|
|
'PhabricatorPeopleProfilePictureController',
|
2012-08-05 14:12:43 -07:00
|
|
|
),
|
2013-07-10 05:11:08 -07:00
|
|
|
'/p/(?P<username>[\w._-]+)/'
|
2012-08-05 14:12:43 -07:00
|
|
|
=> 'PhabricatorPeopleProfileController',
|
2014-02-24 10:04:23 -08:00
|
|
|
'/p/(?P<username>[\w._-]+)/calendar/'
|
|
|
|
=> 'PhabricatorPeopleCalendarController',
|
2012-08-05 14:12:43 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-07-09 16:23:33 -07:00
|
|
|
public function getRemarkupRules() {
|
|
|
|
return array(
|
|
|
|
new PhabricatorRemarkupRuleMention(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-01-30 11:53:49 -08:00
|
|
|
|
|
|
|
protected function getCustomCapabilities() {
|
|
|
|
return array(
|
|
|
|
PeopleCapabilityBrowseUserDirectory::CAPABILITY => array(
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-11-13 11:24:38 -08:00
|
|
|
public function loadStatus(PhabricatorUser $user) {
|
|
|
|
if (!$user->getIsAdmin()) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
$need_approval = id(new PhabricatorPeopleQuery())
|
|
|
|
->setViewer($user)
|
|
|
|
->withIsApproved(false)
|
2014-03-10 16:20:49 -07:00
|
|
|
->withIsDisabled(false)
|
2013-11-13 11:24:38 -08:00
|
|
|
->execute();
|
|
|
|
|
|
|
|
if (!$need_approval) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
$status = array();
|
|
|
|
|
|
|
|
$count = count($need_approval);
|
|
|
|
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
|
|
|
$status[] = id(new PhabricatorApplicationStatusView())
|
|
|
|
->setType($type)
|
|
|
|
->setText(pht('%d User(s) Need Approval', $count))
|
|
|
|
->setCount($count);
|
|
|
|
|
|
|
|
return $status;
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
2013-11-13 11:24:38 -08:00
|
|
|
if ($user->isLoggedIn() && $user->isUserActivated()) {
|
2012-08-10 12:11:24 -07:00
|
|
|
$image = $user->loadProfileImageURI();
|
|
|
|
|
2014-01-28 20:18:01 -08:00
|
|
|
$item = id(new PHUIListItemView())
|
|
|
|
->setName($user->getUsername())
|
|
|
|
->setHref('/p/'.$user->getUsername().'/')
|
|
|
|
->addClass('core-menu-item')
|
2014-01-31 09:10:32 -08:00
|
|
|
->setOrder(100);
|
2012-12-07 13:33:03 -08:00
|
|
|
|
|
|
|
$classes = array(
|
|
|
|
'phabricator-core-menu-icon',
|
|
|
|
'phabricator-core-menu-profile-image',
|
|
|
|
);
|
|
|
|
|
|
|
|
$item->appendChild(
|
2013-01-17 18:57:09 -08:00
|
|
|
phutil_tag(
|
2012-12-07 13:33:03 -08:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
'style' => 'background-image: url('.$image.')',
|
|
|
|
),
|
|
|
|
''));
|
|
|
|
|
2012-08-05 14:12:43 -07:00
|
|
|
$items[] = $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|