ManageNews.template.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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;"><a class="button_link" 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="' . (isBrowser('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="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';" name="news[]"></textarea></div>
  65. </noscript>
  66. </div>
  67. <div class="floatright padding">
  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. echo '
  79. <div id="admincenter">
  80. <form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  81. <div class="cat_bar">
  82. <h3 class="catbg">', $txt['admin_newsletters'], '</h3>
  83. </div>
  84. <div class="information">
  85. ', $txt['admin_news_select_recipients'], '
  86. </div>
  87. <div class="windowbg">
  88. <span class="topslice"><span></span></span>
  89. <div class="content">
  90. <dl class="settings">
  91. <dt>
  92. <strong>', $txt['admin_news_select_group'], ':</strong><br />
  93. <span class="smalltext">', $txt['admin_news_select_group_desc'], '</span>
  94. </dt>
  95. <dd>';
  96. foreach ($context['groups'] as $group)
  97. echo '
  98. <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 />';
  99. echo '
  100. <br />
  101. <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>';
  102. echo '
  103. </dd>
  104. </dl><br class="clear" />
  105. </div>
  106. <span class="botslice"><span></span></span>
  107. </div>
  108. <br />
  109. <div class="cat_bar">
  110. <h3 class="catbg">
  111. <img id="advanced_panel_toggle" class="panel_toggle" style="display: none; src="', $settings['images_url'], '/', empty($context['show_advanced_options']) ? 'collapse' : 'expand', '.png" alt="*" />
  112. <a href="#" id="advanced_panel_link" >', $txt['advanced'], '</a>
  113. </h3>
  114. </div>
  115. <div id="advanced_panel_div" class="windowbg2">
  116. <span class="topslice"><span></span></span>
  117. <div class="content">
  118. <dl class="settings">
  119. <dt>
  120. <strong>', $txt['admin_news_select_email'], ':</strong><br />
  121. <span class="smalltext">', $txt['admin_news_select_email_desc'], '</span>
  122. </dt>
  123. <dd>
  124. <textarea name="emails" rows="5" cols="30" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 98%; min-width: 98%' : 'width: 98%') . ';"></textarea>
  125. </dd>
  126. <dt>
  127. <strong>', $txt['admin_news_select_members'], ':</strong><br />
  128. <span class="smalltext">', $txt['admin_news_select_members_desc'], '</span>
  129. </dt>
  130. <dd>
  131. <input type="text" name="members" id="members" value="" size="30" class="input_text" />
  132. <span id="members_container"></span>
  133. </dd>
  134. </dl>
  135. <hr class="bordercolor" />
  136. <dl class="settings">
  137. <dt>
  138. <strong>', $txt['admin_news_select_excluded_groups'], ':</strong><br />
  139. <span class="smalltext">', $txt['admin_news_select_excluded_groups_desc'], '</span>
  140. </dt>
  141. <dd>';
  142. foreach ($context['groups'] as $group)
  143. echo '
  144. <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 />';
  145. echo '
  146. <br />
  147. <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 />
  148. </dd>
  149. <dt>
  150. <strong>', $txt['admin_news_select_excluded_members'], ':</strong><br />
  151. <span class="smalltext">', $txt['admin_news_select_excluded_members_desc'], '</span>
  152. </dt>
  153. <dd>
  154. <input type="text" name="exclude_members" id="exclude_members" value="" size="30" class="input_text" />
  155. <span id="exclude_members_container"></span>
  156. </dd>
  157. </dl>
  158. <hr class="bordercolor" />
  159. <dl class="settings">
  160. <dt>
  161. <label for="email_force"><strong>', $txt['admin_news_select_override_notify'], ':</strong></label><br />
  162. <span class="smalltext">', $txt['email_force'], '</span>
  163. </dt>
  164. <dd>
  165. <input type="checkbox" name="email_force" id="email_force" value="1" class="input_check" />
  166. </dd>
  167. </dl><br class="clear" />
  168. </div>
  169. <span class="botslice"><span></span></span>
  170. </div>
  171. <div class="righttext">
  172. <input type="submit" value="', $txt['admin_next'], '" class="button_submit" />
  173. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  174. </div>
  175. </form>
  176. </div>
  177. <br class="clear" />';
  178. // This is some javascript for the simple/advanced toggling and member suggest
  179. echo '
  180. <script type="text/javascript"><!-- // --><![CDATA[
  181. var oAdvancedPanelToggle = new smc_Toggle({
  182. bToggleEnabled: true,
  183. bCurrentlyCollapsed: ', empty($context['show_advanced_options']) ? 'true' : 'false', ',
  184. aSwappableContainers: [
  185. \'advanced_panel_div\'
  186. ],
  187. aSwapImages: [
  188. {
  189. sId: \'advanced_panel_toggle\',
  190. srcExpanded: smf_images_url + \'/collapse.png\',
  191. altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
  192. srcCollapsed: smf_images_url + \'/expand.png\',
  193. altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
  194. }
  195. ],
  196. aSwapLinks: [
  197. {
  198. sId: \'advanced_panel_link\',
  199. msgExpanded: ', JavaScriptEscape($txt['advanced']), ',
  200. msgCollapsed: ', JavaScriptEscape($txt['advanced']), '
  201. }
  202. ],
  203. oThemeOptions: {
  204. bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
  205. sOptionName: \'admin_preferences\',
  206. sSessionVar: smf_session_var,
  207. sSessionId: smf_session_id,
  208. sThemeId: \'1\'
  209. }
  210. });
  211. // ]]></script>
  212. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  213. <script type="text/javascript"><!-- // --><![CDATA[
  214. var oMemberSuggest = new smc_AutoSuggest({
  215. sSelf: \'oMemberSuggest\',
  216. sSessionId: smf_session_id,
  217. sSessionVar: smf_session_var,
  218. sSuggestId: \'members\',
  219. sControlId: \'members\',
  220. sSearchType: \'member\',
  221. bItemList: true,
  222. sPostName: \'member_list\',
  223. sURLMask: \'action=profile;u=%item_id%\',
  224. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  225. sItemListContainerId: \'members_container\',
  226. aListItems: []
  227. });
  228. var oExcludeMemberSuggest = new smc_AutoSuggest({
  229. sSelf: \'oExcludeMemberSuggest\',
  230. sSessionId: \'', $context['session_id'], '\',
  231. sSessionVar: \'', $context['session_var'], '\',
  232. sSuggestId: \'exclude_members\',
  233. sControlId: \'exclude_members\',
  234. sSearchType: \'member\',
  235. bItemList: true,
  236. sPostName: \'exclude_member_list\',
  237. sURLMask: \'action=profile;u=%item_id%\',
  238. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  239. sItemListContainerId: \'exclude_members_container\',
  240. aListItems: []
  241. });
  242. // ]]></script>';
  243. }
  244. function template_email_members_compose()
  245. {
  246. global $context, $settings, $options, $txt, $scripturl;
  247. echo '
  248. <div id="admincenter">
  249. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '">
  250. <div class="cat_bar">
  251. <h3 class="catbg">
  252. <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'], '
  253. </h3>
  254. </div>
  255. <div class="information">
  256. ', $txt['email_variables'], '
  257. </div>
  258. <div class="windowbg">
  259. <span class="topslice"><span></span></span>
  260. <div class="content">
  261. <p>
  262. <input type="text" name="subject" size="60" value="', $context['default_subject'], '" class="input_text" />
  263. </p>
  264. <p>
  265. <textarea cols="70" rows="9" name="message" class="editor">', $context['default_message'], '</textarea>
  266. </p>
  267. <ul class="reset">
  268. <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>
  269. <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>
  270. <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>
  271. </ul>
  272. <p>
  273. <input type="submit" value="', $txt['sendtopic_send'], '" class="button_submit" />
  274. </p>
  275. </div>
  276. <span class="botslice"><span></span></span>
  277. </div>
  278. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  279. <input type="hidden" name="email_force" value="', $context['email_force'], '" />
  280. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  281. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />';
  282. foreach ($context['recipients'] as $key => $values)
  283. echo '
  284. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  285. echo '
  286. </form>
  287. </div>
  288. <br class="clear" />';
  289. }
  290. function template_email_members_send()
  291. {
  292. global $context, $settings, $options, $txt, $scripturl;
  293. echo '
  294. <div id="admincenter">
  295. <form action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  296. <div class="cat_bar">
  297. <h3 class="catbg">
  298. <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'], '" align="top" /></a> ', $txt['admin_newsletters'], '
  299. </h3>
  300. </div>
  301. <div class="windowbg">
  302. <span class="topslice"><span></span></span>
  303. <div class="content">
  304. <p>
  305. <strong>', $context['percentage_done'], '% ', $txt['email_done'], '</strong>
  306. </p>
  307. <input type="submit" name="b" value="', $txt['email_continue'], '" class="button_submit" />
  308. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  309. <input type="hidden" name="subject" value="', $context['subject'], '" />
  310. <input type="hidden" name="message" value="', $context['message'], '" />
  311. <input type="hidden" name="start" value="', $context['start'], '" />
  312. <input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
  313. <input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />
  314. <input type="hidden" name="send_pm" value="', $context['send_pm'], '" />
  315. <input type="hidden" name="send_html" value="', $context['send_html'], '" />
  316. <input type="hidden" name="parse_html" value="', $context['parse_html'], '" />';
  317. // All the things we must remember!
  318. foreach ($context['recipients'] as $key => $values)
  319. echo '
  320. <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
  321. echo '
  322. </div>
  323. <span class="botslice"><span></span></span>
  324. </div>
  325. </form>
  326. </div>
  327. <br class="clear" />
  328. <script type="text/javascript"><!-- // --><![CDATA[
  329. var countdown = 2;
  330. doAutoSubmit();
  331. function doAutoSubmit()
  332. {
  333. if (countdown == 0)
  334. document.forms.autoSubmit.submit();
  335. else if (countdown == -1)
  336. return;
  337. document.forms.autoSubmit.b.value = "', $txt['email_continue'], ' (" + countdown + ")";
  338. countdown--;
  339. setTimeout("doAutoSubmit();", 1000);
  340. }
  341. // ]]></script>';
  342. }
  343. ?>