Compare commits

..

2 Commits

2 changed files with 31 additions and 75 deletions

View File

@ -79,6 +79,10 @@ class MailUtility
$type = 'tableLayout'; $type = 'tableLayout';
$textPart = substr($textPart, 3); $textPart = substr($textPart, 3);
} }
if (substr($textPart, 0, 3) === '---') {
$type = 'divider';
$textPart = substr($textPart, 3);
}
if (substr($textPart, 0, 9) === '%subject ') { if (substr($textPart, 0, 9) === '%subject ') {
$type = 'subject'; $type = 'subject';
$textPart = substr($textPart, 9); $textPart = substr($textPart, 9);
@ -234,6 +238,7 @@ class MailUtility
case 'buttonleft': case 'buttonleft':
case 'buttoncenter': case 'buttoncenter':
case 'buttonright': case 'buttonright':
case 'divider':
case 'hr': case 'hr':
$row['data'] = str_replace( $row['data'] = str_replace(
"\\\n", "\\\n",
@ -310,77 +315,10 @@ class MailUtility
$bodydataText[] = $textRow; $bodydataText[] = $textRow;
$bodydataHtml[] = $htmlRow; $bodydataHtml[] = $htmlRow;
break; break;
//case 'button': case 'contentBlockHtml':
// $row['data'] = str_replace( $htmlRow = $row;
// "\\\n", $bodydataHtml[] = $htmlRow;
// '', break;
// $row['data']
// );
// $htmlRow = $row;
// $htmlRow['data'] = preg_replace_callback(
// '/\[.*\]/mU',
// function($matches) {
// foreach ($matches as $match) {
// $test = preg_replace_callback(
// '/\[(\S*)\s(.*)\]/mU',
// function($matchesInner) {
//
// return '<a href="'
// . $matchesInner[1]
// . '">'
// . $matchesInner[2]
// . '</a>';
// },
// $match
// );
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
// $test, null, 3, true, false
// );
// return $test;
// }
// },
// $htmlRow['data']
// );
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
// $htmlRow['data'], null, 3, true, false
// );
// $htmlRow['data'] = preg_replace_callback(
// '/\*.*\*/mU',
// function($matches) {
// foreach ($matches as $match) {
// return '<b>'
// . substr($match, 1, -1)
// . '</b>';
// }
// },
// $htmlRow['data']
// );
// $textRow = $row;
// $textRow['data'] = preg_replace_callback(
// '/\[.*\]/mU',
// function($matches) {
// foreach ($matches as $match) {
// return preg_replace_callback(
// '/\[(\S*)\s(.*)\]/mU',
// function($matchesInner) {
// if (
// $matchesInner[2] == $matchesInner[1]
// ) {
// return $matchesInner[1];
// }
// return $matchesInner[2]
// . ': '
// . $matchesInner[1];
// },
// $match
// );
// }
// },
// $textRow['data']
// );
// $bodydataText[] = $textRow;
// $bodydataHtml[] = $htmlRow;
// break;
case 'attachment': case 'attachment':
$mail->attach(new \Swift_Attachment( $mail->attach(new \Swift_Attachment(
$row['data'][0], $row['data'][0],
@ -404,9 +342,6 @@ class MailUtility
} }
$textView->assign('content', $bodydataText); $textView->assign('content', $bodydataText);
$htmlView->assign('content', $bodydataHtml); $htmlView->assign('content', $bodydataHtml);
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
// $bodydataHtml, null, 8, true, false
//);
$domain = $settings['mailDomain']; $domain = $settings['mailDomain'];
if ($assetDomain) { if ($assetDomain) {
$domain = $assetDomain; $domain = $assetDomain;

View File

@ -24,12 +24,16 @@
<f:for each="{content}" as="row" key="rowKey" iteration="rowI" > <f:for each="{content}" as="row" key="rowKey" iteration="rowI" >
<v:condition.type.isArray value="{row.data}"> <v:condition.type.isArray value="{row.data}">
<f:else> <f:else>
<f:if condition="{row.type} == 'contentBlockHtml'">
{row.data -> f:format.raw()}
</f:if>
<f:if condition="{v:condition.string.contains(haystack: '{row.type}', needle: 'headline', then: '1')} <f:if condition="{v:condition.string.contains(haystack: '{row.type}', needle: 'headline', then: '1')}
|| {row.type} == 'text' || {row.type} == 'text'
|| {row.type} == 'button' || {row.type} == 'button'
|| {row.type} == 'buttonleft' || {row.type} == 'buttonleft'
|| {row.type} == 'buttoncenter' || {row.type} == 'buttoncenter'
|| {row.type} == 'buttonright' || {row.type} == 'buttonright'
|| {row.type} == 'divider'
|| {row.type} == 'hr' || {row.type} == 'hr'
"> ">
<!--[if mso | IE]> <!--[if mso | IE]>
@ -51,6 +55,14 @@
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%"> <table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody> <tbody>
<tr> <tr>
<f:switch expression="{row.type}">
<f:case value="divider">
<f:variable name='paddingTd' value='20px 0' />
</f:case>
<f:defaultCase>
<f:variable name='paddingTd' value='0' />
</f:defaultCase>
</f:switch>
<td style="vertical-align:top;padding:0;"> <td style="vertical-align:top;padding:0;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style width="100%"> <table border="0" cellpadding="0" cellspacing="0" role="presentation" style width="100%">
<tr> <tr>
@ -65,7 +77,7 @@
<f:variable name='align' value='left' /> <f:variable name='align' value='left' />
</f:defaultCase> </f:defaultCase>
</f:switch> </f:switch>
<td align="{align}" style="font-size:0px;padding:0;word-break:break-word;"> <td align="{align}" style="font-size:0px;padding:{paddingTd};word-break:break-word;">
<div style="font-family:Arial, sans-serif;font-size:16px;line-height:1.4;text-align:{align};color:#000000;"> <div style="font-family:Arial, sans-serif;font-size:16px;line-height:1.4;text-align:{align};color:#000000;">
<f:switch expression="{row.type}"> <f:switch expression="{row.type}">
<f:case value="headline"> <f:case value="headline">
@ -125,6 +137,15 @@
&nbsp; &nbsp;
<![endif]--> <![endif]-->
</f:case> </f:case>
<f:case value="divider">
<p style="border-top:solid 2px #025093;font-size:1px;margin:0px auto;width:100%;">
</p>
<!--[if mso | IE]>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="border-top:solid 2px #025093;font-size:1px;margin:0px auto;width:550px;" role="presentation" width="550px" >
<tr><td style="height:0;line-height:0;"> &nbsp; </td></tr>
</table>
<![endif]-->
</f:case>
<f:defaultCase> <f:defaultCase>
<p>{row.data -> f:format.nl2br() -> f:format.raw()}</p> <p>{row.data -> f:format.nl2br() -> f:format.raw()}</p>
</f:defaultCase> </f:defaultCase>