mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-08 14:16:54 +02:00
Email Templates Plugin - Updates #2
This commit is contained in:
@@ -9,13 +9,13 @@ Navigation::add(__('Emails', 'emails'), 'system', 'emails', 5);
|
|||||||
class EmailsAdmin extends Backend
|
class EmailsAdmin extends Backend
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Main Sandbox admin function
|
* Main Emails admin function
|
||||||
*/
|
*/
|
||||||
public static function main()
|
public static function main()
|
||||||
{
|
{
|
||||||
//
|
// Init vars
|
||||||
// Do something here...
|
$email_templates_path = STORAGE . DS . 'emails' . DS;
|
||||||
//
|
$email_templates_list = array();
|
||||||
|
|
||||||
// Check for get actions
|
// Check for get actions
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
@@ -27,19 +27,46 @@ class EmailsAdmin extends Backend
|
|||||||
|
|
||||||
// Plugin action
|
// Plugin action
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
case "edit":
|
case "edit_email_template":
|
||||||
//
|
|
||||||
// Do something here...
|
if (Request::post('edit_email_template') || Request::post('edit_email_template_and_exit') ) {
|
||||||
//
|
|
||||||
|
if (Security::check(Request::post('csrf'))) {
|
||||||
|
|
||||||
|
// Save Email Template
|
||||||
|
File::setContent(STORAGE . DS . 'emails' . DS . Request::post('email_template_name') .'.email.php', Request::post('email_template_content'));
|
||||||
|
|
||||||
|
Notification::set('success', __('Your changes to the email template <i>:name</i> have been saved.', 'emails', array(':name' => Request::post('email_template_name'))));
|
||||||
|
|
||||||
|
if (Request::post('edit_email_template_and_exit')) {
|
||||||
|
Request::redirect('index.php?id=emails');
|
||||||
|
} else {
|
||||||
|
Request::redirect('index.php?id=emails&action=edit_email_template&filename='.Request::post('email_template_name'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$email_template_content = File::getContent($email_templates_path.Request::get('filename').'.email.php');
|
||||||
|
|
||||||
|
// Display view
|
||||||
|
View::factory('box/emails/views/backend/edit')
|
||||||
|
->assign('email_template_content', Text::toHtml($email_template_content))
|
||||||
|
->display();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Display view
|
// Get email templates
|
||||||
View::factory('box/emails/views/backend/index')->display();
|
$email_templates_list = File::scan($email_templates_path, '.email.php');
|
||||||
}
|
|
||||||
|
|
||||||
|
// Display view
|
||||||
|
View::factory('box/emails/views/backend/index')
|
||||||
|
->assign('email_templates_list', $email_templates_list)
|
||||||
|
->display();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user