2012-07-30 19:43:49 +02: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 {
|
|
|
|
|
|
|
|
|
|
|
|
/* -( 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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAutospriteName() {
|
|
|
|
return 'default';
|
2012-08-01 02:58:21 +02:00
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
public function shouldAppearInLaunchView() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
public function getCoreApplicationOrder() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
public function loadStatus(PhabricatorUser $user) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
* @task UI
|
|
|
|
*/
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
$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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|