Example #1
0
            LocalRedirect('sender_mailing_wizard.php?IS_TRIGGER=N&step=' . $step . '&MAILING_ID=' . $MAILING_ID . "&MAILING_CHAIN_ID=" . $MAILING_CHAIN_ID . "&lang=" . LANGUAGE_ID);
        } else {
            $DB->InitTableVarsForEdit("b_sender_mailing_chain", "", "str_");
        }
    } else {
    }
    $arMailngChainAttachment = array();
    if ($ID > 0) {
        $attachmentFileDb = \Bitrix\Sender\MailingAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('CHAIN_ID' => $ID)));
        while ($ar = $attachmentFileDb->fetch()) {
            if ($arFileFetch = CFile::GetFileArray($ar['FILE_ID'])) {
                $arMailngChainAttachment[] = $arFileFetch;
            }
        }
    }
    \Bitrix\Sender\PostingRecipientTable::setPersonalizeList(\Bitrix\Sender\MailingTable::getPersonalizeList($MAILING_ID));
    $templateListHtml = \Bitrix\Sender\Preset\Template::getTemplateListHtml('tabControl_layout');
}
if ($step == 'chain_send_type') {
    $ID = $MAILING_CHAIN_ID;
    IncludeModuleLangFile(dirname(__FILE__) . "/mailing_chain_edit.php");
    $DAYS_OF_WEEK = empty($DAYS_OF_WEEK) ? '' : implode(',', $DAYS_OF_WEEK);
    if ($REQUEST_METHOD == "POST" && !$isPostedFormProcessed && check_bitrix_sessid()) {
        $arFields = array("REITERATE" => "N", "AUTO_SEND_TIME" => "", "DAYS_OF_WEEK" => "", "DAYS_OF_MONTH" => "", "TIMES_OF_DAY" => "");
        switch ($SEND_TYPE) {
            case 'MANUAL':
                break;
            case 'TIME':
                if (empty($AUTO_SEND_TIME)) {
                    $arError[] = GetMessage("sender_chain_edit_error_empty_time");
                }
Example #2
0
    /**
     * @param array $arParams
     * @return string
     */
    public static function initEditor(array $arParams)
    {
        $fieldName = $arParams['FIELD_NAME'];
        $fieldValue = $arParams['FIELD_VALUE'];
        $isUserHavePhpAccess = $arParams['HAVE_USER_ACCESS'];
        $showSaveTemplate = isset($arParams['SHOW_SAVE_TEMPLATE']) ? $arParams['SHOW_SAVE_TEMPLATE'] : true;
        if (!empty($arParams['PERSONALIZE_LIST']) && is_array($arParams['PERSONALIZE_LIST'])) {
            PostingRecipientTable::setPersonalizeList($arParams['PERSONALIZE_LIST']);
        }
        \CJSCore::RegisterExt("editor_mailblock", array("js" => "/bitrix/js/sender/editor_mailblock.js", "rel" => array()));
        static $isInit;
        $editorHeight = 650;
        $editorWidth = '100%';
        ob_start();
        if (\Bitrix\Main\Config\Option::get('fileman', 'use_editor_3') == 'Y') {
            \Bitrix\Main\Loader::includeModule('fileman');
            \CJSCore::Init(array("editor_mailblock"));
            ?>
		<script>
			//BX.ready(function(){
				<?php 
            if (!$isInit) {
                $isInit = true;
                ?>
					letterManager = new SenderLetterManager;
					letterManager.setMailBlockList(<?php 
                echo \CUtil::PhpToJSObject(\Bitrix\Sender\Preset\MailBlock::getBlockForVisualEditor());
                ?>
);
				<?php 
            }
            ?>
			//});

			BX.message({"BXEdMailBlocksTitle" : "<?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_MAILBLOCK');
            ?>
"});
			BX.message({"BXEdMailBlocksSearchPlaceHolder" : "<?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_MAILBLOCK_SEARCH');
            ?>
"});
		</script>
		<?php 
            \CFileMan::AddHTMLEditorFrame($fieldName, $fieldValue, false, "html", array('height' => $editorHeight, 'width' => $editorWidth), "N", 0, "", "onfocus=\"t=this\"", false, !$isUserHavePhpAccess, false, array('componentFilter' => array('TYPE' => 'mail'), 'limit_php_access' => !$isUserHavePhpAccess));
            ?>
		<?php 
        } else {
            $fieldValue = htmlspecialcharsback($fieldValue);
            ?>
			<br>
			<?php 
            echo Loc::getMessage("SENDER_ENTITY_TEMPLATE_NOTE_OLD_EDITOR", array("%LINK_START%" => '<a href="/bitrix/admin/settings.php?mid=fileman&lang=' . LANGUAGE_ID . '">', "%LINK_END%" => '</a>'));
            ?>
			<br>
			<br>
			<textarea class="typearea" style="width:<?php 
            echo $editorWidth;
            ?>
;height:<?php 
            echo $editorHeight;
            ?>
px;" name="<?php 
            echo $fieldName;
            ?>
" id="bxed_<?php 
            echo $fieldName;
            ?>
" wrap="virtual"><?php 
            echo htmlspecialcharsbx($fieldValue);
            ?>
</textarea>
			<?php 
        }
        if ($showSaveTemplate) {
            ?>
		<script>
			function ToggleTemplateSaveDialog()
			{
				BX('TEMPLATE_ACTION_SAVE_NAME_CONT').value = '';

				var currentDisplay =  BX('TEMPLATE_ACTION_SAVE_NAME_CONT').style.display;
				BX('TEMPLATE_ACTION_SAVE_NAME_CONT').style.display = BX.toggle(currentDisplay, ['inline', 'none']);
			}
		</script>
		<div class="adm-detail-content-item-block-save">
			<span>
				<input type="checkbox" value="Y" name="TEMPLATE_ACTION_SAVE" id="TEMPLATE_ACTION_SAVE" onclick="ToggleTemplateSaveDialog();">
				<label for="TEMPLATE_ACTION_SAVE"><?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_SAVE');
            ?>
</label>
			</span>
			<span id="TEMPLATE_ACTION_SAVE_NAME_CONT" style="display: none;"> <?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_SAVE_NAME');
            ?>
 <input type="text" name="TEMPLATE_ACTION_SAVE_NAME"></span>
		</div>
		<?php 
        }
        return ob_get_clean();
    }
Example #3
0
    /**
     * Init editor
     *
     * @param array $params
     * @return string
     */
    public static function initEditor(array $params)
    {
        $fieldName = $params['FIELD_NAME'];
        $fieldValue = $params['FIELD_VALUE'];
        $isUserHavePhpAccess = $params['HAVE_USER_ACCESS'];
        $showSaveTemplate = isset($params['SHOW_SAVE_TEMPLATE']) ? $params['SHOW_SAVE_TEMPLATE'] : true;
        $site = isset($params['SITE']) ? $params['SITE'] : '';
        $charset = isset($params['CHARSET']) ? $params['CHARSET'] : '';
        $contentUrl = isset($params['CONTENT_URL']) ? $params['CONTENT_URL'] : '';
        $templateTypeInput = isset($params['TEMPLATE_TYPE_INPUT']) ? $params['TEMPLATE_TYPE_INPUT'] : 'TEMPLATE_TYPE';
        $templateIdInput = isset($params['TEMPLATE_ID_INPUT']) ? $params['TEMPLATE_ID_INPUT'] : 'TEMPLATE_ID';
        $templateType = isset($params['TEMPLATE_TYPE']) ? $params['TEMPLATE_TYPE'] : '';
        $templateId = isset($params['TEMPLATE_ID']) ? $params['TEMPLATE_ID'] : '';
        $isTemplateMode = isset($params['IS_TEMPLATE_MODE']) ? (bool) $params['IS_TEMPLATE_MODE'] : true;
        if (!empty($params['PERSONALIZE_LIST']) && is_array($params['PERSONALIZE_LIST'])) {
            PostingRecipientTable::setPersonalizeList($params['PERSONALIZE_LIST']);
        }
        \CJSCore::RegisterExt("editor_mailblock", array("js" => array("/bitrix/js/sender/editor_mailblock.js"), "rel" => array()));
        \CJSCore::Init(array("editor_mailblock"));
        static $isInit;
        $isDisplayBlockEditor = $templateType && $templateId || static::isContentForBlockEditor($fieldValue);
        $editorHeight = 650;
        $editorWidth = '100%';
        ob_start();
        ?>
		<div id="bx-sender-visual-editor-<?php 
        echo $fieldName;
        ?>
" style="<?php 
        if ($isDisplayBlockEditor) {
            ?>
display: none;<?php 
        }
        ?>
">
		<?php 
        if (\Bitrix\Main\Config\Option::get('fileman', 'use_editor_3') == 'Y') {
            \Bitrix\Main\Loader::includeModule('fileman');
            ?>
		<script>
			BX.ready(function(){
				<?php 
            if (!$isInit) {
                $isInit = true;
                ?>
					var letterManager = new SenderLetterManager;
					letterManager.setMailBlockList(<?php 
                echo \CUtil::PhpToJSObject(\Bitrix\Sender\Preset\MailBlock::getBlockForVisualEditor());
                ?>
);
					letterManager.setPlaceHolderList(<?php 
                echo \CUtil::PhpToJSObject(\Bitrix\Sender\PostingRecipientTable::getPersonalizeList());
                ?>
);
				<?php 
            }
            ?>
			});

			BX.message({
				"BXEdMailBlocksTitle" : "<?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_MAILBLOCK');
            ?>
",
				"BXEdMailBlocksSearchPlaceHolder" : "<?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_MAILBLOCK_SEARCH');
            ?>
",
				"BXEdPlaceHolderSelectorTitle" : "<?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_PLACEHOLDER');
            ?>
"
			});
		</script>
		<?php 
            \CFileMan::AddHTMLEditorFrame($fieldName, $fieldValue, false, "text", array('height' => $editorHeight, 'width' => $editorWidth), "N", 0, "", "onfocus=\"t=this\"", false, !$isUserHavePhpAccess, false, array('componentFilter' => array('TYPE' => 'mail'), 'limit_php_access' => !$isUserHavePhpAccess));
            ?>
		<?php 
        } else {
            $fieldValue = htmlspecialcharsback($fieldValue);
            ?>
			<br>
			<?php 
            echo Loc::getMessage("SENDER_ENTITY_TEMPLATE_NOTE_OLD_EDITOR", array("%LINK_START%" => '<a href="/bitrix/admin/settings.php?mid=fileman&lang=' . LANGUAGE_ID . '">', "%LINK_END%" => '</a>'));
            ?>
			<br>
			<br>
			<textarea class="typearea" style="width:<?php 
            echo $editorWidth;
            ?>
;height:<?php 
            echo $editorHeight;
            ?>
px;" name="<?php 
            echo $fieldName;
            ?>
" id="bxed_<?php 
            echo $fieldName;
            ?>
" wrap="virtual"><?php 
            echo htmlspecialcharsbx($fieldValue);
            ?>
</textarea>
			<?php 
        }
        ?>
		</div>

		<div id="bx-sender-block-editor-<?php 
        echo $fieldName;
        ?>
" style="<?php 
        if (!$isDisplayBlockEditor) {
            ?>
display: none;<?php 
        }
        ?>
">
			<br/>
			<input type="hidden" name="<?php 
        echo htmlspecialcharsbx($templateTypeInput);
        ?>
" value="<?php 
        echo htmlspecialcharsbx($templateType);
        ?>
" />
			<input type="hidden" name="<?php 
        echo htmlspecialcharsbx($templateIdInput);
        ?>
" value="<?php 
        echo htmlspecialcharsbx($templateId);
        ?>
" />
			<?php 
        $url = '';
        if ($isDisplayBlockEditor) {
            if ($templateType && $templateId) {
                $url = '/bitrix/admin/sender_template_admin.php?';
                $url .= 'action=get_template&template_type=' . $templateType . '&template_id=' . $templateId;
                $url .= '&lang=' . LANGUAGE_ID . '&' . bitrix_sessid_get();
            } else {
                $url = $contentUrl;
            }
        }
        echo \Bitrix\Fileman\Block\EditorMail::show(array('id' => $fieldName, 'charset' => $charset, 'site' => $site, 'own_result_id' => 'bxed_' . $fieldName, 'url' => $url, 'templateType' => $templateType, 'templateId' => $templateId, 'isTemplateMode' => $isTemplateMode, 'isUserHavePhpAccess' => $isUserHavePhpAccess));
        ?>
		</div>

		<?php 
        if ($showSaveTemplate) {
            ?>
		<script>
			function ToggleTemplateSaveDialog()
			{
				BX('TEMPLATE_ACTION_SAVE_NAME_CONT').value = '';

				var currentDisplay =  BX('TEMPLATE_ACTION_SAVE_NAME_CONT').style.display;
				BX('TEMPLATE_ACTION_SAVE_NAME_CONT').style.display = BX.toggle(currentDisplay, ['inline', 'none']);
			}
		</script>
		<div class="adm-detail-content-item-block-save">
			<span>
				<input type="checkbox" value="Y" name="TEMPLATE_ACTION_SAVE" id="TEMPLATE_ACTION_SAVE" onclick="ToggleTemplateSaveDialog();">
				<label for="TEMPLATE_ACTION_SAVE"><?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_SAVE');
            ?>
</label>
			</span>
			<span id="TEMPLATE_ACTION_SAVE_NAME_CONT" style="display: none;"> <?php 
            echo Loc::getMessage('SENDER_TEMPLATE_EDITOR_SAVE_NAME');
            ?>
 <input type="text" name="TEMPLATE_ACTION_SAVE_NAME"></span>
		</div>
		<?php 
        }
        return ob_get_clean();
    }
Example #4
0
][LINK_PARAMS]" value="<?php 
    echo htmlspecialcharsbx($chain['LINK_PARAMS']);
    ?>
">
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</div>
	<?php 
    return ob_get_clean();
}
$personalizeList = \Bitrix\Sender\MailingTable::getChainPersonalizeList($ID);
\Bitrix\Sender\PostingRecipientTable::setPersonalizeList($personalizeList);
if ($_REQUEST["action"] == "get_vr" && check_bitrix_sessid()) {
    $letterTemplate = array('BODY' => getSenderItemContainer($ID), 'FIELDS' => array('MESSAGE' => \Bitrix\Sender\TemplateTable::initEditor(array('FIELD_NAME' => 'SENDER_LETTER_TEMPLATE_MESSAGE', 'FIELD_VALUE' => '', 'TEMPLATE_TYPE_INPUT' => 'CHAIN[%SENDER_LETTER_TEMPLATE_BODY_NUM%][TEMPLATE_TYPE]', 'TEMPLATE_TYPE' => '', 'TEMPLATE_ID_INPUT' => 'CHAIN[%SENDER_LETTER_TEMPLATE_BODY_NUM%][TEMPLATE_ID]', 'TEMPLATE_ID' => '', 'HAVE_USER_ACCESS' => !$isUserHavePhpAccess, 'SHOW_SAVE_TEMPLATE' => false))));
    echo CUtil::PhpToJSObject($letterTemplate);
    exit;
}
if (!is_array($CHAIN)) {
    $CHAIN = array();
}
$mailingDb = \Bitrix\Sender\MailingTable::getList(array('select' => array('ID', 'NAME', 'EMAIL_FROM', 'ACTIVE', 'TRIGGER_FIELDS'), 'filter' => array('=IS_TRIGGER' => 'Y', '=ID' => $ID)));
if (!($mailing = $mailingDb->fetch())) {
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    ShowError(\Bitrix\Main\Localization\Loc::getMessage("SENDER_MAILING_TRIG_ERROR_NOT_FOUND"));
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
    exit;
}