/**
  * Get fields for the form's SObject type
  * @param object
  * @return array
  */
 public function getSObjectFields($dc)
 {
     $arrOptions = array();
     $objFormField = \FormFieldModel::findByPk($dc->id);
     if ($objFormField === null) {
         return $arrOptions;
     }
     $objForm = \FormModel::findByPk($objFormField->pid);
     if ($objForm === null) {
         return $arrOptions;
     }
     if ($objForm->useSalesforce && $objForm->salesforceAPIConfig && $objForm->salesforceSObject) {
         try {
             $objClient = Salesforce::getClient($objForm->salesforceAPIConfig);
             $arrConfig = $GLOBALS['TL_SOBJECTS'][$objForm->salesforceSObject];
             $strClass = $arrConfig['class'];
             if (class_exists($strClass)) {
                 $objResults = $objClient->describeSObjects(array($strClass::getType()));
                 $arrFields = $objResults[0]->getFields();
                 foreach ($arrFields as $field) {
                     if (!$field->isCreateable()) {
                         continue;
                     }
                     $arrOptions[$field->getName()] = $field->getName();
                 }
             }
         } catch (\Exception $e) {
         }
     }
     return $arrOptions;
 }
 /**
  * Generate the checkout step
  * @return  string
  */
 public function generate()
 {
     $this->objForm = new Form($this->objModule->getFormId(), 'POST', function ($haste) {
         return \Input::post('FORM_SUBMIT') === $haste->getFormId();
     });
     if ($this->objModule->iso_order_conditions) {
         $objFormConfig = \FormModel::findByPk($this->objModule->iso_order_conditions);
         if (null === $objFormConfig) {
             throw new \InvalidArgumentException('Order condition form "' . $this->objModule->iso_order_conditions . '" not found.');
         }
         $this->objForm->setTableless($objFormConfig->tableless);
         $this->objForm->addFieldsFromFormGenerator($this->objModule->iso_order_conditions, function ($strName, &$arrDca) {
             $arrDca['value'] = $_SESSION['FORM_DATA'][$strName] ?: $arrDca['value'];
             return true;
         });
     }
     if (!empty($GLOBALS['ISO_HOOKS']['orderConditions']) && is_array($GLOBALS['ISO_HOOKS']['orderConditions'])) {
         foreach ($GLOBALS['ISO_HOOKS']['orderConditions'] as $callback) {
             \System::importStatic($callback[0])->{$callback[1]}($this->objForm, $this->objModule);
         }
     }
     if (!$this->objForm->hasFields()) {
         $this->blnError = false;
         return '';
     }
     // Change enctype if there are uploads
     if ($this->objForm->hasUploads()) {
         $this->objModule->Template->enctype = 'multipart/form-data';
     }
     if ($this->objForm->isSubmitted()) {
         $this->blnError = !$this->objForm->validate();
         $_SESSION['FORM_DATA'] = is_array($_SESSION['FORM_DATA']) ? $_SESSION['FORM_DATA'] : array();
         foreach (array_keys($this->objForm->getFormFields()) as $strField) {
             if ($this->objForm->getWidget($strField) instanceof \uploadable) {
                 $arrFile = $_SESSION['FILES'][$strField];
                 $varValue = str_replace(TL_ROOT . '/', '', dirname($arrFile['tmp_name'])) . '/' . rawurlencode($arrFile['name']);
             } else {
                 $varValue = $this->objForm->fetch($strField);
             }
             $_SESSION['FORM_DATA'][$strField] = $varValue;
         }
     } else {
         $blnError = false;
         foreach (array_keys($this->objForm->getFormFields()) as $strField) {
             // Clone widget because otherwise we add errors to the original widget instance
             $objClone = clone $this->objForm->getWidget($strField);
             $objClone->validate();
             if ($objClone->hasErrors()) {
                 $blnError = true;
                 break;
             }
         }
         $this->blnError = $blnError;
     }
     $objTemplate = new \Isotope\Template('iso_checkout_order_conditions');
     $this->objForm->addToTemplate($objTemplate);
     return $objTemplate->parse();
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function generate()
 {
     if (TL_MODE === 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $subform = \FormModel::findByPk($this->subform);
         $template->wildcard = sprintf('### %s ###', $GLOBALS['TL_LANG']['tl_form_field']['subform'][0]);
         $template->id = $this->id;
         $template->link = $subform->title;
         $template->href = sprintf('contao/main.php?do=form&table=tl_form_field&id=%s&rt=%s', $this->subform, \RequestToken::get());
         return $template->parse();
     }
     return '';
 }
 public function generateTokenLink($arrToSave, &$arrFiles, $intOldId, &$arrForm, $arrLabels)
 {
     $this->arrSubmitted = $arrToSave;
     // generate token & token link
     if (($objForm = \FormModel::findByPk($arrForm['id'])) !== null && ($objPageActivation = \PageModel::findByPk($objForm->jumpTo_activation)) !== null) {
         $strToken = md5(uniqid(mt_rand(), true));
         $this->arrSubmitted[$objForm->formFieldToken] = $strToken;
         $strTokenLink = rtrim(\Environment::get('base'), '/') . '/' . $this->generateFrontendUrl($objPageActivation->row()) . '?token=' . $strToken . '&vid=' . $arrForm['id'];
         $this->arrSubmitted[$objForm->formFieldTokenLink] = $strTokenLink;
     }
     // add recipient if field's been checked
     if ($this->arrSubmitted[$objForm->formFieldNewsletter] == 'yes' && $this->arrSubmitted['email']) {
         $this->addRecipient($this->arrSubmitted['email'], deserialize($objForm->newsletters, true), $objForm->newsletterSubscribeMailText, $objForm->newsletterSubscribeJumpTo);
     }
     return $this->arrSubmitted;
 }
Esempio n. 5
0
 /**
  * Generate the checkout step
  * @return  string
  */
 public function generate()
 {
     $objFormConfig = \FormModel::findByPk($this->objModule->iso_order_conditions);
     $this->objForm = new Form($this->objModule->getFormId(), 'POST', function ($haste) {
         return \Input::post('FORM_SUBMIT') === $haste->getFormId();
     }, (bool) $objFormConfig->tableless);
     // Don't catch the exception here because we want it to be shown to the user
     $this->objForm->addFieldsFromFormGenerator($this->objModule->iso_order_conditions, function ($strName, &$arrDca) {
         $arrDca['value'] = $_SESSION['FORM_DATA'][$strName] ?: $arrDca['value'];
         return true;
     });
     // Change enctype if there are uploads
     if ($this->objForm->hasUploads()) {
         $this->objModule->Template->enctype = 'multipart/form-data';
     }
     if ($this->objForm->isSubmitted()) {
         $this->blnError = !$this->objForm->validate();
         $_SESSION['FORM_DATA'] = is_array($_SESSION['FORM_DATA']) ? $_SESSION['FORM_DATA'] : array();
         foreach (array_keys($this->objForm->getFormFields()) as $strField) {
             if ($this->objForm->getWidget($strField) instanceof \uploadable) {
                 $arrFile = $_SESSION['FILES'][$strField];
                 $varValue = str_replace(TL_ROOT . '/', '', dirname($arrFile['tmp_name'])) . '/' . rawurlencode($arrFile['name']);
             } else {
                 $varValue = $this->objForm->fetch($strField);
             }
             $_SESSION['FORM_DATA'][$strField] = $varValue;
         }
     } else {
         $blnError = false;
         foreach (array_keys($this->objForm->getFormFields()) as $strField) {
             // Clone widget because otherwise we add errors to the original widget instance
             $objClone = clone $this->objForm->getWidget($strField);
             $objClone->validate();
             if ($objClone->hasErrors()) {
                 $blnError = true;
                 break;
             }
         }
         $this->blnError = $blnError;
     }
     $objTemplate = new \Isotope\Template('iso_checkout_order_conditions');
     $this->objForm->addToTemplate($objTemplate);
     return $objTemplate->parse();
 }
 public function compile()
 {
     if (($strToken = \Input::get('token')) && ($strVotingId = \Input::get('vid')) && ($objForm = \FormModel::findByPk($strVotingId)) !== null) {
         $db = \Database::getInstance();
         $objTokenCheck = $db->prepare('SELECT * FROM tl_formdata_details fdt INNER JOIN tl_formdata fd ON fdt.pid=fd.id INNER JOIN tl_form f ON fd.form=f.title WHERE fdt.ff_name=? AND fdt.value=? AND f.id=?')->limit(1)->execute($objForm->formFieldToken, $strToken, $strVotingId);
         if ($objTokenCheck->numRows > 0) {
             // check if already activated
             $objTokenCheckActivated = $db->prepare('SELECT * FROM tl_formdata_details WHERE ff_name=? AND pid=?')->limit(1)->execute($objForm->formFieldActivated, $objTokenCheck->pid);
             if ($objTokenCheckActivated->numRows > 0) {
                 if ($objTokenCheckActivated->value) {
                     $this->Template->message = array(MESSAGE_WARNING, $GLOBALS['TL_LANG']['email_voting']['tokenAlreadyUsed']);
                 } else {
                     $this->Template->message = array(MESSAGE_SUCCESS, $GLOBALS['TL_LANG']['email_voting']['votingSuccessful']);
                     $db->prepare('UPDATE tl_formdata_details SET value=? WHERE ff_name=? AND pid=?')->execute(time(), $objForm->formFieldActivated, $objTokenCheck->pid);
                 }
             }
         } else {
             $this->Template->message = array(MESSAGE_ERROR, $GLOBALS['TL_LANG']['email_voting']['tokenNotFound']);
         }
     }
 }
Esempio n. 7
0
 /**
  * Replace InsertTags.
  *
  * @param string $tag
  *
  * @return int|false
  */
 public function replaceTags($tag)
 {
     if (strpos($tag, 'mp_forms::') === false) {
         return false;
     }
     $chunks = explode('::', $tag);
     $formId = $chunks[1];
     $value = $chunks[2];
     $form = \FormModel::findByPk($formId);
     $manager = new MPFormsFormManager($form->id);
     switch ($value) {
         case 'current':
             return (int) $manager->getCurrentStep() + 1;
         case 'total':
             return $manager->getNumberOfSteps();
         case 'percentage':
             return ($manager->getCurrentStep() + 1) / $manager->getNumberOfSteps() * 100;
         case 'numbers':
             return $manager->getCurrentStep() + 1 . ' / ' . $manager->getNumberOfSteps();
     }
 }
 /**
  * Load form model from database.
  *
  * @param int $formId The form id.
  *
  * @return \FormModel|null
  */
 public function getForm($formId)
 {
     return \FormModel::findByPk($formId);
 }
Esempio n. 9
0
 /**
  * Send the notification
  */
 public function sendNotification()
 {
     if (!\Input::get('master') || !\Leads\NotificationCenterIntegration::available(true)) {
         \Controller::redirect('contao/main.php?act=error');
     }
     // No need to check for null as NotificationCenterIntegration::available(true) already does
     $notificationsCollection = \NotificationCenter\Model\Notification::findBy('type', 'core_form');
     $notifications = [];
     // Generate the notifications
     foreach ($notificationsCollection as $notification) {
         $notifications[$notification->id] = $notification->title;
     }
     // Process the form
     if ('tl_leads_notification' === \Input::post('FORM_SUBMIT')) {
         /**
          * @var \FormModel                             $form
          * @var \NotificationCenter\Model\Notification $notification
          */
         if (!isset($notifications[\Input::post('notification')]) || !is_array(\Input::post('IDS')) || ($form = \FormModel::findByPk(\Input::get('master'))) === null || null === ($notification = \NotificationCenter\Model\Notification::findByPk(\Input::post('notification')))) {
             \Controller::reload();
         }
         if (\Input::get('id')) {
             $ids = [(int) \Input::get('id')];
         } else {
             $session = \Session::getInstance()->getData();
             $ids = array_map('intval', $session['CURRENT']['IDS']);
         }
         foreach ($ids as $id) {
             if (\Leads\NotificationCenterIntegration::send($id, $form, $notification)) {
                 \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_lead']['notification_confirm'], $id));
             }
         }
         \Controller::redirect($this->getReferer());
     }
     return \Leads\NotificationCenterIntegration::generateForm($notifications, [\Input::get('id')]);
 }
 /**
  * Create a new form manager
  *
  * @param int $formGeneratorId
  */
 function __construct($formGeneratorId)
 {
     $this->formModel = \FormModel::findByPk($formGeneratorId);
     $this->prepareFormFields();
 }
Esempio n. 11
0
    /**
     * Send confirmation mail
     * @param integer $intID ID of record
     * @return string
     */
    public function mail($intID = false)
    {
        $blnSend = false;
        if (strlen(\Input::get('token')) && \Input::get('token') == $this->Session->get('fd_mail_send')) {
            $blnSend = true;
        }
        $strFormFilter = $this->strTable == 'tl_formdata' && strlen($this->strFormKey) ? $this->sqlFormFilter : '';
        $table_alias = $this->strTable == 'tl_formdata' ? ' f' : '';
        if ($intID) {
            $this->intId = $intID;
        }
        $return = '';
        $this->values[] = $this->intId;
        $this->procedure[] = 'id=?';
        $this->blnCreateNewVersion = false;
        // Get current record
        $sqlQuery = "SELECT * " . (!empty($this->arrSqlDetails) ? ', ' . implode(',', array_values($this->arrSqlDetails)) : '') . " FROM " . $this->strTable . $table_alias;
        $sqlWhere = " WHERE id=?";
        if ($sqlWhere != '') {
            $sqlQuery .= $sqlWhere;
        }
        $objRow = \Database::getInstance()->prepare($sqlQuery)->limit(1)->execute($this->intId);
        // Redirect if there is no record with the given ID
        if ($objRow->numRows < 1) {
            $this->log('Could not load record "' . $this->strTable . '.id=' . $this->intId . '"', __METHOD__, TL_ERROR);
            \Controller::redirect('contao/main.php?act=error');
        }
        $arrSubmitted = $objRow->fetchAssoc();
        $arrFiles = array();
        // Form
        $objForm = null;
        $intFormId = 0;
        if (!empty($GLOBALS['TL_DCA'][$this->strTable]['tl_formdata']['detailFields'])) {
            // Try to get the form
            foreach ($GLOBALS['TL_DCA'][$this->strTable]['tl_formdata']['detailFields'] as $strField) {
                if ($objForm !== null) {
                    break;
                }
                if (!empty($GLOBALS['TL_DCA'][$this->strTable]['fields'][$strField]['f_id'])) {
                    $intFormId = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$strField]['f_id'];
                    $objForm = \FormModel::findByPk($intFormId);
                }
            }
        }
        if ($objForm == null) {
            $objForm = \FormModel::findOneBy('title', $arrSubmitted['form']);
        }
        if ($objForm == null) {
            $this->log('Could not load record "tl_form.id=' . $intFormId . '" / "tl_form.title=' . $arrSubmitted['form'] . '"', __METHOD__, TL_ERROR);
            \Controller::redirect('contao/main.php?act=error');
        }
        $arrForm = $objForm->row();
        $arrFormFields = $this->Formdata->getFormfieldsAsArray($arrForm['id']);
        if (empty($arrForm['confirmationMailSubject']) || empty($arrForm['confirmationMailText']) && empty($arrForm['confirmationMailTemplate'])) {
            return '<p class="tl_error">Can not send this form data record.<br>Missing "Subject", "Text of confirmation mail" or "HTML-template for confirmation mail"<br>Please check configuration of form in form generator.</p>';
        }
        $this->loadDataContainer('tl_files');
        $objMailProperties = new \stdClass();
        $objMailProperties->subject = '';
        $objMailProperties->sender = '';
        $objMailProperties->senderName = '';
        $objMailProperties->replyTo = '';
        $objMailProperties->recipients = array();
        $objMailProperties->messageText = '';
        $objMailProperties->messageHtmlTmpl = '';
        $objMailProperties->messageHtml = '';
        $objMailProperties->attachments = array();
        $objMailProperties->skipEmptyFields = false;
        $objMailProperties->skipEmptyFields = $arrForm['confirmationMailSkipEmpty'] ? true : false;
        $blnStoreOptionsValues = $arrForm['efgStoreValues'] ? true : false;
        // Set the sender as given in form configuration
        list($senderName, $sender) = \String::splitFriendlyEmail($arrForm['confirmationMailSender']);
        $objMailProperties->sender = $sender;
        $objMailProperties->senderName = $senderName;
        // Set the 'reply to' address, if given in form configuration
        if (!empty($arrForm['confirmationMailReplyto'])) {
            list($replyToName, $replyTo) = \String::splitFriendlyEmail($arrForm['confirmationMailReplyto']);
            $objMailProperties->replyTo = strlen($replyToName) ? $replyToName . ' <' . $replyTo . '>' : $replyTo;
        }
        // Set recipient(s)
        $recipientFieldName = $arrForm['confirmationMailRecipientField'];
        if (!empty($recipientFieldName) && !empty($arrSubmitted[$recipientFieldName])) {
            $varRecipient = $arrSubmitted[$recipientFieldName];
            // handle efg option 'save options of values' for field types radio, select, checkbox
            if (in_array($arrFormFields[$recipientFieldName]['type'], array('radio', 'select', 'checkbox'))) {
                if (!$blnStoreOptionsValues) {
                    $arrRecipient = $this->Formdata->prepareDatabaseValueForWidget($varRecipient, $arrFormFields[$recipientFieldName], false);
                    if (!empty($arrRecipient)) {
                        $varRecipient = implode(', ', $arrRecipient);
                    }
                    unset($arrRecipient);
                }
            }
            $strSep = isset($arrFormFields[$recipientFieldName]['eval']['csv']) ? $arrFormFields[$recipientFieldName]['eval']['csv'] : '|';
            $varRecipient = str_replace($strSep, ',', $varRecipient);
        }
        if (strlen($varRecipient) || strlen($arrForm['confirmationMailRecipient'])) {
            $arrRecipient = array_merge(trimsplit(',', $varRecipient), trimsplit(',', $arrForm['confirmationMailRecipient']));
        }
        if (\Input::get('recipient')) {
            $arrRecipient = trimsplit(',', \Input::get('recipient'));
        }
        if (is_array($arrRecipient)) {
            $strRecipient = implode(', ', $arrRecipient);
            // handle insert tag {{user::email}} in recipient fields
            if (!is_bool(strpos($strRecipient, "{{user::email}}")) && $arrSubmitted['fd_member'] > 0) {
                $objUser = \Database::getInstance()->prepare("SELECT `email` FROM `tl_member` WHERE id=?")->limit(1)->execute($arrSubmitted['fd_member']);
                $arrRecipient = array_map("str_replace", array_fill(0, count($arrRecipient), "{{user::email}}"), array_fill(0, count($arrRecipient), $objUser->email), $arrRecipient);
            }
            $arrRecipient = array_filter(array_unique($arrRecipient));
        }
        $objMailProperties->recipients = $arrRecipient;
        // Check if we want custom attachments... (Thanks to Torben Schwellnus)
        if ($arrForm['addConfirmationMailAttachments']) {
            if ($arrForm['confirmationMailAttachments']) {
                $arrCustomAttachments = deserialize($arrForm['confirmationMailAttachments'], true);
                if (!empty($arrCustomAttachments)) {
                    foreach ($arrCustomAttachments as $varFile) {
                        $objFileModel = \FilesModel::findById($varFile);
                        if ($objFileModel !== null) {
                            $objFile = new \File($objFileModel->path, true);
                            if ($objFile->size) {
                                $objMailProperties->attachments[TL_ROOT . '/' . $objFile->path] = array('file' => TL_ROOT . '/' . $objFile->path, 'name' => $objFile->basename, 'mime' => $objFile->mime);
                            }
                        }
                    }
                }
            }
        }
        $objMailProperties->subject = \String::decodeEntities($arrForm['confirmationMailSubject']);
        $objMailProperties->messageText = \String::decodeEntities($arrForm['confirmationMailText']);
        $objMailProperties->messageHtmlTmpl = $arrForm['confirmationMailTemplate'];
        // Replace Insert tags and conditional tags
        $objMailProperties = $this->Formdata->prepareMailData($objMailProperties, $arrSubmitted, $arrFiles, $arrForm, $arrFormFields);
        $objEmail = new \Email();
        $objEmail->from = $objMailProperties->sender;
        if (!empty($objMailProperties->senderName)) {
            $objEmail->fromName = $objMailProperties->senderName;
        }
        $objEmail->subject = $objMailProperties->subject;
        if (!empty($objMailProperties->attachments)) {
            foreach ($objMailProperties->attachments as $strFile => $varParams) {
                $strContent = file_get_contents($varParams['file'], false);
                $objEmail->attachFileFromString($strContent, $varParams['name'], $varParams['mime']);
            }
        }
        if (!empty($objMailProperties->messageText)) {
            $objEmail->text = $objMailProperties->messageText;
        }
        if (!empty($objMailProperties->messageHtml)) {
            $objEmail->html = $objMailProperties->messageHtml;
        }
        // Send Mail
        if (strlen(\Input::get('token')) && \Input::get('token') == $this->Session->get('fd_mail_send')) {
            $this->Session->set('fd_mail_send', null);
            $blnSend = true;
            $blnConfirmationSent = false;
            if ($blnSend) {
                // Send e-mail
                if (!empty($objMailProperties->recipients)) {
                    foreach ($objMailProperties->recipients as $recipient) {
                        if (strlen($recipient)) {
                            $recipient = str_replace(array('[', ']'), array('<', '>'), $recipient);
                            $recipientName = '';
                            if (strpos($recipient, '<') > 0) {
                                preg_match('/(.*)?<(\\S*)>/si', $recipient, $parts);
                                $recipientName = trim($parts[1]);
                                $recipient = strlen($recipientName) ? $recipientName . ' <' . $parts[2] . '>' : $parts[2];
                            }
                        }
                        $objEmail->sendTo($recipient);
                        $blnConfirmationSent = true;
                        \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_formdata']['mail_sent'], str_replace(array('<', '>'), array('[', ']'), $recipient)));
                    }
                }
                if ($blnConfirmationSent && isset($this->intId) && intval($this->intId) > 0) {
                    $arrUpd = array('confirmationSent' => '1', 'confirmationDate' => time());
                    $res = \Database::getInstance()->prepare("UPDATE tl_formdata %s WHERE id=?")->set($arrUpd)->execute($this->intId);
                }
            }
        }
        $strToken = md5(uniqid('', true));
        $this->Session->set('fd_mail_send', $strToken);
        $strHint = '';
        if (strlen($objRow->confirmationSent)) {
            if (!$blnSend) {
                if (strlen($objRow->confirmationDate)) {
                    $dateConfirmation = new \Date($objRow->confirmationDate);
                    $strHint .= '<div class="tl_message"><p class="tl_info">' . sprintf($GLOBALS['TL_LANG']['tl_formdata']['confirmation_sent'], $dateConfirmation->date, $dateConfirmation->time) . '</p></div>';
                } else {
                    $strHint .= '<div class="tl_message"><p class="tl_info">' . sprintf($GLOBALS['TL_LANG']['tl_formdata']['confirmation_sent'], '-n/a-', '-n/a-') . '</p></div>';
                }
            }
        }
        // Preview Mail
        $return = '
<div id="tl_buttons">
<a href="' . $this->getReferer(ENCODE_AMPERSANDS) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>

<h2 class="sub_headline">' . $GLOBALS['TL_LANG']['tl_formdata']['mail'][0] . '</h2>' . \Message::generate() . $strHint . '

<form action="' . ampersand(\Environment::get('script'), ENCODE_AMPERSANDS) . '" id="tl_formdata_send" class="tl_form" method="get">
<div class="tl_formbody_edit fd_mail_send">
<input type="hidden" name="do" value="' . \Input::get('do') . '">
<input type="hidden" name="table" value="' . \Input::get('table') . '">
<input type="hidden" name="act" value="' . \Input::get('act') . '">
<input type="hidden" name="id" value="' . \Input::get('id') . '">
<input type="hidden" name="rt" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="token" value="' . $strToken . '">

<table cellpadding="0" cellspacing="0" class="prev_header" summary="">
  <tr class="row_0">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_formdata']['mail_sender'][0] . '</td>
    <td class="col_1">' . $objMailProperties->sender . '</td>
  </tr>

  <tr class="row_1">
    <td class="col_0"><label for="ctrl_formdata_recipient">' . $GLOBALS['TL_LANG']['tl_formdata']['mail_recipient'][0] . '</label></td>
    <td class="col_1"><input name="recipient" type="ctrl_recipient" class="tl_text" value="' . implode(',', $objMailProperties->recipients) . '" ' . ($blnSend ? 'disabled="disabled"' : '') . '></td>
  </tr>

  <tr class="row_2">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_formdata']['mail_subject'][0] . '</td>
    <td class="col_1">' . $objMailProperties->subject . '</td>
  </tr>';
        if (!empty($objMailProperties->attachments)) {
            $attachments = array();
            foreach ($objMailProperties->attachments as $strFile => $arr) {
                $attachments[] = str_replace(TL_ROOT . '/', '', $strFile);
            }
            $return .= '
  <tr class="row_3">
    <td class="col_0" style="vertical-align:top">' . $GLOBALS['TL_LANG']['tl_formdata']['attachments'] . '</td>
    <td class="col_1">' . implode(',<br> ', $attachments) . '</td>
  </tr>';
        }
        $return .= '
</table>

<h3>' . $GLOBALS['TL_LANG']['tl_formdata']['mail_body_plaintext'][0] . '</h3>
<div class="preview_plaintext">
' . nl2br($objMailProperties->messageText) . '
</div>';
        if (!empty($objMailProperties->messageHtml)) {
            $return .= '
<h3>' . $GLOBALS['TL_LANG']['tl_formdata']['mail_body_html'][0] . '</h3>
<div class="preview_html">
' . preg_replace(array('/.*?<body.*?>/si', '/<\\/body>.*$/si'), array('', ''), $objMailProperties->messageHtml) . '
</div>';
        }
        $return .= '
</div>';
        if (!$blnSend) {
            $return .= '
<div class="tl_formbody_submit">

<div class="tl_submit_container">
<input type="submit" id="send" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_formdata']['mail'][0]) . '">
</div>

</div>';
        }
        $return .= '
</form>';
        return $return;
    }