Important! All references to *Email* have been changed to *Mail*

(This change might hurt a little, sorry!)
This commit is contained in:
Sam Georges 2014-07-04 18:47:46 +10:00
parent d912b73aab
commit 3617a7fea8
42 changed files with 228 additions and 228 deletions

View File

@ -7,7 +7,7 @@ use BackendMenu;
use BackendAuth;
use Backend\Classes\WidgetManager;
use October\Rain\Support\ModuleServiceProvider;
use System\Models\EmailTemplate;
use System\Models\MailTemplate;
use System\Classes\SettingsManager;
class ServiceProvider extends ModuleServiceProvider
@ -117,12 +117,12 @@ class ServiceProvider extends ModuleServiceProvider
});
/*
* Register email templates
* Register mail templates
*/
EmailTemplate::registerCallback(function($template){
$template->registerEmailTemplates([
'backend::emails.invite' => 'Invitation for newly created administrators.',
'backend::emails.restore' => 'Password reset instructions for backend-end administrators.',
MailTemplate::registerCallback(function($template){
$template->registerMailTemplates([
'backend::mail.invite' => 'Invitation for newly created administrators.',
'backend::mail.restore' => 'Password reset instructions for backend-end administrators.',
]);
});
}

View File

@ -130,7 +130,7 @@ class Auth extends Controller
'link' => $link,
];
Mail::send('backend::emails.restore', $data, function($message) use ($user)
Mail::send('backend::mail.restore', $data, function($message) use ($user)
{
$message->to($user->email, $user->full_name)->subject(trans('backend::lang.account.password_reset'));
});

View File

@ -4,4 +4,4 @@
form: @/modules/backend/models/editorpreferences/fields.yaml
modelClass: Backend\Models\EditorPreferences
defaultRedirect: system/emailtemplates
defaultRedirect: system/mailtemplates

View File

@ -97,7 +97,7 @@ class User extends UserBase
'link' => Backend::url('backend'),
];
Mail::send('backend::emails.invite', $data, function($message)
Mail::send('backend::mail.invite', $data, function($message)
{
$message->to($this->email, $this->full_name);
});

View File

@ -15,8 +15,8 @@ use System\Classes\SettingsManager;
use System\Twig\Engine as TwigEngine;
use System\Twig\Loader as TwigLoader;
use System\Twig\Extension as TwigExtension;
use System\Models\EmailSettings;
use System\Models\EmailTemplate;
use System\Models\MailSettings;
use System\Models\MailTemplate;
use Backend\Classes\WidgetManager;
use October\Rain\Support\ModuleServiceProvider;
@ -101,8 +101,8 @@ class ServiceProvider extends ModuleServiceProvider
* Override system email with email settings
*/
Event::listen('mailer.beforeRegister', function() {
if (EmailSettings::isConfigured())
EmailSettings::applyConfigValues();
if (MailSettings::isConfigured())
MailSettings::applyConfigValues();
});
/*
@ -110,7 +110,7 @@ class ServiceProvider extends ModuleServiceProvider
*/
Event::listen('mailer.register', function($provider, $mailer) {
$mailer->bindEvent('beforeAddContent', function($message, $view, $plain, $data){
if (EmailTemplate::addContentToMailer($message, $view, $data))
if (MailTemplate::addContentToMailer($message, $view, $data))
return false;
});
});
@ -177,7 +177,7 @@ class ServiceProvider extends ModuleServiceProvider
$manager->registerPermissions('October.System', [
'system.manage_settings' => ['label' => 'Manage system settings', 'tab' => 'System'],
'system.manage_updates' => ['label' => 'Manage software updates', 'tab' => 'System'],
'system.manage_email_templates' => ['label' => 'Manage email templates', 'tab' => 'System'],
'system.manage_mail_templates' => ['label' => 'Manage mail templates', 'tab' => 'System'],
]);
});
@ -187,19 +187,19 @@ class ServiceProvider extends ModuleServiceProvider
SettingsManager::instance()->registerCallback(function($manager){
$manager->registerSettingItems('October.System', [
'email_settings' => [
'label' => 'system::lang.email.menu_label',
'description' => 'system::lang.email.menu_description',
'label' => 'system::lang.mail.menu_label',
'description' => 'system::lang.mail.menu_description',
'category' => 'System',
'icon' => 'icon-envelope',
'class' => 'System\Models\EmailSettings',
'class' => 'System\Models\MailSettings',
'sort' => 100
],
'email_templates' => [
'label' => 'system::lang.email_templates.menu_label',
'description' => 'system::lang.email_templates.menu_description',
'mail_templates' => [
'label' => 'system::lang.mail_templates.menu_label',
'description' => 'system::lang.mail_templates.menu_description',
'category' => 'System',
'icon' => 'icon-envelope-square',
'url' => Backend::url('system/emailtemplates'),
'url' => Backend::url('system/mailtemplates'),
'sort' => 100
],
]);

View File

@ -106,12 +106,12 @@ abstract class PluginBase extends ServiceProviderBase
}
/**
* Registers any email templates implemented by this plugin.
* Registers any mail templates implemented by this plugin.
* The templates must be returned in the following format:
* ['acme.blog::emails.welcome' => 'This is a description of the welcome template'],
* ['acme.blog::emails.forgot_password' => 'This is a description of the forgot password template'],
* ['acme.blog::mail.welcome' => 'This is a description of the welcome template'],
* ['acme.blog::mail.forgot_password' => 'This is a description of the forgot password template'],
*/
public function registerEmailTemplates()
public function registerMailTemplates()
{
return [];
}

View File

@ -12,20 +12,20 @@ use System\Classes\ApplicationException;
use Exception;
/**
* Email layouts controller
* Mail layouts controller
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*
*/
class EmailLayouts extends Controller
class MailLayouts extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
];
public $requiredPermissions = ['system.manage_email_templates'];
public $requiredPermissions = ['system.manage_mail_templates'];
public $formConfig = 'config_form.yaml';

View File

@ -10,18 +10,18 @@ use Redirect;
use BackendMenu;
use BackendAuth;
use Backend\Classes\Controller;
use System\Models\EmailTemplate;
use System\Models\MailTemplate;
use System\Classes\ApplicationException;
use Exception;
/**
* Email templates controller
* Mail templates controller
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*
*/
class EmailTemplates extends Controller
class MailTemplates extends Controller
{
public $implement = [
@ -29,7 +29,7 @@ class EmailTemplates extends Controller
'Backend.Behaviors.ListController'
];
public $requiredPermissions = ['system.manage_email_templates'];
public $requiredPermissions = ['system.manage_mail_templates'];
public $listConfig = ['templates' => 'config_templates_list.yaml', 'layouts' => 'config_layouts_list.yaml'];
public $formConfig = 'config_form.yaml';
@ -43,9 +43,9 @@ class EmailTemplates extends Controller
public function index()
{
/* @todo Remove line if year >= 2015 */ if (!\System\Models\EmailLayout::whereCode('default')->count()) { \Eloquent::unguard(); with(new \System\Database\Seeds\SeedSetupEmailLayouts)->run(); }
/* @todo Remove line if year >= 2015 */ if (!\System\Models\MailLayout::whereCode('default')->count()) { \Eloquent::unguard(); with(new \System\Database\Seeds\SeedSetupMailLayouts)->run(); }
EmailTemplate::syncAll();
MailTemplate::syncAll();
$this->getClassExtension('Backend.Behaviors.ListController')->index();
}

View File

@ -1,16 +0,0 @@
# ===================================
# Form Behavior Config
# ===================================
name: system::lang.email_templates.layout
form: @/modules/system/models/emaillayout/fields.yaml
modelClass: System\Models\EmailLayout
defaultRedirect: system/emailtemplates
create:
redirect: system/emailtemplates/update/:id
redirectClose: system/emailtemplates
update:
redirect: system/emailtemplates
redirectClose: system/emailtemplates

View File

@ -1,7 +0,0 @@
<div data-control="toolbar">
<a
href="<?= Backend::url('system/emaillayouts/create') ?>"
class="btn btn-primary oc-icon-plus">
<?= e(trans('system::lang.email_templates.new_layout')) ?>
</a>
</div>

View File

@ -1,7 +0,0 @@
<div data-control="toolbar">
<a
href="<?= Backend::url('system/emailtemplates/create') ?>"
class="btn btn-primary oc-icon-plus">
<?= e(trans('system::lang.email_templates.new_template')) ?>
</a>
</div>

View File

@ -1,16 +0,0 @@
# ===================================
# Form Behavior Config
# ===================================
name: system::lang.email_templates.template
form: @/modules/system/models/emailtemplate/fields.yaml
modelClass: System\Models\EmailTemplate
defaultRedirect: system/emailtemplates
create:
redirect: system/emailtemplates/update/:id
redirectClose: system/emailtemplates
update:
redirect: system/emailtemplates
redirectClose: system/emailtemplates

View File

@ -1,15 +0,0 @@
# ===================================
# List Behavior Config
# ===================================
title: system::lang.email_templates.menu_label
list: @/modules/system/models/emaillayout/columns.yaml
modelClass: System\Models\EmailLayout
recordUrl: system/emaillayouts/update/:id
noRecordsMessage: backend::lang.list.no_records
showSetup: false
toolbar:
buttons: list_layouts_toolbar
search:
prompt: backend::lang.list.search_prompt

View File

@ -0,0 +1,16 @@
# ===================================
# Form Behavior Config
# ===================================
name: system::lang.mail_templates.layout
form: @/modules/system/models/maillayout/fields.yaml
modelClass: System\Models\MailLayout
defaultRedirect: system/mailtemplates
create:
redirect: system/mailtemplates/update/:id
redirectClose: system/mailtemplates
update:
redirect: system/mailtemplates
redirectClose: system/mailtemplates

View File

@ -1,7 +1,7 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('system/settings') ?>"><?= e(trans('system::lang.settings.menu_label')) ?></a></li>
<li><a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('system::lang.email_templates.menu_layouts_label')) ?></a></li>
<li><a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('system::lang.mail_templates.menu_layouts_label')) ?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
@ -34,7 +34,7 @@
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('backend::lang.form.close')) ?></a>
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('backend::lang.form.close')) ?></a>
</span>
</div>
</div>
@ -44,6 +44,6 @@
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('system/emailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.email_templates.return')) ?></a></p>
<p><a href="<?= Backend::url('system/mailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.mail_templates.return')) ?></a></p>
<?php endif ?>

View File

@ -1,7 +1,7 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('system/settings') ?>"><?= e(trans('system::lang.settings.menu_label')) ?></a></li>
<li><a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('system::lang.email_templates.menu_layouts_label')) ?></a></li>
<li><a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('system::lang.mail_templates.menu_layouts_label')) ?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
@ -11,7 +11,7 @@
<div class="scoreboard">
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.email_templates.template')) ?></h4>
<h4><?= e(trans('system::lang.mail_templates.template')) ?></h4>
<p><?= $formModel->code ?></p>
</div>
</div>
@ -53,7 +53,7 @@
</button>
<?php endif ?>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
@ -63,6 +63,6 @@
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('system/emailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.email_templates.return')) ?></a></p>
<p><a href="<?= Backend::url('system/mailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.mail_templates.return')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1,7 @@
<div data-control="toolbar">
<a
href="<?= Backend::url('system/maillayouts/create') ?>"
class="btn btn-primary oc-icon-plus">
<?= e(trans('system::lang.mail_templates.new_layout')) ?>
</a>
</div>

View File

@ -0,0 +1,7 @@
<div data-control="toolbar">
<a
href="<?= Backend::url('system/mailtemplates/create') ?>"
class="btn btn-primary oc-icon-plus">
<?= e(trans('system::lang.mail_templates.new_template')) ?>
</a>
</div>

View File

@ -0,0 +1,16 @@
# ===================================
# Form Behavior Config
# ===================================
name: system::lang.mail_templates.template
form: @/modules/system/models/mailtemplate/fields.yaml
modelClass: System\Models\MailTemplate
defaultRedirect: system/mailtemplates
create:
redirect: system/mailtemplates/update/:id
redirectClose: system/mailtemplates
update:
redirect: system/mailtemplates
redirectClose: system/mailtemplates

View File

@ -0,0 +1,15 @@
# ===================================
# List Behavior Config
# ===================================
title: system::lang.mail_templates.menu_label
list: @/modules/system/models/maillayout/columns.yaml
modelClass: System\Models\MailLayout
recordUrl: system/maillayouts/update/:id
noRecordsMessage: backend::lang.list.no_records
showSetup: false
toolbar:
buttons: list_layouts_toolbar
search:
prompt: backend::lang.list.search_prompt

View File

@ -2,10 +2,10 @@
# List Behavior Config
# ===================================
title: system::lang.email_templates.menu_label
list: @/modules/system/models/emailtemplate/columns.yaml
modelClass: System\Models\EmailTemplate
recordUrl: system/emailtemplates/update/:id
title: system::lang.mail_templates.menu_label
list: @/modules/system/models/mailtemplate/columns.yaml
modelClass: System\Models\MailTemplate
recordUrl: system/mailtemplates/update/:id
noRecordsMessage: backend::lang.list.no_records
recordsPerPage: 20
showSetup: false

View File

@ -1,7 +1,7 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('system/settings') ?>"><?= e(trans('system::lang.settings.menu_label')) ?></a></li>
<li><a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('system::lang.email_templates.menu_label')) ?></a></li>
<li><a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('system::lang.mail_templates.menu_label')) ?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
@ -34,7 +34,7 @@
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('backend::lang.form.close')) ?></a>
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('backend::lang.form.close')) ?></a>
</span>
</div>
</div>
@ -44,6 +44,6 @@
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('system/emailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.email_templates.return')) ?></a></p>
<p><a href="<?= Backend::url('system/mailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.mail_templates.return')) ?></a></p>
<?php endif ?>

View File

@ -7,8 +7,8 @@
<div class="control-tabs content-tabs tabs-flush" data-control="tab">
<ul class="nav nav-tabs">
<li class="active"><a href="#templates"><?= e(trans('system::lang.email_templates.templates')) ?></a></li>
<li><a href="#layouts"><?= e(trans('system::lang.email_templates.layouts')) ?></a></li>
<li class="active"><a href="#templates"><?= e(trans('system::lang.mail_templates.templates')) ?></a></li>
<li><a href="#layouts"><?= e(trans('system::lang.mail_templates.layouts')) ?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active">

View File

@ -1,7 +1,7 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('system/settings') ?>"><?= e(trans('system::lang.settings.menu_label')) ?></a></li>
<li><a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('system::lang.email_templates.menu_label')) ?></a></li>
<li><a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('system::lang.mail_templates.menu_label')) ?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
@ -11,7 +11,7 @@
<div class="scoreboard">
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.email_templates.template')) ?></h4>
<h4><?= e(trans('system::lang.mail_templates.template')) ?></h4>
<p><?= $formModel->code ?></p>
</div>
</div>
@ -49,7 +49,7 @@
data-load-indicator="Sending test message..."
data-request-confirm="A test message will be sent to <?= e(BackendAuth::getUser()->email) ?>. Continue?"
class="btn btn-info">
<?= e(trans('system::lang.email_templates.test_send')) ?>
<?= e(trans('system::lang.mail_templates.test_send')) ?>
</button>
<button
type="button"
@ -59,7 +59,7 @@
data-request-confirm="Do you really want to delete this template?">
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/emailtemplates') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('system/mailtemplates') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
@ -69,6 +69,6 @@
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('system/emailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.email_templates.return')) ?></a></p>
<p><a href="<?= Backend::url('system/mailtemplates') ?>" class="btn btn-default"><?= e(trans('system::lang.mail_templates.return')) ?></a></p>
<?php endif ?>

View File

@ -3,12 +3,12 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DbSystemEmailTemplates extends Migration
class DbSystemMailTemplates extends Migration
{
public function up()
{
Schema::create('system_email_templates', function(Blueprint $table)
Schema::create('system_mail_templates', function(Blueprint $table)
{
$table->engine = 'InnoDB';
$table->increments('id');
@ -25,7 +25,7 @@ class DbSystemEmailTemplates extends Migration
public function down()
{
Schema::dropIfExists('system_email_templates');
Schema::dropIfExists('system_mail_templates');
}
}

View File

@ -3,12 +3,12 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DbSystemEmailLayouts extends Migration
class DbSystemMailLayouts extends Migration
{
public function up()
{
Schema::create('system_email_layouts', function(Blueprint $table)
Schema::create('system_mail_layouts', function(Blueprint $table)
{
$table->engine = 'InnoDB';
$table->increments('id');
@ -24,7 +24,7 @@ class DbSystemEmailLayouts extends Migration
public function down()
{
Schema::dropIfExists('system_email_layouts');
Schema::dropIfExists('system_mail_layouts');
}
}

View File

@ -15,7 +15,7 @@ class DatabaseSeeder extends Seeder
{
Eloquent::unguard();
$this->call('System\Database\Seeds\SeedSetupEmailLayouts');
$this->call('System\Database\Seeds\SeedSetupMailLayouts');
}
}

View File

@ -1,9 +1,9 @@
<?php namespace System\Database\Seeds;
use Seeder;
use System\Models\EmailLayout;
use System\Models\MailLayout;
class SeedSetupEmailLayouts extends Seeder
class SeedSetupMailLayouts extends Seeder
{
public function run()
@ -37,7 +37,7 @@ $html = '<html>
$text = '{{ message|raw }}';
EmailLayout::create([
MailLayout::create([
'is_locked' => true,
'name' => 'Default',
'code' => 'default',
@ -66,7 +66,7 @@ $text = '{{ message|raw }}
This is an automatic message. Please do not reply to it.
';
EmailLayout::create([
MailLayout::create([
'is_locked' => true,
'name' => 'System',
'code' => 'system',

View File

@ -66,11 +66,11 @@ return [
'update_success' => 'Settings for :name have been updated successfully.',
'return' => 'Return to system settings',
],
'email' => [
'menu_label' => 'Email Configuration',
'mail' => [
'menu_label' => 'Mail Configuration',
'menu_description' => 'Manage email configuration.',
'general' => 'General',
'method' => 'Email Method',
'method' => 'Mail Method',
'sender_name' => 'Sender Name',
'sender_email' => 'Sender Email',
'smtp' => 'SMTP',
@ -85,14 +85,14 @@ return [
'sendmail_path' => 'Sendmail Path',
'sendmail_path_comment' => 'Please specify the path of the sendmail program.',
],
'email_templates' => [
'menu_label' => 'Email Templates',
'menu_description' => 'Modify the email templates that are sent to users and administrators.',
'mail_templates' => [
'menu_label' => 'Mail Templates',
'menu_description' => 'Modify the mail templates that are sent to users and administrators.',
'new_template' => 'New Template',
'new_layout' => 'New Layout',
'template' => 'Template',
'templates' => 'Templates',
'menu_layouts_label' => 'Email Layouts',
'menu_layouts_label' => 'Mail Layouts',
'layout' => 'Layout',
'layouts' => 'Layouts',
'name' => 'Name',

View File

@ -75,7 +75,7 @@ return [
'sendmail_path' => 'Caminho do Sendmail',
'sendmail_path_comment' => 'Por favor, especifique o caminho do programa sendmail.',
],
'email_templates' => [
'mail_templates' => [
'menu_label' => 'Modelos de E-mail',
'menu_description' => 'Modificar os modelos de e-mail que são enviados para usuários e administradores.',
'new_template' => 'Novo modelo',

View File

@ -75,7 +75,7 @@ return [
'sendmail_path' => 'Sendmail Путь',
'sendmail_path_comment' => 'Пожалуйста, укажите путь к sendmail.',
],
'email_templates' => [
'mail_templates' => [
'menu_label' => 'Шаблоны почты',
'menu_description' => 'Изменение шаблонов писем, отправляемых пользователям и администраторам.',
'new_template' => 'Новый шаблон',

View File

@ -3,15 +3,15 @@
use Model;
use System\Classes\ApplicationException;
class EmailLayout extends Model
class MailLayout extends Model
{
/**
* @var string The database table used by the model.
*/
protected $table = 'system_email_layouts';
protected $table = 'system_mail_layouts';
public $rules = [
'code' => 'required|unique:system_email_layouts',
'code' => 'required|unique:system_mail_layouts',
'name' => 'required',
'content_html' => 'required',
];

View File

@ -3,11 +3,11 @@
use App;
use Model;
class EmailSettings extends Model
class MailSettings extends Model
{
public $implement = ['System.Behaviors.SettingsModel'];
public $settingsCode = 'system_email_settings';
public $settingsCode = 'system_mail_settings';
public $settingsFields = 'fields.yaml';
const MODE_MAIL = 'mail';

View File

@ -7,26 +7,26 @@ use Model;
use October\Rain\Mail\MailParser;
use System\Classes\PluginManager;
class EmailTemplate extends Model
class MailTemplate extends Model
{
/**
* @var string The database table used by the model.
*/
protected $table = 'system_email_templates';
protected $table = 'system_mail_templates';
public $rules = [
'code' => 'required|unique:system_email_templates',
'code' => 'required|unique:system_mail_templates',
'subject' => 'required',
'description' => 'required',
'content_html' => 'required',
];
public $belongsTo = [
'layout' => ['System\Models\EmailLayout']
'layout' => ['System\Models\MailLayout']
];
/**
* @var array A cache of customised email templates.
* @var array A cache of customised mail templates.
*/
protected static $cache = [];
@ -58,7 +58,7 @@ class EmailTemplate extends Model
* Create new templates
*/
if (count($newTemplates))
$categories = EmailLayout::lists('id', 'code');
$categories = MailLayout::lists('id', 'code');
foreach ($newTemplates as $code => $description) {
$sections = self::getTemplateSections($code);
@ -138,7 +138,7 @@ class EmailTemplate extends Model
//
/**
* Loads registered email templates from modules and plugins
* Loads registered mail templates from modules and plugins
* @return void
*/
public function loadRegisteredTemplates()
@ -149,11 +149,11 @@ class EmailTemplate extends Model
$plugins = PluginManager::instance()->getPlugins();
foreach ($plugins as $pluginId => $pluginObj) {
$templates = $pluginObj->registerEmailTemplates();
$templates = $pluginObj->registerMailTemplates();
if (!is_array($templates))
continue;
$this->registerEmailTemplates($templates);
$this->registerMailTemplates($templates);
}
}
@ -170,13 +170,13 @@ class EmailTemplate extends Model
}
/**
* Registers a callback function that defines email templates.
* Registers a callback function that defines mail templates.
* The callback function should register templates by calling the manager's
* registerEmailTemplates() function. Thi instance is passed to the
* registerMailTemplates() function. Thi instance is passed to the
* callback function as an argument. Usage:
* <pre>
* EmailTemplate::registerCallback(function($template){
* $template->registerEmailTemplates([...]);
* MailTemplate::registerCallback(function($template){
* $template->registerMailTemplates([...]);
* });
* </pre>
* @param callable $callback A callable function.
@ -187,9 +187,9 @@ class EmailTemplate extends Model
}
/**
* Registers email views and manageable templates.
* Registers mail views and manageable templates.
*/
public function registerEmailTemplates(array $definitions)
public function registerMailTemplates(array $definitions)
{
if (!static::$registeredTemplates)
static::$registeredTemplates = [];

View File

@ -1,55 +0,0 @@
# ===================================
# Field Definitions
# ===================================
tabs:
fields:
send_mode:
label: system::lang.email.method
type: dropdown
tab: system::lang.email.general
sender_name:
label: system::lang.email.sender_name
span: auto
tab: system::lang.email.general
sender_email:
label: system::lang.email.sender_email
span: auto
tab: system::lang.email.general
smtp_address:
label: system::lang.email.smtp_address
tab: system::lang.email.smtp
smtp_authorization:
type: checkbox
label: system::lang.email.smtp_authorization
tab: system::lang.email.smtp
comment: system::lang.email.smtp_authorization_comment
smtp_user:
label: system::lang.email.smtp_username
tab: system::lang.email.smtp
span: left
smtp_password:
label: system::lang.email.smtp_password
tab: system::lang.email.smtp
span: right
smtp_port:
label: system::lang.email.smtp_port
tab: system::lang.email.smtp
smtp_ssl:
type: checkbox
label: system::lang.email.smtp_ssl
tab: system::lang.email.smtp
sendmail_path:
label: system::lang.email.sendmail_path
commentAbove: system::lang.email.sendmail_path_comment
tab: system::lang.email.sendmail

View File

@ -5,17 +5,17 @@
fields:
code:
label: system::lang.email_templates.code
comment: system::lang.email_templates.code_comment
label: system::lang.mail_templates.code
comment: system::lang.mail_templates.code_comment
span: left
context: create
name@create:
label: system::lang.email_templates.name
label: system::lang.mail_templates.name
span: right
name@update:
label: system::lang.email_templates.name
label: system::lang.mail_templates.name
secondaryTabs:
fields:
@ -23,16 +23,16 @@ secondaryTabs:
content_html:
type: codeeditor
size: giant
tab: system::lang.email_templates.content_html
tab: system::lang.mail_templates.content_html
language: html
content_css:
type: codeeditor
size: giant
tab: system::lang.email_templates.content_css
tab: system::lang.mail_templates.content_css
language: css
content_text:
type: textarea
size: giant
tab: system::lang.email_templates.content_text
tab: system::lang.mail_templates.content_text

View File

@ -0,0 +1,55 @@
# ===================================
# Field Definitions
# ===================================
tabs:
fields:
send_mode:
label: system::lang.mail.method
type: dropdown
tab: system::lang.mail.general
sender_name:
label: system::lang.mail.sender_name
span: auto
tab: system::lang.mail.general
sender_email:
label: system::lang.mail.sender_email
span: auto
tab: system::lang.mail.general
smtp_address:
label: system::lang.mail.smtp_address
tab: system::lang.mail.smtp
smtp_authorization:
type: checkbox
label: system::lang.mail.smtp_authorization
tab: system::lang.mail.smtp
comment: system::lang.mail.smtp_authorization_comment
smtp_user:
label: system::lang.mail.smtp_username
tab: system::lang.mail.smtp
span: left
smtp_password:
label: system::lang.mail.smtp_password
tab: system::lang.mail.smtp
span: right
smtp_port:
label: system::lang.mail.smtp_port
tab: system::lang.mail.smtp
smtp_ssl:
type: checkbox
label: system::lang.mail.smtp_ssl
tab: system::lang.mail.smtp
sendmail_path:
label: system::lang.mail.sendmail_path
commentAbove: system::lang.mail.sendmail_path_comment
tab: system::lang.mail.sendmail

View File

@ -5,27 +5,27 @@
fields:
layout:
label: system::lang.email_templates.layout
label: system::lang.mail_templates.layout
type: relation
options:
emptyOption: -- No layout --
code:
label: system::lang.email_templates.code
comment: system::lang.email_templates.code_comment
label: system::lang.mail_templates.code
comment: system::lang.mail_templates.code_comment
span: left
context: create
subject@create:
label: system::lang.email_templates.subject
comment: system::lang.email_templates.subject_comment
label: system::lang.mail_templates.subject
comment: system::lang.mail_templates.subject_comment
span: right
subject@update:
label: system::lang.email_templates.subject
label: system::lang.mail_templates.subject
description:
label: system::lang.email_templates.description
label: system::lang.mail_templates.description
type: textarea
size: tiny
@ -35,9 +35,9 @@ secondaryTabs:
content_html:
type: richeditor
size: huge
tab: system::lang.email_templates.content_html
tab: system::lang.mail_templates.content_html
content_text:
type: textarea
size: huge
tab: system::lang.email_templates.content_text
tab: system::lang.mail_templates.content_text