@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+156 -582
+4 -4
src/__phutil_library_map__.php
··· 6880 6880 'PhabricatorDestructionEngineExtension' => 'Phobject', 6881 6881 'PhabricatorDestructionEngineExtensionModule' => 'PhabricatorConfigModule', 6882 6882 'PhabricatorDeveloperConfigOptions' => 'PhabricatorApplicationConfigOptions', 6883 - 'PhabricatorDeveloperPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 6883 + 'PhabricatorDeveloperPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 6884 6884 'PhabricatorDiffInlineCommentQuery' => 'PhabricatorApplicationTransactionCommentQuery', 6885 - 'PhabricatorDiffPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 6885 + 'PhabricatorDiffPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 6886 6886 'PhabricatorDifferenceEngine' => 'Phobject', 6887 6887 'PhabricatorDifferentialApplication' => 'PhabricatorApplication', 6888 6888 'PhabricatorDifferentialAttachCommitWorkflow' => 'PhabricatorDifferentialManagementWorkflow', ··· 6893 6893 'PhabricatorDiffusionApplication' => 'PhabricatorApplication', 6894 6894 'PhabricatorDiffusionConfigOptions' => 'PhabricatorApplicationConfigOptions', 6895 6895 'PhabricatorDisabledUserController' => 'PhabricatorAuthController', 6896 - 'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 6896 + 'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 6897 6897 'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider', 6898 6898 'PhabricatorDividerProfilePanel' => 'PhabricatorProfilePanel', 6899 6899 'PhabricatorDivinerApplication' => 'PhabricatorApplication', ··· 6963 6963 'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel', 6964 6964 'PhabricatorEmailContentSource' => 'PhabricatorContentSource', 6965 6965 'PhabricatorEmailFormatSetting' => 'PhabricatorSelectSetting', 6966 - 'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel', 6966 + 'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 6967 6967 'PhabricatorEmailLoginController' => 'PhabricatorAuthController', 6968 6968 'PhabricatorEmailNotificationsSetting' => 'PhabricatorSelectSetting', 6969 6969 'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
+2 -85
src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorDeveloperPreferencesSettingsPanel 4 - extends PhabricatorSettingsPanel { 4 + extends PhabricatorEditEngineSettingsPanel { 5 5 6 - public function getPanelKey() { 7 - return 'developer'; 8 - } 6 + const PANELKEY = 'developer'; 9 7 10 8 public function getPanelName() { 11 9 return pht('Developer Settings'); ··· 15 13 return PhabricatorSettingsDeveloperPanelGroup::PANELGROUPKEY; 16 14 } 17 15 18 - public function processRequest(AphrontRequest $request) { 19 - $user = $request->getUser(); 20 - $preferences = $user->loadPreferences(); 21 - 22 - $pref_dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE; 23 - 24 - $dark_console_value = $preferences->getPreference($pref_dark_console); 25 - 26 - if ($request->isFormPost()) { 27 - $new_dark_console = $request->getBool($pref_dark_console); 28 - $preferences->setPreference($pref_dark_console, $new_dark_console); 29 - 30 - // If the user turned Dark Console on, enable it (as though they had hit 31 - // "`"). 32 - if ($new_dark_console && !$dark_console_value) { 33 - $user->setConsoleVisible(true); 34 - $user->save(); 35 - } 36 - 37 - $preferences->save(); 38 - 39 - return id(new AphrontRedirectResponse()) 40 - ->setURI($this->getPanelURI('?saved=true')); 41 - } 42 - 43 - $is_console_enabled = PhabricatorEnv::getEnvConfig('darkconsole.enabled'); 44 - 45 - $preamble = pht( 46 - "**DarkConsole** is a developer console which can help build and ". 47 - "debug Phabricator applications. It includes tools for understanding ". 48 - "errors, performance, service calls, and other low-level aspects of ". 49 - "Phabricator's inner workings."); 50 - 51 - if ($is_console_enabled) { 52 - $instructions = pht( 53 - "%s\n\n". 54 - 'You can enable it for your account below. Enabling DarkConsole will '. 55 - 'slightly decrease performance, but give you access to debugging '. 56 - 'tools. You may want to disable it again later if you only need it '. 57 - 'temporarily.'. 58 - "\n\n". 59 - 'NOTE: After enabling DarkConsole, **press the ##%s## key on your '. 60 - 'keyboard** to show or hide it.', 61 - $preamble, 62 - '`'); 63 - } else { 64 - $instructions = pht( 65 - "%s\n\n". 66 - 'Before you can turn on DarkConsole, it needs to be enabled in '. 67 - 'the configuration for this install (`%s`).', 68 - $preamble, 69 - 'darkconsole.enabled'); 70 - } 71 - 72 - $form = id(new AphrontFormView()) 73 - ->setUser($user) 74 - ->appendRemarkupInstructions($instructions) 75 - ->appendChild( 76 - id(new AphrontFormSelectControl()) 77 - ->setLabel(pht('Dark Console')) 78 - ->setName($pref_dark_console) 79 - ->setValue($dark_console_value) 80 - ->setOptions( 81 - array( 82 - 0 => pht('Disable DarkConsole'), 83 - 1 => pht('Enable DarkConsole'), 84 - )) 85 - ->setDisabled(!$is_console_enabled)) 86 - ->appendChild( 87 - id(new AphrontFormSubmitControl()) 88 - ->setValue(pht('Save Preferences'))); 89 - 90 - $form_box = id(new PHUIObjectBoxView()) 91 - ->setHeaderText(pht('Developer Settings')) 92 - ->setFormSaved($request->getBool('saved')) 93 - ->setForm($form); 94 - 95 - return array( 96 - $form_box, 97 - ); 98 - } 99 16 }
+2 -92
src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorDiffPreferencesSettingsPanel 4 - extends PhabricatorSettingsPanel { 4 + extends PhabricatorEditEngineSettingsPanel { 5 5 6 - public function getPanelKey() { 7 - return 'diff'; 8 - } 6 + const PANELKEY = 'diff'; 9 7 10 8 public function getPanelName() { 11 9 return pht('Diff Preferences'); ··· 15 13 return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY; 16 14 } 17 15 18 - public function processRequest(AphrontRequest $request) { 19 - $user = $request->getUser(); 20 - $preferences = $user->loadPreferences(); 21 - 22 - $pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED; 23 - $pref_ghosts = PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS; 24 - $pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE; 25 - 26 - if ($request->isFormPost()) { 27 - $filetree = $request->getInt($pref_filetree); 28 - 29 - if ($filetree && !$preferences->getPreference($pref_filetree)) { 30 - $preferences->setPreference( 31 - PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED, 32 - false); 33 - } 34 - 35 - $preferences->setPreference($pref_filetree, $filetree); 36 - 37 - $unified = $request->getStr($pref_unified); 38 - $preferences->setPreference($pref_unified, $unified); 39 - 40 - $ghosts = $request->getStr($pref_ghosts); 41 - $preferences->setPreference($pref_ghosts, $ghosts); 42 - 43 - $preferences->save(); 44 - return id(new AphrontRedirectResponse()) 45 - ->setURI($this->getPanelURI('?saved=true')); 46 - } 47 - 48 - $form = id(new AphrontFormView()) 49 - ->setUser($user) 50 - ->appendRemarkupInstructions( 51 - pht( 52 - 'Phabricator normally shows diffs in a side-by-side layout on '. 53 - 'large screens, and automatically switches to a unified '. 54 - 'view on small screens (like mobile phones). If you prefer '. 55 - 'unified diffs even on large screens, you can select them as '. 56 - 'the default layout.')) 57 - ->appendChild( 58 - id(new AphrontFormSelectControl()) 59 - ->setLabel(pht('Show Unified Diffs')) 60 - ->setName($pref_unified) 61 - ->setValue($preferences->getPreference($pref_unified)) 62 - ->setOptions( 63 - array( 64 - 'default' => pht('On Small Screens'), 65 - 'unified' => pht('Always'), 66 - ))) 67 - ->appendChild( 68 - id(new AphrontFormSelectControl()) 69 - ->setLabel(pht('Show Older Inlines')) 70 - ->setName($pref_ghosts) 71 - ->setValue($preferences->getPreference($pref_ghosts)) 72 - ->setOptions( 73 - array( 74 - 'default' => pht('Enabled'), 75 - 'disabled' => pht('Disabled'), 76 - ))) 77 - ->appendChild( 78 - id(new AphrontFormSelectControl()) 79 - ->setLabel(pht('Show Filetree')) 80 - ->setName($pref_filetree) 81 - ->setValue($preferences->getPreference($pref_filetree)) 82 - ->setOptions( 83 - array( 84 - 0 => pht('Disable Filetree'), 85 - 1 => pht('Enable Filetree'), 86 - )) 87 - ->setCaption( 88 - pht( 89 - 'When looking at a revision or commit, enable a sidebar '. 90 - 'showing affected files. You can press %s to show or hide '. 91 - 'the sidebar.', 92 - phutil_tag('tt', array(), 'f')))) 93 - ->appendChild( 94 - id(new AphrontFormSubmitControl()) 95 - ->setValue(pht('Save Preferences'))); 96 - 97 - $form_box = id(new PHUIObjectBoxView()) 98 - ->setHeaderText(pht('Diff Preferences')) 99 - ->setFormSaved($request->getBool('saved')) 100 - ->setForm($form); 101 - 102 - return array( 103 - $form_box, 104 - ); 105 - } 106 16 }
+2 -186
src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorDisplayPreferencesSettingsPanel 4 - extends PhabricatorSettingsPanel { 4 + extends PhabricatorEditEngineSettingsPanel { 5 5 6 - public function getPanelKey() { 7 - return 'display'; 8 - } 6 + const PANELKEY = 'display'; 9 7 10 8 public function getPanelName() { 11 9 return pht('Display Preferences'); ··· 15 13 return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY; 16 14 } 17 15 18 - public function processRequest(AphrontRequest $request) { 19 - $user = $request->getUser(); 20 - $preferences = $user->loadPreferences(); 21 - 22 - $pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED; 23 - $pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR; 24 - $pref_multiedit = PhabricatorUserPreferences::PREFERENCE_MULTIEDIT; 25 - $pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES; 26 - $pref_monospaced_textareas = 27 - PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS; 28 - $pref_postprocessor = 29 - PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR; 30 - 31 - $errors = array(); 32 - $e_editor = null; 33 - if ($request->isFormPost()) { 34 - $monospaced = $request->getStr($pref_monospaced); 35 - $monospaced = PhabricatorUserPreferences::filterMonospacedCSSRule( 36 - $monospaced); 37 - 38 - $preferences->setPreference($pref_titles, $request->getStr($pref_titles)); 39 - $preferences->setPreference($pref_editor, $request->getStr($pref_editor)); 40 - $preferences->setPreference( 41 - $pref_multiedit, 42 - $request->getStr($pref_multiedit)); 43 - $preferences->setPreference($pref_monospaced, $monospaced); 44 - $preferences->setPreference( 45 - $pref_monospaced_textareas, 46 - $request->getStr($pref_monospaced_textareas)); 47 - $preferences->setPreference( 48 - $pref_postprocessor, 49 - $request->getStr($pref_postprocessor)); 50 - 51 - $editor_pattern = $preferences->getPreference($pref_editor); 52 - if (strlen($editor_pattern)) { 53 - $ok = PhabricatorHelpEditorProtocolController::hasAllowedProtocol( 54 - $editor_pattern); 55 - if (!$ok) { 56 - $allowed_key = 'uri.allowed-editor-protocols'; 57 - $allowed_protocols = PhabricatorEnv::getEnvConfig($allowed_key); 58 - 59 - $proto_names = array(); 60 - foreach (array_keys($allowed_protocols) as $protocol) { 61 - $proto_names[] = $protocol.'://'; 62 - } 63 - 64 - $errors[] = pht( 65 - 'Editor link has an invalid or missing protocol. You must '. 66 - 'use a whitelisted editor protocol from this list: %s. To '. 67 - 'add protocols, update %s.', 68 - implode(', ', $proto_names), 69 - phutil_tag('tt', array(), $allowed_key)); 70 - 71 - $e_editor = pht('Invalid'); 72 - } 73 - } 74 - 75 - if (!$errors) { 76 - $preferences->save(); 77 - return id(new AphrontRedirectResponse()) 78 - ->setURI($this->getPanelURI('?saved=true')); 79 - } 80 - } 81 - 82 - $example_string = <<<EXAMPLE 83 - // This is what your monospaced font currently looks like. 84 - function helloWorld() { 85 - alert("Hello world!"); 86 - } 87 - EXAMPLE; 88 - 89 - $editor_doc_link = phutil_tag( 90 - 'a', 91 - array( 92 - 'href' => PhabricatorEnv::getDoclink( 93 - 'User Guide: Configuring an External Editor'), 94 - ), 95 - pht('User Guide: Configuring an External Editor')); 96 - 97 - $pref_monospaced_textareas_value = $preferences 98 - ->getPreference($pref_monospaced_textareas); 99 - if (!$pref_monospaced_textareas_value) { 100 - $pref_monospaced_textareas_value = 'disabled'; 101 - } 102 - 103 - $editor_instructions = pht( 104 - 'Link to edit files in external editor. '. 105 - '%%f is replaced by filename, %%l by line number, %%r by repository '. 106 - 'callsign, %%%% by literal %%. For documentation, see: %s', 107 - $editor_doc_link); 108 - 109 - $font_instructions = pht( 110 - 'Overrides default fonts in tools like Differential. '. 111 - 'Input should be valid CSS "font" declaration, such as '. 112 - '"13px Consolas"'); 113 - 114 - $postprocessor_map = CelerityPostprocessor::getAllPostprocessors(); 115 - $postprocessor_map = mpull($postprocessor_map, 'getPostprocessorName'); 116 - asort($postprocessor_map); 117 - $postprocessor_order = array( 118 - CelerityDefaultPostprocessor::POSTPROCESSOR_KEY, 119 - ); 120 - 121 - $postprocessor_map = array_select_keys( 122 - $postprocessor_map, 123 - $postprocessor_order) + $postprocessor_map; 124 - 125 - $form = id(new AphrontFormView()) 126 - ->setUser($user) 127 - ->appendControl( 128 - id(new AphrontFormSelectControl()) 129 - ->setLabel(pht('Accessibility')) 130 - ->setName($pref_postprocessor) 131 - ->setValue($preferences->getPreference($pref_postprocessor)) 132 - ->setOptions($postprocessor_map)) 133 - ->appendChild( 134 - id(new AphrontFormSelectControl()) 135 - ->setLabel(pht('Page Titles')) 136 - ->setName($pref_titles) 137 - ->setValue($preferences->getPreference($pref_titles)) 138 - ->setOptions( 139 - array( 140 - 'glyph' => 141 - pht( 142 - 'In page titles, show Tool names as unicode glyphs: %s', 143 - "\xE2\x9A\x99"), 144 - 'text' => 145 - pht( 146 - 'In page titles, show Tool names as plain text: '. 147 - '[Differential]'), 148 - ))) 149 - ->appendChild( 150 - id(new AphrontFormTextControl()) 151 - ->setLabel(pht('Editor Link')) 152 - ->setName($pref_editor) 153 - ->setCaption($editor_instructions) 154 - ->setError($e_editor) 155 - ->setValue($preferences->getPreference($pref_editor))) 156 - ->appendChild( 157 - id(new AphrontFormSelectControl()) 158 - ->setLabel(pht('Edit Multiple Files')) 159 - ->setName($pref_multiedit) 160 - ->setOptions(array( 161 - '' => pht('Supported (paths separated by spaces)'), 162 - 'disable' => pht('Not Supported'), 163 - )) 164 - ->setValue($preferences->getPreference($pref_multiedit))) 165 - ->appendChild( 166 - id(new AphrontFormTextControl()) 167 - ->setLabel(pht('Monospaced Font')) 168 - ->setName($pref_monospaced) 169 - ->setCaption($font_instructions) 170 - ->setValue($preferences->getPreference($pref_monospaced))) 171 - ->appendChild( 172 - id(new AphrontFormMarkupControl()) 173 - ->setValue(phutil_tag( 174 - 'pre', 175 - array('class' => 'PhabricatorMonospaced'), 176 - $example_string))) 177 - ->appendChild( 178 - id(new AphrontFormRadioButtonControl()) 179 - ->setLabel(pht('Monospaced Textareas')) 180 - ->setName($pref_monospaced_textareas) 181 - ->setValue($pref_monospaced_textareas_value) 182 - ->addButton('enabled', pht('Enabled'), 183 - pht('Show all textareas using the monospaced font defined above.')) 184 - ->addButton('disabled', pht('Disabled'), null)); 185 - 186 - $form->appendChild( 187 - id(new AphrontFormSubmitControl()) 188 - ->setValue(pht('Save Preferences'))); 189 - 190 - $form_box = id(new PHUIObjectBoxView()) 191 - ->setHeaderText(pht('Display Preferences')) 192 - ->setFormErrors($errors) 193 - ->setFormSaved($request->getStr('saved') === 'true') 194 - ->setForm($form); 195 - 196 - return array( 197 - $form_box, 198 - ); 199 - } 200 16 }
+2 -214
src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorEmailFormatSettingsPanel 4 - extends PhabricatorSettingsPanel { 4 + extends PhabricatorEditEngineSettingsPanel { 5 5 6 - public function getPanelKey() { 7 - return 'emailformat'; 8 - } 6 + const PANELKEY = 'emailformat'; 9 7 10 8 public function getPanelName() { 11 9 return pht('Email Format'); ··· 21 19 } 22 20 23 21 return false; 24 - } 25 - 26 - public function processRequest(AphrontRequest $request) { 27 - $viewer = $this->getViewer(); 28 - $user = $this->getUser(); 29 - 30 - $preferences = $user->loadPreferences(); 31 - 32 - $pref_re_prefix = PhabricatorUserPreferences::PREFERENCE_RE_PREFIX; 33 - $pref_vary = PhabricatorUserPreferences::PREFERENCE_VARY_SUBJECT; 34 - $prefs_html_email = PhabricatorUserPreferences::PREFERENCE_HTML_EMAILS; 35 - 36 - $errors = array(); 37 - if ($request->isFormPost()) { 38 - 39 - if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) { 40 - if ($request->getStr($pref_re_prefix) == 'default') { 41 - $preferences->unsetPreference($pref_re_prefix); 42 - } else { 43 - $preferences->setPreference( 44 - $pref_re_prefix, 45 - $request->getBool($pref_re_prefix)); 46 - } 47 - 48 - if ($request->getStr($pref_vary) == 'default') { 49 - $preferences->unsetPreference($pref_vary); 50 - } else { 51 - $preferences->setPreference( 52 - $pref_vary, 53 - $request->getBool($pref_vary)); 54 - } 55 - 56 - if ($request->getStr($prefs_html_email) == 'default') { 57 - $preferences->unsetPreference($prefs_html_email); 58 - } else { 59 - $preferences->setPreference( 60 - $prefs_html_email, 61 - $request->getBool($prefs_html_email)); 62 - } 63 - } 64 - 65 - $preferences->save(); 66 - 67 - return id(new AphrontRedirectResponse()) 68 - ->setURI($this->getPanelURI('?saved=true')); 69 - } 70 - 71 - $re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix') 72 - ? pht('Enabled') 73 - : pht('Disabled'); 74 - 75 - $vary_default = PhabricatorEnv::getEnvConfig('metamta.vary-subjects') 76 - ? pht('Vary') 77 - : pht('Do Not Vary'); 78 - 79 - $html_emails_default = pht('HTML'); 80 - 81 - $re_prefix_value = $preferences->getPreference($pref_re_prefix); 82 - if ($re_prefix_value === null) { 83 - $re_prefix_value = 'default'; 84 - } else { 85 - $re_prefix_value = $re_prefix_value 86 - ? 'true' 87 - : 'false'; 88 - } 89 - 90 - $vary_value = $preferences->getPreference($pref_vary); 91 - if ($vary_value === null) { 92 - $vary_value = 'default'; 93 - } else { 94 - $vary_value = $vary_value 95 - ? 'true' 96 - : 'false'; 97 - } 98 - 99 - $html_emails_value = $preferences->getPreference($prefs_html_email); 100 - if ($html_emails_value === null) { 101 - $html_emails_value = 'default'; 102 - } else { 103 - $html_emails_value = $html_emails_value 104 - ? 'true' 105 - : 'false'; 106 - } 107 - 108 - $form = new AphrontFormView(); 109 - $form 110 - ->setUser($viewer); 111 - 112 - if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) { 113 - $html_email_control = id(new AphrontFormSelectControl()) 114 - ->setName($prefs_html_email) 115 - ->setOptions( 116 - array( 117 - 'default' => pht('Default (%s)', $html_emails_default), 118 - 'true' => pht('Send HTML Email'), 119 - 'false' => pht('Send Plain Text Email'), 120 - )) 121 - ->setValue($html_emails_value); 122 - 123 - $re_control = id(new AphrontFormSelectControl()) 124 - ->setName($pref_re_prefix) 125 - ->setOptions( 126 - array( 127 - 'default' => pht('Use Server Default (%s)', $re_prefix_default), 128 - 'true' => pht('Enable "Re:" prefix'), 129 - 'false' => pht('Disable "Re:" prefix'), 130 - )) 131 - ->setValue($re_prefix_value); 132 - 133 - $vary_control = id(new AphrontFormSelectControl()) 134 - ->setName($pref_vary) 135 - ->setOptions( 136 - array( 137 - 'default' => pht('Use Server Default (%s)', $vary_default), 138 - 'true' => pht('Vary Subjects'), 139 - 'false' => pht('Do Not Vary Subjects'), 140 - )) 141 - ->setValue($vary_value); 142 - } else { 143 - $html_email_control = id(new AphrontFormStaticControl()) 144 - ->setValue(pht('Server Default (%s)', $html_emails_default)); 145 - 146 - $re_control = id(new AphrontFormStaticControl()) 147 - ->setValue(pht('Server Default (%s)', $re_prefix_default)); 148 - 149 - $vary_control = id(new AphrontFormStaticControl()) 150 - ->setValue(pht('Server Default (%s)', $vary_default)); 151 - } 152 - 153 - $form 154 - ->appendRemarkupInstructions( 155 - pht( 156 - 'These settings fine-tune some technical aspects of how email is '. 157 - 'formatted. You may be able to adjust them to make mail more '. 158 - 'useful or improve threading.')); 159 - 160 - if (!PhabricatorMetaMTAMail::shouldMultiplexAllMail()) { 161 - $form->appendRemarkupInstructions( 162 - pht( 163 - 'NOTE: This install of Phabricator is configured to send a '. 164 - 'single mail message to all recipients, so all settings are '. 165 - 'locked at the server default value.')); 166 - } 167 - 168 - $form 169 - ->appendRemarkupInstructions( 170 - pht( 171 - "You can use the **HTML Email** setting to control whether ". 172 - "Phabricator send you HTML email (which has more color and ". 173 - "formatting) or plain text email (which is more compatible).\n". 174 - "\n". 175 - "WARNING: This feature is new and experimental! If you enable ". 176 - "it, mail may not render properly and replying to mail may not ". 177 - "work as well.")) 178 - ->appendChild( 179 - $html_email_control 180 - ->setLabel(pht('HTML Email'))) 181 - ->appendRemarkupInstructions('') 182 - ->appendRemarkupInstructions( 183 - pht( 184 - 'The **Add "Re:" Prefix** setting adds "Re:" in front of all '. 185 - 'messages, even if they are not replies. If you use **Mail.app** on '. 186 - 'Mac OS X, this may improve mail threading.'. 187 - "\n\n". 188 - "| Setting | Example Mail Subject\n". 189 - "|------------------------|----------------\n". 190 - "| Enable \"Re:\" Prefix | ". 191 - "`Re: [Differential] [Accepted] D123: Example Revision`\n". 192 - "| Disable \"Re:\" Prefix | ". 193 - "`[Differential] [Accepted] D123: Example Revision`")) 194 - ->appendChild( 195 - $re_control 196 - ->setLabel(pht('Add "Re:" Prefix'))) 197 - ->appendRemarkupInstructions('') 198 - ->appendRemarkupInstructions( 199 - pht( 200 - 'With **Vary Subjects** enabled, most mail subject lines will '. 201 - 'include a brief description of their content, like **[Closed]** '. 202 - 'for a notification about someone closing a task.'. 203 - "\n\n". 204 - "| Setting | Example Mail Subject\n". 205 - "|----------------------|----------------\n". 206 - "| Vary Subjects | ". 207 - "`[Maniphest] [Closed] T123: Example Task`\n". 208 - "| Do Not Vary Subjects | ". 209 - "`[Maniphest] T123: Example Task`\n". 210 - "\n". 211 - 'This can make mail more useful, but some clients have difficulty '. 212 - 'threading these messages. Disabling this option may improve '. 213 - 'threading, at the cost of less useful subject lines.')) 214 - ->appendChild( 215 - $vary_control 216 - ->setLabel(pht('Vary Subjects'))); 217 - 218 - $form 219 - ->appendChild( 220 - id(new AphrontFormSubmitControl()) 221 - ->setValue(pht('Save Preferences'))); 222 - 223 - $form_box = id(new PHUIObjectBoxView()) 224 - ->setHeaderText(pht('Email Format')) 225 - ->setFormSaved($request->getStr('saved')) 226 - ->setFormErrors($errors) 227 - ->setForm($form); 228 - 229 - return id(new AphrontNullView()) 230 - ->appendChild( 231 - array( 232 - $form_box, 233 - )); 234 22 } 235 23 236 24 }
+9 -1
src/applications/settings/setting/PhabricatorAccessibilitySetting.php
··· 9 9 return pht('Accessibility'); 10 10 } 11 11 12 + public function getSettingPanelKey() { 13 + return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY; 14 + } 15 + 16 + protected function getSettingOrder() { 17 + return 100; 18 + } 19 + 12 20 protected function getControlInstructions() { 13 21 return pht( 14 - 'If you have difficulty reading the Phabricator UI, these settings '. 22 + 'If you have difficulty reading the Phabricator UI, this setting '. 15 23 'may make Phabricator more accessible.'); 16 24 } 17 25
+12
src/applications/settings/setting/PhabricatorDarkConsoleSetting.php
··· 12 12 return pht('DarkConsole'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorDeveloperPreferencesSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 100; 21 + } 22 + 23 + protected function isEnabledForViewer(PhabricatorUser $viewer) { 24 + return PhabricatorEnv::getEnvConfig('darkconsole.enabled'); 25 + } 26 + 15 27 protected function getControlInstructions() { 16 28 return pht( 17 29 'DarkConsole is a debugging console for developing and troubleshooting '.
+8
src/applications/settings/setting/PhabricatorEditorMultipleSetting.php
··· 12 12 return pht('Edit Mulitple Files'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 400; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'Some editors support opening multiple files with a single URI. You '.
+31
src/applications/settings/setting/PhabricatorEditorSetting.php
··· 9 9 return pht('Editor Link'); 10 10 } 11 11 12 + public function getSettingPanelKey() { 13 + return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY; 14 + } 15 + 16 + protected function getSettingOrder() { 17 + return 300; 18 + } 19 + 12 20 protected function getControlInstructions() { 13 21 return pht( 14 22 "Many text editors can be configured as URI handlers for special ". ··· 28 36 "see **[[ %s | %s ]]**.", 29 37 PhabricatorEnv::getDoclink('User Guide: Configuring an External Editor'), 30 38 pht('User Guide: Configuring an External Editor')); 39 + } 40 + 41 + public function validateTransactionValue($value) { 42 + $ok = PhabricatorHelpEditorProtocolController::hasAllowedProtocol($value); 43 + if ($ok) { 44 + return; 45 + } 46 + 47 + $allowed_key = 'uri.allowed-editor-protocols'; 48 + $allowed_protocols = PhabricatorEnv::getEnvConfig($allowed_key); 49 + 50 + $proto_names = array(); 51 + foreach (array_keys($allowed_protocols) as $protocol) { 52 + $proto_names[] = $protocol.'://'; 53 + } 54 + 55 + throw new Exception( 56 + pht( 57 + 'Editor link has an invalid or missing protocol. You must '. 58 + 'use a whitelisted editor protocol from this list: %s. To '. 59 + 'add protocols, update "%s" in Config.', 60 + implode(', ', $proto_names), 61 + $allowed_key)); 31 62 } 32 63 33 64 }
+12
src/applications/settings/setting/PhabricatorEmailFormatSetting.php
··· 12 12 return pht('HTML Email'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorEmailFormatSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 100; 21 + } 22 + 23 + protected function isEnabledForViewer(PhabricatorUser $viewer) { 24 + return PhabricatorMetaMTAMail::shouldMultiplexAllMail(); 25 + } 26 + 15 27 protected function getControlInstructions() { 16 28 return pht( 17 29 'You can opt to receive plain text email from Phabricator instead '.
+12
src/applications/settings/setting/PhabricatorEmailRePrefixSetting.php
··· 12 12 return pht('Add "Re:" Prefix'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorEmailFormatSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 200; 21 + } 22 + 23 + protected function isEnabledForViewer(PhabricatorUser $viewer) { 24 + return PhabricatorMetaMTAMail::shouldMultiplexAllMail(); 25 + } 26 + 15 27 protected function getControlInstructions() { 16 28 return pht( 17 29 'The **Add "Re:" Prefix** setting adds "Re:" in front of all messages, '.
+12
src/applications/settings/setting/PhabricatorEmailVarySubjectsSetting.php
··· 12 12 return pht('Vary Subjects'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorEmailFormatSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 300; 21 + } 22 + 23 + protected function isEnabledForViewer(PhabricatorUser $viewer) { 24 + return PhabricatorMetaMTAMail::shouldMultiplexAllMail(); 25 + } 26 + 15 27 protected function getControlInstructions() { 16 28 return pht( 17 29 'With **Vary Subjects** enabled, most mail subject lines will include '.
+8
src/applications/settings/setting/PhabricatorMonospacedFontSetting.php
··· 9 9 return pht('Monospaced Font'); 10 10 } 11 11 12 + public function getSettingPanelKey() { 13 + return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY; 14 + } 15 + 16 + protected function getSettingOrder() { 17 + return 500; 18 + } 19 + 12 20 protected function getControlInstructions() { 13 21 return pht( 14 22 'You can customize the font used when showing monospaced text, '.
+8
src/applications/settings/setting/PhabricatorMonospacedTextareasSetting.php
··· 12 12 return pht('Monospaced Textareas'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 600; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'You can choose to use either a monospaced or variable-width font '.
+8
src/applications/settings/setting/PhabricatorOlderInlinesSetting.php
··· 12 12 return pht('Show Older Inlines'); 13 13 } 14 14 15 + protected function getSettingOrder() { 16 + return 200; 17 + } 18 + 19 + public function getSettingPanelKey() { 20 + return PhabricatorDiffPreferencesSettingsPanel::PANELKEY; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'When a revision is updated, Phabricator attempts to bring inline '.
+8
src/applications/settings/setting/PhabricatorShowFiletreeSetting.php
··· 12 12 return pht('Show Filetree'); 13 13 } 14 14 15 + protected function getSettingOrder() { 16 + return 300; 17 + } 18 + 19 + public function getSettingPanelKey() { 20 + return PhabricatorDiffPreferencesSettingsPanel::PANELKEY; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'When viewing a revision or commit, you can enable a sidebar showing '.
+8
src/applications/settings/setting/PhabricatorTitleGlyphsSetting.php
··· 12 12 return pht('Page Titles'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorDisplayPreferencesSettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 200; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'Phabricator uses unicode glyphs in page titles to provide a compact '.
+8
src/applications/settings/setting/PhabricatorUnifiedDiffsSetting.php
··· 12 12 return pht('Show Unified Diffs'); 13 13 } 14 14 15 + protected function getSettingOrder() { 16 + return 100; 17 + } 18 + 19 + public function getSettingPanelKey() { 20 + return PhabricatorDiffPreferencesSettingsPanel::PANELKEY; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'Phabricator normally shows diffs in a side-by-side layout on large '.