1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Use EditEngine for diff, display, developer and most email settings

Summary: Ref T4103. This converts other straightforward panels to modern stuff.

Test Plan:
  - Edited various settings.
  - Tried to set a bogus editor value.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4103

Differential Revision: https://secure.phabricator.com/D16023
This commit is contained in:
epriestley 2016-06-03 06:35:08 -07:00
parent ef28adae9a
commit 45f347fe47
18 changed files with 156 additions and 582 deletions

View file

@ -6880,9 +6880,9 @@ phutil_register_library_map(array(
'PhabricatorDestructionEngineExtension' => 'Phobject',
'PhabricatorDestructionEngineExtensionModule' => 'PhabricatorConfigModule',
'PhabricatorDeveloperConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorDeveloperPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorDeveloperPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorDiffInlineCommentQuery' => 'PhabricatorApplicationTransactionCommentQuery',
'PhabricatorDiffPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorDiffPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorDifferenceEngine' => 'Phobject',
'PhabricatorDifferentialApplication' => 'PhabricatorApplication',
'PhabricatorDifferentialAttachCommitWorkflow' => 'PhabricatorDifferentialManagementWorkflow',
@ -6893,7 +6893,7 @@ phutil_register_library_map(array(
'PhabricatorDiffusionApplication' => 'PhabricatorApplication',
'PhabricatorDiffusionConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorDisabledUserController' => 'PhabricatorAuthController',
'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorDividerProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorDivinerApplication' => 'PhabricatorApplication',
@ -6963,7 +6963,7 @@ phutil_register_library_map(array(
'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailContentSource' => 'PhabricatorContentSource',
'PhabricatorEmailFormatSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorEmailLoginController' => 'PhabricatorAuthController',
'PhabricatorEmailNotificationsSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',

View file

@ -1,11 +1,9 @@
<?php
final class PhabricatorDeveloperPreferencesSettingsPanel
extends PhabricatorSettingsPanel {
extends PhabricatorEditEngineSettingsPanel {
public function getPanelKey() {
return 'developer';
}
const PANELKEY = 'developer';
public function getPanelName() {
return pht('Developer Settings');
@ -15,85 +13,4 @@ final class PhabricatorDeveloperPreferencesSettingsPanel
return PhabricatorSettingsDeveloperPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$preferences = $user->loadPreferences();
$pref_dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE;
$dark_console_value = $preferences->getPreference($pref_dark_console);
if ($request->isFormPost()) {
$new_dark_console = $request->getBool($pref_dark_console);
$preferences->setPreference($pref_dark_console, $new_dark_console);
// If the user turned Dark Console on, enable it (as though they had hit
// "`").
if ($new_dark_console && !$dark_console_value) {
$user->setConsoleVisible(true);
$user->save();
}
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true'));
}
$is_console_enabled = PhabricatorEnv::getEnvConfig('darkconsole.enabled');
$preamble = pht(
"**DarkConsole** is a developer console which can help build and ".
"debug Phabricator applications. It includes tools for understanding ".
"errors, performance, service calls, and other low-level aspects of ".
"Phabricator's inner workings.");
if ($is_console_enabled) {
$instructions = pht(
"%s\n\n".
'You can enable it for your account below. Enabling DarkConsole will '.
'slightly decrease performance, but give you access to debugging '.
'tools. You may want to disable it again later if you only need it '.
'temporarily.'.
"\n\n".
'NOTE: After enabling DarkConsole, **press the ##%s## key on your '.
'keyboard** to show or hide it.',
$preamble,
'`');
} else {
$instructions = pht(
"%s\n\n".
'Before you can turn on DarkConsole, it needs to be enabled in '.
'the configuration for this install (`%s`).',
$preamble,
'darkconsole.enabled');
}
$form = id(new AphrontFormView())
->setUser($user)
->appendRemarkupInstructions($instructions)
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Dark Console'))
->setName($pref_dark_console)
->setValue($dark_console_value)
->setOptions(
array(
0 => pht('Disable DarkConsole'),
1 => pht('Enable DarkConsole'),
))
->setDisabled(!$is_console_enabled))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Developer Settings'))
->setFormSaved($request->getBool('saved'))
->setForm($form);
return array(
$form_box,
);
}
}

View file

@ -1,11 +1,9 @@
<?php
final class PhabricatorDiffPreferencesSettingsPanel
extends PhabricatorSettingsPanel {
extends PhabricatorEditEngineSettingsPanel {
public function getPanelKey() {
return 'diff';
}
const PANELKEY = 'diff';
public function getPanelName() {
return pht('Diff Preferences');
@ -15,92 +13,4 @@ final class PhabricatorDiffPreferencesSettingsPanel
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$preferences = $user->loadPreferences();
$pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED;
$pref_ghosts = PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS;
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
if ($request->isFormPost()) {
$filetree = $request->getInt($pref_filetree);
if ($filetree && !$preferences->getPreference($pref_filetree)) {
$preferences->setPreference(
PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED,
false);
}
$preferences->setPreference($pref_filetree, $filetree);
$unified = $request->getStr($pref_unified);
$preferences->setPreference($pref_unified, $unified);
$ghosts = $request->getStr($pref_ghosts);
$preferences->setPreference($pref_ghosts, $ghosts);
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true'));
}
$form = id(new AphrontFormView())
->setUser($user)
->appendRemarkupInstructions(
pht(
'Phabricator normally shows diffs in a side-by-side layout on '.
'large screens, and automatically switches to a unified '.
'view on small screens (like mobile phones). If you prefer '.
'unified diffs even on large screens, you can select them as '.
'the default layout.'))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Show Unified Diffs'))
->setName($pref_unified)
->setValue($preferences->getPreference($pref_unified))
->setOptions(
array(
'default' => pht('On Small Screens'),
'unified' => pht('Always'),
)))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Show Older Inlines'))
->setName($pref_ghosts)
->setValue($preferences->getPreference($pref_ghosts))
->setOptions(
array(
'default' => pht('Enabled'),
'disabled' => pht('Disabled'),
)))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Show Filetree'))
->setName($pref_filetree)
->setValue($preferences->getPreference($pref_filetree))
->setOptions(
array(
0 => pht('Disable Filetree'),
1 => pht('Enable Filetree'),
))
->setCaption(
pht(
'When looking at a revision or commit, enable a sidebar '.
'showing affected files. You can press %s to show or hide '.
'the sidebar.',
phutil_tag('tt', array(), 'f'))))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Diff Preferences'))
->setFormSaved($request->getBool('saved'))
->setForm($form);
return array(
$form_box,
);
}
}

View file

@ -1,11 +1,9 @@
<?php
final class PhabricatorDisplayPreferencesSettingsPanel
extends PhabricatorSettingsPanel {
extends PhabricatorEditEngineSettingsPanel {
public function getPanelKey() {
return 'display';
}
const PANELKEY = 'display';
public function getPanelName() {
return pht('Display Preferences');
@ -15,186 +13,4 @@ final class PhabricatorDisplayPreferencesSettingsPanel
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$preferences = $user->loadPreferences();
$pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED;
$pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR;
$pref_multiedit = PhabricatorUserPreferences::PREFERENCE_MULTIEDIT;
$pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES;
$pref_monospaced_textareas =
PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS;
$pref_postprocessor =
PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR;
$errors = array();
$e_editor = null;
if ($request->isFormPost()) {
$monospaced = $request->getStr($pref_monospaced);
$monospaced = PhabricatorUserPreferences::filterMonospacedCSSRule(
$monospaced);
$preferences->setPreference($pref_titles, $request->getStr($pref_titles));
$preferences->setPreference($pref_editor, $request->getStr($pref_editor));
$preferences->setPreference(
$pref_multiedit,
$request->getStr($pref_multiedit));
$preferences->setPreference($pref_monospaced, $monospaced);
$preferences->setPreference(
$pref_monospaced_textareas,
$request->getStr($pref_monospaced_textareas));
$preferences->setPreference(
$pref_postprocessor,
$request->getStr($pref_postprocessor));
$editor_pattern = $preferences->getPreference($pref_editor);
if (strlen($editor_pattern)) {
$ok = PhabricatorHelpEditorProtocolController::hasAllowedProtocol(
$editor_pattern);
if (!$ok) {
$allowed_key = 'uri.allowed-editor-protocols';
$allowed_protocols = PhabricatorEnv::getEnvConfig($allowed_key);
$proto_names = array();
foreach (array_keys($allowed_protocols) as $protocol) {
$proto_names[] = $protocol.'://';
}
$errors[] = pht(
'Editor link has an invalid or missing protocol. You must '.
'use a whitelisted editor protocol from this list: %s. To '.
'add protocols, update %s.',
implode(', ', $proto_names),
phutil_tag('tt', array(), $allowed_key));
$e_editor = pht('Invalid');
}
}
if (!$errors) {
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true'));
}
}
$example_string = <<<EXAMPLE
// This is what your monospaced font currently looks like.
function helloWorld() {
alert("Hello world!");
}
EXAMPLE;
$editor_doc_link = phutil_tag(
'a',
array(
'href' => PhabricatorEnv::getDoclink(
'User Guide: Configuring an External Editor'),
),
pht('User Guide: Configuring an External Editor'));
$pref_monospaced_textareas_value = $preferences
->getPreference($pref_monospaced_textareas);
if (!$pref_monospaced_textareas_value) {
$pref_monospaced_textareas_value = 'disabled';
}
$editor_instructions = pht(
'Link to edit files in external editor. '.
'%%f is replaced by filename, %%l by line number, %%r by repository '.
'callsign, %%%% by literal %%. For documentation, see: %s',
$editor_doc_link);
$font_instructions = pht(
'Overrides default fonts in tools like Differential. '.
'Input should be valid CSS "font" declaration, such as '.
'"13px Consolas"');
$postprocessor_map = CelerityPostprocessor::getAllPostprocessors();
$postprocessor_map = mpull($postprocessor_map, 'getPostprocessorName');
asort($postprocessor_map);
$postprocessor_order = array(
CelerityDefaultPostprocessor::POSTPROCESSOR_KEY,
);
$postprocessor_map = array_select_keys(
$postprocessor_map,
$postprocessor_order) + $postprocessor_map;
$form = id(new AphrontFormView())
->setUser($user)
->appendControl(
id(new AphrontFormSelectControl())
->setLabel(pht('Accessibility'))
->setName($pref_postprocessor)
->setValue($preferences->getPreference($pref_postprocessor))
->setOptions($postprocessor_map))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Page Titles'))
->setName($pref_titles)
->setValue($preferences->getPreference($pref_titles))
->setOptions(
array(
'glyph' =>
pht(
'In page titles, show Tool names as unicode glyphs: %s',
"\xE2\x9A\x99"),
'text' =>
pht(
'In page titles, show Tool names as plain text: '.
'[Differential]'),
)))
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Editor Link'))
->setName($pref_editor)
->setCaption($editor_instructions)
->setError($e_editor)
->setValue($preferences->getPreference($pref_editor)))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Edit Multiple Files'))
->setName($pref_multiedit)
->setOptions(array(
'' => pht('Supported (paths separated by spaces)'),
'disable' => pht('Not Supported'),
))
->setValue($preferences->getPreference($pref_multiedit)))
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Monospaced Font'))
->setName($pref_monospaced)
->setCaption($font_instructions)
->setValue($preferences->getPreference($pref_monospaced)))
->appendChild(
id(new AphrontFormMarkupControl())
->setValue(phutil_tag(
'pre',
array('class' => 'PhabricatorMonospaced'),
$example_string)))
->appendChild(
id(new AphrontFormRadioButtonControl())
->setLabel(pht('Monospaced Textareas'))
->setName($pref_monospaced_textareas)
->setValue($pref_monospaced_textareas_value)
->addButton('enabled', pht('Enabled'),
pht('Show all textareas using the monospaced font defined above.'))
->addButton('disabled', pht('Disabled'), null));
$form->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Display Preferences'))
->setFormErrors($errors)
->setFormSaved($request->getStr('saved') === 'true')
->setForm($form);
return array(
$form_box,
);
}
}

View file

@ -1,11 +1,9 @@
<?php
final class PhabricatorEmailFormatSettingsPanel
extends PhabricatorSettingsPanel {
extends PhabricatorEditEngineSettingsPanel {
public function getPanelKey() {
return 'emailformat';
}
const PANELKEY = 'emailformat';
public function getPanelName() {
return pht('Email Format');
@ -23,214 +21,4 @@ final class PhabricatorEmailFormatSettingsPanel
return false;
}
public function processRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$user = $this->getUser();
$preferences = $user->loadPreferences();
$pref_re_prefix = PhabricatorUserPreferences::PREFERENCE_RE_PREFIX;
$pref_vary = PhabricatorUserPreferences::PREFERENCE_VARY_SUBJECT;
$prefs_html_email = PhabricatorUserPreferences::PREFERENCE_HTML_EMAILS;
$errors = array();
if ($request->isFormPost()) {
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
if ($request->getStr($pref_re_prefix) == 'default') {
$preferences->unsetPreference($pref_re_prefix);
} else {
$preferences->setPreference(
$pref_re_prefix,
$request->getBool($pref_re_prefix));
}
if ($request->getStr($pref_vary) == 'default') {
$preferences->unsetPreference($pref_vary);
} else {
$preferences->setPreference(
$pref_vary,
$request->getBool($pref_vary));
}
if ($request->getStr($prefs_html_email) == 'default') {
$preferences->unsetPreference($prefs_html_email);
} else {
$preferences->setPreference(
$prefs_html_email,
$request->getBool($prefs_html_email));
}
}
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true'));
}
$re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix')
? pht('Enabled')
: pht('Disabled');
$vary_default = PhabricatorEnv::getEnvConfig('metamta.vary-subjects')
? pht('Vary')
: pht('Do Not Vary');
$html_emails_default = pht('HTML');
$re_prefix_value = $preferences->getPreference($pref_re_prefix);
if ($re_prefix_value === null) {
$re_prefix_value = 'default';
} else {
$re_prefix_value = $re_prefix_value
? 'true'
: 'false';
}
$vary_value = $preferences->getPreference($pref_vary);
if ($vary_value === null) {
$vary_value = 'default';
} else {
$vary_value = $vary_value
? 'true'
: 'false';
}
$html_emails_value = $preferences->getPreference($prefs_html_email);
if ($html_emails_value === null) {
$html_emails_value = 'default';
} else {
$html_emails_value = $html_emails_value
? 'true'
: 'false';
}
$form = new AphrontFormView();
$form
->setUser($viewer);
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
$html_email_control = id(new AphrontFormSelectControl())
->setName($prefs_html_email)
->setOptions(
array(
'default' => pht('Default (%s)', $html_emails_default),
'true' => pht('Send HTML Email'),
'false' => pht('Send Plain Text Email'),
))
->setValue($html_emails_value);
$re_control = id(new AphrontFormSelectControl())
->setName($pref_re_prefix)
->setOptions(
array(
'default' => pht('Use Server Default (%s)', $re_prefix_default),
'true' => pht('Enable "Re:" prefix'),
'false' => pht('Disable "Re:" prefix'),
))
->setValue($re_prefix_value);
$vary_control = id(new AphrontFormSelectControl())
->setName($pref_vary)
->setOptions(
array(
'default' => pht('Use Server Default (%s)', $vary_default),
'true' => pht('Vary Subjects'),
'false' => pht('Do Not Vary Subjects'),
))
->setValue($vary_value);
} else {
$html_email_control = id(new AphrontFormStaticControl())
->setValue(pht('Server Default (%s)', $html_emails_default));
$re_control = id(new AphrontFormStaticControl())
->setValue(pht('Server Default (%s)', $re_prefix_default));
$vary_control = id(new AphrontFormStaticControl())
->setValue(pht('Server Default (%s)', $vary_default));
}
$form
->appendRemarkupInstructions(
pht(
'These settings fine-tune some technical aspects of how email is '.
'formatted. You may be able to adjust them to make mail more '.
'useful or improve threading.'));
if (!PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
$form->appendRemarkupInstructions(
pht(
'NOTE: This install of Phabricator is configured to send a '.
'single mail message to all recipients, so all settings are '.
'locked at the server default value.'));
}
$form
->appendRemarkupInstructions(
pht(
"You can use the **HTML Email** setting to control whether ".
"Phabricator send you HTML email (which has more color and ".
"formatting) or plain text email (which is more compatible).\n".
"\n".
"WARNING: This feature is new and experimental! If you enable ".
"it, mail may not render properly and replying to mail may not ".
"work as well."))
->appendChild(
$html_email_control
->setLabel(pht('HTML Email')))
->appendRemarkupInstructions('')
->appendRemarkupInstructions(
pht(
'The **Add "Re:" Prefix** setting adds "Re:" in front of all '.
'messages, even if they are not replies. If you use **Mail.app** on '.
'Mac OS X, this may improve mail threading.'.
"\n\n".
"| Setting | Example Mail Subject\n".
"|------------------------|----------------\n".
"| Enable \"Re:\" Prefix | ".
"`Re: [Differential] [Accepted] D123: Example Revision`\n".
"| Disable \"Re:\" Prefix | ".
"`[Differential] [Accepted] D123: Example Revision`"))
->appendChild(
$re_control
->setLabel(pht('Add "Re:" Prefix')))
->appendRemarkupInstructions('')
->appendRemarkupInstructions(
pht(
'With **Vary Subjects** enabled, most mail subject lines will '.
'include a brief description of their content, like **[Closed]** '.
'for a notification about someone closing a task.'.
"\n\n".
"| Setting | Example Mail Subject\n".
"|----------------------|----------------\n".
"| Vary Subjects | ".
"`[Maniphest] [Closed] T123: Example Task`\n".
"| Do Not Vary Subjects | ".
"`[Maniphest] T123: Example Task`\n".
"\n".
'This can make mail more useful, but some clients have difficulty '.
'threading these messages. Disabling this option may improve '.
'threading, at the cost of less useful subject lines.'))
->appendChild(
$vary_control
->setLabel(pht('Vary Subjects')));
$form
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Email Format'))
->setFormSaved($request->getStr('saved'))
->setFormErrors($errors)
->setForm($form);
return id(new AphrontNullView())
->appendChild(
array(
$form_box,
));
}
}

View file

@ -9,9 +9,17 @@ final class PhabricatorAccessibilitySetting
return pht('Accessibility');
}
public function getSettingPanelKey() {
return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 100;
}
protected function getControlInstructions() {
return pht(
'If you have difficulty reading the Phabricator UI, these settings '.
'If you have difficulty reading the Phabricator UI, this setting '.
'may make Phabricator more accessible.');
}

View file

@ -12,6 +12,18 @@ final class PhabricatorDarkConsoleSetting
return pht('DarkConsole');
}
public function getSettingPanelKey() {
return PhabricatorDeveloperPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 100;
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
return PhabricatorEnv::getEnvConfig('darkconsole.enabled');
}
protected function getControlInstructions() {
return pht(
'DarkConsole is a debugging console for developing and troubleshooting '.

View file

@ -12,6 +12,14 @@ final class PhabricatorEditorMultipleSetting
return pht('Edit Mulitple Files');
}
public function getSettingPanelKey() {
return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 400;
}
protected function getControlInstructions() {
return pht(
'Some editors support opening multiple files with a single URI. You '.

View file

@ -9,6 +9,14 @@ final class PhabricatorEditorSetting
return pht('Editor Link');
}
public function getSettingPanelKey() {
return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 300;
}
protected function getControlInstructions() {
return pht(
"Many text editors can be configured as URI handlers for special ".
@ -30,4 +38,27 @@ final class PhabricatorEditorSetting
pht('User Guide: Configuring an External Editor'));
}
public function validateTransactionValue($value) {
$ok = PhabricatorHelpEditorProtocolController::hasAllowedProtocol($value);
if ($ok) {
return;
}
$allowed_key = 'uri.allowed-editor-protocols';
$allowed_protocols = PhabricatorEnv::getEnvConfig($allowed_key);
$proto_names = array();
foreach (array_keys($allowed_protocols) as $protocol) {
$proto_names[] = $protocol.'://';
}
throw new Exception(
pht(
'Editor link has an invalid or missing protocol. You must '.
'use a whitelisted editor protocol from this list: %s. To '.
'add protocols, update "%s" in Config.',
implode(', ', $proto_names),
$allowed_key));
}
}

View file

@ -12,6 +12,18 @@ final class PhabricatorEmailFormatSetting
return pht('HTML Email');
}
public function getSettingPanelKey() {
return PhabricatorEmailFormatSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 100;
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
return PhabricatorMetaMTAMail::shouldMultiplexAllMail();
}
protected function getControlInstructions() {
return pht(
'You can opt to receive plain text email from Phabricator instead '.

View file

@ -12,6 +12,18 @@ final class PhabricatorEmailRePrefixSetting
return pht('Add "Re:" Prefix');
}
public function getSettingPanelKey() {
return PhabricatorEmailFormatSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 200;
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
return PhabricatorMetaMTAMail::shouldMultiplexAllMail();
}
protected function getControlInstructions() {
return pht(
'The **Add "Re:" Prefix** setting adds "Re:" in front of all messages, '.

View file

@ -12,6 +12,18 @@ final class PhabricatorEmailVarySubjectsSetting
return pht('Vary Subjects');
}
public function getSettingPanelKey() {
return PhabricatorEmailFormatSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 300;
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
return PhabricatorMetaMTAMail::shouldMultiplexAllMail();
}
protected function getControlInstructions() {
return pht(
'With **Vary Subjects** enabled, most mail subject lines will include '.

View file

@ -9,6 +9,14 @@ final class PhabricatorMonospacedFontSetting
return pht('Monospaced Font');
}
public function getSettingPanelKey() {
return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 500;
}
protected function getControlInstructions() {
return pht(
'You can customize the font used when showing monospaced text, '.

View file

@ -12,6 +12,14 @@ final class PhabricatorMonospacedTextareasSetting
return pht('Monospaced Textareas');
}
public function getSettingPanelKey() {
return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 600;
}
protected function getControlInstructions() {
return pht(
'You can choose to use either a monospaced or variable-width font '.

View file

@ -12,6 +12,14 @@ final class PhabricatorOlderInlinesSetting
return pht('Show Older Inlines');
}
protected function getSettingOrder() {
return 200;
}
public function getSettingPanelKey() {
return PhabricatorDiffPreferencesSettingsPanel::PANELKEY;
}
protected function getControlInstructions() {
return pht(
'When a revision is updated, Phabricator attempts to bring inline '.

View file

@ -12,6 +12,14 @@ final class PhabricatorShowFiletreeSetting
return pht('Show Filetree');
}
protected function getSettingOrder() {
return 300;
}
public function getSettingPanelKey() {
return PhabricatorDiffPreferencesSettingsPanel::PANELKEY;
}
protected function getControlInstructions() {
return pht(
'When viewing a revision or commit, you can enable a sidebar showing '.

View file

@ -12,6 +12,14 @@ final class PhabricatorTitleGlyphsSetting
return pht('Page Titles');
}
public function getSettingPanelKey() {
return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 200;
}
protected function getControlInstructions() {
return pht(
'Phabricator uses unicode glyphs in page titles to provide a compact '.

View file

@ -12,6 +12,14 @@ final class PhabricatorUnifiedDiffsSetting
return pht('Show Unified Diffs');
}
protected function getSettingOrder() {
return 100;
}
public function getSettingPanelKey() {
return PhabricatorDiffPreferencesSettingsPanel::PANELKEY;
}
protected function getControlInstructions() {
return pht(
'Phabricator normally shows diffs in a side-by-side layout on large '.