Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15334562
D17003.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D17003.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1787,6 +1787,7 @@
'PhabricatorApplicationEmailCommandsController' => 'applications/meta/controller/PhabricatorApplicationEmailCommandsController.php',
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
'PhabricatorApplicationPanelController' => 'applications/meta/controller/PhabricatorApplicationPanelController.php',
+ 'PhabricatorApplicationProfilePanel' => 'applications/search/profilepanel/PhabricatorApplicationProfilePanel.php',
'PhabricatorApplicationQuery' => 'applications/meta/query/PhabricatorApplicationQuery.php',
'PhabricatorApplicationSearchController' => 'applications/search/controller/PhabricatorApplicationSearchController.php',
'PhabricatorApplicationSearchEngine' => 'applications/search/engine/PhabricatorApplicationSearchEngine.php',
@@ -2776,8 +2777,12 @@
'PhabricatorHeraldContentSource' => 'applications/herald/contentsource/PhabricatorHeraldContentSource.php',
'PhabricatorHighSecurityRequestExceptionHandler' => 'aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php',
'PhabricatorHomeApplication' => 'applications/home/application/PhabricatorHomeApplication.php',
+ 'PhabricatorHomeConstants' => 'applications/home/constants/PhabricatorHomeConstants.php',
'PhabricatorHomeController' => 'applications/home/controller/PhabricatorHomeController.php',
'PhabricatorHomeMainController' => 'applications/home/controller/PhabricatorHomeMainController.php',
+ 'PhabricatorHomeManagePanel' => 'applications/home/profilepanel/PhabricatorHomeManagePanel.php',
+ 'PhabricatorHomePanelController' => 'applications/home/controller/PhabricatorHomePanelController.php',
+ 'PhabricatorHomePanelEngine' => 'applications/home/engine/PhabricatorHomePanelEngine.php',
'PhabricatorHomePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php',
'PhabricatorHomeQuickCreateController' => 'applications/home/controller/PhabricatorHomeQuickCreateController.php',
'PhabricatorHovercardEngineExtension' => 'applications/search/engineextension/PhabricatorHovercardEngineExtension.php',
@@ -6608,6 +6613,7 @@
'PhabricatorApplicationEmailCommandsController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationLaunchView' => 'AphrontTagView',
'PhabricatorApplicationPanelController' => 'PhabricatorApplicationsController',
+ 'PhabricatorApplicationProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorApplicationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController',
'PhabricatorApplicationSearchEngine' => 'Phobject',
@@ -7766,8 +7772,12 @@
'PhabricatorHeraldContentSource' => 'PhabricatorContentSource',
'PhabricatorHighSecurityRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorHomeApplication' => 'PhabricatorApplication',
+ 'PhabricatorHomeConstants' => 'Phobject',
'PhabricatorHomeController' => 'PhabricatorController',
'PhabricatorHomeMainController' => 'PhabricatorHomeController',
+ 'PhabricatorHomeManagePanel' => 'PhabricatorProfilePanel',
+ 'PhabricatorHomePanelController' => 'PhabricatorHomeController',
+ 'PhabricatorHomePanelEngine' => 'PhabricatorProfilePanelEngine',
'PhabricatorHomePreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorHomeQuickCreateController' => 'PhabricatorHomeController',
'PhabricatorHovercardEngineExtension' => 'Phobject',
diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php
--- a/src/applications/dashboard/storage/PhabricatorDashboard.php
+++ b/src/applications/dashboard/storage/PhabricatorDashboard.php
@@ -24,7 +24,6 @@
private $panels = self::ATTACHABLE;
private $edgeProjectPHIDs = self::ATTACHABLE;
-
public static function initializeNewDashboard(PhabricatorUser $actor) {
return id(new PhabricatorDashboard())
->setName('')
diff --git a/src/applications/home/application/PhabricatorHomeApplication.php b/src/applications/home/application/PhabricatorHomeApplication.php
--- a/src/applications/home/application/PhabricatorHomeApplication.php
+++ b/src/applications/home/application/PhabricatorHomeApplication.php
@@ -26,6 +26,8 @@
'/' => 'PhabricatorHomeMainController',
'/(?P<only>home)/' => 'PhabricatorHomeMainController',
'/home/' => array(
+ 'panel/' =>
+ $this->getPanelRouting('PhabricatorHomePanelController'),
'create/' => 'PhabricatorHomeQuickCreateController',
),
);
diff --git a/src/applications/home/constants/PhabricatorHomeConstants.php b/src/applications/home/constants/PhabricatorHomeConstants.php
new file mode 100644
--- /dev/null
+++ b/src/applications/home/constants/PhabricatorHomeConstants.php
@@ -0,0 +1,7 @@
+<?php
+
+abstract class PhabricatorHomeConstants extends Phobject {
+
+ const PANEL_MANAGE = 'home.manage';
+
+}
diff --git a/src/applications/home/controller/PhabricatorHomePanelController.php b/src/applications/home/controller/PhabricatorHomePanelController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/home/controller/PhabricatorHomePanelController.php
@@ -0,0 +1,20 @@
+<?php
+
+final class PhabricatorHomePanelController
+ extends PhabricatorHomeController {
+
+ public function handleRequest(AphrontRequest $request) {
+
+ $viewer = $this->getViewer();
+ $object = id(new PhabricatorHomeApplication())->getPHID();
+
+ $engine = id(new PhabricatorHomePanelEngine())
+ ->setProfileObject($object)
+ ->setController($this);
+
+ $this->setProfilePanelEngine($engine);
+
+ return $engine->buildResponse();
+ }
+
+}
diff --git a/src/applications/home/engine/PhabricatorHomePanelEngine.php b/src/applications/home/engine/PhabricatorHomePanelEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/home/engine/PhabricatorHomePanelEngine.php
@@ -0,0 +1,24 @@
+<?php
+
+final class PhabricatorHomePanelEngine
+ extends PhabricatorProfilePanelEngine {
+
+ protected function isPanelEngineConfigurable() {
+ return true;
+ }
+
+ protected function getPanelURI($path) {
+ return "/home/panel/{$path}";
+ }
+
+ protected function getBuiltinProfilePanels($object) {
+ $panels = array();
+
+ $panels[] = $this->newPanel()
+ ->setBuiltinKey(PhabricatorHomeController::PANEL_MANAGE)
+ ->setPanelKey(PhabricatorHomeManagePanel::PANELKEY);
+
+ return $panels;
+ }
+
+}
diff --git a/src/applications/home/profilepanel/PhabricatorHomeManagePanel.php b/src/applications/home/profilepanel/PhabricatorHomeManagePanel.php
new file mode 100644
--- /dev/null
+++ b/src/applications/home/profilepanel/PhabricatorHomeManagePanel.php
@@ -0,0 +1,60 @@
+<?php
+
+final class PhabricatorHomeManagePanel
+ extends PhabricatorProfilePanel {
+
+ const PANELKEY = 'home.manage.menu';
+
+ public function getPanelTypeName() {
+ return pht('Manage Menu');
+ }
+
+ private function getDefaultName() {
+ return pht('Manage');
+ }
+
+ public function canHidePanel(
+ PhabricatorProfilePanelConfiguration $config) {
+ return false;
+ }
+
+ public function getDisplayName(
+ PhabricatorProfilePanelConfiguration $config) {
+ $name = $config->getPanelProperty('name');
+
+ if (strlen($name)) {
+ return $name;
+ }
+
+ return $this->getDefaultName();
+ }
+
+ public function buildEditEngineFields(
+ PhabricatorProfilePanelConfiguration $config) {
+ return array(
+ id(new PhabricatorTextEditField())
+ ->setKey('name')
+ ->setLabel(pht('Name'))
+ ->setPlaceholder($this->getDefaultName())
+ ->setValue($config->getPanelProperty('name')),
+ );
+ }
+
+ protected function newNavigationMenuItems(
+ PhabricatorProfilePanelConfiguration $config) {
+
+ $name = $this->getDisplayName($config);
+ $icon = 'fa-gears';
+ $href = '/home/manage/';
+
+ $item = $this->newItem()
+ ->setHref($href)
+ ->setName($name)
+ ->setIcon($icon);
+
+ return array(
+ $item,
+ );
+ }
+
+}
diff --git a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php b/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php
new file mode 100644
--- /dev/null
+++ b/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php
@@ -0,0 +1,72 @@
+<?php
+
+final class PhabricatorApplicationProfilePanel
+ extends PhabricatorProfilePanel {
+
+ const PANELKEY = 'application';
+
+ public function getPanelTypeIcon() {
+ return 'fa-globe';
+ }
+
+ public function getPanelTypeName() {
+ return pht('Application');
+ }
+
+ public function canAddToObject($object) {
+ return true;
+ }
+
+ public function getDisplayName(
+ PhabricatorProfilePanelConfiguration $config) {
+ $app = $this->getApplication($config);
+ return $app->getName();
+ }
+
+ public function buildEditEngineFields(
+ PhabricatorProfilePanelConfiguration $config) {
+ return array(
+ id(new PhabricatorDatasourceEditField())
+ ->setKey('application')
+ ->setLabel(pht('Application'))
+ ->setDatasource(new PhabricatorApplicationDatasource())
+ ->setSingleValue($config->getPanelProperty('application')),
+ );
+ }
+
+ private function getApplication(
+ PhabricatorProfilePanelConfiguration $config) {
+ $applications = PhabricatorApplication::getAllInstalledApplications();
+ $selected = $config->getPanelProperty('application');
+ foreach ($applications as $app) {
+ if ($app->getPHID() == $selected) {
+ $selected_app = $app;
+ break;
+ }
+ }
+ return $selected_app;
+ }
+
+ protected function newNavigationMenuItems(
+ PhabricatorProfilePanelConfiguration $config) {
+ $viewer = $this->getViewer();
+ $app = $this->getApplication($config);
+
+ $is_installed = PhabricatorApplication::isClassInstalledForViewer(
+ get_class($app),
+ $viewer);
+ if (!$is_installed) {
+ return null;
+ }
+
+ $item = $this->newItem()
+ ->setHref($app->getApplicationURI())
+ ->setName($app->getName())
+ ->setIcon($app->getIcon());
+
+ return array(
+ $item,
+ );
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 10:21 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7388238
Default Alt Text
D17003.diff (10 KB)
Attached To
Mode
D17003: [WIP] Allow Home to take a PanelEngine
Attached
Detach File
Event Timeline
Log In to Comment