mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Modernize MetaMTA
Summary: - Add an Application. - Move routes to the application. - Move nav out of tabs (which no longer exist). - Fix a couple of random things. Test Plan: Viewed sent/received mail logs. Performed send/receive tests. Viewed email details. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T631, T1569 Differential Revision: https://secure.phabricator.com/D3255
This commit is contained in:
parent
29e176fe53
commit
b2f12a09b5
10 changed files with 108 additions and 68 deletions
|
@ -553,6 +553,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
|
||||
'PhabricatorApplicationMailingLists' => 'applications/mailinglists/application/PhabricatorApplicationMailingLists.php',
|
||||
'PhabricatorApplicationManiphest' => 'applications/maniphest/application/PhabricatorApplicationManiphest.php',
|
||||
'PhabricatorApplicationMetaMTA' => 'applications/metamta/application/PhabricatorApplicationMetaMTA.php',
|
||||
'PhabricatorApplicationPeople' => 'applications/people/application/PhabricatorApplicationPeople.php',
|
||||
'PhabricatorApplicationPhriction' => 'applications/phriction/application/PhabricatorApplicationPhriction.php',
|
||||
'PhabricatorApplicationPonder' => 'applications/ponder/application/PhabricatorApplicationPonder.php',
|
||||
|
@ -1673,6 +1674,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationLaunchView' => 'AphrontView',
|
||||
'PhabricatorApplicationMailingLists' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationManiphest' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationMetaMTA' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationPeople' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationPhriction' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationPonder' => 'PhabricatorApplication',
|
||||
|
|
|
@ -81,15 +81,6 @@ class AphrontDefaultApplicationConfiguration
|
|||
=> 'PhabricatorTypeaheadCommonDatasourceController',
|
||||
),
|
||||
|
||||
'/mail/' => array(
|
||||
'' => 'PhabricatorMetaMTAListController',
|
||||
'send/' => 'PhabricatorMetaMTASendController',
|
||||
'view/(?P<id>\d+)/' => 'PhabricatorMetaMTAViewController',
|
||||
'receive/' => 'PhabricatorMetaMTAReceiveController',
|
||||
'received/' => 'PhabricatorMetaMTAReceivedListController',
|
||||
'sendgrid/' => 'PhabricatorMetaMTASendGridReceiveController',
|
||||
),
|
||||
|
||||
'/login/' => array(
|
||||
'' => 'PhabricatorLoginController',
|
||||
'email/' => 'PhabricatorEmailLoginController',
|
||||
|
|
|
@ -149,17 +149,18 @@ abstract class PhabricatorController extends AphrontController {
|
|||
|
||||
if (!($view instanceof AphrontSideNavFilterView)) {
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
if ($application) {
|
||||
$nav->setCurrentApplication($application);
|
||||
}
|
||||
$nav->setUser($this->getRequest()->getUser());
|
||||
$nav->setFlexNav(true);
|
||||
$nav->setShowApplicationMenu(true);
|
||||
$nav->appendChild($view);
|
||||
|
||||
$view = $nav;
|
||||
}
|
||||
|
||||
if ($application) {
|
||||
$view->setCurrentApplication($application);
|
||||
}
|
||||
|
||||
$view->setUser($this->getRequest()->getUser());
|
||||
$view->setFlexNav(true);
|
||||
$view->setShowApplicationMenu(true);
|
||||
|
||||
$page->appendChild($view);
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 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.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationMetaMTA extends PhabricatorApplication {
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/mail/';
|
||||
}
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'View Mail Logs';
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
$this->getBaseURI() => array(
|
||||
'' => 'PhabricatorMetaMTAListController',
|
||||
'send/' => 'PhabricatorMetaMTASendController',
|
||||
'view/(?P<id>\d+)/' => 'PhabricatorMetaMTAViewController',
|
||||
'receive/' => 'PhabricatorMetaMTAReceiveController',
|
||||
'received/' => 'PhabricatorMetaMTAReceivedListController',
|
||||
'sendgrid/' => 'PhabricatorMetaMTASendGridReceiveController',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function getTitleGlyph() {
|
||||
return '@';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,33 +22,23 @@ abstract class PhabricatorMetaMTAController extends PhabricatorController {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function buildStandardPageResponse($view, array $data) {
|
||||
$page = $this->buildStandardPageView();
|
||||
public function buildSideNavView() {
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||
|
||||
$page->setApplicationName('MetaMTA');
|
||||
$page->setBaseURI('/mail/');
|
||||
$page->setTitle(idx($data, 'title'));
|
||||
$page->setTabs(
|
||||
array(
|
||||
'queue' => array(
|
||||
'name' => 'Mail Queue',
|
||||
'href' => '/mail/',
|
||||
),
|
||||
'lists' => array(
|
||||
'name' => 'Mailing Lists',
|
||||
'href' => '/mail/lists/',
|
||||
),
|
||||
'received' => array(
|
||||
'name' => 'Received',
|
||||
'href' => '/mail/received/',
|
||||
),
|
||||
),
|
||||
idx($data, 'tab'));
|
||||
$page->setGlyph("@");
|
||||
$page->appendChild($view);
|
||||
$nav->addLabel('Mail Logs');
|
||||
$nav->addFilter('sent', 'Sent Mail', $this->getApplicationURI());
|
||||
$nav->addFilter('received', 'Received Mail');
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
return $response->setContent($page->render());
|
||||
$nav->addSpacer();
|
||||
|
||||
if ($this->getRequest()->getUser()->getIsAdmin()) {
|
||||
$nav->addLabel('Diagnostics');
|
||||
$nav->addFilter('send', 'Send Test');
|
||||
$nav->addFilter('receive', 'Receive Test');
|
||||
}
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ final class PhabricatorMetaMTAListController
|
|||
'a',
|
||||
array(
|
||||
'class' => 'button small grey',
|
||||
'href' => '/mail/view/'.$mail->getID().'/',
|
||||
'href' => $this->getApplicationURI('/view/'.$mail->getID().'/'),
|
||||
),
|
||||
'View'),
|
||||
);
|
||||
|
@ -120,16 +120,16 @@ final class PhabricatorMetaMTAListController
|
|||
$panel = new AphrontPanelView();
|
||||
$panel->appendChild($table);
|
||||
$panel->setHeader('MetaMTA Messages');
|
||||
if ($user->getIsAdmin()) {
|
||||
$panel->setCreateButton('Send New Test Message', '/mail/send/');
|
||||
}
|
||||
$panel->appendChild($pager);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$panel,
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('sent');
|
||||
$nav->appendChild($panel);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'MetaMTA',
|
||||
'tab' => 'queue',
|
||||
'title' => 'Sent Mail',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ final class PhabricatorMetaMTAReceiveController
|
|||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($request->getUser());
|
||||
$form->setAction('/mail/receive/');
|
||||
$form->setAction($this->getApplicationURI('/receive/'));
|
||||
$form
|
||||
->appendChild(
|
||||
'<p class="aphront-form-instructions">This form will simulate '.
|
||||
|
@ -79,12 +79,16 @@ final class PhabricatorMetaMTAReceiveController
|
|||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Receive Email');
|
||||
$panel->appendChild($form);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$panel,
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('receive');
|
||||
$nav->appendChild($panel);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Receive Mail',
|
||||
'title' => 'Receive Test',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -80,12 +80,15 @@ final class PhabricatorMetaMTAReceivedListController
|
|||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Received Mail');
|
||||
$panel->setCreateButton('Test Receiver', '/mail/receive/');
|
||||
$panel->appendChild($table);
|
||||
$panel->appendChild($pager);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$panel,
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('received');
|
||||
$nav->appendChild($panel);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Received Mail',
|
||||
'tab' => 'received',
|
||||
|
|
|
@ -54,7 +54,7 @@ final class PhabricatorMetaMTASendController
|
|||
}
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/mail/view/'.$mail->getID().'/');
|
||||
->setURI($this->getApplicationURI('/view/'.$mail->getID().'/'));
|
||||
}
|
||||
|
||||
$failure_caption =
|
||||
|
@ -94,12 +94,11 @@ final class PhabricatorMetaMTASendController
|
|||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($request->getUser());
|
||||
$form->setAction('/mail/send/');
|
||||
$form
|
||||
->appendChild($instructions)
|
||||
->appendChild(
|
||||
id(new AphrontFormStaticControl())
|
||||
->setLabel('Configured Adapter')
|
||||
->setLabel('Adapter')
|
||||
->setValue($adapter))
|
||||
->appendChild(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
|
@ -159,15 +158,20 @@ final class PhabricatorMetaMTASendController
|
|||
$panel->setHeader('Send Email');
|
||||
$panel->appendChild($form);
|
||||
$panel->setID($panel_id);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('send');
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$warning,
|
||||
$panel,
|
||||
),
|
||||
));
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Send Mail',
|
||||
'title' => 'Send Test',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ final class PhabricatorMetaMTAViewController
|
|||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($request->getUser());
|
||||
$form->setAction('/mail/send/');
|
||||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormStaticControl())
|
||||
|
@ -67,14 +66,14 @@ final class PhabricatorMetaMTAViewController
|
|||
->setValue($mail->getRelatedPHID()))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->addCancelButton('/mail/', 'Done'));
|
||||
->addCancelButton($this->getApplicationURI(), 'Done'));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('View Email');
|
||||
$panel->appendChild($form);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
return $this->buildApplicationPage(
|
||||
$panel,
|
||||
array(
|
||||
'title' => 'View Mail',
|
||||
|
|
Loading…
Reference in a new issue