1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446:
<?php
function template_email_members()
{
global $context, $txt, $scripturl;
if (!empty($context['newsletter_sent']))
echo '
<div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>';
echo '
<form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" id="admin_newsletters" class="flow_hidden" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['admin_newsletters'], '</h3>
</div>
<div class="information noup">
', $txt['admin_news_select_recipients'], '
</div>
<div class="windowbg noup">
<dl class="settings">
<dt>
<strong>', $txt['admin_news_select_group'], ':</strong><br>
<span class="smalltext">', $txt['admin_news_select_group_desc'], '</span>
</dt>
<dd>';
foreach ($context['groups'] as $group)
echo '
<label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>';
echo '
<br>
<label for="checkAllGroups"><input type="checkbox" id="checkAllGroups" checked onclick="invertAll(this, this.form, \'groups\');"> <em>', $txt['check_all'], '</em></label>
</dd>
</dl>
<div id="advanced_panel_header" class="title_bar">
<h3 class="titlebg">
<span id="advanced_panel_toggle" class="toggle_down floatright" style="display: none;"></span>
<a href="#" id="advanced_panel_link">', $txt['advanced'], '</a>
</h3>
</div>
<div id="advanced_panel_div" class="padding">
<dl class="settings">
<dt>
<strong>', $txt['admin_news_select_email'], ':</strong><br>
<span class="smalltext">', $txt['admin_news_select_email_desc'], '</span>
</dt>
<dd>
<textarea name="emails" rows="5" cols="30" style="width: 98%;"></textarea>
</dd>
<dt>
<strong>', $txt['admin_news_select_members'], ':</strong><br>
<span class="smalltext">', $txt['admin_news_select_members_desc'], '</span>
</dt>
<dd>
<input type="text" name="members" id="members" value="" size="30">
<span id="members_container"></span>
</dd>
</dl>
<hr class="bordercolor">
<dl class="settings">
<dt>
<strong>', $txt['admin_news_select_excluded_groups'], ':</strong><br>
<span class="smalltext">', $txt['admin_news_select_excluded_groups_desc'], '</span>
</dt>
<dd>';
foreach ($context['groups'] as $group)
echo '
<label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>';
echo '
<br>
<label for="checkAllGroupsExclude"><input type="checkbox" id="checkAllGroupsExclude" onclick="invertAll(this, this.form, \'exclude_groups\');"> <em>', $txt['check_all'], '</em></label><br>
</dd>
<dt>
<strong>', $txt['admin_news_select_excluded_members'], ':</strong><br>
<span class="smalltext">', $txt['admin_news_select_excluded_members_desc'], '</span>
</dt>
<dd>
<input type="text" name="exclude_members" id="exclude_members" value="" size="30">
<span id="exclude_members_container"></span>
</dd>
</dl>
<hr class="bordercolor">
<dl class="settings">
<dt>
<label for="email_force"><strong>', $txt['admin_news_select_override_notify'], ':</strong></label><br>
<span class="smalltext">', $txt['email_force'], '</span>
</dt>
<dd>
<input type="checkbox" name="email_force" id="email_force" value="1">
</dd>
</dl>
</div><!-- #advanced_panel_div -->
<br>
<input type="submit" value="', $txt['admin_next'], '" class="button">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</div><!-- .windowbg -->
</form>';
echo '
<script>
var oAdvancedPanelToggle = new smc_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: true,
aSwappableContainers: [
\'advanced_panel_div\'
],
aSwapImages: [
{
sId: \'advanced_panel_toggle\',
altExpanded: ', JavaScriptEscape($txt['hide']), ',
altCollapsed: ', JavaScriptEscape($txt['show']), '
}
],
aSwapLinks: [
{
sId: \'advanced_panel_link\',
msgExpanded: ', JavaScriptEscape($txt['advanced']), ',
msgCollapsed: ', JavaScriptEscape($txt['advanced']), '
}
]
});
</script>
<script>
var oMemberSuggest = new smc_AutoSuggest({
sSelf: \'oMemberSuggest\',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sSuggestId: \'members\',
sControlId: \'members\',
sSearchType: \'member\',
bItemList: true,
sPostName: \'member_list\',
sURLMask: \'action=profile;u=%item_id%\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
sItemListContainerId: \'members_container\',
aListItems: []
});
var oExcludeMemberSuggest = new smc_AutoSuggest({
sSelf: \'oExcludeMemberSuggest\',
sSessionId: \'', $context['session_id'], '\',
sSessionVar: \'', $context['session_var'], '\',
sSuggestId: \'exclude_members\',
sControlId: \'exclude_members\',
sSearchType: \'member\',
bItemList: true,
sPostName: \'exclude_member_list\',
sURLMask: \'action=profile;u=%item_id%\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
sItemListContainerId: \'exclude_members_container\',
aListItems: []
});
</script>';
}
function template_email_members_compose()
{
global $context, $txt, $scripturl;
echo '
<div id="preview_section"', isset($context['preview_message']) ? '' : ' class="hidden"', '>
<div class="cat_bar">
<h3 class="catbg">
<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
</h3>
</div>
<div class="windowbg">
<div class="post" id="preview_body">
', empty($context['preview_message']) ? '<br>' : $context['preview_message'], '
</div>
</div>
</div>
<br>';
echo '
<form name="newsmodify" action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><span class="main_icons help" title="', $txt['help'], '"></span></a> ', $txt['admin_newsletters'], '
</h3>
</div>
<div class="information noup">
', $txt['email_variables'], '
</div>
<div class="windowbg noup">
<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
<dl>
<dt>
<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
</dt>
<dd class="error" id="error_list">
', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), '
</dd>
</dl>
</div>
<dl id="post_header">
<dt>
<label', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' for="subject" id="caption_subject">', $txt['subject'], '</label>
</dt>
<dd id="pm_subject">
<input type="text" id="subject" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="84"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', '>
</dd>
</dl>
<div id="bbcBox_message"></div>';
if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
echo '
<div id="smileyBox_message"></div>';
echo '
', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
echo '
<ul>
<li><label for="send_pm"><input type="checkbox" name="send_pm" id="send_pm"', !empty($context['send_pm']) ? ' checked' : '', ' onclick="checkboxes_status(this);"> ', $txt['email_as_pms'], '</label></li>
<li><label for="send_html"><input type="checkbox" name="send_html" id="send_html"', !empty($context['send_html']) ? ' checked' : '', ' onclick="checkboxes_status(this);"> ', $txt['email_as_html'], '</label></li>
<li><label for="parse_html"><input type="checkbox" name="parse_html" id="parse_html" checked disabled> ', $txt['email_parsed_html'], '</label></li>
</ul>
<span id="post_confirm_buttons">
', template_control_richedit_buttons($context['post_box_name']), '
</span>
</div><!-- .windowbg -->
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="email_force" value="', $context['email_force'], '">
<input type="hidden" name="total_emails" value="', $context['total_emails'], '">';
foreach ($context['recipients'] as $key => $values)
echo '
<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">';
echo '
<script>';
echo '
var txt_preview_title = "', $txt['preview_title'], '";
var txt_preview_fetch = "', $txt['preview_fetch'], '";
function previewPost()
{
if (window.XMLHttpRequest)
{
// Opera didn\'t support setRequestHeader() before 8.01.
// @todo Remove support for old browsers
if (\'opera\' in window)
{
// Handle the WYSIWYG editor.
if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).php_to8bit().php_urlencode();
else
x[x.length] = textFields[i] + \'=\' + document.forms.newsmodify[textFields[i]].value.php_to8bit().php_urlencode();
}
// @todo Currently not sending poll options and option checkboxes.
var x = new Array();
var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), '];
var checkboxFields = [\'send_html\', \'send_pm\'];
for (var i = 0, n = textFields.length; i < n; i++)
if (textFields[i] in document.forms.newsmodify)
{
// Handle the WYSIWYG editor.
if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#\').php_to8bit().php_urlencode();
else
x[x.length] = textFields[i] + \'=\' + document.forms.newsmodify[textFields[i]].value.replace(/&#/g, \'&#\').php_to8bit().php_urlencode();
}
for (var i = 0, n = checkboxFields.length; i < n; i++)
if (checkboxFields[i] in document.forms.newsmodify && document.forms.newsmodify.elements[checkboxFields[i]].checked)
x[x.length] = checkboxFields[i] + \'=\' + document.forms.newsmodify.elements[checkboxFields[i]].value;
x[x.length] = \'item=newsletterpreview\';
sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=xmlhttp;sa=previews;xml\', x.join(\'&\'), onDocSent);
document.getElementById(\'preview_section\').style.display = \'\';
setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);
return false;
}
else
return submitThisOnce(document.forms.newsmodify);
}
function onDocSent(XMLDoc)
{
if (!XMLDoc)
{
document.forms.newsmodify.preview.onclick = new function ()
{
return true;
}
document.forms.newsmodify.preview.click();
}
// Show the preview section.
var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);
var bodyText = \'\';
for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;
setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
document.getElementById(\'preview_body\').className = \'post\';
// Show a list of errors (if any).
var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
var errorList = new Array();
for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br>\'));
// Adjust the color of captions if the given data is erroneous.
var captions = errors.getElementsByTagName(\'caption\');
for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');
if (errors.getElementsByTagName(\'post_error\').length == 1)
document.forms.newsmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
else if (document.forms.newsmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.newsmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\')
{
if (\'runtimeStyle\' in document.forms.newsmodify.', $context['post_box_name'], ')
document.forms.newsmodify.', $context['post_box_name'], '.style.borderColor = \'\';
else
document.forms.newsmodify.', $context['post_box_name'], '.style.border = null;
}
location.hash = \'#\' + \'preview_section\';
}
</script>';
echo '
<script>
function checkboxes_status (item)
{
if (item.id == \'send_html\')
document.getElementById(\'parse_html\').disabled = !document.getElementById(\'parse_html\').disabled;
if (item.id == \'send_pm\')
{
if (!document.getElementById(\'send_html\').checked)
document.getElementById(\'parse_html\').disabled = true;
else
document.getElementById(\'parse_html\').disabled = false;
document.getElementById(\'send_html\').disabled = !document.getElementById(\'send_html\').disabled;
}
}
</script>
</form>';
}
function template_email_members_send()
{
global $context, $txt, $scripturl;
echo '
<form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><span class="main_icons help" title="', $txt['help'], '"></span></a> ', $txt['admin_newsletters'], '
</h3>
</div>
<div class="windowbg">
<div class="progress_bar">
<span>', $context['percentage_done'], '% ', $txt['email_done'], '</span>
<div class="bar" style="width: ', $context['percentage_done'], '%;"></div>
</div>
<hr>
<input type="submit" name="b" value="', $txt['email_continue'], '" class="button">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="subject" value="', $context['subject'], '">
<input type="hidden" name="message" value="', $context['message'], '">
<input type="hidden" name="start" value="', $context['start'], '">
<input type="hidden" name="total_members" value="', $context['total_members'], '">
<input type="hidden" name="total_emails" value="', $context['total_emails'], '">
<input type="hidden" name="send_pm" value="', $context['send_pm'], '">
<input type="hidden" name="send_html" value="', $context['send_html'], '">
<input type="hidden" name="parse_html" value="', $context['parse_html'], '">';
foreach ($context['recipients'] as $key => $values)
echo '
<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">';
echo '
</div><!-- .windowbg -->
</form>
<script>
var countdown = 2;
doAutoSubmit();
function doAutoSubmit()
{
if (countdown == 0)
document.forms.autoSubmit.submit();
else if (countdown == -1)
return;
document.forms.autoSubmit.b.value = "', $txt['email_continue'], ' (" + countdown + ")";
countdown--;
setTimeout("doAutoSubmit();", 1000);
}
</script>';
}
function template_news_lists()
{
global $context, $txt;
if (!empty($context['saved_successful']))
echo '
<div class="infobox">', $txt['settings_saved'], '</div>';
template_show_list('news_lists');
}
?>