2011-02-06 07:36:21 +01:00
|
|
|
<?php
|
|
|
|
|
2012-08-13 21:37:18 +02:00
|
|
|
final class PhabricatorSettingsMainController
|
|
|
|
extends PhabricatorController {
|
2011-02-06 07:36:21 +01:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
private $key;
|
2011-02-06 07:36:21 +01:00
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
2012-08-13 21:37:26 +02:00
|
|
|
$this->key = idx($data, 'key');
|
2011-02-06 07:36:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$panels = $this->buildPanels();
|
|
|
|
$nav = $this->renderSideNav($panels);
|
|
|
|
|
|
|
|
$key = $nav->selectFilter($this->key, head($panels)->getPanelKey());
|
|
|
|
|
2011-02-06 07:36:21 +01:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$panel = $panels[$key];
|
2011-02-06 07:36:21 +01:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$response = $panel->processRequest($request);
|
|
|
|
if ($response instanceof AphrontResponse) {
|
2011-07-18 17:02:00 +02:00
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$nav->appendChild($response);
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$nav,
|
|
|
|
array(
|
|
|
|
'title' => $panel->getPanelName(),
|
|
|
|
));
|
|
|
|
}
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
private function buildPanels() {
|
|
|
|
$panel_specs = id(new PhutilSymbolLoader())
|
|
|
|
->setAncestorClass('PhabricatorSettingsPanel')
|
|
|
|
->setConcreteOnly(true)
|
|
|
|
->selectAndLoadSymbols();
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$panels = array();
|
|
|
|
foreach ($panel_specs as $spec) {
|
|
|
|
$class = newv($spec['name'], array());
|
|
|
|
$panels[] = $class->buildPanels();
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
}
|
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$panels = array_mergev($panels);
|
|
|
|
$panels = mpull($panels, null, 'getPanelKey');
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$result = array();
|
|
|
|
foreach ($panels as $key => $panel) {
|
|
|
|
if (!$panel->isEnabled()) {
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
continue;
|
|
|
|
}
|
2012-08-13 21:37:26 +02:00
|
|
|
if (!empty($result[$key])) {
|
2013-03-03 15:52:42 +01:00
|
|
|
throw new Exception(pht(
|
|
|
|
"Two settings panels share the same panel key ('%s'): %s, %s.",
|
|
|
|
$key,
|
|
|
|
get_class($panel),
|
|
|
|
get_class($result[$key])));
|
2012-08-13 21:37:26 +02:00
|
|
|
}
|
|
|
|
$result[$key] = $panel;
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
}
|
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
$result = msort($result, 'getPanelSortKey');
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
2012-06-13 17:52:05 +02:00
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
private function renderSideNav(array $panels) {
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('/panel/')));
|
|
|
|
|
|
|
|
$group = null;
|
|
|
|
foreach ($panels as $panel) {
|
|
|
|
if ($panel->getPanelGroup() != $group) {
|
|
|
|
$group = $panel->getPanelGroup();
|
|
|
|
$nav->addLabel($group);
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
}
|
2012-08-13 21:37:26 +02:00
|
|
|
|
|
|
|
$nav->addFilter($panel->getPanelKey(), $panel->getPanelName());
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
}
|
|
|
|
|
2012-08-13 21:37:26 +02:00
|
|
|
return $nav;
|
2011-02-22 07:51:34 +01:00
|
|
|
}
|
2012-08-13 21:37:26 +02:00
|
|
|
|
2011-06-18 22:07:02 +02:00
|
|
|
}
|