ManageNews.template.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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.0
  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="' . ($context['browser']['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="floatleftpadding">
  54. <div id="moreNewsItems_link" style="display: none;"><a href="javascript:void(0);" onclick="addNewsItem(); return false;">', $txt['editnews_clickadd'], '</a></div>
  55. <script type="text/javascript"><!-- // --><![CDATA[
  56. document.getElementById("moreNewsItems_link").style.display = "";
  57. function addNewsItem()
  58. {
  59. document.getElementById("moreNews").style.display = "";
  60. setOuterHTML(document.getElementById("moreNewsItems"), \'<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';"><\' + \'/textarea><\' + \'/div><div id="moreNewsItems"><\' + \'/div>\');
  61. }
  62. // ]]></script>
  63. <noscript>
  64. <div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';" name="news[]"></textarea></div>
  65. </noscript>
  66. </div>
  67. <div class="floatrightpadding">
  68. <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" />
  69. </div>
  70. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  71. </form>
  72. </div>
  73. <br class="clear" />';
  74. }
  75. function template_email_members()
  76. {
  77. global $context, $settings, $options, $txt, $scripturl;
  78. // This is some javascript for the simple/advanced toggling stuff.
  79. echo '
  80. <script type="text/javascript"><!-- // --><![CDATA[
  81. function toggleAdvanced(mode)
  82. {
  83. // What styles are we doing?
  84. var divStyle = mode ? "" : "none";
  85. document.getElementById("advanced_settings_div").style.display = divStyle;
  86. document.getElementById("gosimple").style.display = divStyle;
  87. document.getElementById("goadvanced").style.display = mode ? "none" : "";
  88. }
  89. // ]]></script>';
  90. echo '
  91. <div id="admincenter">
  92. <form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  93. <div class="cat_bar">
  94. <h3 class="catbg">', $txt['admin_newsletters'], '</h3>
  95. </div>
  96. <div class="information">
  97. ', $txt['admin_news_select_recipients'], '
  98. </div>
  99. <div class="windowbg">
  100. <span class="topslice"><span></span></span>
  101. <div class="content">
  102. <dl class="settings">
  103. <dt>
  104. <strong>', $txt['admin_news_select_group'], ':</strong><br />
  105. <span class="smalltext">', $txt['admin_news_select_group_desc'], '</span>
  106. </dt>
  107. <dd>';
  108. foreach ($context['groups'] as $group)
  109. echo '
  110. <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 />';
  111. echo '
  112. <br />
  113. <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>';
  114. echo '
  115. </dd>
  116. </dl><br class="clear" />
  117. </div>
  118. <span class="botslice"><span></span></span>
  119. </div>
  120. <br />
  121. <div class="cat_bar">
  122. <h3 class="catbg" id="advanced_select_div" style="display: none;">
  123. <span class="ie6_header floatleft">
  124. <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>
  125. <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>
  126. </span>
  127. </h3>
  128. </div>
  129. <div class="windowbg2" id="advanced_settings_div" style="display: none;">
  130. <span class="topslice"><span></span></span>
  131. <div class="content">
  132. <dl class="settings">
  133. <dt>
  134. <strong>', $txt['admin_news_select_email'], ':</strong><br />
  135. <span class="smalltext">', $txt['admin_news_select_email_desc'], '</span>
  136. </dt>
  137. <dd>
  138. <textarea name="emails" rows="5" cols="30" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 98%; min-width: 98%' : 'width: 98%') . ';"></textarea>
  139. </dd>
  140. <dt>
  141. <strong>', $txt['admin_news_select_members'], ':</strong><br />
  142. <span class="smalltext">', $txt['admin_news_select_members_desc'], '</span>
  143. </dt>
  144. <dd>
  145. <input type="text" name="members" id="members" value="" size="30" class="input_text" />
  146. <span id="members_container"></span>
  147. </dd>
  148. </dl>
  149. <hr class="bordercolor" />
  150. <dl class="settings">
  151. <dt>
  152. <strong>', $txt['admin_news_select_excluded_groups'], ':</strong><br />
  153. <span class="smalltext">', $txt['admin_news_select_excluded_groups_desc'], '</span>
  154. </dt>
  155. <dd>';
  156. foreach ($context['groups'] as $group)
  157. echo '
  158. <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 />';
  159. echo '
  160. <br />
  161. <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 />
  162. </dd>
  163. <dt>
  164. <strong>', $txt['admin_news_select_excluded_members'], ':</strong><br />
  165. <span class="smalltext">', $txt['admin_news_select_excluded_members_desc'], '</span>
  166. </dt>
  167. <dd>
  168. <input type="text" name="exclude_members" id="exclude_members" value="" size="30" class="input_text" />
  169. <span id="exclude_members_container"></span>
  170. </dd>
  171. </dl>
  172. <hr class="bordercolor" />
  173. <dl class="settings">
  174. <dt>
  175. <label for="email_force"><strong>', $txt['admin_news_select_override_notify'], ':</strong></label><br />
  176. <span class="smalltext">', $txt['email_force'], '</span>
  177. </dt>
  178. <dd>
  179. <input type="checkbox" name="email_force" id="email_force" value="1" class="input_check" />
  180. </dd>
  181. </dl><br class="clear" />
  182. </div>
  183. <span class="botslice"><span></span></span>
  184. </div>
  185. <div class="righttext">
  186. <input type="submit" value="', $txt['admin_next'], '" class="button_submit" />
  187. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  188. </div>
  189. </form>
  190. </div>
  191. <br class="clear" />';
  192. // Make the javascript stuff visible.
  193. echo '
  194. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  195. <script type="text/javascript"><!-- // --><![CDATA[
  196. document.getElementById("advanced_select_div").style.display = "";
  197. var oMemberSuggest = new smc_AutoSuggest({
  198. sSelf: \'oMemberSuggest\',
  199. sSessionId: \'', $context['session_id'], '\',
  200. sSessionVar: \'', $context['session_var'], '\',
  201. sSuggestId: \'members\',
  202. sControlId: \'members\',
  203. sSearchType: \'member\',
  204. bItemList: true,
  205. sPostName: \'member_list\',
  206. sURLMask: \'action=profile;u=%item_id%\',
  207. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  208. sItemListContainerId: \'members_container\',
  209. aListItems: []
  210. });
  211. var oExcludeMemberSuggest = new smc_AutoSuggest({
  212. sSelf: \'oExcludeMemberSuggest\',
  213. sSessionId: \'', $context['session_id'], '\',
  214. sSessionVar: \'', $context['session_var'], '\',
  215. sSuggestId: \'exclude_members\',
  216. sControlId: \'exclude_members\',
  217. sSearchType: \'member\',
  218. bItemList: true,
  219. sPostName: \'exclude_member_list\',
  220. sURLMask: \'action=profile;u=%item_id%\',
  221. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  222. sItemListContainerId: \'exclude_members_container\',
  223. aListItems: []
  224. });
  225. // ]]></script>';
  226. }
  227. function template_email_members_compose()
  228. {
  229. global $context, $settings, $options, $txt, $scripturl;
  230. echo '
  231. <div id="admincenter">
  232. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '">
  233. <div class="cat_bar">
  234. <h3 class="catbg">
  235. <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'], '
  236. </h3>
  237. </div>
  238. <div class="information">
  239. ', $txt['email_variables'], '
  240. </div>
  241. <div class="windowbg">
  242. <span class="topslice"><span></span></span>
  243. <div class="content">
  244. <p>
  245. <input type="text" name="subject" size="60" value="', $context['default_subject'], '" class="input_text" />
  246. </p>
  247. <p>
  248. <textarea cols="70" rows="9" name="message" class="editor">', $context['default_message'], '</textarea>
  249. </p>
  250. <ul class="reset">
  251. <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>
  252. <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>
  253. <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>
  254. </ul>
  255. <p>
  256. <input type="submit" value="', $txt['sendtopic_send'], '" class="button_submit" />
  257. </p>
  258. </div>
  259. <span class="botslice"><span></span></span>
  260. </div>
  261. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  262. <input type="hidden" name="email_force" value="', $context['email_force'], '" />
  263. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  264. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />';
  265. foreach ($context['recipients'] as $key => $values)
  266. echo '
  267. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  268. echo '
  269. </form>
  270. </div>
  271. <br class="clear" />';
  272. }
  273. function template_email_members_send()
  274. {
  275. global $context, $settings, $options, $txt, $scripturl;
  276. echo '
  277. <div id="admincenter">
  278. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  279. <div class="cat_bar">
  280. <h3 class="catbg">
  281. <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'], '
  282. </h3>
  283. </div>
  284. <div class="windowbg">
  285. <span class="topslice"><span></span></span>
  286. <div class="content">
  287. <p>
  288. <strong>', $context['percentage_done'], '% ', $txt['email_done'], '</strong>
  289. </p>
  290. <input type="submit" name="b" value="', $txt['email_continue'], '" class="button_submit" />
  291. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  292. <input type="hidden" name="subject" value="', $context['subject'], '" />
  293. <input type="hidden" name="message" value="', $context['message'], '" />
  294. <input type="hidden" name="start" value="', $context['start'], '" />
  295. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  296. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />
  297. <input type="hidden" name="send_pm" value="', $context['send_pm'], '" />
  298. <input type="hidden" name="send_html" value="', $context['send_html'], '" />
  299. <input type="hidden" name="parse_html" value="', $context['parse_html'], '" />';
  300. // All the things we must remember!
  301. foreach ($context['recipients'] as $key => $values)
  302. echo '
  303. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  304. echo '
  305. </div>
  306. <span class="botslice"><span></span></span>
  307. </div>
  308. </form>
  309. </div>
  310. <br class="clear" />
  311. <script type="text/javascript"><!-- // --><![CDATA[
  312. var countdown = 2;
  313. doAutoSubmit();
  314. function doAutoSubmit()
  315. {
  316. if (countdown == 0)
  317. document.forms.autoSubmit.submit();
  318. else if (countdown == -1)
  319. return;
  320. document.forms.autoSubmit.b.value = "', $txt['email_continue'], ' (" + countdown + ")";
  321. countdown--;
  322. setTimeout("doAutoSubmit();", 1000);
  323. }
  324. // ]]></script>';
  325. }
  326. ?>