ManageNews.template.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // Form for editing current news on the site.
  13. function template_edit_news()
  14. {
  15. global $context, $settings, $options, $scripturl, $txt;
  16. echo '
  17. <div id="admincenter">
  18. <form action="', $scripturl, '?action=admin;area=news;sa=editnews" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify">
  19. <table class="table_grid" width="100%">
  20. <thead>
  21. <tr class="catbg">
  22. <th class="first_th" width="50%">', $txt['admin_edit_news'], '</th>
  23. <th align="left" width="45%">', $txt['preview'], '</th>
  24. <th class="last_th" align="center" width="5%"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" /></th>
  25. </tr>
  26. </thead>
  27. <tbody>';
  28. // Loop through all the current news items so you can edit/remove them.
  29. foreach ($context['admin_current_news'] as $admin_news)
  30. echo '
  31. <tr class="windowbg2">
  32. <td align="center">
  33. <div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';">', $admin_news['unparsed'], '</textarea></div>
  34. </td><td align="left" valign="top">
  35. <div style="overflow: auto; width: 100%; height: 10ex;">', $admin_news['parsed'], '</div>
  36. </td><td align="center">
  37. <input type="checkbox" name="remove[]" value="', $admin_news['id'], '" class="input_check" />
  38. </td>
  39. </tr>';
  40. // This provides an empty text box to add a news item to the site.
  41. echo '
  42. <tr id="moreNews" class="windowbg2" style="display: none;">
  43. <td align="center">
  44. <div id="moreNewsItems"></div>
  45. </td>
  46. <td align="center">
  47. </td>
  48. <td align="center">
  49. </td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. <div class="floatleft padding">
  54. <div id="moreNewsItems_link" style="display: none;">
  55. <a class="button_link" href="javascript:void(0);" onclick="addNewsItem(); return false;">', $txt['editnews_clickadd'], '</a></div>
  56. <script type="text/javascript"><!-- // --><![CDATA[
  57. document.getElementById("moreNewsItems_link").style.display = "";
  58. function addNewsItem()
  59. {
  60. document.getElementById("moreNews").style.display = "";
  61. setOuterHTML(document.getElementById("moreNewsItems"), \'<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';"><\' + \'/textarea><\' + \'/div><div id="moreNewsItems"><\' + \'/div>\');
  62. }
  63. // ]]></script>
  64. <noscript>
  65. <div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';" name="news[]"></textarea></div>
  66. </noscript>
  67. </div>
  68. <div class="floatright padding">
  69. <input type="submit" name="save_items" value="', $txt['save'], '" class="button_submit" /> <input type="submit" name="delete_selection" value="', $txt['editnews_remove_selected'], '" onclick="return confirm(\'', $txt['editnews_remove_confirm'], '\');" class="button_submit" />
  70. </div>
  71. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  72. </form>
  73. </div>
  74. <br class="clear" />';
  75. }
  76. function template_email_members()
  77. {
  78. global $context, $settings, $options, $txt, $scripturl;
  79. echo '
  80. <div id="admincenter">
  81. <form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  82. <div class="cat_bar">
  83. <h3 class="catbg">', $txt['admin_newsletters'], '</h3>
  84. </div>
  85. <div class="information">
  86. ', $txt['admin_news_select_recipients'], '
  87. </div>
  88. <div class="windowbg">
  89. <span class="topslice"><span></span></span>
  90. <div class="content">
  91. <dl class="settings">
  92. <dt>
  93. <strong>', $txt['admin_news_select_group'], ':</strong><br />
  94. <span class="smalltext">', $txt['admin_news_select_group_desc'], '</span>
  95. </dt>
  96. <dd>';
  97. foreach ($context['groups'] as $group)
  98. echo '
  99. <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked="checked" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br />';
  100. echo '
  101. <br />
  102. <label for="checkAllGroups"><input type="checkbox" id="checkAllGroups" checked="checked" onclick="invertAll(this, this.form, \'groups\');" class="input_check" /> <em>', $txt['check_all'], '</em></label>';
  103. echo '
  104. </dd>
  105. </dl><br class="clear" />
  106. </div>
  107. <span class="botslice"><span></span></span>
  108. </div>
  109. <br />
  110. <div class="cat_bar">
  111. <h3 class="catbg">
  112. <img id="advanced_panel_toggle" class="panel_toggle" style="display: none; src="', $settings['images_url'], '/', empty($context['show_advanced_options']) ? 'collapse' : 'expand', '.png" alt="*" />
  113. <a href="#" id="advanced_panel_link" >', $txt['advanced'], '</a>
  114. </h3>
  115. </div>
  116. <div id="advanced_panel_div" class="windowbg2">
  117. <span class="topslice"><span></span></span>
  118. <div class="content">
  119. <dl class="settings">
  120. <dt>
  121. <strong>', $txt['admin_news_select_email'], ':</strong><br />
  122. <span class="smalltext">', $txt['admin_news_select_email_desc'], '</span>
  123. </dt>
  124. <dd>
  125. <textarea name="emails" rows="5" cols="30" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 98%; min-width: 98%' : 'width: 98%') . ';"></textarea>
  126. </dd>
  127. <dt>
  128. <strong>', $txt['admin_news_select_members'], ':</strong><br />
  129. <span class="smalltext">', $txt['admin_news_select_members_desc'], '</span>
  130. </dt>
  131. <dd>
  132. <input type="text" name="members" id="members" value="" size="30" class="input_text" />
  133. <span id="members_container"></span>
  134. </dd>
  135. </dl>
  136. <hr class="bordercolor" />
  137. <dl class="settings">
  138. <dt>
  139. <strong>', $txt['admin_news_select_excluded_groups'], ':</strong><br />
  140. <span class="smalltext">', $txt['admin_news_select_excluded_groups_desc'], '</span>
  141. </dt>
  142. <dd>';
  143. foreach ($context['groups'] as $group)
  144. echo '
  145. <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br />';
  146. echo '
  147. <br />
  148. <label for="checkAllGroupsExclude"><input type="checkbox" id="checkAllGroupsExclude" onclick="invertAll(this, this.form, \'exclude_groups\');" class="input_check" /> <em>', $txt['check_all'], '</em></label><br />
  149. </dd>
  150. <dt>
  151. <strong>', $txt['admin_news_select_excluded_members'], ':</strong><br />
  152. <span class="smalltext">', $txt['admin_news_select_excluded_members_desc'], '</span>
  153. </dt>
  154. <dd>
  155. <input type="text" name="exclude_members" id="exclude_members" value="" size="30" class="input_text" />
  156. <span id="exclude_members_container"></span>
  157. </dd>
  158. </dl>
  159. <hr class="bordercolor" />
  160. <dl class="settings">
  161. <dt>
  162. <label for="email_force"><strong>', $txt['admin_news_select_override_notify'], ':</strong></label><br />
  163. <span class="smalltext">', $txt['email_force'], '</span>
  164. </dt>
  165. <dd>
  166. <input type="checkbox" name="email_force" id="email_force" value="1" class="input_check" />
  167. </dd>
  168. </dl><br class="clear" />
  169. </div>
  170. <span class="botslice"><span></span></span>
  171. </div>
  172. <div class="righttext">
  173. <input type="submit" value="', $txt['admin_next'], '" class="button_submit" />
  174. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  175. </div>
  176. </form>
  177. </div>
  178. <br class="clear" />';
  179. // This is some javascript for the simple/advanced toggling and member suggest
  180. echo '
  181. <script type="text/javascript"><!-- // --><![CDATA[
  182. var oAdvancedPanelToggle = new smc_Toggle({
  183. bToggleEnabled: true,
  184. bCurrentlyCollapsed: ', empty($context['show_advanced_options']) ? 'true' : 'false', ',
  185. aSwappableContainers: [
  186. \'advanced_panel_div\'
  187. ],
  188. aSwapImages: [
  189. {
  190. sId: \'advanced_panel_toggle\',
  191. srcExpanded: smf_images_url + \'/collapse.png\',
  192. altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
  193. srcCollapsed: smf_images_url + \'/expand.png\',
  194. altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
  195. }
  196. ],
  197. aSwapLinks: [
  198. {
  199. sId: \'advanced_panel_link\',
  200. msgExpanded: ', JavaScriptEscape($txt['advanced']), ',
  201. msgCollapsed: ', JavaScriptEscape($txt['advanced']), '
  202. }
  203. ],
  204. oThemeOptions: {
  205. bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
  206. sOptionName: \'admin_preferences\',
  207. sSessionVar: smf_session_var,
  208. sSessionId: smf_session_id,
  209. sThemeId: \'1\'
  210. }
  211. });
  212. // ]]></script>
  213. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  214. <script type="text/javascript"><!-- // --><![CDATA[
  215. var oMemberSuggest = new smc_AutoSuggest({
  216. sSelf: \'oMemberSuggest\',
  217. sSessionId: smf_session_id,
  218. sSessionVar: smf_session_var,
  219. sSuggestId: \'members\',
  220. sControlId: \'members\',
  221. sSearchType: \'member\',
  222. bItemList: true,
  223. sPostName: \'member_list\',
  224. sURLMask: \'action=profile;u=%item_id%\',
  225. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  226. sItemListContainerId: \'members_container\',
  227. aListItems: []
  228. });
  229. var oExcludeMemberSuggest = new smc_AutoSuggest({
  230. sSelf: \'oExcludeMemberSuggest\',
  231. sSessionId: \'', $context['session_id'], '\',
  232. sSessionVar: \'', $context['session_var'], '\',
  233. sSuggestId: \'exclude_members\',
  234. sControlId: \'exclude_members\',
  235. sSearchType: \'member\',
  236. bItemList: true,
  237. sPostName: \'exclude_member_list\',
  238. sURLMask: \'action=profile;u=%item_id%\',
  239. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  240. sItemListContainerId: \'exclude_members_container\',
  241. aListItems: []
  242. });
  243. // ]]></script>';
  244. }
  245. function template_email_members_compose()
  246. {
  247. global $context, $settings, $options, $txt, $scripturl;
  248. echo '
  249. <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
  250. <div class="cat_bar">
  251. <h3 class="catbg">
  252. <span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
  253. </h3>
  254. </div>
  255. <div class="windowbg">
  256. <span class="topslice"><span></span></span>
  257. <div class="content">
  258. <div class="post" id="preview_body">
  259. ', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
  260. </div>
  261. </div>
  262. <span class="botslice"><span></span></span>
  263. </div>
  264. </div><br />';
  265. echo '
  266. <div id="admincenter">
  267. <form name="newsmodify" action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '">
  268. <div class="cat_bar">
  269. <h3 class="catbg">
  270. <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" class="icon" /></a> ', $txt['admin_newsletters'], '
  271. </h3>
  272. </div>
  273. <div class="information">
  274. ', $txt['email_variables'], '
  275. </div>
  276. <div class="windowbg">
  277. <span class="topslice"><span></span></span>
  278. <div class="content">
  279. <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
  280. <dl>
  281. <dt>
  282. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  283. </dt>
  284. <dd class="error" id="error_list">
  285. ', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
  286. </dd>
  287. </dl>
  288. </div>
  289. <dl id="post_header">
  290. <dt class="clear_left">
  291. <span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span>
  292. </dt>
  293. <dd id="pm_subject">
  294. <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="60" maxlength="60"',isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/>
  295. </dd>
  296. </dl><hr class="clear" />
  297. <div id="bbcBox_message"></div>';
  298. // What about smileys?
  299. if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
  300. echo '
  301. <div id="smileyBox_message"></div>';
  302. // Show BBC buttons, smileys and textbox.
  303. echo '
  304. ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
  305. echo '
  306. <ul class="reset">
  307. <li><label for="send_pm"><input type="checkbox" name="send_pm" id="send_pm" ', !empty($context['send_pm']) ? 'checked="checked"' : '', 'class="input_check" onclick="checkboxes_status(this);" /> ', $txt['email_as_pms'], '</label></li>
  308. <li><label for="send_html"><input type="checkbox" name="send_html" id="send_html" ', !empty($context['send_html']) ? 'checked="checked"' : '', 'class="input_check" onclick="checkboxes_status(this);" /> ', $txt['email_as_html'], '</label></li>
  309. <li><label for="parse_html"><input type="checkbox" name="parse_html" id="parse_html" checked="checked" disabled="disabled" class="input_check" /> ', $txt['email_parsed_html'], '</label></li>
  310. </ul>
  311. <p id="shortcuts" class="smalltext">
  312. ', isBrowser('is_firefox') ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
  313. </p>
  314. <p id="post_confirm_strip" class="righttext">
  315. ', template_control_richedit_buttons($context['post_box_name']), '
  316. </p>
  317. </div>
  318. <span class="botslice"><span></span></span>
  319. </div>
  320. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  321. <input type="hidden" name="email_force" value="', $context['email_force'], '" />
  322. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  323. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />';
  324. foreach ($context['recipients'] as $key => $values)
  325. echo '
  326. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  327. echo '
  328. <script type="text/javascript"><!-- // --><![CDATA[';
  329. // The functions used to preview a posts without loading a new page.
  330. echo '
  331. var txt_preview_title = "', $txt['preview_title'], '";
  332. var txt_preview_fetch = "', $txt['preview_fetch'], '";
  333. function previewPost()
  334. {';
  335. if (isBrowser('is_firefox'))
  336. echo '
  337. // Firefox doesn\'t render <marquee> that have been put it using javascript
  338. if (document.forms.newsmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
  339. {
  340. return submitThisOnce(document.forms.newsmodify);
  341. }';
  342. echo '
  343. if (window.XMLHttpRequest)
  344. {
  345. // Opera didn\'t support setRequestHeader() before 8.01.
  346. // @todo Remove support for old browsers
  347. if (\'opera\' in window)
  348. {
  349. var test = new XMLHttpRequest();
  350. if (!(\'setRequestHeader\' in test))
  351. return submitThisOnce(document.forms.newsmodify);
  352. }
  353. // @todo Currently not sending poll options and option checkboxes.
  354. var x = new Array();
  355. var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), '];
  356. var checkboxFields = [\'send_html\', \'send_pm\'];
  357. for (var i = 0, n = textFields.length; i < n; i++)
  358. if (textFields[i] in document.forms.newsmodify)
  359. {
  360. // Handle the WYSIWYG editor.
  361. if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
  362. x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  363. else
  364. x[x.length] = textFields[i] + \'=\' + document.forms.newsmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  365. }
  366. for (var i = 0, n = checkboxFields.length; i < n; i++)
  367. if (checkboxFields[i] in document.forms.newsmodify && document.forms.newsmodify.elements[checkboxFields[i]].checked)
  368. x[x.length] = checkboxFields[i] + \'=\' + document.forms.newsmodify.elements[checkboxFields[i]].value;
  369. x[x.length] = \'item=newsletterpreview\';
  370. sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=xmlhttp;sa=previews;xml\', x.join(\'&\'), onDocSent);
  371. document.getElementById(\'preview_section\').style.display = \'\';
  372. setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
  373. setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);
  374. return false;
  375. }
  376. else
  377. return submitThisOnce(document.forms.newsmodify);
  378. }
  379. function onDocSent(XMLDoc)
  380. {
  381. if (!XMLDoc)
  382. {
  383. document.forms.newsmodify.preview.onclick = new function ()
  384. {
  385. return true;
  386. }
  387. document.forms.newsmodify.preview.click();
  388. }
  389. // Show the preview section.
  390. var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
  391. setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);
  392. var bodyText = \'\';
  393. for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
  394. bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;
  395. setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
  396. document.getElementById(\'preview_body\').className = \'post\';
  397. // Show a list of errors (if any).
  398. var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
  399. var errorList = new Array();
  400. for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
  401. errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
  402. document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
  403. setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br />\'));
  404. // Adjust the color of captions if the given data is erroneous.
  405. var captions = errors.getElementsByTagName(\'caption\');
  406. for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
  407. if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
  408. document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');
  409. if (errors.getElementsByTagName(\'post_error\').length == 1)
  410. document.forms.newsmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
  411. 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\')
  412. {
  413. if (\'runtimeStyle\' in document.forms.newsmodify.', $context['post_box_name'], ')
  414. document.forms.newsmodify.', $context['post_box_name'], '.style.borderColor = \'\';
  415. else
  416. document.forms.newsmodify.', $context['post_box_name'], '.style.border = null;
  417. }
  418. location.hash = \'#\' + \'preview_section\';
  419. }';
  420. echo '
  421. // ]]></script>';
  422. echo '
  423. <script type="text/javascript"><!-- // --><![CDATA[
  424. function checkboxes_status (item)
  425. {
  426. if (item.id == \'send_html\')
  427. document.getElementById(\'parse_html\').disabled = !document.getElementById(\'parse_html\').disabled;
  428. if (item.id == \'send_pm\')
  429. {
  430. if (!document.getElementById(\'send_html\').checked)
  431. document.getElementById(\'parse_html\').disabled = true;
  432. else
  433. document.getElementById(\'parse_html\').disabled = false;
  434. document.getElementById(\'send_html\').disabled = !document.getElementById(\'send_html\').disabled;
  435. }
  436. }
  437. // ]]></script>
  438. </form>
  439. </div>
  440. <br class="clear" />';
  441. }
  442. function template_email_members_send()
  443. {
  444. global $context, $settings, $options, $txt, $scripturl;
  445. echo '
  446. <div id="admincenter">
  447. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  448. <div class="cat_bar">
  449. <h3 class="catbg">
  450. <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a> ', $txt['admin_newsletters'], '
  451. </h3>
  452. </div>
  453. <div class="windowbg">
  454. <span class="topslice"><span></span></span>
  455. <div class="content">
  456. <p>
  457. <strong>', $context['percentage_done'], '% ', $txt['email_done'], '</strong>
  458. </p>
  459. <input type="submit" name="b" value="', $txt['email_continue'], '" class="button_submit" />
  460. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  461. <input type="hidden" name="subject" value="', $context['subject'], '" />
  462. <input type="hidden" name="message" value="', $context['message'], '" />
  463. <input type="hidden" name="start" value="', $context['start'], '" />
  464. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  465. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />
  466. <input type="hidden" name="send_pm" value="', $context['send_pm'], '" />
  467. <input type="hidden" name="send_html" value="', $context['send_html'], '" />
  468. <input type="hidden" name="parse_html" value="', $context['parse_html'], '" />';
  469. // All the things we must remember!
  470. foreach ($context['recipients'] as $key => $values)
  471. echo '
  472. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  473. echo '
  474. </div>
  475. <span class="botslice"><span></span></span>
  476. </div>
  477. </form>
  478. </div>
  479. <br class="clear" />
  480. <script type="text/javascript"><!-- // --><![CDATA[
  481. var countdown = 2;
  482. doAutoSubmit();
  483. function doAutoSubmit()
  484. {
  485. if (countdown == 0)
  486. document.forms.autoSubmit.submit();
  487. else if (countdown == -1)
  488. return;
  489. document.forms.autoSubmit.b.value = "', $txt['email_continue'], ' (" + countdown + ")";
  490. countdown--;
  491. setTimeout("doAutoSubmit();", 1000);
  492. }
  493. // ]]></script>';
  494. }
  495. ?>