* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //////////// Check Inclusion de pages //////////// if (!class_exists('auth')) { include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// //////////// Check Droits utilisateur //////////// if (!$l21auth->isSuperAdmin()) ReloadIndex('admin'); //////////// include_once(override('../user/'.SQL.'.inc.php')); if (isset($_GET['id'])) $id = $_GET['id']; if (isset($_POST['id'])) $id = $_POST['id']; // we get logged-in user email to send a newsletter test $user = $sql_object->DBSelect(SQL_getAllUserInfo($l21auth->GetSessionElement('id'))); $user_email = $user[0]['profile_email']; $req_det = SQL_getoneCompleteNewsLetter($id); $result = $sql_object->DBSelect($req_det); // Do record exists? if(!isset($result[0]['newsletter_title'])) redirect_to('@module_default'); $display_title = formatText($result[0]['newsletter_title'], '2HTML'); $display_body = formatText($result[0]['newsletter_body'], '2HTML'); $display_user = formatText($result[0]['user_login'], '2HTML'); $display_date_crea = $result[0]['newsletter_date_crea_display']; $display_last_modify = $result[0]['newsletter_last_modify_display']; $display_statut = display_statut($result[0]['newsletter_statut']); $newsletter_status = $result[0]['newsletter_statut']; $newsletter_owner= $result[0]['newsletter_posted_by']; if (formatDate($result[0]['newsletter_published_date_display'], true) == formatDate('0001-01-01', true)) $display_published_date = _t('statut','draft'); else $display_published_date = $result[0]['newsletter_published_date_display']; $link_sup = $rub_link . "&todo=sup&id="; $link_mod = $rub_link . "&todo=mod&id="; // ajax code $js = '$("a.send-newsletter").click(function() { var url = $(this).attr("href"); id = $(this).attr("id"); if(id == "send-bulk") { // if already clicked, we exit if( $(this).attr("data-clicked") == "true") {return false}; /// alertify confirm alertify.set({ labels : { ok: "'._t('divers', 'yes').'", cancel: "'._t('divers', 'no').'" } }); alertify.confirm("' . _t('newsletter', 'send_confirm') . '", function (e) { if (e) { $("#" + id).attr("data-clicked", true); // we init data clicked flag to prevent double click $("#" + id).html(" <\/span> '._t('newsletter', 'sending_mail').'"); alertify.log(" <\/span>' . _t('newsletter', 'sending_mail') . '"); $.ajax({ type: "POST", url: url, data: "call=ajax", dataType: "json", success: function(data){ if(data.status==1) { alertify.success(data.msg); $("#" + id).fadeOut("slow"); } else { alertify.error(data.msg); } } }); } else { return false; } }); /// end - alertify confirm } if(id == "send-test") { alertify.log(" <\/span>' . _t('newsletter', 'sending_mail') . '"); $.ajax({ type: "POST", url: url, data: "call=ajax", dataType: "json", success: function(data){ if(data.status==1) { alertify.success(data.msg); } else { alertify.error(data.msg); } } }); } return false; });'; footerAddInlineJS($js); ?>
'; } echo "

"; echo formatTitleh2($display_title); echo "

\n"; echo ''.sprintf(_t('newsletter','send_test'), $user_email).''; echo "\t" . _t('newsletter','sup') . "\n"; echo "\t" . _t('newsletter','mod') . "\n"; echo "
\n"; echo "
" . mb_ucfirst(_t('newsletter','title')) . " :
\n"; echo "
" . $display_title . "
\n"; echo "
" . mb_ucfirst(_t('newsletter','body')) . " :
\n"; echo "
" . $display_body . "
\n"; echo "
" . mb_ucfirst(_t('newsletter','author')) . " :
\n"; echo '
' . $display_user . '
'.PHP_EOL; echo "
" . mb_ucfirst(_t('statut','published_on')) . " :
\n"; echo "
" . $display_published_date . "
\n"; echo "
" . mb_ucfirst(_t('divers','date_crea')) . " :
\n"; echo "
" . $display_date_crea . "
\n"; echo "
" . mb_ucfirst(_t('divers','last_modify')) . " :
\n"; echo "
" . $display_last_modify . "
\n"; echo "
" . mb_ucfirst(_t('divers','statut')) . " :
\n"; echo "
" . $display_statut . "
\n"; echo "
\n"; ?>