Example #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 
    }
Example #2
0
    public static function description($listEdit, $lists, $show, $html, $listType)
    {
        $editor = JFactory::getEditor();
        static $db = null;
        if (!isset($db)) {
            $db = JFactory::getDBO();
        }
        ?>
	<fieldset class="jnewscss">
	<table class="jnewstable" width="100%"  cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_INFO_LIST_PUB;
        $title = _JNEWS_PUBLISHED;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td><?php 
        echo $lists['published'];
        ?>
</td>
		</tr>
	<?php 
        if ($show['hide']) {
            ?>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_MAILING_VISIBLE;
            $title = _JNEWS_VISIBLE_FRONT;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			<td><?php 
            echo $lists['hidden'];
            ?>
</td>
			</tr>

	<?php 
        } else {
            echo '<input type="hidden" name="hidden" value="' . $listEdit->hidden . '" />';
        }
        ?>
	 		<?php 
        if ($listType == 2) {
            ?>
	 	<tr>
	 		<td width="185%" class="key">
	 			<span class="editlinktip">
	 			<?php 
            $tip = _JNEWS_SUBS_LIST_TIPS;
            $title = _JNEWS_SUBS_LIST2;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
	 			</span>
	 		</td>

			<td width="90%">
			<table width = "50%"><tr><td>
			<?php 
            require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'views' . DS . 'mailings.jnews.html.php';
            jNews_MailingsHTML::lists(null, $lists, $show, $listType, $listEdit->id, true);
            ?>
			 </td></tr></table>
			</td>	 	</tr>
			<?php 
        }
        ?>

		</tbody>
	</table>
	</fieldset>
	<fieldset class="jnewscss">
	<legend><?php 
        echo _JNEWS_LIST_T_GENERAL;
        ?>
</legend>
	<table class="jnewstable" width="100%" cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_INFO_LIST_NAME;
        $title = _JNEWS_LIST_NAME;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td>
			<?php 
        $text = str_replace('"', '&quot;', $listEdit->list_name);
        if (function_exists('htmlspecialchars_decode')) {
            $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
        } elseif (function_exists('html_entity_decode')) {
            $text = html_entity_decode($text, ENT_NOQUOTES);
        }
        echo ' <input type="text" name="list_name" class="inputbox requiredd" size="50" maxlength="64" value="' . $text . '" />';
        ?>
			</td>
		</tr>
		<?php 
        if ($GLOBALS[JNEWS . 'listHTMLeditor'] == '1') {
            ?>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_DESC;
            $title = _JNEWS_LIST_DESC;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
			<?php 
            echo $editor->display('list_desc', $listEdit->list_desc, '100%', '200', '75', '10');
            ?>
			</td>
		</tr>
		<?php 
        } else {
            echo jnews::printM('notice', _JNEWS__LIST_HTML_EDITOR);
        }
        ?>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_ASSIGN_LIS_TEMPLATE_TIPS;
        $title = _JNEWS_ASSIGN_LIS_TEMPLATE;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td>
			<?php 
        echo $lists['list_templates'];
        ?>
			</td>
		</tr>
		</tbody>
	</table>
	</fieldset>
<?php 
        if ($show['sender_info']) {
            ?>
	<fieldset class="jnewscss">
	<legend><?php 
            echo _JNEWS_LIST_T_SENDER;
            ?>
</legend>
	<table class="jnewstable" width="100%" cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_NAME;
            $title = _JNEWS_SENDER_NAME;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
			<?php 
            //if empty sender name and sender email
            //				$userSender=jNews_Subscribers::getUsers( 'gid', '50',$listEdit->owner );
            //				if(empty($listEdit->sendername)) $listEdit->sendername=$userSender[0]->name;
            //				if(empty($listEdit->senderemail)) $listEdit->senderemail=$userSender[0]->email;
            $text = str_replace('"', '&quot;', $listEdit->sendername);
            if (function_exists('htmlspecialchars_decode')) {
                $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
            } elseif (function_exists('html_entity_decode')) {
                $text = html_entity_decode($text, ENT_NOQUOTES);
            }
            echo ' <input type="text" name="sendername" class="inputbox" size="40" maxlength="64" value="' . $text . '" />';
            ?>

				&nbsp;<img src="components/<?php 
            echo JNEWS_OPTION;
            ?>
/images/16/profile.png" id="popbtn" name="popbtn" onClick="document.getElementById('poplist').style.display = 'inline'; document.getElementById('popbtn').style.display = 'none';" title="<?php 
            echo _JNEWS_SENDER_LIST_INFO;
            ?>
" style="position:absolute;">
				<select id="poplist" name="poplist" style="display:none;position:relative;" onChange="document.getElementById('poplist').style.display = 'none'; document.getElementById('popbtn').style.display = 'inline';">
				<option value="0" onClick="document.adminForm.sendername.value=''; document.adminForm.senderemail.value='';"> </option>
			<?php 
            // 2nd parameter of this public static function should be a preference
            // we need to limit it so that it wouldnt cause any problems when loading a bunch of datas e.g hundreds or thousands of users
            $usersA = jNews_Subscribers::getUsers('gid', '50');
            // create options for list
            if (!empty($usersA)) {
                foreach ($usersA as $user) {
                    $name = $user->name;
                    $email = $user->email;
                    $selected = isset($listEdit->sendername) && $listEdit->sendername == $name && (isset($listEdit->senderemail) && $listEdit->senderemail == $email) ? true : false;
                    ?>
						<option value="<?php 
                    echo $user->name;
                    ?>
" onClick="document.adminForm.sendername.value='<?php 
                    echo $name;
                    ?>
'; document.adminForm.senderemail.value='<?php 
                    echo $email;
                    ?>
';" <?php 
                    if ($selected) {
                        echo 'selected';
                    }
                    ?>
> <?php 
                    echo $user->name . ' (' . $user->email . ')';
                    ?>
 </option>
				<?php 
                }
            }
            ?>
			 	</select>
			</td>
		</tr>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_EMAIL;
            $title = _JNEWS_SENDER_EMAIL;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<input type="text" name="senderemail" class="inputbox" size="40" maxlength="64" value="<?php 
            echo $listEdit->senderemail;
            ?>
" />
			</td>
		</tr>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_BOUNCED;
            $title = _JNEWS_SENDER_BOUNCE;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<input type="text" name="bounceadres" class="inputbox" size="40" maxlength="64" value="<?php 
            echo $listEdit->bounceadres;
            ?>
" />
			</td>
		</tr>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_JNEWS_OWNER;
            $title = _JNEWS_OWNER;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<?php 
            echo $listEdit->owner;
            ?>
			</td>
		</tr>
		</tbody>
	</table>
	</fieldset>
	<?php 
        } else {
            echo '<input type="hidden" name="sendername" value="' . $listEdit->sendername . '" />';
            echo '<input type="hidden" name="senderemail" value="' . $listEdit->senderemail . '" />';
            echo '<input type="hidden" name="bounceadres" value="' . $listEdit->bounceadres . '" />';
        }
    }