-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add mailer to install procedure * improve start command * do not persist most of mailer data
- Loading branch information
Showing
12 changed files
with
384 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/Zikula/CoreInstallerBundle/Resources/views/Install/mailer.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{% extends '@ZikulaCoreInstaller/theme.html.twig' %} | ||
{% block childjavascripts %} | ||
<script src="{{ asset('bundles/core/js/bootstrap-zikula.js') }}"></script> | ||
{% endblock %} | ||
|
||
{% block title 'Zikula Core Installer :: Enter mailer transport information' %} | ||
|
||
{% block content %} | ||
<div class="card"> | ||
<div class="card-header"> | ||
<strong>{% trans %}Mailer transport information{% endtrans %}</strong> | ||
</div> | ||
<div class="card-body"> | ||
|
||
{{ form_start(form) }} | ||
{{ form_errors(form) }} | ||
|
||
<div class="form-group row"> | ||
{{ form_label(form.transport) }} | ||
<div class="col-md-9"> | ||
{{ form_errors(form.transport) }} | ||
{{ form_widget(form.transport) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
{{ form_label(form.mailer_id) }} | ||
<div class="col-sm-9"> | ||
{{ form_errors(form.mailer_id) }} | ||
{{ form_widget(form.mailer_id) }} | ||
{{ form_help(form.mailer_id) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
{{ form_label(form.mailer_key) }} | ||
<div class="col-sm-9"> | ||
{{ form_errors(form.mailer_key) }} | ||
{{ form_widget(form.mailer_key) }} | ||
{{ form_help(form.mailer_key) }} | ||
</div> | ||
</div> | ||
|
||
<div data-switch="zikulamailermodule_config[transport]" data-switch-value="smtp"> | ||
<div class="alert alert-info">{% trans %}SMTP settings{% endtrans %}</div> | ||
<div class="form-group row"> | ||
{{ form_label(form.host) }} | ||
<div class="col-sm-9"> | ||
{{ form_errors(form.host) }} | ||
{{ form_widget(form.host) }} | ||
{{ form_help(form.host) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
{{ form_label(form.port) }} | ||
<div class="col-sm-9"> | ||
{{ form_errors(form.port) }} | ||
{{ form_widget(form.port) }} | ||
{{ form_help(form.port) }} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class="alert alert-info">{% trans %}Additional options{% endtrans %}</div> | ||
<div class="form-group row"> | ||
{{ form_label(form.customParameters) }} | ||
<div class="col-md-9"> | ||
{{ form_errors(form.customParameters) }} | ||
{{ form_widget(form.customParameters) }} | ||
{{ form_help(form.customParameters) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
{{ form_label(form.enableLogging) }} | ||
<div class="col-md-9"> | ||
{{ form_errors(form.enableLogging) }} | ||
{{ form_widget(form.enableLogging) }} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row"> | ||
<div class="col-md-9 offset-md-3"> | ||
<input type="submit" id="submit_button" value="{% trans %}Next{% endtrans %}" class="btn btn-success" /> | ||
</div> | ||
</div> | ||
{% do form.save.setRendered() %} | ||
{% do form.cancel.setRendered() %} | ||
{{ form_end(form) }} | ||
</div> | ||
</div> | ||
<script> | ||
$(document).ready(function() { | ||
$('form:first *:input:text:first').focus(); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/Zikula/CoreInstallerBundle/Stage/EmailTransportStage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Zikula package. | ||
* | ||
* Copyright Zikula Foundation - https://ziku.la/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zikula\Bundle\CoreInstallerBundle\Stage; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\Form\FormInterface; | ||
use Zikula\Component\Wizard\FormHandlerInterface; | ||
use Zikula\Component\Wizard\InjectContainerInterface; | ||
use Zikula\Component\Wizard\StageInterface; | ||
use Zikula\MailerModule\Form\Type\MailTransportConfigType; | ||
use Zikula\MailerModule\Helper\MailTransportHelper; | ||
|
||
class EmailTransportStage implements StageInterface, FormHandlerInterface, InjectContainerInterface | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
private $container; | ||
|
||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return 'emailtransport'; | ||
} | ||
|
||
public function getFormType(): string | ||
{ | ||
return MailTransportConfigType::class; | ||
} | ||
|
||
public function getFormOptions(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getTemplateName(): string | ||
{ | ||
return '@ZikulaCoreInstaller/Install/mailer.html.twig'; | ||
} | ||
|
||
public function isNecessary(): bool | ||
{ | ||
$mailerDsn = $_ENV['MAILER_DSN'] ?? ''; | ||
if (!empty($mailerDsn) && 'smtp://localhost' !== $mailerDsn) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public function getTemplateParams(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function handleFormResult(FormInterface $form): bool | ||
{ | ||
$projectDir = $this->container->getParameter('kernel.project_dir'); | ||
|
||
return (new MailTransportHelper($projectDir))->handleFormData($form->getData()); | ||
} | ||
} |
Oops, something went wrong.