@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.

Split up settings into "Date and Time Settings" and everything else.

Summary: Ref T8176, Split up settings into "Date and Time Settings" and everything else.

Test Plan: Open /settings, Account Settings should now have two tabs: "Account" and "Date and Time"

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8176

Differential Revision: https://secure.phabricator.com/D12881

+95 -46
+2
src/__phutil_library_map__.php
··· 1742 1742 'PhabricatorDataCacheSpec' => 'applications/cache/spec/PhabricatorDataCacheSpec.php', 1743 1743 'PhabricatorDataNotAttachedException' => 'infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php', 1744 1744 'PhabricatorDatabaseSetupCheck' => 'applications/config/check/PhabricatorDatabaseSetupCheck.php', 1745 + 'PhabricatorDateTimeSettingsPanel' => 'applications/settings/panel/PhabricatorDateTimeSettingsPanel.php', 1745 1746 'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php', 1746 1747 'PhabricatorDefaultSearchEngineSelector' => 'applications/search/selector/PhabricatorDefaultSearchEngineSelector.php', 1747 1748 'PhabricatorDestructibleInterface' => 'applications/system/interface/PhabricatorDestructibleInterface.php', ··· 5134 5135 'PhabricatorDataCacheSpec' => 'PhabricatorCacheSpec', 5135 5136 'PhabricatorDataNotAttachedException' => 'Exception', 5136 5137 'PhabricatorDatabaseSetupCheck' => 'PhabricatorSetupCheck', 5138 + 'PhabricatorDateTimeSettingsPanel' => 'PhabricatorSettingsPanel', 5137 5139 'PhabricatorDebugController' => 'PhabricatorController', 5138 5140 'PhabricatorDefaultSearchEngineSelector' => 'PhabricatorSearchEngineSelector', 5139 5141 'PhabricatorDestructionEngine' => 'Phobject',
+4 -46
src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
··· 18 18 $user = $request->getUser(); 19 19 $username = $user->getUsername(); 20 20 21 - $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; 22 - $preferences = $user->loadPreferences(); 23 - 24 21 $errors = array(); 25 22 if ($request->isFormPost()) { 26 - $new_timezone = $request->getStr('timezone'); 27 - if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) { 28 - $user->setTimezoneIdentifier($new_timezone); 29 - } else { 30 - $errors[] = pht('The selected timezone is not a valid timezone.'); 31 - } 32 - 33 23 $sex = $request->getStr('sex'); 34 24 $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); 35 25 if (in_array($sex, $sexes)) { ··· 41 31 // Checked in runtime. 42 32 $user->setTranslation($request->getStr('translation')); 43 33 44 - $preferences->setPreference($pref_time, $request->getStr($pref_time)); 45 - 46 34 if (!$errors) { 47 - $preferences->save(); 48 35 $user->save(); 49 36 return id(new AphrontRedirectResponse()) 50 37 ->setURI($this->getPanelURI('?saved=true')); 51 38 } 52 39 } 53 40 54 - $timezone_ids = DateTimeZone::listIdentifiers(); 55 - $timezone_id_map = array_fuse($timezone_ids); 56 - 57 41 $label_unknown = pht('%s updated their profile', $username); 58 42 $label_her = pht('%s updated her profile', $username); 59 43 $label_his = pht('%s updated his profile', $username); ··· 93 77 ->setUser($user) 94 78 ->appendChild( 95 79 id(new AphrontFormSelectControl()) 96 - ->setLabel(pht('Timezone')) 97 - ->setName('timezone') 98 - ->setOptions($timezone_id_map) 99 - ->setValue($user->getTimezoneIdentifier())) 80 + ->setOptions($translations) 81 + ->setLabel(pht('Translation')) 82 + ->setName('translation') 83 + ->setValue($user->getTranslation())) 100 84 ->appendRemarkupInstructions(pht('**Choose the pronoun you prefer:**')) 101 85 ->appendChild( 102 86 id(new AphrontFormSelectControl()) ··· 104 88 ->setLabel(pht('Pronoun')) 105 89 ->setName('sex') 106 90 ->setValue($user->getSex())) 107 - ->appendChild( 108 - id(new AphrontFormSelectControl()) 109 - ->setOptions($translations) 110 - ->setLabel(pht('Translation')) 111 - ->setName('translation') 112 - ->setValue($user->getTranslation())) 113 - ->appendRemarkupInstructions( 114 - pht( 115 - "**Custom Date and Time Formats**\n\n". 116 - "You can specify custom formats which will be used when ". 117 - "rendering dates and times of day. Examples:\n\n". 118 - "| Format | Example | Notes |\n". 119 - "| ------ | -------- | ----- |\n". 120 - "| `g:i A` | 2:34 PM | Default 12-hour time. |\n". 121 - "| `G.i a` | 02.34 pm | Alternate 12-hour time. |\n". 122 - "| `H:i` | 14:34 | 24-hour time. |\n". 123 - "\n\n". 124 - "You can find a [[%s | full reference in the PHP manual]].", 125 - 'http://www.php.net/manual/en/function.date.php')) 126 - ->appendChild( 127 - id(new AphrontFormTextControl()) 128 - ->setLabel(pht('Time-of-Day Format')) 129 - ->setName($pref_time) 130 - ->setCaption( 131 - pht('Format used when rendering a time of day.')) 132 - ->setValue($preferences->getPreference($pref_time))) 133 91 ->appendChild( 134 92 id(new AphrontFormSubmitControl()) 135 93 ->setValue(pht('Save Account Settings')));
+89
src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php
··· 1 + <?php 2 + 3 + final class PhabricatorDateTimeSettingsPanel extends PhabricatorSettingsPanel { 4 + 5 + public function getPanelKey() { 6 + return 'datetime'; 7 + } 8 + 9 + public function getPanelName() { 10 + return pht('Date and Time'); 11 + } 12 + 13 + public function getPanelGroup() { 14 + return pht('Account Information'); 15 + } 16 + 17 + public function processRequest(AphrontRequest $request) { 18 + $user = $request->getUser(); 19 + $username = $user->getUsername(); 20 + 21 + $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; 22 + $preferences = $user->loadPreferences(); 23 + 24 + $errors = array(); 25 + if ($request->isFormPost()) { 26 + $new_timezone = $request->getStr('timezone'); 27 + if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) { 28 + $user->setTimezoneIdentifier($new_timezone); 29 + } else { 30 + $errors[] = pht('The selected timezone is not a valid timezone.'); 31 + } 32 + 33 + $preferences->setPreference($pref_time, $request->getStr($pref_time)); 34 + 35 + if (!$errors) { 36 + $preferences->save(); 37 + $user->save(); 38 + return id(new AphrontRedirectResponse()) 39 + ->setURI($this->getPanelURI('?saved=true')); 40 + } 41 + } 42 + 43 + $timezone_ids = DateTimeZone::listIdentifiers(); 44 + $timezone_id_map = array_fuse($timezone_ids); 45 + 46 + $form = new AphrontFormView(); 47 + $form 48 + ->setUser($user) 49 + ->appendChild( 50 + id(new AphrontFormSelectControl()) 51 + ->setLabel(pht('Timezone')) 52 + ->setName('timezone') 53 + ->setOptions($timezone_id_map) 54 + ->setValue($user->getTimezoneIdentifier())) 55 + ->appendRemarkupInstructions( 56 + pht( 57 + "**Custom Date and Time Formats**\n\n". 58 + "You can specify custom formats which will be used when ". 59 + "rendering dates and times of day. Examples:\n\n". 60 + "| Format | Example | Notes |\n". 61 + "| ------ | -------- | ----- |\n". 62 + "| `g:i A` | 2:34 PM | Default 12-hour time. |\n". 63 + "| `G.i a` | 02.34 pm | Alternate 12-hour time. |\n". 64 + "| `H:i` | 14:34 | 24-hour time. |\n". 65 + "\n\n". 66 + "You can find a [[%s | full reference in the PHP manual]].", 67 + 'http://www.php.net/manual/en/function.date.php')) 68 + ->appendChild( 69 + id(new AphrontFormTextControl()) 70 + ->setLabel(pht('Time-of-Day Format')) 71 + ->setName($pref_time) 72 + ->setCaption( 73 + pht('Format used when rendering a time of day.')) 74 + ->setValue($preferences->getPreference($pref_time))) 75 + ->appendChild( 76 + id(new AphrontFormSubmitControl()) 77 + ->setValue(pht('Save Account Settings'))); 78 + 79 + $form_box = id(new PHUIObjectBoxView()) 80 + ->setHeaderText(pht('Date and Time Settings')) 81 + ->setFormSaved($request->getStr('saved')) 82 + ->setFormErrors($errors) 83 + ->setForm($form); 84 + 85 + return array( 86 + $form_box, 87 + ); 88 + } 89 + }