1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Move "Preferences" to "Settings"

Summary:
It makes more sense to just make this a settings panel rather than a standalone
app, particularly since setting panels are relatively well separated now.

Also default-disabled the SSH Keys interface since it won't currently be useful
for most installs.

Test Plan: Edited preferences.
Reviewed By: jungejason
Reviewers: tuomaspelkonen, jungejason, aran
CC: aran, jungejason
Differential Revision: 716
This commit is contained in:
epriestley 2011-07-24 11:02:08 -07:00
parent 2de071ce3a
commit 6e08a9215d
12 changed files with 42 additions and 70 deletions

View file

@ -228,6 +228,13 @@ return array(
// to have.
'auth.sessions.conduit' => 3,
// Set this true to enable the Settings -> SSH Public Keys panel, which will
// allow users to associated SSH public keys with their accounts. This is only
// really useful if you're setting up services over SSH and want to use
// Phabricator for authentication; in most situations you can leave this
// disabled.
'auth.sshkeys.enabled' => false,
// -- Accounts -------------------------------------------------------------- //

View file

@ -0,0 +1,2 @@
DELETE FROM phabricator_directory.directory_item
WHERE href = '/preferences/';

View file

@ -574,6 +574,7 @@ phutil_register_library_map(array(
'PhabricatorUserLog' => 'applications/people/storage/log',
'PhabricatorUserOAuthInfo' => 'applications/people/storage/useroauthinfo',
'PhabricatorUserOAuthSettingsPanelController' => 'applications/people/controller/settings/panels/oauth',
'PhabricatorUserPreferenceSettingsPanelController' => 'applications/people/controller/settings/panels/preferences',
'PhabricatorUserPreferences' => 'applications/people/storage/preferences',
'PhabricatorUserProfile' => 'applications/people/storage/profile',
'PhabricatorUserSSHKey' => 'applications/people/storage/usersshkey',
@ -1094,6 +1095,7 @@ phutil_register_library_map(array(
'PhabricatorUserLog' => 'PhabricatorUserDAO',
'PhabricatorUserOAuthInfo' => 'PhabricatorUserDAO',
'PhabricatorUserOAuthSettingsPanelController' => 'PhabricatorUserSettingsPanelController',
'PhabricatorUserPreferenceSettingsPanelController' => 'PhabricatorUserSettingsPanelController',
'PhabricatorUserPreferences' => 'PhabricatorUserDAO',
'PhabricatorUserProfile' => 'PhabricatorUserDAO',
'PhabricatorUserSSHKey' => 'PhabricatorUserDAO',

View file

@ -275,10 +275,6 @@ class AphrontDefaultApplicationConfiguration
=> 'HeraldTranscriptController',
),
'/preferences/' => array(
'$' => 'PhabricatorEditPreferencesController'
),
'/uiexample/' => array(
'$' => 'PhabricatorUIExampleRenderController',
'view/(?P<class>[^/]+)/$' => 'PhabricatorUIExampleRenderController',

View file

@ -29,14 +29,19 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
$request = $this->getRequest();
// TODO: Implement a password panel.
$this->pages = array(
'account' => 'Account',
'email' => 'Email',
// 'password' => 'Password',
'preferences' => 'Preferences',
'conduit' => 'Conduit Certificate',
'sshkeys' => 'SSH Public Keys',
);
if (PhabricatorUserSSHKeysSettingsPanelController::isEnabled()) {
$this->pages['sshkeys'] = 'SSH Public Keys';
}
$oauth_providers = PhabricatorOAuthProvider::getAllProviders();
foreach ($oauth_providers as $provider) {
if (!$provider->isProviderEnabled()) {
@ -64,6 +69,10 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
case 'sshkeys':
$delegate = new PhabricatorUserSSHKeysSettingsPanelController($request);
break;
case 'preferences':
$delegate = new PhabricatorUserPreferenceSettingsPanelController(
$request);
break;
default:
if (empty($this->pages[$this->page])) {
return new Aphront404Response();

View file

@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'applications/people/controller/settings/pa
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/conduit');
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/email');
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/oauth');
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/preferences');
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/sshkeys');
phutil_require_module('phabricator', 'view/layout/sidenav');

View file

@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorEditPreferencesController
extends PhabricatorPreferencesController {
class PhabricatorUserPreferenceSettingsPanelController
extends PhabricatorUserSettingsPanelController {
public function processRequest() {
@ -40,7 +40,7 @@ extends PhabricatorPreferencesController {
$preferences->setPreferences($pref_dict);
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI('/preferences/?saved=true');
->setURI('/settings/page/preferences/?saved=true');
}
$example_string = <<<EXAMPLE
@ -51,8 +51,8 @@ function helloWorld() {
EXAMPLE;
$form = id(new AphrontFormView())
->setAction('/preferences/')
->setUser($user)
->setAction('/settings/page/preferences/')
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Page Titles')
@ -99,15 +99,12 @@ EXAMPLE;
->setErrors(array('Your preferences have been saved.'));
}
return $this->buildStandardPageResponse(
return id(new AphrontNullView())
->appendChild(
array(
$error_view,
$panel,
),
array(
'title' => 'Edit Preferences',
));
}
}

View file

@ -7,8 +7,8 @@
phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/base');
phutil_require_module('phabricator', 'applications/people/storage/preferences');
phutil_require_module('phabricator', 'applications/preferences/controller/base');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/markup');
phutil_require_module('phabricator', 'view/form/control/select');
@ -16,9 +16,10 @@ phutil_require_module('phabricator', 'view/form/control/submit');
phutil_require_module('phabricator', 'view/form/control/text');
phutil_require_module('phabricator', 'view/form/error');
phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phabricator', 'view/null');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorEditPreferencesController.php');
phutil_require_source('PhabricatorUserPreferenceSettingsPanelController.php');

View file

@ -21,7 +21,12 @@ class PhabricatorUserSSHKeysSettingsPanelController
const PANEL_BASE_URI = '/settings/page/sshkeys/';
public static function isEnabled() {
return PhabricatorEnv::getEnvConfig('auth.sshkeys.enabled');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();

View file

@ -12,6 +12,7 @@ phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'aphront/response/reload');
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/base');
phutil_require_module('phabricator', 'applications/people/storage/usersshkey');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'view/control/table');
phutil_require_module('phabricator', 'view/dialog');

View file

@ -1,34 +0,0 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
abstract class PhabricatorPreferencesController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setApplicationName('Preferences');
$page->setBaseURI('/preferences/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x9A\x92");
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
}

View file

@ -1,15 +0,0 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'aphront/response/webpage');
phutil_require_module('phabricator', 'applications/base/controller/base');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorPreferencesController.php');