mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Added mail preview window to admin->mailout.
This commit is contained in:
@@ -354,8 +354,15 @@ class mailout_main_ui extends e_admin_ui
|
|||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
$action = varset($_GET['mode'], 'main');
|
$action = varset($_GET['mode'], 'main');
|
||||||
|
|
||||||
$this->mailAdmin = new mailoutAdminClass($action);
|
$this->mailAdmin = new mailoutAdminClass($action);
|
||||||
|
|
||||||
|
if($_GET['action'] == 'preview')
|
||||||
|
{
|
||||||
|
echo $this->previewPage();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->mailAdmin->loadMailHandlers() == 0)
|
if ($this->mailAdmin->loadMailHandlers() == 0)
|
||||||
{
|
{
|
||||||
e107::getMessage()->addDebug('No mail handlers loaded!!');
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -170,7 +170,7 @@ $EMAIL_TEMPLATE['default']['header'] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHT
|
|||||||
<html xmlns='http://www.w3.org/1999/xhtml' >
|
<html xmlns='http://www.w3.org/1999/xhtml' >
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
|
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
|
||||||
<style>
|
<style type='text/css'>
|
||||||
body { padding:10px; background-color: #E1E1E1 }
|
body { padding:10px; background-color: #E1E1E1 }
|
||||||
div#body { padding:10px; width: 800px; background-color: #FFFFFF; border-radius: 5px }
|
div#body { padding:10px; width: 800px; background-color: #FFFFFF; border-radius: 5px }
|
||||||
</style>
|
</style>
|
||||||
|
@@ -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
|
* Sets one or more parameters from an array. See @see{sendEmail()} for list of parameters
|
||||||
|
@@ -890,7 +890,9 @@ class mailoutAdminClass extends e107MailManager
|
|||||||
|
|
||||||
if($k == 'mail_body')
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user