From 4674b88ff6764a9d93366b020ed39cec5564b713 Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Thu, 21 Mar 2013 16:02:35 -0700 Subject: [PATCH] Added configurable welcome content for Phabricator home page. Summary: The welcome.enabled feature is turned on by default; unsure of whether this is desired by upstream. Test Plan: Apply the patch and see the welcome content. It's configurable in the config. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5339 --- conf/default.conf.php | 7 ++++++- .../option/PhabricatorCoreConfigOptions.php | 4 ++++ .../PhabricatorDirectoryMainController.php | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/conf/default.conf.php b/conf/default.conf.php index a45254eaa6..621b932639 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -847,7 +847,12 @@ return array( 'phabricator.show-beta-applications' => false, // Contains a list of uninstalled applications - 'phabricator.uninstalled-applications' => array(), + 'phabricator.uninstalled-applications' => array(), + +// -- Welcome Screen -------------------------------------------------------- // + + // The custom HTML content for the Phabricator welcome screen. + 'welcome.html' => null, // -- Files ----------------------------------------------------------------- // diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php index 252f0a30e7..432c0aac49 100644 --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -135,6 +135,10 @@ final class PhabricatorCoreConfigOptions ->setLocked(true) ->setDescription( pht('Array containing list of Uninstalled applications.')), + $this->newOption('welcome.html', 'string', null) + ->setLocked(true) + ->setDescription( + pht('Custom HTML to show on the main Phabricator dashboard.')), ); } diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 9e5fab475b..ce79ad2bab 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -40,6 +40,11 @@ final class PhabricatorDirectoryMainController $tasks_panel = null; } + if (PhabricatorEnv::getEnvConfig('welcome.html') !== null) { + $welcome_panel = $this->buildWelcomePanel(); + } else { + $welcome_panel = null; + } $jump_panel = $this->buildJumpPanel(); $revision_panel = $this->buildRevisionPanel(); $audit_panel = $this->buildAuditPanel(); @@ -47,6 +52,7 @@ final class PhabricatorDirectoryMainController $content = array( $jump_panel, + $welcome_panel, $unbreak_panel, $triage_panel, $revision_panel, @@ -226,6 +232,16 @@ final class PhabricatorDirectoryMainController return $panel; } + private function buildWelcomePanel() { + $panel = new AphrontPanelView(); + $panel->appendChild( + phutil_safe_html( + PhabricatorEnv::getEnvConfig('welcome.html'))); + $panel->setNoBackground(); + + return $panel; + } + private function buildTasksPanel() { $user = $this->getRequest()->getUser(); $user_phid = $user->getPHID();