Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13999515
D17016.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.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,79 @@
+<?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);
+ if ($app) {
+ return $app->getName();
+ } else {
+ return pht('(Uninstalled Application)');
+ }
+ 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) {
+ $viewer = $this->getViewer();
+ $phid = $config->getPanelProperty('application');
+ $app = id(new PhabricatorApplicationQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($phid))
+ ->executeOne();
+
+ return $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
Fri, Oct 25, 3:18 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711395
Default Alt Text
D17016.diff (3 KB)
Attached To
Mode
D17016: Add an ApplicationProfilePanel
Attached
Detach File
Event Timeline
Log In to Comment