1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Added mail preview window to admin->mailout.

This commit is contained in:
Cameron
2014-10-18 03:19:45 -07:00
parent 9eb415abae
commit f689d6ae9c
4 changed files with 49 additions and 3 deletions

View File

@@ -354,8 +354,15 @@ class mailout_main_ui extends e_admin_ui
function init()
{
$action = varset($_GET['mode'], 'main');
$this->mailAdmin = new mailoutAdminClass($action);
if($_GET['action'] == 'preview')
{
echo $this->previewPage();
exit;
}
if ($this->mailAdmin->loadMailHandlers() == 0)
{
e107::getMessage()->addDebug('No mail handlers loaded!!');
@@ -578,8 +585,25 @@ class mailout_main_ui extends e_admin_ui
}
/**
* Preview the Email.
*/
function previewPage()
{
$mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($_GET['id'])." LIMIT 1");
$data = $this->mailAdmin->dbToMail($mailData);
$eml = array(
'body' => $data['mail_body'],
'template' => $data['mail_send_style']
);
return e107::getEmail()->preview($eml);
exit;
}

View File

@@ -170,7 +170,7 @@ $EMAIL_TEMPLATE['default']['header'] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHT
<html xmlns='http://www.w3.org/1999/xhtml' >
<head>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<style>
<style type='text/css'>
body { padding:10px; background-color: #E1E1E1 }
div#body { padding:10px; width: 800px; background-color: #FFFFFF; border-radius: 5px }
</style>

View File

@@ -594,6 +594,26 @@ class e107Email extends PHPMailer
}
}
/**
* Preview the BODY of an email
* @param $eml - array.
*/
public function preview($eml)
{
if (count($eml))
{
if($error = $this->arraySet($eml)) // Set parameters from list
{
return $error;
}
}
return $this->Body;
}
/**
* Sets one or more parameters from an array. See @see{sendEmail()} for list of parameters

View File

@@ -890,7 +890,9 @@ class mailoutAdminClass extends e107MailManager
if($k == 'mail_body')
{
$text .= $tp->toHtml($val,true);
// $text .= print_a($mailSource,true);
// $text .= $tp->toHtml($val,true);
$text .= "<iframe src='".e_ADMIN."mailout.php?mode=main&action=preview&id=".$mailSource['mail_source_id']."' width='100%' height='350'>Loading...</iframe>";
continue;
}