[REVERT][TASK] new changes Mail

This reverts commit 9ba671cfd0ce4cd245933225b645f7761291cb8e.
This commit is contained in:
Philipp Dieter 2024-07-18 10:56:02 +02:00
parent 9ba671cfd0
commit 0045f87815
2 changed files with 55 additions and 80 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

@ -15,7 +15,7 @@
</f:if> </f:if>
<f:if condition="{buttonBackgroundcolor}"> <f:if condition="{buttonBackgroundcolor}">
<f:else> <f:else>
<f:variable name="buttonBackgroundcolor" value="#007D5A" /> <f:variable name="buttonBackgroundcolor" value="#8ABF6F" />
</f:else> </f:else>
</f:if> </f:if>
<f:variable name="widthPadded" value="{width - padding - padding}" /> <f:variable name="widthPadded" value="{width - padding - padding}" />
@ -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,11 +77,11 @@
<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">
<h1 style="margin-bottom: 20px;margin-top: 40px;font-size: 24px;line-height: 30px;">{row.data -> f:format.nl2br() -> f:format.raw()}</h1> <h1>{row.data -> f:format.nl2br() -> f:format.raw()}</h1>
</f:case> </f:case>
<f:case value="headline2"> <f:case value="headline2">
<h2>{row.data -> f:format.nl2br() -> f:format.raw()}</h2> <h2>{row.data -> f:format.nl2br() -> f:format.raw()}</h2>
@ -91,7 +103,7 @@
<span style="display: inline-block;" class="buttonwrapper"> <span style="display: inline-block;" class="buttonwrapper">
<f:variable name="rowData">{row.data -> v:format.json.decode()}</f:variable> <f:variable name="rowData">{row.data -> v:format.json.decode()}</f:variable>
<a style="display: inline-block; color: {buttonColor}" target="_blank" href="{rowData.0}"> <a style="display: inline-block; color: {buttonColor}" target="_blank" href="{rowData.0}">
<span style="display: inline-block; padding: 9px 24px; border-radius: 20px; background-color: {buttonBackgroundcolor};font-weight:bold;font-size:16px;line-height:1.5"> <span style="display: inline-block; padding: 10px 15px; border-radius: 3px; background-color: {buttonBackgroundcolor};">
{rowData.1} {rowData.1}
</span> </span>
</a> </a>
@ -103,11 +115,39 @@
</span> </span>
</f:case> </f:case>
<f:case value="hr"> <f:case value="hr">
<p style="border-top:solid 2px #025093;margin:10px auto;width:100%;"> <p style="border-top:solid 1px #bababa;font-size:1px;margin:13px auto;width:100%;">
</p> </p>
<!--[if mso | IE]>
&nbsp;
<table
align="center"
border="0"
cellpadding="0"
cellspacing="0"
style="border-top:solid 1px #bababa;font-size:1px;margin:13px auto;width:100%;"
role="presentation"
width="550px"
>
<tr>
<td style="height:0;line-height:0;">
&nbsp;
</td>
</tr>
</table>
&nbsp;
<![endif]-->
</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:case>
<f:defaultCase> <f:defaultCase>
<p style="margin: 20px 0;">{row.data -> f:format.nl2br() -> f:format.raw()}</p> <p>{row.data -> f:format.nl2br() -> f:format.raw()}</p>
</f:defaultCase> </f:defaultCase>
</f:switch> </f:switch>
</div> </div>