2012-07-30 19:43:49 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @task info Application Information
|
2012-08-06 21:46:51 +02:00
|
|
|
* @task ui UI Integration
|
2012-07-30 19:44:08 +02:00
|
|
|
* @task uri URI Routing
|
2012-07-30 19:43:49 +02:00
|
|
|
* @task fact Fact Integration
|
|
|
|
* @task meta Application Management
|
|
|
|
* @group apps
|
|
|
|
*/
|
|
|
|
abstract class PhabricatorApplication {
|
|
|
|
|
2012-10-04 00:46:19 +02:00
|
|
|
const GROUP_CORE = 'core';
|
|
|
|
const GROUP_COMMUNICATION = 'communication';
|
|
|
|
const GROUP_ORGANIZATION = 'organization';
|
|
|
|
const GROUP_UTILITIES = 'util';
|
|
|
|
const GROUP_ADMIN = 'admin';
|
|
|
|
const GROUP_DEVELOPER = 'developer';
|
|
|
|
const GROUP_MISC = 'misc';
|
|
|
|
|
2013-01-16 18:00:11 +01:00
|
|
|
const TILE_INVISIBLE = 'invisible';
|
|
|
|
const TILE_HIDE = 'hide';
|
|
|
|
const TILE_SHOW = 'show';
|
|
|
|
const TILE_FULL = 'full';
|
|
|
|
|
2012-10-04 00:46:19 +02:00
|
|
|
public static function getApplicationGroups() {
|
|
|
|
return array(
|
|
|
|
self::GROUP_CORE => pht('Core Applications'),
|
|
|
|
self::GROUP_COMMUNICATION => pht('Communication'),
|
|
|
|
self::GROUP_ORGANIZATION => pht('Organization'),
|
|
|
|
self::GROUP_UTILITIES => pht('Utilities'),
|
|
|
|
self::GROUP_ADMIN => pht('Administration'),
|
|
|
|
self::GROUP_DEVELOPER => pht('Developer Tools'),
|
|
|
|
self::GROUP_MISC => pht('Miscellaneous Applications'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-01-16 18:00:11 +01:00
|
|
|
public static function getTileDisplayName($constant) {
|
|
|
|
$names = array(
|
|
|
|
self::TILE_INVISIBLE => pht('Invisible'),
|
|
|
|
self::TILE_HIDE => pht('Hidden'),
|
|
|
|
self::TILE_SHOW => pht('Show Small Tile'),
|
|
|
|
self::TILE_FULL => pht('Show Large Tile'),
|
|
|
|
);
|
|
|
|
return idx($names, $constant);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-30 19:43:49 +02:00
|
|
|
|
|
|
|
/* -( Application Information )-------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getName() {
|
2012-08-01 02:58:21 +02:00
|
|
|
return substr(get_class($this), strlen('PhabricatorApplication'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getShortDescription() {
|
|
|
|
return $this->getName().' Application';
|
2012-07-30 19:43:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isEnabled() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-01-19 19:12:44 +01:00
|
|
|
public function isBeta() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-08-01 02:58:21 +02:00
|
|
|
public function getPHID() {
|
|
|
|
return 'PHID-APPS-'.get_class($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTypeaheadURI() {
|
|
|
|
return $this->getBaseURI();
|
|
|
|
}
|
2012-07-30 19:43:49 +02:00
|
|
|
|
2012-08-01 02:58:21 +02:00
|
|
|
public function getBaseURI() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIconURI() {
|
2012-08-14 23:23:55 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
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 22:37:28 +01:00
|
|
|
public function getIconName() {
|
|
|
|
return 'application';
|
2012-08-01 02:58:21 +02:00
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
public function shouldAppearInLaunchView() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-10-04 00:46:19 +02:00
|
|
|
public function getApplicationOrder() {
|
|
|
|
return PHP_INT_MAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationGroup() {
|
|
|
|
return self::GROUP_MISC;
|
Add basic support for new navigation menu
Summary:
Add a new left-side application menu. This menu shows which application you're in and provides a quick way to get to other applications.
On desktops, menus are always shown but the app menu can be collapsed to be very small.
On tablets, navigation buttons allow you to choose between the menus and the content.
On phones, navigation buttons allow you to choose between the app menu, the local menu, and the content.
This needs some code and UI cleanup, but has no effect yet so I think it's okay to land as-is, I'll clean it up a bit as I start integrating it. I want to play around with it a bit and see if it's good/useful or horrible anyway.
Test Plan: Will include screenshots.
Reviewers: vrana, btrahan, chad
Reviewed By: btrahan
CC: aran, alanh
Maniphest Tasks: T1569
Differential Revision: https://secure.phabricator.com/D3223
2012-08-11 16:06:12 +02:00
|
|
|
}
|
|
|
|
|
2012-08-13 04:19:46 +02:00
|
|
|
public function getTitleGlyph() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2012-08-14 00:28:41 +02:00
|
|
|
public function getHelpURI() {
|
|
|
|
// TODO: When these applications get created, link to their docs:
|
|
|
|
//
|
|
|
|
// - Drydock
|
|
|
|
// - OAuth Server
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2012-08-24 22:19:47 +02:00
|
|
|
public function getEventListeners() {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2013-01-16 18:00:11 +01:00
|
|
|
public function getDefaultTileDisplay(PhabricatorUser $user) {
|
|
|
|
switch ($this->getApplicationGroup()) {
|
|
|
|
case self::GROUP_CORE:
|
|
|
|
return self::TILE_FULL;
|
|
|
|
case self::GROUP_UTILITIES:
|
|
|
|
case self::GROUP_DEVELOPER:
|
|
|
|
return self::TILE_HIDE;
|
|
|
|
case self::GROUP_ADMIN:
|
|
|
|
if ($user->getIsAdmin()) {
|
|
|
|
return self::TILE_SHOW;
|
|
|
|
} else {
|
|
|
|
return self::TILE_INVISIBLE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return self::TILE_SHOW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-01 02:58:21 +02:00
|
|
|
|
|
|
|
/* -( URI Routing )-------------------------------------------------------- */
|
2012-07-30 19:44:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
public function getRoutes() {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-30 19:43:49 +02:00
|
|
|
/* -( Fact Integration )--------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getFactObjectsForAnalysis() {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-06 21:46:51 +02:00
|
|
|
/* -( UI Integration )----------------------------------------------------- */
|
2012-08-02 23:07:21 +02:00
|
|
|
|
|
|
|
|
2012-10-04 00:16:26 +02:00
|
|
|
/**
|
|
|
|
* Render status elements (like "3 Waiting Reviews") for application list
|
|
|
|
* views. These provide a way to alert users to new or pending action items
|
|
|
|
* in applications.
|
|
|
|
*
|
|
|
|
* @param PhabricatorUser Viewing user.
|
|
|
|
* @return list<PhabricatorApplicationStatusView> Application status elements.
|
|
|
|
* @task ui
|
|
|
|
*/
|
2012-08-02 23:07:21 +02:00
|
|
|
public function loadStatus(PhabricatorUser $user) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2012-08-06 21:46:51 +02:00
|
|
|
|
2012-10-04 00:16:26 +02:00
|
|
|
/**
|
|
|
|
* You can provide an optional piece of flavor text for the application. This
|
|
|
|
* is currently rendered in application launch views if the application has no
|
|
|
|
* status elements.
|
|
|
|
*
|
|
|
|
* @return string|null Flavor text.
|
|
|
|
* @task ui
|
|
|
|
*/
|
|
|
|
public function getFlavorText() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-06 21:46:51 +02:00
|
|
|
/**
|
|
|
|
* Build items for the main menu.
|
|
|
|
*
|
|
|
|
* @param PhabricatorUser The viewing user.
|
|
|
|
* @param AphrontController The current controller. May be null for special
|
|
|
|
* pages like 404, exception handlers, etc.
|
|
|
|
* @return list<PhabricatorMainMenuIconView> List of menu items.
|
2012-10-04 00:16:26 +02:00
|
|
|
* @task ui
|
2012-08-06 21:46:51 +02:00
|
|
|
*/
|
2012-08-05 23:12:43 +02:00
|
|
|
public function buildMainMenuItems(
|
|
|
|
PhabricatorUser $user,
|
2012-08-06 21:46:51 +02:00
|
|
|
PhabricatorController $controller = null) {
|
2012-08-05 23:12:43 +02:00
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
|
2012-07-30 19:43:49 +02:00
|
|
|
/* -( Application Management )--------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public static function getAllInstalledApplications() {
|
2012-09-11 18:56:40 +02:00
|
|
|
static $applications;
|
|
|
|
|
2013-01-19 21:28:05 +01:00
|
|
|
$show_beta =
|
|
|
|
PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
|
|
|
|
|
2012-09-11 18:56:40 +02:00
|
|
|
if (empty($applications)) {
|
|
|
|
$classes = id(new PhutilSymbolLoader())
|
|
|
|
->setAncestorClass(__CLASS__)
|
|
|
|
->setConcreteOnly(true)
|
|
|
|
->selectAndLoadSymbols();
|
|
|
|
|
|
|
|
$apps = array();
|
|
|
|
foreach ($classes as $class) {
|
|
|
|
$app = newv($class['name'], array());
|
|
|
|
if (!$app->isEnabled()) {
|
|
|
|
continue;
|
|
|
|
}
|
2013-01-19 21:28:05 +01:00
|
|
|
|
|
|
|
if (!$show_beta && $app->isBeta()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-09-11 18:56:40 +02:00
|
|
|
$apps[] = $app;
|
2012-07-30 19:43:49 +02:00
|
|
|
}
|
2012-09-11 18:56:40 +02:00
|
|
|
$applications = $apps;
|
2012-07-30 19:43:49 +02:00
|
|
|
}
|
|
|
|
|
2012-09-11 18:56:40 +02:00
|
|
|
return $applications;
|
2012-07-30 19:43:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|