Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
index 54610001cd..707f0476cc 100644
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -1,302 +1,300 @@
<?php
/**
* @task info Application Information
* @task ui UI Integration
* @task uri URI Routing
* @task fact Fact Integration
* @task meta Application Management
* @group apps
*/
abstract class PhabricatorApplication {
const GROUP_CORE = 'core';
const GROUP_COMMUNICATION = 'communication';
const GROUP_ORGANIZATION = 'organization';
const GROUP_UTILITIES = 'util';
const GROUP_ADMIN = 'admin';
const GROUP_DEVELOPER = 'developer';
const GROUP_MISC = 'misc';
const TILE_INVISIBLE = 'invisible';
const TILE_HIDE = 'hide';
const TILE_SHOW = 'show';
const TILE_FULL = 'full';
public static function getApplicationGroups() {
return array(
self::GROUP_CORE => pht('Core Applications'),
self::GROUP_COMMUNICATION => pht('Communication'),
self::GROUP_ORGANIZATION => pht('Organization'),
self::GROUP_UTILITIES => pht('Utilities'),
self::GROUP_ADMIN => pht('Administration'),
self::GROUP_DEVELOPER => pht('Developer Tools'),
self::GROUP_MISC => pht('Miscellaneous Applications'),
);
}
public static function getTileDisplayName($constant) {
$names = array(
self::TILE_INVISIBLE => pht('Invisible'),
self::TILE_HIDE => pht('Hidden'),
self::TILE_SHOW => pht('Show Small Tile'),
self::TILE_FULL => pht('Show Large Tile'),
);
return idx($names, $constant);
}
/* -( Application Information )-------------------------------------------- */
public function getName() {
return substr(get_class($this), strlen('PhabricatorApplication'));
}
public function getShortDescription() {
return $this->getName().' Application';
}
public function isEnabled() {
return true;
}
public function isInstalled() {
- $uninstalled = PhabricatorEnv::getEnvConfig(
- 'phabricator.uninstalled-applications');
-
if (!$this->canUninstall()) {
return true;
}
+ $beta = PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
+ if (!$beta && $this->isBeta()) {
+ return false;
+ }
+
+ $uninstalled = PhabricatorEnv::getEnvConfig(
+ 'phabricator.uninstalled-applications');
+
return empty($uninstalled[get_class($this)]);
}
public function isBeta() {
return false;
}
public function canUninstall() {
return true;
}
public function getPHID() {
return 'PHID-APPS-'.get_class($this);
}
public function getTypeaheadURI() {
return $this->getBaseURI();
}
public function getBaseURI() {
return null;
}
public function getIconURI() {
return null;
}
public function getIconName() {
return 'application';
}
public function shouldAppearInLaunchView() {
return true;
}
public function getApplicationOrder() {
return PHP_INT_MAX;
}
public function getApplicationGroup() {
return self::GROUP_MISC;
}
public function getTitleGlyph() {
return null;
}
public function getHelpURI() {
// TODO: When these applications get created, link to their docs:
//
// - Drydock
// - OAuth Server
return null;
}
public function getEventListeners() {
return array();
}
public function getDefaultTileDisplay(PhabricatorUser $user) {
switch ($this->getApplicationGroup()) {
case self::GROUP_CORE:
return self::TILE_FULL;
case self::GROUP_UTILITIES:
case self::GROUP_DEVELOPER:
return self::TILE_HIDE;
case self::GROUP_ADMIN:
if ($user->getIsAdmin()) {
return self::TILE_SHOW;
} else {
return self::TILE_INVISIBLE;
}
break;
default:
return self::TILE_SHOW;
}
}
public function getRemarkupRules() {
return array();
}
/* -( URI Routing )-------------------------------------------------------- */
public function getRoutes() {
return array();
}
/* -( Fact Integration )--------------------------------------------------- */
public function getFactObjectsForAnalysis() {
return array();
}
/* -( UI Integration )----------------------------------------------------- */
/**
* Render status elements (like "3 Waiting Reviews") for application list
* views. These provide a way to alert users to new or pending action items
* in applications.
*
* @param PhabricatorUser Viewing user.
* @return list<PhabricatorApplicationStatusView> Application status elements.
* @task ui
*/
public function loadStatus(PhabricatorUser $user) {
return array();
}
/**
* You can provide an optional piece of flavor text for the application. This
* is currently rendered in application launch views if the application has no
* status elements.
*
* @return string|null Flavor text.
* @task ui
*/
public function getFlavorText() {
return null;
}
/**
* 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
*/
public function buildMainMenuItems(
PhabricatorUser $user,
PhabricatorController $controller = null) {
return array();
}
/**
* On the Phabricator homepage sidebar, this function returns the URL for
* a quick create X link which is displayed in the wide button only.
*
* @return string
* @task ui
*/
public function getQuickCreateURI() {
return null;
}
/* -( Application Management )--------------------------------------------- */
public static function getByClass($class_name) {
$selected = null;
$applications = PhabricatorApplication::getAllApplications();
foreach ($applications as $application) {
if (get_class($application) == $class_name) {
$selected = $application;
break;
}
}
return $selected;
}
public static function getAllApplications() {
$classes = id(new PhutilSymbolLoader())
->setAncestorClass(__CLASS__)
->setConcreteOnly(true)
->selectAndLoadSymbols();
$apps = array();
foreach ($classes as $class) {
$app = newv($class['name'], array());
$apps[] = $app;
}
// Reorder the applications into "application order". Notably, this ensures
// their event handlers register in application order.
$apps = msort($apps, 'getApplicationOrder');
$apps = mgroup($apps, 'getApplicationGroup');
$apps = array_select_keys($apps, self::getApplicationGroups()) + $apps;
$apps = array_mergev($apps);
return $apps;
}
public static function getAllInstalledApplications() {
static $applications;
- $show_beta = PhabricatorEnv::getEnvConfig(
- 'phabricator.show-beta-applications');
-
if (empty($applications)) {
$all_applications = self::getAllApplications();
$apps = array();
foreach ($all_applications as $app) {
if (!$app->isInstalled()) {
continue;
}
if (!$app->isEnabled()) {
continue;
}
- if (!$show_beta && $app->isBeta()) {
- continue;
- }
-
$apps[] = $app;
}
$applications = $apps;
}
return $applications;
}
}
diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php
index a5910c2441..604cedf476 100644
--- a/src/applications/config/option/PhabricatorCoreConfigOptions.php
+++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php
@@ -1,215 +1,225 @@
<?php
final class PhabricatorCoreConfigOptions
extends PhabricatorApplicationConfigOptions {
public function getName() {
return pht("Core");
}
public function getDescription() {
return pht("Configure core options, including URIs.");
}
public function getOptions() {
return array(
$this->newOption('phabricator.base-uri', 'string', null)
->setLocked(true)
->setSummary(pht("URI where Phabricator is installed."))
->setDescription(
pht(
"Set the URI where Phabricator is installed. Setting this ".
"improves security by preventing cookies from being set on other ".
"domains, and allows daemons to send emails with links that have ".
"the correct domain."))
->addExample('http://phabricator.example.com/', pht('Valid Setting')),
$this->newOption('phabricator.production-uri', 'string', null)
->setSummary(
pht("Primary install URI, for multi-environment installs."))
->setDescription(
pht(
"If you have multiple Phabricator environments (like a ".
"development/staging environment for working on testing ".
"Phabricator, and a production environment for deploying it), ".
"set the production environment URI here so that emails and other ".
"durable URIs will always generate with links pointing at the ".
"production environment. If unset, defaults to ".
"{{phabricator.base-uri}}. Most installs do not need to set ".
"this option."))
->addExample('http://phabricator.example.com/', pht('Valid Setting')),
$this->newOption('phabricator.timezone', 'string', null)
->setSummary(
pht("The timezone Phabricator should use."))
->setDescription(
pht(
"PHP requires that you set a timezone in your php.ini before ".
"using date functions, or it will emit a warning. If this isn't ".
"possible (for instance, because you are using HPHP) you can set ".
"some valid constant for date_default_timezone_set() here and ".
"Phabricator will set it on your behalf, silencing the warning."))
->addExample('America/New_York', pht('US East (EDT)'))
->addExample('America/Chicago', pht('US Central (CDT)'))
->addExample('America/Boise', pht('US Mountain (MDT)'))
->addExample('America/Los_Angeles', pht('US West (PDT)')),
$this->newOption('phabricator.show-beta-applications', 'bool', false)
->setBoolOptions(
array(
- pht('Visible'),
- pht('Invisible')
- ))->setDescription(pht('Show beta applications on the home page.')),
+ pht('Install Beta Applications'),
+ pht('Uninstall Beta Applications')
+ ))
+ ->setDescription(
+ pht(
+ "Phabricator includes 'Beta' applications which are in an early ".
+ "stage of development. They range from very rough prototypes to ".
+ "relatively complete (but unpolished) applications.\n\n".
+ "By default, Beta applications are not installed. You can enable ".
+ "this option to install them if you're interested in previewing ".
+ "upcoming features.\n\n".
+ "After enabling Beta applications, you can selectively uninstall ".
+ "them (like normal applications).")),
$this->newOption('phabricator.serious-business', 'bool', false)
->setBoolOptions(
array(
pht('Serious business'),
pht('Shenanigans'), // That should be interesting to translate. :P
))
->setSummary(
pht("Should Phabricator be serious?"))
->setDescription(
pht(
"By default, Phabricator includes some silly nonsense in the UI, ".
"such as a submit button called 'Clowncopterize' in Differential ".
"and a call to 'Leap Into Action'. If you'd prefer more ".
"traditional UI strings like 'Submit', you can set this flag to ".
"disable most of the jokes and easter eggs.")),
$this->newOption('environment.append-paths', 'list<string>', array())
->setSummary(
pht("These paths get appended to your \$PATH envrionment variable."))
->setDescription(
pht(
"Phabricator occasionally shells out to other binaries on the ".
"server. An example of this is the \"pygmentize\" command, used ".
"to syntax-highlight code written in languages other than PHP. ".
"By default, it is assumed that these binaries are in the \$PATH ".
"of the user running Phabricator (normally 'apache', 'httpd', or ".
"'nobody'). Here you can add extra directories to the \$PATH ".
"environment variable, for when these binaries are in ".
"non-standard locations. Note that you can also put binaries in ".
"`phabricator/support/bin`."))
->addExample('/usr/local/bin', pht('Add One Path'))
->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')),
$this->newOption('tokenizer.ondemand', 'bool', false)
->setBoolOptions(
array(
pht("Query on demand"),
pht("Query on page load"),
))
->setSummary(
pht("Query for tokenizer fields on demand."))
->setDescription(
pht(
"Tokenizers are UI controls which let the user select other ".
"users, email addresses, project names, etc., by typing the ".
"first few letters and having the control autocomplete from a ".
"list. They can load their data in two ways: either in a big ".
"chunk up front, or as the user types. By default, the data is ".
"loaded in a big chunk. This is simpler and performs better for ".
"small datasets. However, if you have a very large number of ".
"users or projects, (in the ballpark of more than a thousand), ".
"loading all that data may become slow enough that it's ".
"worthwhile to query on demand instead. This makes the typeahead ".
"slightly less responsive but overall performance will be much ".
"better if you have a ton of stuff. You can figure out which ".
"setting is best for your install by changing this setting and ".
"then playing with a user tokenizer (like the user selectors in ".
"Maniphest or Differential) and seeing which setting loads ".
"faster and feels better.")),
$this->newOption('config.lock', 'set', array())
->setLocked(true)
->setDescription(pht('Additional configuration options to lock.')),
$this->newOption('config.hide', 'set', array())
->setLocked(true)
->setDescription(pht('Additional configuration options to hide.')),
$this->newOption('config.mask', 'set', array())
->setLocked(true)
->setDescription(pht('Additional configuration options to mask.')),
$this->newOption('config.ignore-issues', 'set', array())
->setLocked(true)
->setDescription(pht('Setup issues to ignore.')),
$this->newOption('phabricator.env', 'string', null)
->setLocked(true)
->setDescription(pht('Internal.')),
$this->newOption('test.value', 'wild', null)
->setLocked(true)
->setDescription(pht('Unit test value.')),
$this->newOption('phabricator.uninstalled-applications', 'set', array())
->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.')),
$this->newOption('phabricator.cache-namespace', 'string', null)
->setLocked(true)
->setDescription(pht('Cache namespace.')),
);
}
protected function didValidateOption(
PhabricatorConfigOption $option,
$value) {
$key = $option->getKey();
if ($key == 'phabricator.base-uri' ||
$key == 'phabricator.production-uri') {
$uri = new PhutilURI($value);
$protocol = $uri->getProtocol();
if ($protocol !== 'http' && $protocol !== 'https') {
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must start with ".
"'http://' or 'https://'.",
$key));
}
$domain = $uri->getDomain();
if (strpos($domain, '.') === false) {
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must contain a dot ('.'), ".
"like 'http://example.com/', not just a bare name like ".
"'http://example/'. Some web browsers will not set cookies on ".
"domains with no TLD.",
$key));
}
$path = $uri->getPath();
if ($path !== '' && $path !== '/') {
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must NOT have a path, ".
"e.g. 'http://phabricator.example.com/' is OK, but ".
"'http://example.com/phabricator/' is not. Phabricator must be ".
"installed on an entire domain; it can not be installed on a ".
"path.",
$key));
}
}
if ($key === 'phabricator.timezone') {
$old = date_default_timezone_get();
$ok = @date_default_timezone_set($value);
@date_default_timezone_set($old);
if (!$ok) {
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The timezone identifier must ".
"be a valid timezone identifier recognized by PHP, like ".
"'America/Los_Angeles'. You can find a list of valid identifiers ".
"here: %s",
$key,
'http://php.net/manual/timezones.php'));
}
}
}
}
diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelConpherencePreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelConpherencePreferences.php
index 778f0c3888..838d88f113 100644
--- a/src/applications/settings/panel/PhabricatorSettingsPanelConpherencePreferences.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelConpherencePreferences.php
@@ -1,84 +1,79 @@
<?php
final class PhabricatorSettingsPanelConpherencePreferences
extends PhabricatorSettingsPanel {
public function isEnabled() {
- // TODO - epriestley - resolve isBeta and isInstalled for
- // PhabricatorApplication
- $app = PhabricatorApplication::getByClass(
+ $conpherence_app = PhabricatorApplication::getByClass(
'PhabricatorApplicationConpherence');
- $is_prod = !$app->isBeta();
- $allow_beta =
- PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
- return ($is_prod || $allow_beta) && $app->isInstalled();
+ return $conpherence_app->isInstalled();
}
public function getPanelKey() {
return 'conpherence';
}
public function getPanelName() {
return pht('Conpherence Preferences');
}
public function getPanelGroup() {
return pht('Application Settings');
}
public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$preferences = $user->loadPreferences();
$pref = PhabricatorUserPreferences::PREFERENCE_CONPH_NOTIFICATIONS;
if ($request->isFormPost()) {
$notifications = $request->getInt($pref);
$preferences->setPreference($pref, $notifications);
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true'));
}
$form = id(new AphrontFormView())
->setUser($user)
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Conpherence Notifications'))
->setName($pref)
->setValue($preferences->getPreference($pref))
->setOptions(
array(
ConpherenceSettings::EMAIL_ALWAYS
=> pht('Email Always'),
ConpherenceSettings::NOTIFICATIONS_ONLY
=> pht('Notifications Only'),
))
->setCaption(
pht('Should Conpherence send emails for updates or '.
'notifications only? This global setting can be overridden '.
'on a per-thread basis within Conpherence.')))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
$panel = new AphrontPanelView();
$panel->setHeader(pht('Conpherence Preferences'));
$panel->appendChild($form);
$panel->setNoBackground();
$error_view = null;
if ($request->getBool('saved')) {
$error_view = id(new AphrontErrorView())
->setTitle(pht('Preferences Saved'))
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setErrors(array(pht('Your preferences have been saved.')));
}
return array(
$error_view,
$panel,
);
}
}
diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php
index 91bbbdca82..2c56e7f50c 100644
--- a/src/view/page/menu/PhabricatorMainMenuView.php
+++ b/src/view/page/menu/PhabricatorMainMenuView.php
@@ -1,388 +1,387 @@
<?php
final class PhabricatorMainMenuView extends AphrontView {
private $defaultSearchScope;
private $controller;
private $applicationMenu;
public function setApplicationMenu(PhabricatorMenuView $application_menu) {
$this->applicationMenu = $application_menu;
return $this;
}
public function getApplicationMenu() {
return $this->applicationMenu;
}
public function setController(PhabricatorController $controller) {
$this->controller = $controller;
return $this;
}
public function getController() {
return $this->controller;
}
public function setDefaultSearchScope($default_search_scope) {
$this->defaultSearchScope = $default_search_scope;
return $this;
}
public function getDefaultSearchScope() {
return $this->defaultSearchScope;
}
public function render() {
$user = $this->user;
require_celerity_resource('phabricator-main-menu-view');
$header_id = celerity_generate_unique_node_id();
$menus = array();
$alerts = array();
$search_button = '';
$app_button = '';
if ($user->isLoggedIn()) {
list($menu, $dropdown) = $this->renderNotificationMenu();
$alerts[] = $menu;
$menus[] = $dropdown;
$app_button = $this->renderApplicationMenuButton($header_id);
$search_button = $this->renderSearchMenuButton($header_id);
}
$search_menu = $this->renderPhabricatorSearchMenu();
if ($alerts) {
$alerts = phutil_tag(
'div',
array(
'class' => 'phabricator-main-menu-alerts',
),
$alerts);
}
$application_menu = $this->renderApplicationMenu();
return phutil_tag(
'div',
array(
'class' => 'phabricator-main-menu',
'id' => $header_id,
),
array(
$app_button,
$search_button,
$this->renderPhabricatorLogo(),
$alerts,
$application_menu,
$search_menu,
$menus,
));
}
private function renderSearch() {
$user = $this->user;
$result = null;
$keyboard_config = array(
'helpURI' => '/help/keyboardshortcut/',
);
if ($user->isLoggedIn()) {
$search = new PhabricatorMainMenuSearchView();
$search->setUser($user);
$search->setScope($this->getDefaultSearchScope());
$result = $search;
$pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
if ($user->loadPreferences()->getPreference($pref_shortcut, true)) {
$keyboard_config['searchID'] = $search->getID();
}
}
Javelin::initBehavior('phabricator-keyboard-shortcuts', $keyboard_config);
if ($result) {
$result = id(new PhabricatorMenuItemView())
->addClass('phabricator-main-menu-search')
->appendChild($result);
}
return $result;
}
public function renderApplicationMenuButton($header_id) {
$button_id = celerity_generate_unique_node_id();
return javelin_tag(
'a',
array(
'class' => 'phabricator-main-menu-expand-button '.
'phabricator-expand-search-menu',
'sigil' => 'jx-toggle-class',
'meta' => array(
'map' => array(
$header_id => 'phabricator-application-menu-expanded',
$button_id => 'menu-icon-app-blue',
),
),
),
phutil_tag(
'span',
array(
'class' => 'phabricator-menu-button-icon sprite-menu menu-icon-app',
'id' => $button_id,
),
''));
}
public function renderApplicationMenu() {
$user = $this->getUser();
$controller = $this->getController();
$applications = PhabricatorApplication::getAllInstalledApplications();
$actions = array();
foreach ($applications as $application) {
if ($application->shouldAppearInLaunchView()) {
$app_actions = $application->buildMainMenuItems($user, $controller);
foreach ($app_actions as $action) {
$actions[] = $action;
}
}
}
$view = $this->getApplicationMenu();
if (!$view) {
$view = new PhabricatorMenuView();
}
$view->addClass('phabricator-dark-menu');
$view->addClass('phabricator-application-menu');
if ($actions) {
$view->addMenuItem(
id(new PhabricatorMenuItemView())
->addClass('phabricator-core-item-device')
->setType(PhabricatorMenuItemView::TYPE_LABEL)
->setName(pht('Actions')));
foreach ($actions as $action) {
$icon = $action->getIcon();
if ($icon) {
if ($action->getSelected()) {
$action->appendChild($this->renderMenuIcon($icon.'-blue-large'));
} else {
$action->appendChild($this->renderMenuIcon($icon.'-light-large'));
}
}
$view->addMenuItem($action);
}
}
if ($user->isLoggedIn()) {
$view->addMenuItem(
id(new PhabricatorMenuItemView())
->addClass('phabricator-menu-item-type-link')
->addClass('phabricator-core-menu-item')
->setName(pht('Log Out'))
->setHref('/logout/')
->appendChild($this->renderMenuIcon('power-light-large')));
}
return $view;
}
public function renderSearchMenuButton($header_id) {
$button_id = celerity_generate_unique_node_id();
return javelin_tag(
'a',
array(
'class' => 'phabricator-main-menu-search-button '.
'phabricator-expand-application-menu',
'sigil' => 'jx-toggle-class',
'meta' => array(
'map' => array(
$header_id => 'phabricator-search-menu-expanded',
$button_id => 'menu-icon-search-blue',
),
),
),
phutil_tag(
'span',
array(
'class' => 'phabricator-menu-button-icon sprite-menu menu-icon-search',
'id' => $button_id,
),
''));
}
private function renderPhabricatorSearchMenu() {
$view = new PhabricatorMenuView();
$view->addClass('phabricator-dark-menu');
$view->addClass('phabricator-search-menu');
$search = $this->renderSearch();
if ($search) {
$view->addMenuItem($search);
}
return $view;
}
private function renderPhabricatorLogo() {
return phutil_tag(
'a',
array(
'class' => 'phabricator-main-menu-logo',
'href' => '/',
),
phutil_tag(
'span',
array(
'class' => 'sprite-menu phabricator-main-menu-logo-image',
),
''));
}
private function renderNotificationMenu() {
$user = $this->user;
require_celerity_resource('phabricator-notification-css');
require_celerity_resource('phabricator-notification-menu-css');
require_celerity_resource('sprite-menu-css');
$container_classes = array(
'sprite-menu',
'alert-notifications',
);
- $conpherence = id(new PhabricatorApplicationConpherence())->isBeta();
- $allow_beta =
- PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
- $message_tag = '';
+ $conpherence_application = PhabricatorApplication::getByClass(
+ 'PhabricatorApplicationConpherence');
- if (!$conpherence || $allow_beta) {
+ $message_tag = '';
+ if ($conpherence_application->isInstalled()) {
$message_id = celerity_generate_unique_node_id();
$message_count_id = celerity_generate_unique_node_id();
$unread_status = ConpherenceParticipationStatus::BEHIND;
$unread = id(new ConpherenceParticipantQuery())
->withParticipantPHIDs(array($user->getPHID()))
->withParticipationStatus($unread_status)
->execute();
$message_count_number = count($unread);
if ($message_count_number > 999) {
$message_count_number = "\xE2\x88\x9E";
}
$message_count_tag = phutil_tag(
'span',
array(
'id' => $message_count_id,
'class' => 'phabricator-main-menu-message-count'
),
$message_count_number);
$message_icon_tag = phutil_tag(
'span',
array(
'class' => 'sprite-menu phabricator-main-menu-message-icon',
),
'');
if ($message_count_number) {
$container_classes[] = 'message-unread';
}
$message_tag = phutil_tag(
'a',
array(
'href' => '/conpherence/',
'class' => implode(' ', $container_classes),
'id' => $message_id,
),
array(
$message_icon_tag,
$message_count_tag,
));
}
$count_id = celerity_generate_unique_node_id();
$dropdown_id = celerity_generate_unique_node_id();
$bubble_id = celerity_generate_unique_node_id();
$count_number = id(new PhabricatorFeedStoryNotification())
->countUnread($user);
if ($count_number > 999) {
$count_number = "\xE2\x88\x9E";
}
$count_tag = phutil_tag(
'span',
array(
'id' => $count_id,
'class' => 'phabricator-main-menu-alert-count'
),
$count_number);
$icon_tag = phutil_tag(
'span',
array(
'class' => 'sprite-menu phabricator-main-menu-alert-icon',
),
'');
if ($count_number) {
$container_classes[] = 'alert-unread';
}
$bubble_tag = phutil_tag(
'a',
array(
'href' => '/notification/',
'class' => implode(' ', $container_classes),
'id' => $bubble_id,
),
array($icon_tag, $count_tag));
Javelin::initBehavior(
'aphlict-dropdown',
array(
'bubbleID' => $bubble_id,
'countID' => $count_id,
'dropdownID' => $dropdown_id,
'loadingText' => pht('Loading...'),
));
$notification_dropdown = javelin_tag(
'div',
array(
'id' => $dropdown_id,
'class' => 'phabricator-notification-menu',
'sigil' => 'phabricator-notification-menu',
'style' => 'display: none;',
),
'');
return array(
hsprintf('%s%s', $bubble_tag, $message_tag),
$notification_dropdown,
);
}
private function renderMenuIcon($name) {
return phutil_tag(
'span',
array(
'class' => 'phabricator-core-menu-icon '.
'sprite-apps-large app-'.$name,
),
'');
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 12:19 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124492
Default Alt Text
(32 KB)

Event Timeline