> <td colspan="2"> </td> </tr> <tr class="adm-detail-required-field hidden-when-show-template-list" <?php echo empty($str_MESSAGE) ? 'style="display: none;"' : ''; ?> > <td colspan="2" align="left"> <div class="adm-detail-content-item-block"> <span class="adm-detail-content-item-block-span"><?php echo GetMessage("sender_chain_edit_field_message"); ?> </span> <?php echo \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_VALUE' => $str_MESSAGE, 'HAVE_USER_ACCESS' => $isUserHavePhpAccess)); ?> <input type="hidden" name="IS_TEMPLATE_LIST_SHOWN" id="IS_TEMPLATE_LIST_SHOWN" value="<?php echo empty($str_MESSAGE) ? "Y" : "N"; ?> "> </div> </td> </tr> <tr class="hidden-when-show-template-list" <?php echo empty($str_MESSAGE) ? 'style="display: none;"' : ''; ?> > <td colspan="2"> </td>
$DB->Commit(); break; case "activate": case "deactivate": $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N"); $dataUpdateDb = \Bitrix\Sender\TemplateTable::update($dataPrimary, $arFields); if (!$dataUpdateDb->isSuccess()) { $LAST_ERROR = $dataUpdateDb->getErrorMessages(); $LAST_ERROR = $LAST_ERROR[0]; $lAdmin->AddGroupError(GetMessage("rub_save_error") . '<br>' . $LAST_ERROR, $ID); } break; } } } $templateListDb = \Bitrix\Sender\TemplateTable::getList(array('select' => array('*'), 'filter' => $arFilter, 'order' => array($by => $order))); $rsData = new CAdminResult($templateListDb, $sTableID); $rsData->NavStart(); $lAdmin->NavText($rsData->GetNavPrint(GetMessage("rub_nav"))); $lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "align" => "right", "default" => true), array("id" => "NAME", "content" => GetMessage("rub_name"), "sort" => "NAME", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("rub_act"), "sort" => "ACTIVE", "default" => true))); while ($arRes = $rsData->NavNext(true, "f_")) { $row =& $lAdmin->AddRow($f_ID, $arRes); $row->AddInputField("NAME", array("size" => 20)); $row->AddViewField("NAME", '<a href="sender_template_edit.php?ID=' . $f_ID . '&lang=' . LANG . '">' . $f_NAME . '</a>'); $row->AddCheckField("ACTIVE"); $arActions = array(); $arActions[] = array("ICON" => "edit", "DEFAULT" => true, "TEXT" => GetMessage("rub_edit"), "ACTION" => $lAdmin->ActionRedirect("sender_template_edit.php?ID=" . $f_ID)); if ($POST_RIGHT >= "W") { $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("rub_del"), "ACTION" => "if(confirm('" . GetMessage('rub_del_conf') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete")); } $arActions[] = array("SEPARATOR" => true);
?> </span> </span> </div> </div> <div id="SENDER_TRIGGER_CHAIN_CONTAINER" class="trigger_chain"> <?php $i = 0; foreach ($chainFieldsList as $chain) { $i++; echo str_replace(array('%SENDER_LETTER_TEMPLATE_BODY_NUM%', '%SENDER_LETTER_TEMPLATE_MESSAGE%'), array($i, \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'CHAIN_MESSAGE_' . $i, 'FIELD_VALUE' => $chain['MESSAGE'], 'HAVE_USER_ACCESS' => !$isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false, 'PERSONALIZE_LIST' => $personalizeList))), getSenderItemContainer($ID, $chain)); } if (count($chainFieldsList) <= 0) { // fix for load editor when no letters \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'EMPTY_CHAIN_MESSAGE', 'FIELD_VALUE' => '', 'HAVE_USER_ACCESS' => !$isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false, 'PERSONALIZE_LIST' => $personalizeList)); } ?> </div> <div class="sender-trigger-add-letter"> <input type="button" onclick="senderLetterContainer.addItem();" value="<?php echo GetMessage("sender_chain_edit_list_add"); ?> "> </div> <div class="sender-trigger-status-mailing sender-trigger-status-mailing-finish"> <div class="sender-trigger-status-mailing-title"><?php echo GetMessage("sender_chain_edit_list_event_end"); ?>
</tr> <?php } ?> <tr class="adm-detail-required-field hidden-when-show-template-list" <?php echo empty($str_CONTENT) ? 'style="display: none;"' : ''; ?> > <td colspan="2" align="left"> <b><?php echo GetMessage("sender_tmpl_edit_field_message"); ?> </b> <?php echo \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'MESSAGE', 'FIELD_VALUE' => $str_CONTENT, 'HAVE_USER_ACCESS' => $isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false)); ?> <input type="hidden" name="IS_TEMPLATE_LIST_SHOWN" id="IS_TEMPLATE_LIST_SHOWN" value="<?php echo empty($str_CONTENT) ? "Y" : "N"; ?> "> </td> </tr> <?php $tabControl->Buttons(array("disabled" => $POST_RIGHT < "W", "back_url" => "sender_template_admin.php?lang=" . LANG)); echo bitrix_sessid_post(); ?> <input type="hidden" name="lang" value="<?php echo LANG; ?> ">
?> > <td colspan="2"> </td> </tr> <tr class="adm-detail-required-field hidden-when-show-template-list" <?php echo empty($str_MESSAGE) ? 'style="display: none;"' : ''; ?> > <td colspan="2" align="left"> <b><?php echo GetMessage("sender_chain_edit_field_message"); ?> </b> <?php echo \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'MESSAGE', 'FIELD_VALUE' => $str_MESSAGE, 'TEMPLATE_TYPE' => $str_TEMPLATE_TYPE, 'TEMPLATE_ID' => $str_TEMPLATE_ID, 'HAVE_USER_ACCESS' => $isUserHavePhpAccess, 'SITE' => $mailingSite['SITE_ID'], 'CHARSET' => $chainCharset)); ?> <input type="hidden" name="IS_TEMPLATE_LIST_SHOWN" id="IS_TEMPLATE_LIST_SHOWN" value="<?php echo empty($str_MESSAGE) ? "Y" : "N"; ?> "> </td> </tr> <tr class="hidden-when-show-template-list" <?php echo empty($str_MESSAGE) ? 'style="display: none;"' : ''; ?> > <td colspan="2"> </td> </tr>
</tr> <?php } ?> <tr class="adm-detail-required-field hidden-when-show-template-list" <?php echo empty($str_CONTENT) ? 'style="display: none;"' : ''; ?> > <td colspan="2" align="left"> <b><?php echo GetMessage("sender_tmpl_edit_field_message"); ?> </b> <?php echo \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'MESSAGE', 'FIELD_VALUE' => $str_CONTENT, 'CONTENT_URL' => '/bitrix/admin/sender_template_admin.php?action=get_template&template_type=USER&template_id=' . $ID . '&lang=' . LANGUAGE_ID . '&' . bitrix_sessid_get(), 'HAVE_USER_ACCESS' => $isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false, 'IS_TEMPLATE_MODE' => false)); ?> <input type="hidden" name="IS_TEMPLATE_LIST_SHOWN" id="IS_TEMPLATE_LIST_SHOWN" value="<?php echo empty($str_CONTENT) ? "Y" : "N"; ?> "> </td> </tr> <?php $tabControl->Buttons(array("disabled" => $POST_RIGHT < "W", "back_url" => "sender_template_admin.php?lang=" . LANG)); echo bitrix_sessid_post(); ?> <input type="hidden" name="lang" value="<?php echo LANG; ?> ">
/** * @return string */ public static function getTemplateListHtml($containerId = 'TEMPLATE_CONTAINER') { static $templateListByType; if (!$templateListByType) { $templateListByType = \Bitrix\Sender\Preset\Template::getListByType(); } $templateTypeList = \Bitrix\Sender\Preset\Template::getTypeList(); ob_start(); ?> <script> BX.ready(function(){ letterManager = new SenderLetterManager; if(!letterManager.get('<?php echo $containerId; ?> ')) { letterManager.add('<?php echo $containerId; ?> ', {'container': BX('<?php echo $containerId; ?> ')}); } }); </script> <div class="sender-template-cont"> <div> <table> <tr> <td style="vertical-align: top;"> <div class="sender-template-type-selector"> <?php $firstTemplateType = null; foreach ($templateTypeList as $templateType => $templateTypeName) { if (!$firstTemplateType) { $firstTemplateType = $templateType; } ?> <div class="sender-template-type-selector-button sender-template-type-selector-button-type-<?php echo $templateType; ?> " data-bx-sender-tmpl-type="<?php echo htmlspecialcharsbx($templateType); ?> "> <?php echo $templateTypeName; ?> </div> <?php } ?> </div> </td> <td style="vertical-align: top;"> <div class="sender-template-list-container"> <?php foreach ($templateTypeList as $templateType => $templateTypeName) { ?> <div id="sender-template-list-type-container-<?php echo $templateType; ?> " class="sender-template-list-type-container sender-template-list-type-container-<?php echo $templateType; ?> " style="display: none;"> <?php /* if($templateType == 'MARKETPLACE') { \Bitrix\Main\Page\Asset::getInstance()->addCss('/bitrix/panel/main/marketplace.css'); ?> <script> function mp_hl(el, show) { if(show) BX.addClass(el, 'mp-over-over'); else BX.removeClass(el, 'mp-over-over'); } BX.ready(function(){ BX.ajax.insertToNode( '/bitrix/admin/update_system_market.php?category=55&lang=ru&mode=list', BX('sender-template-list-type-container-<?=$templateType?>') ); }); </script> <? } else */ if (isset($templateListByType[$templateType])) { foreach ($templateListByType[$templateType] as $templateNum => $template) { $isContentForBlockEditor = TemplateTable::isContentForBlockEditor($template['HTML']); ?> <div class="sender-template-list-type-block"> <div class="sender-template-list-type-block-caption sender-template-list-block-selector" data-bx-sender-tmpl-version="<?php echo $isContentForBlockEditor ? 'block' : 'visual'; ?> " data-bx-sender-tmpl-name="<?php echo htmlspecialcharsbx($template['NAME']); ?> " data-bx-sender-tmpl-type="<?php echo htmlspecialcharsbx($template['TYPE']); ?> " data-bx-sender-tmpl-code="<?php echo htmlspecialcharsbx($template['ID']); ?> " data-bx-sender-tmpl-lang="<?php echo LANGUAGE_ID; ?> "> <a class="sender-link-email" href="javascript: void(0);"> <?php echo htmlspecialcharsbx($template['NAME']); ?> </a> <?php if (!$isContentForBlockEditor) { ?> <br> <span style="font-size: 10px;"><?php echo Loc::getMessage('SENDER_PRESET_TEMPLATE_OLD_EDITOR'); ?> </span> <?php } ?> </div> <div class="sender-template-list-type-block-img sender-template-list-block-selector" data-bx-sender-tmpl-version="<?php echo $isContentForBlockEditor ? 'block' : 'visual'; ?> " data-bx-sender-tmpl-name="<?php echo htmlspecialcharsbx($template['NAME']); ?> " data-bx-sender-tmpl-type="<?php echo htmlspecialcharsbx($template['TYPE']); ?> " data-bx-sender-tmpl-code="<?php echo htmlspecialcharsbx($template['ID']); ?> " data-bx-sender-tmpl-lang="<?php echo LANGUAGE_ID; ?> "> <?php if (!empty($template['ICON'])) { ?> <img src="<?php echo $template['ICON']; ?> "> <?php } ?> </div> <?php if (!empty($template['HTML'])) { ?> <div class="sender-template-message-preview-btn" data-bx-sender-tmpl-name="<?php echo htmlspecialcharsbx($template['NAME']); ?> " data-bx-sender-tmpl-type="<?php echo htmlspecialcharsbx($template['TYPE']); ?> " data-bx-sender-tmpl-code="<?php echo htmlspecialcharsbx($template['ID']); ?> " data-bx-sender-tmpl-lang="<?php echo LANGUAGE_ID; ?> "> <a class="sender-link-email " href="javascript: void(0);"><?php echo Loc::getMessage('SENDER_PRESET_TEMPLATE_BTN_PREVIEW'); ?> </a> </div> <?php } ?> </div> <?php } } ?> <?php if (empty($templateListByType[$templateType])) { ?> <div class="sender-template-list-type-blockempty"> <?php echo Loc::getMessage('SENDER_PRESET_TEMPLATE_NO_TMPL'); ?> </div> <?php } ?> </div> <?php } ?> </div> </td> <td style="vertical-align: top;"> <span class="sender-template-btn-close" title="<?php echo Loc::getMessage('SENDER_PRESET_TEMPLATE_BTN_CLOSE'); ?> "></span> </td> </tr> </table> </div> </div> <?php return ob_get_clean(); }
?> </span> </span> </div> </div> <div id="SENDER_TRIGGER_CHAIN_CONTAINER" class="trigger_chain"> <?php $i = 0; foreach ($chainFieldsList as $chain) { $i++; echo str_replace(array('%SENDER_LETTER_TEMPLATE_BODY_NUM%', '%SENDER_LETTER_TEMPLATE_MESSAGE%', '%sender_letter_template_message%'), array($i, \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'CHAIN_MESSAGE_' . $i, 'FIELD_VALUE' => $chain['MESSAGE'], 'TEMPLATE_TYPE_INPUT' => 'CHAIN[' . $i . '][TEMPLATE_TYPE]', 'TEMPLATE_TYPE' => $chain['TEMPLATE_TYPE'], 'TEMPLATE_ID_INPUT' => 'CHAIN[' . $i . '][TEMPLATE_ID]', 'TEMPLATE_ID' => $chain['TEMPLATE_ID'], 'HAVE_USER_ACCESS' => !$isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false))), getSenderItemContainer($ID, $chain)); } if (count($chainFieldsList) <= 0) { // fix for load editor when no letters \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'EMPTY_CHAIN_MESSAGE', 'FIELD_VALUE' => '', 'HAVE_USER_ACCESS' => !$isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false)); } ?> </div> <div class="sender-trigger-add-letter"> <input type="button" onclick="senderLetterContainer.addItem();" value="<?php echo GetMessage("sender_chain_edit_list_add"); ?> "> </div> <div class="sender-trigger-status-mailing sender-trigger-status-mailing-finish"> <div class="sender-trigger-status-mailing-title"><?php echo GetMessage("sender_chain_edit_list_event_end"); ?>