Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14025262
D16020.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
25 KB
Referenced Files
None
Subscribers
None
D16020.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3371,14 +3371,21 @@
'PhabricatorSendGridConfigOptions' => 'applications/config/option/PhabricatorSendGridConfigOptions.php',
'PhabricatorSessionsSettingsPanel' => 'applications/settings/panel/PhabricatorSessionsSettingsPanel.php',
'PhabricatorSetting' => 'applications/settings/setting/PhabricatorSetting.php',
+ 'PhabricatorSettingsAccountPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsAccountPanelGroup.php',
'PhabricatorSettingsAddEmailAction' => 'applications/settings/action/PhabricatorSettingsAddEmailAction.php',
'PhabricatorSettingsAdjustController' => 'applications/settings/controller/PhabricatorSettingsAdjustController.php',
'PhabricatorSettingsApplication' => 'applications/settings/application/PhabricatorSettingsApplication.php',
+ 'PhabricatorSettingsApplicationsPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsApplicationsPanelGroup.php',
+ 'PhabricatorSettingsAuthenticationPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsAuthenticationPanelGroup.php',
+ 'PhabricatorSettingsDeveloperPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsDeveloperPanelGroup.php',
'PhabricatorSettingsEditController' => 'applications/settings/controller/PhabricatorSettingsEditController.php',
'PhabricatorSettingsEditEngine' => 'applications/settings/editor/PhabricatorSettingsEditEngine.php',
+ 'PhabricatorSettingsEmailPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsEmailPanelGroup.php',
+ 'PhabricatorSettingsLogsPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsLogsPanelGroup.php',
'PhabricatorSettingsMainController' => 'applications/settings/controller/PhabricatorSettingsMainController.php',
'PhabricatorSettingsMainMenuBarExtension' => 'applications/settings/extension/PhabricatorSettingsMainMenuBarExtension.php',
'PhabricatorSettingsPanel' => 'applications/settings/panel/PhabricatorSettingsPanel.php',
+ 'PhabricatorSettingsPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsPanelGroup.php',
'PhabricatorSettingsTimezoneController' => 'applications/settings/controller/PhabricatorSettingsTimezoneController.php',
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
'PhabricatorSetupCheckTestCase' => 'applications/config/check/__tests__/PhabricatorSetupCheckTestCase.php',
@@ -8125,14 +8132,21 @@
'PhabricatorSendGridConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorSessionsSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorSetting' => 'Phobject',
+ 'PhabricatorSettingsAccountPanelGroup' => 'PhabricatorSettingsPanelGroup',
'PhabricatorSettingsAddEmailAction' => 'PhabricatorSystemAction',
'PhabricatorSettingsAdjustController' => 'PhabricatorController',
'PhabricatorSettingsApplication' => 'PhabricatorApplication',
+ 'PhabricatorSettingsApplicationsPanelGroup' => 'PhabricatorSettingsPanelGroup',
+ 'PhabricatorSettingsAuthenticationPanelGroup' => 'PhabricatorSettingsPanelGroup',
+ 'PhabricatorSettingsDeveloperPanelGroup' => 'PhabricatorSettingsPanelGroup',
'PhabricatorSettingsEditController' => 'PhabricatorController',
'PhabricatorSettingsEditEngine' => 'PhabricatorEditEngine',
+ 'PhabricatorSettingsEmailPanelGroup' => 'PhabricatorSettingsPanelGroup',
+ 'PhabricatorSettingsLogsPanelGroup' => 'PhabricatorSettingsPanelGroup',
'PhabricatorSettingsMainController' => 'PhabricatorController',
'PhabricatorSettingsMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorSettingsPanel' => 'Phobject',
+ 'PhabricatorSettingsPanelGroup' => 'Phobject',
'PhabricatorSettingsTimezoneController' => 'PhabricatorController',
'PhabricatorSetupCheck' => 'Phobject',
'PhabricatorSetupCheckTestCase' => 'PhabricatorTestCase',
diff --git a/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php b/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php
--- a/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php
+++ b/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php
@@ -15,8 +15,8 @@
return pht('Conduit API Tokens');
}
- public function getPanelGroup() {
- return pht('Sessions and Logs');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
}
public function isEnabled() {
diff --git a/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php b/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php
--- a/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php
+++ b/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php
@@ -14,8 +14,8 @@
return pht('VCS Password');
}
- public function getPanelGroup() {
- return pht('Authentication');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
public function isEnabled() {
diff --git a/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php b/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php
--- a/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php
+++ b/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('OAuth Authorizations');
}
- public function getPanelGroup() {
- return pht('Sessions and Logs');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
}
public function isEnabled() {
diff --git a/src/applications/settings/controller/PhabricatorSettingsMainController.php b/src/applications/settings/controller/PhabricatorSettingsMainController.php
--- a/src/applications/settings/controller/PhabricatorSettingsMainController.php
+++ b/src/applications/settings/controller/PhabricatorSettingsMainController.php
@@ -80,7 +80,7 @@
}
private function buildPanels() {
- $panels = PhabricatorSettingsPanel::getAllPanels();
+ $panels = PhabricatorSettingsPanel::getAllDisplayPanels();
$result = array();
foreach ($panels as $key => $panel) {
@@ -125,11 +125,12 @@
$nav->setBaseURI(new PhutilURI($this->getApplicationURI($base_uri)));
- $group = null;
+ $group_key = null;
foreach ($panels as $panel) {
- if ($panel->getPanelGroup() != $group) {
+ if ($panel->getPanelGroupKey() != $group_key) {
+ $group_key = $panel->getPanelGroupKey();
$group = $panel->getPanelGroup();
- $nav->addLabel($group);
+ $nav->addLabel($group->getPanelGroupName());
}
$nav->addFilter($panel->getPanelKey(), $panel->getPanelName());
diff --git a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
@@ -9,8 +9,8 @@
return pht('Account');
}
- public function getPanelGroup() {
- return pht('Account Information');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAccountPanelGroup::PANELGROUPKEY;
}
public function isEditableByAdministrators() {
diff --git a/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php b/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php
@@ -14,12 +14,8 @@
return pht('Activity Logs');
}
- public function getPanelGroup() {
- return pht('Sessions and Logs');
- }
-
- public function isEnabled() {
- return true;
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php
@@ -16,8 +16,8 @@
return pht('Conpherence Preferences');
}
- public function getPanelGroup() {
- return pht('Application Settings');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php b/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php
@@ -9,8 +9,8 @@
return pht('Date and Time');
}
- public function getPanelGroup() {
- return pht('Account Information');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAccountPanelGroup::PANELGROUPKEY;
}
public function isEditableByAdministrators() {
diff --git a/src/applications/settings/panel/PhabricatorDesktopNotificationsSettingsPanel.php b/src/applications/settings/panel/PhabricatorDesktopNotificationsSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorDesktopNotificationsSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDesktopNotificationsSettingsPanel.php
@@ -21,8 +21,8 @@
return pht('Desktop Notifications');
}
- public function getPanelGroup() {
- return pht('Application Settings');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Developer Settings');
}
- public function getPanelGroup() {
- return pht('Developer');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsDeveloperPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Diff Preferences');
}
- public function getPanelGroup() {
- return pht('Application Settings');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Display Preferences');
}
- public function getPanelGroup() {
- return pht('Application Settings');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Email Addresses');
}
- public function getPanelGroup() {
- return pht('Email');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY;
}
public function isEditableByAdministrators() {
diff --git a/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Email Format');
}
- public function getPanelGroup() {
- return pht('Email');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY;
}
public function isEditableByAdministrators() {
diff --git a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Email Preferences');
}
- public function getPanelGroup() {
- return pht('Email');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY;
}
public function isEditableByAdministrators() {
diff --git a/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php b/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
@@ -11,12 +11,8 @@
return pht('External Accounts');
}
- public function getPanelGroup() {
- return pht('Authentication');
- }
-
- public function isEnabled() {
- return true;
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Home Page');
}
- public function getPanelGroup() {
- return pht('Application Settings');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php b/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php
@@ -11,8 +11,8 @@
return pht('Multi-Factor Auth');
}
- public function getPanelGroup() {
- return pht('Authentication');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php b/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php
@@ -10,8 +10,8 @@
return pht('Password');
}
- public function getPanelGroup() {
- return pht('Authentication');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
public function isEnabled() {
diff --git a/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php b/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php
@@ -14,8 +14,8 @@
return pht('SSH Public Keys');
}
- public function getPanelGroup() {
- return pht('Authentication');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
public function isEnabled() {
diff --git a/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php b/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php
@@ -10,8 +10,8 @@
return pht('Sessions');
}
- public function getPanelGroup() {
- return pht('Sessions and Logs');
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
}
public function isEnabled() {
diff --git a/src/applications/settings/panel/PhabricatorSettingsPanel.php b/src/applications/settings/panel/PhabricatorSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanel.php
@@ -7,8 +7,6 @@
* submits the form. By extending this class, you can add new settings
* panels.
*
- * NOTE: This stuff is new and might not be completely stable.
- *
* @task config Panel Configuration
* @task panel Panel Implementation
* @task internal Internals
@@ -63,11 +61,38 @@
}
final public static function getAllPanels() {
- return id(new PhutilClassMapQuery())
+ $panels = id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setUniqueMethod('getPanelKey')
- ->setSortMethod('getPanelSortKey')
->execute();
+ return msortv($panels, 'getPanelOrderVector');
+ }
+
+ final public static function getAllDisplayPanels() {
+ $panels = array();
+ $groups = PhabricatorSettingsPanelGroup::getAllPanelGroupsWithPanels();
+ foreach ($groups as $group) {
+ foreach ($group->getPanels() as $key => $panel) {
+ $panels[$key] = $panel;
+ }
+ }
+
+ return $panels;
+ }
+
+ final public function getPanelGroup() {
+ $group_key = $this->getPanelGroupKey();
+
+ $groups = PhabricatorSettingsPanelGroup::getAllPanelGroupsWithPanels();
+ $group = idx($groups, $group_key);
+ if (!$group) {
+ throw new Exception(
+ pht(
+ 'No settings panel group with key "%s" exists!',
+ $group_key));
+ }
+
+ return $group;
}
@@ -97,17 +122,12 @@
/**
- * Return a human-readable group name for this panel. For instance, if you
- * had several related panels like "Volume Settings" and
- * "Microphone Settings", you might put them in a group called "Audio".
- *
- * When displayed, panels are grouped with other panels that have the same
- * group name.
+ * Return a panel group key constant for this panel.
*
- * @return string Human-readable panel group name.
+ * @return const Panel group key.
* @task config
*/
- abstract public function getPanelGroup();
+ abstract public function getPanelGroupKey();
/**
@@ -192,11 +212,9 @@
* @return string Sortable key.
* @task internal
*/
- final public function getPanelSortKey() {
- return sprintf(
- '%s'.chr(255).'%s',
- $this->getPanelGroup(),
- $this->getPanelName());
+ final public function getPanelOrderVector() {
+ return id(new PhutilSortVector())
+ ->addString($this->getPanelName());
}
}
diff --git a/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php b/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php
@@ -10,12 +10,8 @@
return pht('Temporary Tokens');
}
- public function getPanelGroup() {
- return pht('Sessions and Logs');
- }
-
- public function isEnabled() {
- return true;
+ public function getPanelGroupKey() {
+ return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
}
public function processRequest(AphrontRequest $request) {
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsAccountPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsAccountPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsAccountPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorSettingsAccountPanelGroup
+ extends PhabricatorSettingsPanelGroup {
+
+ const PANELGROUPKEY = 'account';
+
+ public function getPanelGroupName() {
+ return pht('Account');
+ }
+
+ protected function getPanelGroupOrder() {
+ return 100;
+ }
+
+}
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsApplicationsPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsApplicationsPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsApplicationsPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorSettingsApplicationsPanelGroup
+ extends PhabricatorSettingsPanelGroup {
+
+ const PANELGROUPKEY = 'applications';
+
+ public function getPanelGroupName() {
+ return pht('Applications');
+ }
+
+ protected function getPanelGroupOrder() {
+ return 200;
+ }
+
+}
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsAuthenticationPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsAuthenticationPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsAuthenticationPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorSettingsAuthenticationPanelGroup
+ extends PhabricatorSettingsPanelGroup {
+
+ const PANELGROUPKEY = 'authentication';
+
+ public function getPanelGroupName() {
+ return pht('Authentication');
+ }
+
+ protected function getPanelGroupOrder() {
+ return 300;
+ }
+
+}
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsDeveloperPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsDeveloperPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsDeveloperPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorSettingsDeveloperPanelGroup
+ extends PhabricatorSettingsPanelGroup {
+
+ const PANELGROUPKEY = 'developer';
+
+ public function getPanelGroupName() {
+ return pht('Developer');
+ }
+
+ protected function getPanelGroupOrder() {
+ return 400;
+ }
+
+}
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsEmailPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsEmailPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsEmailPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorSettingsEmailPanelGroup
+ extends PhabricatorSettingsPanelGroup {
+
+ const PANELGROUPKEY = 'email';
+
+ public function getPanelGroupName() {
+ return pht('Email');
+ }
+
+ protected function getPanelGroupOrder() {
+ return 500;
+ }
+
+}
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsLogsPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsLogsPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsLogsPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorSettingsLogsPanelGroup
+ extends PhabricatorSettingsPanelGroup {
+
+ const PANELGROUPKEY = 'logs';
+
+ public function getPanelGroupName() {
+ return pht('Sessions and Logs');
+ }
+
+ protected function getPanelGroupOrder() {
+ return 600;
+ }
+
+}
diff --git a/src/applications/settings/panelgroup/PhabricatorSettingsPanelGroup.php b/src/applications/settings/panelgroup/PhabricatorSettingsPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/panelgroup/PhabricatorSettingsPanelGroup.php
@@ -0,0 +1,48 @@
+<?php
+
+abstract class PhabricatorSettingsPanelGroup extends Phobject {
+
+ private $panels;
+
+ abstract public function getPanelGroupName();
+
+ protected function getPanelGroupOrder() {
+ return 1000;
+ }
+
+ final public function getPanelGroupOrderVector() {
+ return id(new PhutilSortVector())
+ ->addInt($this->getPanelGroupOrder())
+ ->addString($this->getPanelGroupName());
+ }
+
+ final public function getPanelGroupKey() {
+ return $this->getPhobjectClassConstant('PANELGROUPKEY');
+ }
+
+ final public static function getAllPanelGroups() {
+ $groups = id(new PhutilClassMapQuery())
+ ->setAncestorClass(__CLASS__)
+ ->setUniqueMethod('getPanelGroupKey')
+ ->execute();
+
+ return msortv($groups, 'getPanelGroupOrderVector');
+ }
+
+ final public static function getAllPanelGroupsWithPanels() {
+ $groups = self::getAllPanelGroups();
+
+ $panels = PhabricatorSettingsPanel::getAllPanels();
+ $panels = mgroup($panels, 'getPanelGroupKey');
+ foreach ($groups as $key => $group) {
+ $group->panels = idx($panels, $key, array());
+ }
+
+ return $groups;
+ }
+
+ public function getPanels() {
+ return $this->panels;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 3:40 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6722355
Default Alt Text
D16020.diff (25 KB)
Attached To
Mode
D16020: Formalize and fully modularize settings panel groups
Attached
Detach File
Event Timeline
Log In to Comment