Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13967738
D17016.id40940.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D17016.id40940.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',
@@ -6609,6 +6610,7 @@
'PhabricatorApplicationEmailCommandsController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationLaunchView' => 'AphrontTagView',
'PhabricatorApplicationPanelController' => 'PhabricatorApplicationsController',
+ 'PhabricatorApplicationProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorApplicationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController',
'PhabricatorApplicationSearchEngine' => 'Phobject',
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,76 @@
+<?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');
+ $selected_app = null;
+ 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);
+ if (!$app) {
+ return array();
+ }
+
+ $is_installed = PhabricatorApplication::isClassInstalledForViewer(
+ get_class($app),
+ $viewer);
+ if (!$is_installed) {
+ return array();
+ }
+
+ $item = $this->newItem()
+ ->setHref($app->getApplicationURI())
+ ->setName($app->getName())
+ ->setIcon($app->getIcon());
+
+ return array(
+ $item,
+ );
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 17 2024, 3:35 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6722577
Default Alt Text
D17016.id40940.diff (3 KB)
Attached To
Mode
D17016: Add an ApplicationProfilePanel
Attached
Detach File
Event Timeline
Log In to Comment