1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-02 18:08:26 +01:00

Modernize People application

Summary: Move to application navigation, make it possible to get to /logs/ from the navigation.

Test Plan: Hit all interfaces, verified email.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1569, T631

Differential Revision: https://secure.phabricator.com/D3261
This commit is contained in:
epriestley 2012-08-13 15:27:21 -07:00
parent dd26bc6d1a
commit e0e339f16c
9 changed files with 59 additions and 44 deletions

View file

@ -305,9 +305,6 @@ class AphrontDefaultApplicationConfiguration
'testpaymentform/' => 'PhortuneStripeTestPaymentFormController', 'testpaymentform/' => 'PhortuneStripeTestPaymentFormController',
), ),
), ),
'/emailverify/(?P<code>[^/]+)/' =>
'PhabricatorEmailVerificationController',
); );
} }

View file

@ -26,6 +26,10 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication {
return '/people/'; return '/people/';
} }
public function getTitleGlyph() {
return "\xE2\x99\x9F";
}
public function getIconURI() { public function getIconURI() {
return celerity_get_resource_uri('/rsrc/image/app/app_people.png'); return celerity_get_resource_uri('/rsrc/image/app/app_people.png');
} }
@ -41,6 +45,8 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication {
), ),
'/p/(?P<username>[\w._-]+)/(?:(?P<page>\w+)/)?' '/p/(?P<username>[\w._-]+)/(?:(?P<page>\w+)/)?'
=> 'PhabricatorPeopleProfileController', => 'PhabricatorPeopleProfileController',
'/emailverify/(?P<code>[^/]+)/' =>
'PhabricatorEmailVerificationController',
); );
} }

View file

@ -87,7 +87,7 @@ final class PhabricatorEmailVerificationController
$settings_link); $settings_link);
} }
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$content, $content,
array( array(
'title' => 'Verify Email', 'title' => 'Verify Email',

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright 2011 Facebook, Inc. * Copyright 2012 Facebook, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,38 +18,29 @@
abstract class PhabricatorPeopleController extends PhabricatorController { abstract class PhabricatorPeopleController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) { public function buildSideNavView() {
$page = $this->buildStandardPageView(); $nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$page->setApplicationName('People'); $is_admin = $this->getRequest()->getUser()->getIsAdmin();
$page->setBaseURI('/people/');
$page->setTitle(idx($data, 'title'));
$tabs = array( if ($is_admin) {
'directory' => array( $nav->addLabel('Create Users');
'name' => 'User Directory', $nav->addFilter('edit', 'Create New User');
'href' => '/people/', $nav->addFilter('ldap', 'Import from LDAP');
), $nav->addSpacer();
);
if ($this->getRequest()->getUser()->getIsAdmin()) {
$tabs = array_merge(
$tabs,
array(
'logs' => array(
'name' => 'Activity Logs',
'href' => '/people/logs/',
),
));
} }
$page->setTabs($tabs, idx($data, 'tab')); $nav->addLabel('Directory');
$nav->addFilter('people', 'User Directory', $this->getApplicationURI());
$page->setGlyph("\xE2\x99\x9F"); if ($is_admin) {
$page->appendChild($view); $nav->addSpacer();
$nav->addLabel('Logs');
$nav->addFilter('logs', 'Activity Logs');
}
$response = new AphrontWebpageResponse(); return $nav;
return $response->setContent($page->render());
} }
} }

View file

@ -49,16 +49,20 @@ final class PhabricatorPeopleEditController
$nav = new AphrontSideNavFilterView(); $nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($base_uri)); $nav->setBaseURI(new PhutilURI($base_uri));
$nav->addLabel('User Information');
$nav->addFilter('basic', 'Basic Information'); $nav->addFilter('basic', 'Basic Information');
$nav->addFilter('role', 'Edit Roles'); $nav->addFilter('role', 'Edit Roles');
$nav->addFilter('cert', 'Conduit Certificate'); $nav->addFilter('cert', 'Conduit Certificate');
$nav->addFilter('profile', 'View Profile', '/p/'.$user->getUsername().'/');
$nav->addSpacer(); $nav->addSpacer();
$nav->addLabel('Special');
$nav->addFilter('rename', 'Change Username'); $nav->addFilter('rename', 'Change Username');
$nav->addFilter('delete', 'Delete User'); $nav->addFilter('delete', 'Delete User');
if (!$user->getID()) { if (!$user->getID()) {
$this->view = 'basic'; $this->view = 'basic';
} }
$view = $nav->selectFilter($this->view, 'basic'); $view = $nav->selectFilter($this->view, 'basic');
$content = array(); $content = array();
@ -99,11 +103,14 @@ final class PhabricatorPeopleEditController
if ($user->getID()) { if ($user->getID()) {
$nav->appendChild($content); $nav->appendChild($content);
$content = $nav; } else {
$nav = $this->buildSideNavView();
$nav->selectFilter('edit');
$nav->appendChild($content);
} }
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$content, $nav,
array( array(
'title' => 'Edit User', 'title' => 'Edit User',
)); ));

View file

@ -68,8 +68,12 @@ final class PhabricatorPeopleLdapController
$content[] = $this->processSearchRequest($request); $content[] = $this->processSearchRequest($request);
} }
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$content, $nav->selectFilter('ldap');
$nav->appendChild($content);
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Import Ldap Users', 'title' => 'Import Ldap Users',
)); ));

View file

@ -138,13 +138,18 @@ final class PhabricatorPeopleListController
'href' => '/people/ldap/', 'href' => '/people/ldap/',
'class' => 'button green' 'class' => 'button green'
), ),
'Import from Ldap')); 'Import from LDAP'));
} }
} }
return $this->buildStandardPageResponse($panel, array( $nav = $this->buildSideNavView();
$nav->selectFilter('people');
$nav->appendChild($panel);
return $this->buildApplicationPage(
$nav,
array(
'title' => 'People', 'title' => 'People',
'tab' => 'directory',
)); ));
} }
} }

View file

@ -232,14 +232,19 @@ final class PhabricatorPeopleLogsController
$filter = new AphrontListFilterView(); $filter = new AphrontListFilterView();
$filter->appendChild($form); $filter->appendChild($form);
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$nav->selectFilter('logs');
$nav->appendChild(
array( array(
$filter, $filter,
$panel, $panel,
), ));
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Activity Logs', 'title' => 'Activity Logs',
'tab' => 'logs',
)); ));
} }
} }

View file

@ -158,7 +158,7 @@ final class PhabricatorPeopleProfileController
'/people/edit/'.$user->getID().'/'); '/people/edit/'.$user->getID().'/');
} }
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$header, $header,
array( array(
'title' => $user->getUsername(), 'title' => $user->getUsername(),