Exemple #1
0
    public static function layoutBE($mailingEdit, $lists, $show, $isEdit = false)
    {
        $tagjs = "function insertTag(tag){\n\t\ttry{\n\t\t\tstatus=jInsertEditorText(tag,'jnewsContent');\n\t\t\treturn true;\n\t\t} catch(err){\n\t\t\talert('Your editor does not enable jNews to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;\n\t\t}\n\t\t}";
        $editor = JFactory::getEditor();
        $script = "function changeTemplate(newbody,newaltbody,templateid){\n\t\t\tif(newbody.length>2){" . jnews::EditorSetContent($editor, 'jnewsContent', 'newbody') . ";}\n\t\t\tvar jnewstextarea =\$('altbody'); if(newaltbody.length>2){jnewstextarea.setHTML(newaltbody);}\n\t\t\tvar jnewstemplateid =\$('template_id'); jnewstemplateid.value = templateid;\n\n\t\t\t}\n\t\t\t";
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($script . $tagjs);
        if (!empty($_SESSION['skip_subscribers' . $mailingEdit->id])) {
            echo 'If you click on the Send button, the process will skip the first ' . $_SESSION['skip_subscribers' . $mailingEdit->id] . ' subscribers';
        }
        ?>
	<!--<fieldset class="jnewscss">-->
	<!--<legend><?php 
        echo @constant($GLOBALS[JNEWS . 'listname' . $mailingEdit->mailing_type]) . ' ' . _JNEWS_CONTENT;
        ?>
</legend>-->
	<table class="jnewstable" cellspacing="1" width="100%" border="0">
		<tbody>
		<tr>
			<td valign="top">

		<?php 
        $mailingType = JRequest::getVar('listype');
        $listId = JRequest::getVar('listid');
        $list_template_id = jNews_Lists::getListTemplate($listId);
        if ($mailingEdit->mailing_type == '7' || $mailingType == '7' and class_exists('jNews_Autonews')) {
            jNews_MailingsHTML::smartNewsHead($mailingEdit, $lists, $show);
        } else {
            jNews_MailingsHTML::subject($mailingEdit, $lists, $show);
        }
        if (empty($mailingEdit->id)) {
            if (!empty($mailingEdit->template_id)) {
                $template = jNews_Templates::loadOneTemplate('*', $mailingEdit->template_id);
            } else {
                if (!empty($list_template_id)) {
                    $template = jNews_Templates::loadOneTemplate('*', $list_template_id, 'template_id', 'DESC', false);
                } else {
                    $template = jNews_Templates::loadOneTemplate('*', '', 'template_id', 'DESC', true);
                }
                $mailingEdit->template_id = $template->template_id;
            }
            $mailingEdit->htmlcontent = isset($template->body) ? $template->body : '';
            $mailingEdit->textonly = isset($template->altbody) ? $template->altbody : '';
        }
        if ($show['htmlcontent']) {
            echo '<fieldset class="jnewscss" id="htmlfieldset">';
            echo '<legend>';
            echo _JNEWS_HTML_VERSION;
            echo '</legend>';
            echo $editor->display('jnewsContent', $mailingEdit->htmlcontent, '100%', '600', '80', '30');
            echo '</fieldset>';
        }
        ?>
			</td>
			<td valign="top" width="330px" rowspan="2">
			<?php 
        $config_tabs = new MosTabsjNews(0);
        $config_tabs->startPane('acaMailingOptions');
        $config_tabs->startTab(_JNEWS_LIST_T_LIST, 'acaMailingOptions.general');
        jNews_MailingsHTML::lists($mailingEdit, $lists, $show, 0, 0, false, $isEdit);
        //added another parameter for the list type ---mary
        $config_tabs->endTab();
        $config_tabs->startTab(_JNEWS_LIST_T_SENDER, 'acaMailingOptions.general');
        jNews_MailingsHTML::senderinfo($mailingEdit, $lists, $show);
        $config_tabs->endTab();
        if ($GLOBALS[JNEWS . 'show_jcalpro'] and class_exists('jNews_Pro')) {
            $config_tabs->startTab(_JNEWS_SHOW_JCALPRO, 'acaMailingOptions.jcalpro');
            jNews_MailingsHTML::jcalpro();
            $config_tabs->endTab();
        }
        if ($show['attachement']) {
            $config_tabs->startTab(_JNEWS_ATTACHMENTS, 'acaMailingOptions.attachement');
            jNews_MailingsHTML::attachement($mailingEdit, null, null);
            $config_tabs->endTab();
        }
        $config_tabs->endPane();
        ?>
			</td>
		</tr>


	<?php 
        if ($show['textcontent']) {
            ?>
		<tr>
			<td>
				<fieldset class="jnewscss">
				<legend><?php 
            echo _JNEWS_NONHTML_VERSION;
            ?>
</legend>
				<textarea name="altbody" id="altbody" rows="20" cols="70" style="width: 100%; height: 400px;">
					<?php 
            echo strip_tags($mailingEdit->textonly);
            ?>
				</textarea>
				</fieldset>
			</td>
			<td>
			</td>
		</tr>
	<?php 
        }
        ?>
		</tbody>
	</table>
	<!--</fieldset>-->
	<input type="hidden" id="template_id" name="template_id" value="<?php 
        echo $mailingEdit->template_id;
        ?>
" />
	<?php 
    }