ManageNews.template.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. function template_email_members()
  13. {
  14. global $context, $settings, $options, $txt, $scripturl;
  15. // This is some javascript for the simple/advanced toggling stuff.
  16. echo '
  17. <script type="text/javascript"><!-- // --><![CDATA[
  18. function toggleAdvanced(mode)
  19. {
  20. // What styles are we doing?
  21. var divStyle = mode ? "" : "none";
  22. document.getElementById("advanced_settings_div").style.display = divStyle;
  23. document.getElementById("gosimple").style.display = divStyle;
  24. document.getElementById("goadvanced").style.display = mode ? "none" : "";
  25. }
  26. // ]]></script>';
  27. echo '
  28. <div id="admincenter">
  29. <form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  30. <div class="cat_bar">
  31. <h3 class="catbg">', $txt['admin_newsletters'], '</h3>
  32. </div>
  33. <div class="information">
  34. ', $txt['admin_news_select_recipients'], '
  35. </div>
  36. <div class="windowbg">
  37. <span class="topslice"><span></span></span>
  38. <div class="content">
  39. <dl class="settings">
  40. <dt>
  41. <strong>', $txt['admin_news_select_group'], ':</strong><br />
  42. <span class="smalltext">', $txt['admin_news_select_group_desc'], '</span>
  43. </dt>
  44. <dd>';
  45. foreach ($context['groups'] as $group)
  46. echo '
  47. <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 />';
  48. echo '
  49. <br />
  50. <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>';
  51. echo '
  52. </dd>
  53. </dl><br class="clear" />
  54. </div>
  55. <span class="botslice"><span></span></span>
  56. </div>
  57. <br />
  58. <div class="cat_bar">
  59. <h3 class="catbg" id="advanced_select_div" style="display: none;">
  60. <span class="ie6_header floatleft">
  61. <a href="#" onclick="toggleAdvanced(1); return false;" id="goadvanced"><img src="', $settings['images_url'], '/selected.gif" alt="', $txt['advanced'], '" />&nbsp;<strong>', $txt['advanced'], '</strong></a>
  62. <a href="#" onclick="toggleAdvanced(0); return false;" id="gosimple" style="display: none;"><img src="', $settings['images_url'], '/sort_down.gif" alt="', $txt['simple'], '" />&nbsp;<strong>', $txt['simple'], '</strong></a>
  63. </span>
  64. </h3>
  65. </div>
  66. <div class="windowbg2" id="advanced_settings_div" style="display: none;">
  67. <span class="topslice"><span></span></span>
  68. <div class="content">
  69. <dl class="settings">
  70. <dt>
  71. <strong>', $txt['admin_news_select_email'], ':</strong><br />
  72. <span class="smalltext">', $txt['admin_news_select_email_desc'], '</span>
  73. </dt>
  74. <dd>
  75. <textarea name="emails" rows="5" cols="30" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 98%; min-width: 98%' : 'width: 98%') . ';"></textarea>
  76. </dd>
  77. <dt>
  78. <strong>', $txt['admin_news_select_members'], ':</strong><br />
  79. <span class="smalltext">', $txt['admin_news_select_members_desc'], '</span>
  80. </dt>
  81. <dd>
  82. <input type="text" name="members" id="members" value="" size="30" class="input_text" />
  83. <span id="members_container"></span>
  84. </dd>
  85. </dl>
  86. <hr class="bordercolor" />
  87. <dl class="settings">
  88. <dt>
  89. <strong>', $txt['admin_news_select_excluded_groups'], ':</strong><br />
  90. <span class="smalltext">', $txt['admin_news_select_excluded_groups_desc'], '</span>
  91. </dt>
  92. <dd>';
  93. foreach ($context['groups'] as $group)
  94. echo '
  95. <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 />';
  96. echo '
  97. <br />
  98. <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 />
  99. </dd>
  100. <dt>
  101. <strong>', $txt['admin_news_select_excluded_members'], ':</strong><br />
  102. <span class="smalltext">', $txt['admin_news_select_excluded_members_desc'], '</span>
  103. </dt>
  104. <dd>
  105. <input type="text" name="exclude_members" id="exclude_members" value="" size="30" class="input_text" />
  106. <span id="exclude_members_container"></span>
  107. </dd>
  108. </dl>
  109. <hr class="bordercolor" />
  110. <dl class="settings">
  111. <dt>
  112. <label for="email_force"><strong>', $txt['admin_news_select_override_notify'], ':</strong></label><br />
  113. <span class="smalltext">', $txt['email_force'], '</span>
  114. </dt>
  115. <dd>
  116. <input type="checkbox" name="email_force" id="email_force" value="1" class="input_check" />
  117. </dd>
  118. </dl><br class="clear" />
  119. </div>
  120. <span class="botslice"><span></span></span>
  121. </div>
  122. <div class="righttext">
  123. <input type="submit" value="', $txt['admin_next'], '" class="button_submit" />
  124. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  125. </div>
  126. </form>
  127. </div>
  128. <br class="clear" />';
  129. // Make the javascript stuff visible.
  130. echo '
  131. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  132. <script type="text/javascript"><!-- // --><![CDATA[
  133. document.getElementById("advanced_select_div").style.display = "";
  134. var oMemberSuggest = new smc_AutoSuggest({
  135. sSelf: \'oMemberSuggest\',
  136. sSessionId: \'', $context['session_id'], '\',
  137. sSessionVar: \'', $context['session_var'], '\',
  138. sSuggestId: \'members\',
  139. sControlId: \'members\',
  140. sSearchType: \'member\',
  141. bItemList: true,
  142. sPostName: \'member_list\',
  143. sURLMask: \'action=profile;u=%item_id%\',
  144. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  145. sItemListContainerId: \'members_container\',
  146. aListItems: []
  147. });
  148. var oExcludeMemberSuggest = new smc_AutoSuggest({
  149. sSelf: \'oExcludeMemberSuggest\',
  150. sSessionId: \'', $context['session_id'], '\',
  151. sSessionVar: \'', $context['session_var'], '\',
  152. sSuggestId: \'exclude_members\',
  153. sControlId: \'exclude_members\',
  154. sSearchType: \'member\',
  155. bItemList: true,
  156. sPostName: \'exclude_member_list\',
  157. sURLMask: \'action=profile;u=%item_id%\',
  158. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  159. sItemListContainerId: \'exclude_members_container\',
  160. aListItems: []
  161. });
  162. // ]]></script>';
  163. }
  164. function template_email_members_compose()
  165. {
  166. global $context, $settings, $options, $txt, $scripturl;
  167. echo '
  168. <div id="admincenter">
  169. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '">
  170. <div class="cat_bar">
  171. <h3 class="catbg">
  172. <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a> ', $txt['admin_newsletters'], '
  173. </h3>
  174. </div>
  175. <div class="information">
  176. ', $txt['email_variables'], '
  177. </div>
  178. <div class="windowbg">
  179. <span class="topslice"><span></span></span>
  180. <div class="content">
  181. <p>
  182. <input type="text" name="subject" size="60" value="', $context['default_subject'], '" class="input_text" />
  183. </p>
  184. <p>
  185. <textarea cols="70" rows="9" name="message" class="editor">', $context['default_message'], '</textarea>
  186. </p>
  187. <ul class="reset">
  188. <li><label for="send_pm"><input type="checkbox" name="send_pm" id="send_pm" class="input_check" onclick="if (this.checked && ', $context['total_emails'], ' != 0 && !confirm(\'', $txt['admin_news_cannot_pm_emails_js'], '\')) return false; this.form.parse_html.disabled = this.checked; this.form.send_html.disabled = this.checked; " /> ', $txt['email_as_pms'], '</label></li>
  189. <li><label for="send_html"><input type="checkbox" name="send_html" id="send_html" class="input_check" onclick="this.form.parse_html.disabled = !this.checked;" /> ', $txt['email_as_html'], '</label></li>
  190. <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>
  191. </ul>
  192. <p>
  193. <input type="submit" value="', $txt['sendtopic_send'], '" class="button_submit" />
  194. </p>
  195. </div>
  196. <span class="botslice"><span></span></span>
  197. </div>
  198. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  199. <input type="hidden" name="email_force" value="', $context['email_force'], '" />
  200. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  201. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />';
  202. foreach ($context['recipients'] as $key => $values)
  203. echo '
  204. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  205. echo '
  206. </form>
  207. </div>
  208. <br class="clear" />';
  209. }
  210. function template_email_members_send()
  211. {
  212. global $context, $settings, $options, $txt, $scripturl;
  213. echo '
  214. <div id="admincenter">
  215. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  216. <div class="cat_bar">
  217. <h3 class="catbg">
  218. <a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> ', $txt['admin_newsletters'], '
  219. </h3>
  220. </div>
  221. <div class="windowbg">
  222. <span class="topslice"><span></span></span>
  223. <div class="content">
  224. <p>
  225. <strong>', $context['percentage_done'], '% ', $txt['email_done'], '</strong>
  226. </p>
  227. <input type="submit" name="b" value="', $txt['email_continue'], '" class="button_submit" />
  228. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  229. <input type="hidden" name="subject" value="', $context['subject'], '" />
  230. <input type="hidden" name="message" value="', $context['message'], '" />
  231. <input type="hidden" name="start" value="', $context['start'], '" />
  232. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  233. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />
  234. <input type="hidden" name="send_pm" value="', $context['send_pm'], '" />
  235. <input type="hidden" name="send_html" value="', $context['send_html'], '" />
  236. <input type="hidden" name="parse_html" value="', $context['parse_html'], '" />';
  237. // All the things we must remember!
  238. foreach ($context['recipients'] as $key => $values)
  239. echo '
  240. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  241. echo '
  242. </div>
  243. <span class="botslice"><span></span></span>
  244. </div>
  245. </form>
  246. </div>
  247. <br class="clear" />
  248. <script type="text/javascript"><!-- // --><![CDATA[
  249. var countdown = 2;
  250. doAutoSubmit();
  251. function doAutoSubmit()
  252. {
  253. if (countdown == 0)
  254. document.forms.autoSubmit.submit();
  255. else if (countdown == -1)
  256. return;
  257. document.forms.autoSubmit.b.value = "', $txt['email_continue'], ' (" + countdown + ")";
  258. countdown--;
  259. setTimeout("doAutoSubmit();", 1000);
  260. }
  261. // ]]></script>';
  262. }
  263. ?>