ModerationCenter.template.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2013 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. function template_moderation_center()
  13. {
  14. global $settings, $options, $context, $txt, $scripturl;
  15. // Show moderators notes.
  16. template_notes();
  17. // Show a welcome message to the user.
  18. echo '
  19. <div id="modcenter">';
  20. $alternate = true;
  21. // Show all the blocks they want to see.
  22. foreach ($context['mod_blocks'] as $block)
  23. {
  24. $block_function = 'template_' . $block;
  25. echo '
  26. <div class="modblock_', $alternate ? 'left' : 'right', '">', function_exists($block_function) ? $block_function() : '', '</div>';
  27. if (!$alternate)
  28. echo '
  29. <br class="clear" />';
  30. $alternate = !$alternate;
  31. }
  32. echo '
  33. </div>
  34. <br class="clear" />';
  35. }
  36. // Show all the group requests the user can see.
  37. function template_group_requests_block()
  38. {
  39. global $settings, $options, $context, $txt, $scripturl;
  40. echo '
  41. <div class="cat_bar">
  42. <h3 class="catbg">
  43. <a href="', $scripturl, '?action=groups;sa=requests">', $txt['mc_group_requests'], '</a>
  44. </h3>
  45. </div>
  46. <div class="windowbg">
  47. <div class="content modbox">
  48. <ul class="reset">';
  49. foreach ($context['group_requests'] as $request)
  50. echo '
  51. <li class="smalltext">
  52. <a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
  53. </li>';
  54. // Don't have any watched users right now?
  55. if (empty($context['group_requests']))
  56. echo '
  57. <li>
  58. <strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
  59. </li>';
  60. echo '
  61. </ul>
  62. </div>
  63. </div>';
  64. }
  65. // A block to show the current top reported posts.
  66. function template_reported_posts_block()
  67. {
  68. global $settings, $options, $context, $txt, $scripturl;
  69. echo '
  70. <div class="cat_bar">
  71. <h3 class="catbg">
  72. <a href="', $scripturl, '?action=moderate;area=reports">', $txt['mc_recent_reports'], '</a>
  73. </h3>
  74. </div>
  75. <div class="windowbg">
  76. <div class="content modbox">
  77. <ul class="reset">';
  78. foreach ($context['reported_posts'] as $report)
  79. echo '
  80. <li class="smalltext">
  81. <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
  82. </li>';
  83. // Don't have any watched users right now?
  84. if (empty($context['reported_posts']))
  85. echo '
  86. <li>
  87. <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
  88. </li>';
  89. echo '
  90. </ul>
  91. </div>
  92. </div>';
  93. }
  94. function template_watched_users()
  95. {
  96. global $settings, $options, $context, $txt, $scripturl;
  97. echo '
  98. <div class="cat_bar">
  99. <h3 class="catbg">
  100. <a href="', $scripturl, '?action=moderate;area=userwatch">', $txt['mc_watched_users'], '</a>
  101. </h3>
  102. </div>
  103. <div class="windowbg">
  104. <div class="content modbox">
  105. <ul class="reset">';
  106. foreach ($context['watched_users'] as $user)
  107. echo '
  108. <li>
  109. <span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
  110. </li>';
  111. // Don't have any watched users right now?
  112. if (empty($context['watched_users']))
  113. echo '
  114. <li>
  115. <strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
  116. </li>';
  117. echo '
  118. </ul>
  119. </div>
  120. </div>';
  121. }
  122. // Little section for making... notes.
  123. function template_notes()
  124. {
  125. global $settings, $options, $context, $txt, $scripturl;
  126. echo '
  127. <div class="modnotes">
  128. <form action="', $scripturl, '?action=moderate;area=index;modnote" method="post">
  129. <div class="cat_bar">
  130. <h3 class="catbg">', $txt['mc_notes'], '</h3>
  131. </div>
  132. <div class="windowbg">
  133. <div class="content modbox">';
  134. if (!empty($context['notes']))
  135. {
  136. echo '
  137. <ul class="reset moderation_notes">';
  138. // Cycle through the notes.
  139. foreach ($context['notes'] as $note)
  140. echo '
  141. <li class="smalltext"><a href="', $note['delete_href'], '"><img src="', $settings['images_url'], '/pm_recipient_delete.png" alt="" /></a>', $note['time'] ,' <strong>', $note['author']['link'], ':</strong> ', $note['text'], '</li>';
  142. echo '
  143. </ul>
  144. <div class="pagesection notes">
  145. <span class="smalltext">', $context['page_index'], '</span>
  146. </div>';
  147. }
  148. echo '
  149. <div class="floatleft post_note">
  150. <input type="text" name="new_note" value="', $txt['mc_click_add_note'], '" style="width: 95%;" onclick="if (this.value == \'', $txt['mc_click_add_note'], '\') this.value = \'\';" class="input_text" />
  151. </div>
  152. <input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button_submit" />
  153. </div>
  154. </div>
  155. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  156. </form>
  157. </div>';
  158. }
  159. function template_reported_posts()
  160. {
  161. global $settings, $options, $context, $txt, $scripturl;
  162. echo '
  163. <form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  164. <div class="cat_bar">
  165. <h3 class="catbg">
  166. ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
  167. </h3>
  168. </div>
  169. <div class="pagesection">
  170. <div class="pagelinks">', $context['page_index'], '</div>
  171. </div>';
  172. // Make the buttons.
  173. $close_button = create_button('close.png', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', 'class="centericon"');
  174. $details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
  175. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  176. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  177. foreach ($context['reports'] as $report)
  178. {
  179. echo '
  180. <div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
  181. <div class="content">
  182. <h5>
  183. <strong><a href="', $report['topic_href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
  184. </h5>
  185. <div class="smalltext">
  186. ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
  187. // Prepare the comments...
  188. $comments = array();
  189. foreach ($report['comments'] as $comment)
  190. $comments[$comment['member']['id']] = $comment['member']['link'];
  191. echo '
  192. ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
  193. </div>
  194. <hr />
  195. ', $report['body'], '
  196. <br />
  197. <ul class="quickbuttons">
  198. <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
  199. <li><a href="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$report['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
  200. <li><a href="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';close=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a></li>
  201. <li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check" />' : '', '</li>
  202. </ul>
  203. </div>
  204. </div>';
  205. }
  206. // Were none found?
  207. if (empty($context['reports']))
  208. echo '
  209. <div class="windowbg2">
  210. <div class="content">
  211. <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
  212. </div>
  213. </div>';
  214. echo '
  215. <div class="pagesection">
  216. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  217. <div class="floatright">
  218. ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit" />' : '', '
  219. </div>
  220. </div>
  221. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  222. </form>';
  223. }
  224. // Show a list of all the unapproved posts
  225. function template_unapproved_posts()
  226. {
  227. global $settings, $options, $context, $txt, $scripturl;
  228. // Just a big table of it all really...
  229. echo '
  230. <div id="modcenter">
  231. <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '">
  232. <div class="cat_bar">
  233. <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
  234. </div>';
  235. // Make up some buttons
  236. $approve_button = create_button('approve.png', 'approve', 'approve', 'class="centericon"');
  237. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  238. // No posts?
  239. if (empty($context['unapproved_items']))
  240. echo '
  241. <div class="windowbg2">
  242. <div class="content">
  243. <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p>
  244. </div>
  245. </div>';
  246. else
  247. echo '
  248. <div class="pagesection floatleft">
  249. ', $context['page_index'], '
  250. </div>';
  251. foreach ($context['unapproved_items'] as $item)
  252. {
  253. echo '
  254. <div class="topic clear">
  255. <div class="', $item['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  256. <div class="content">
  257. <div class="counter">', $item['counter'], '</div>
  258. <div class="topic_details">
  259. <h5><strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong></h5>
  260. <span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
  261. </div>
  262. <div class="list_posts">
  263. <div class="post">', $item['body'], '</div>
  264. </div>
  265. <span class="floatright">
  266. <a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';approve=', $item['id'], '">', $approve_button, '</a>';
  267. if ($item['can_delete'])
  268. echo '
  269. ', $context['menu_separator'], '
  270. <a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';delete=', $item['id'], '">', $remove_button, '</a>';
  271. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  272. echo '
  273. <input type="checkbox" name="item[]" value="', $item['id'], '" checked="checked" class="input_check" /> ';
  274. echo '
  275. </span>
  276. </div>
  277. </div>
  278. </div>';
  279. }
  280. echo '
  281. <div class="pagesection">';
  282. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
  283. echo '
  284. <div class="floatright">
  285. <select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
  286. <option value="0">', $txt['with_selected'], ':</option>
  287. <option value="0">-------------------</option>
  288. <option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
  289. <option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
  290. </select>
  291. <noscript><input type="submit" name="mc_go" value="', $txt['go'], '" class="button_submit" /></noscript>
  292. </div>';
  293. if (!empty($context['unapproved_items']))
  294. echo '
  295. <div class="floatleft">
  296. <div class="pagelinks">', $context['page_index'], '</div>
  297. </div>';
  298. echo '
  299. </div>
  300. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  301. </form>
  302. </div>';
  303. }
  304. function template_viewmodreport()
  305. {
  306. global $context, $scripturl, $txt;
  307. echo '
  308. <div id="modcenter">
  309. <form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  310. <div class="cat_bar">
  311. <h3 class="catbg">
  312. ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
  313. </h3>
  314. </div>
  315. <div class="title_bar">
  316. <h3 class="titlebg">
  317. <span class="floatleft">
  318. ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
  319. </span>
  320. <span class="floatright">';
  321. // Make the buttons.
  322. $close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', 'class="centericon"');
  323. $ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
  324. $unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
  325. echo '
  326. <a href="', $scripturl, '?action=moderate;area=reports;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$context['report']['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
  327. <a href="', $scripturl, '?action=moderate;area=reports;close=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a>
  328. </span>
  329. </h3>
  330. </div>
  331. <div class="windowbg2">
  332. <div class="content">
  333. ', $context['report']['body'], '
  334. </div>
  335. </div>
  336. <br />
  337. <div class="cat_bar">
  338. <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
  339. </div>';
  340. foreach ($context['report']['comments'] as $comment)
  341. echo '
  342. <div class="windowbg">
  343. <div class="content">
  344. <p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
  345. <p>', $comment['message'], '</p>
  346. </div>
  347. </div>';
  348. echo '
  349. <br />
  350. <div class="cat_bar">
  351. <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
  352. </div>
  353. <div class="windowbg2">
  354. <div class="content">';
  355. if (empty($context['report']['mod_comments']))
  356. echo '
  357. <div class="information">
  358. <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
  359. </div>';
  360. foreach ($context['report']['mod_comments'] as $comment)
  361. echo
  362. '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
  363. echo '
  364. <textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
  365. <div>
  366. <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
  367. </div>
  368. </div>
  369. </div>
  370. <br />';
  371. $alt = false;
  372. template_show_list('moderation_actions_list');
  373. echo '
  374. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  375. </form>
  376. </div>';
  377. }
  378. // Callback function for showing a watched users post in the table.
  379. function template_user_watch_post_callback($post)
  380. {
  381. global $scripturl, $context, $txt, $delete_button;
  382. // We'll have a delete please bob.
  383. if (empty($delete_button))
  384. $delete_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  385. $output_html = '
  386. <div>
  387. <div class="floatleft">
  388. <strong><a href="' . $scripturl . '?topic=' . $post['id_topic'] . '.' . $post['id'] . '#msg' . $post['id'] . '">' . $post['subject'] . '</a></strong> ' . $txt['mc_reportedp_by'] . ' <strong>' . $post['author_link'] . '</strong>
  389. </div>
  390. <div class="floatright">';
  391. if ($post['can_delete'])
  392. $output_html .= '
  393. <a href="' . $scripturl . '?action=moderate;area=userwatch;sa=post;delete=' . $post['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mc_watched_users_delete_post'] . '\');">' . $delete_button . '</a>
  394. <input type="checkbox" name="delete[]" value="' . $post['id'] . '" class="input_check" />';
  395. $output_html .= '
  396. </div>
  397. </div><br />
  398. <div class="smalltext">
  399. &#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
  400. </div>
  401. <hr />
  402. ' . $post['body'];
  403. return $output_html;
  404. }
  405. // Moderation settings
  406. function template_moderation_settings()
  407. {
  408. global $settings, $options, $context, $txt, $scripturl;
  409. echo '
  410. <div id="modcenter">
  411. <form action="', $scripturl, '?action=moderate;area=settings" method="post" accept-charset="', $context['character_set'], '">
  412. <div class="windowbg2">
  413. <div class="content">
  414. <dl class="settings">
  415. <dt>
  416. <strong>', $txt['mc_prefs_homepage'], ':</strong>
  417. </dt>
  418. <dd>';
  419. foreach ($context['homepage_blocks'] as $k => $v)
  420. echo '
  421. <label for="mod_homepage_', $k, '"><input type="checkbox" id="mod_homepage_', $k, '" name="mod_homepage[', $k, ']"', in_array($k, $context['mod_settings']['user_blocks']) ? ' checked="checked"' : '', ' class="input_check" /> ', $v, '</label><br />';
  422. echo '
  423. </dd>';
  424. // If they can moderate boards they have more options!
  425. if ($context['can_moderate_boards'])
  426. {
  427. echo '
  428. <dt>
  429. <strong><label for="mod_show_reports">', $txt['mc_prefs_show_reports'], '</label>:</strong>
  430. </dt>
  431. <dd>
  432. <input type="checkbox" id="mod_show_reports" name="mod_show_reports" ', $context['mod_settings']['show_reports'] ? 'checked="checked"' : '', ' class="input_check" />
  433. </dd>
  434. <dt>
  435. <strong><label for="mod_notify_report">', $txt['mc_prefs_notify_report'], '</label>:</strong>
  436. </dt>
  437. <dd>
  438. <select id="mod_notify_report" name="mod_notify_report">
  439. <option value="0" ', $context['mod_settings']['notify_report'] == 0 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_never'], '</option>
  440. <option value="1" ', $context['mod_settings']['notify_report'] == 1 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_moderator'], '</option>
  441. <option value="2" ', $context['mod_settings']['notify_report'] == 2 ? 'selected="selected"' : '', '>', $txt['mc_prefs_notify_report_always'], '</option>
  442. </select>
  443. </dd>';
  444. }
  445. if ($context['can_moderate_approvals'])
  446. {
  447. echo '
  448. <dt>
  449. <strong><label for="mod_notify_approval">', $txt['mc_prefs_notify_approval'], '</label>:</strong>
  450. </dt>
  451. <dd>
  452. <input type="checkbox" id="mod_notify_approval" name="mod_notify_approval" ', $context['mod_settings']['notify_approval'] ? 'checked="checked"' : '', ' class="input_check" />
  453. </dd>';
  454. }
  455. echo '
  456. </dl>
  457. <hr class="hrcolor" />
  458. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  459. <input type="hidden" name="', $context['mod-set_token_var'], '" value="', $context['mod-set_token'], '" />
  460. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />
  461. </div>
  462. </div>
  463. </form>
  464. </div>';
  465. }
  466. // Show a notice sent to a user.
  467. function template_show_notice()
  468. {
  469. global $txt, $settings, $options, $context;
  470. // We do all the HTML for this one!
  471. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  472. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  473. <head>
  474. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  475. <title>', $context['page_title'], '</title>
  476. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />
  477. </head>
  478. <body>
  479. <div class="cat_bar">
  480. <h3 class="catbg">', $txt['show_notice'], '</h3>
  481. </div>
  482. <div class="title_bar">
  483. <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
  484. </div>
  485. <div class="windowbg">
  486. <div class="content">
  487. <dl>
  488. <dt>
  489. <strong>', $txt['show_notice_text'], ':</strong>
  490. </dt>
  491. <dd>
  492. ', $context['notice_body'], '
  493. </dd>
  494. </dl>
  495. </div>
  496. </div>
  497. </body>
  498. </html>';
  499. }
  500. // Add or edit a warning template.
  501. function template_warn_template()
  502. {
  503. global $context, $settings, $options, $txt, $scripturl;
  504. echo '
  505. <div id="modcenter">
  506. <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
  507. <div class="cat_bar">
  508. <h3 class="catbg">', $context['page_title'], '</h3>
  509. </div>
  510. <div class="information">
  511. ', $txt['mc_warning_template_desc'], '
  512. </div>
  513. <div class="windowbg">
  514. <div class="content">
  515. <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
  516. <dl>
  517. <dt>
  518. <strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
  519. </dt>
  520. <dd class="error" id="error_list">
  521. ', empty($context['warning_errors']) ? '' : implode('<br />', $context['warning_errors']), '
  522. </dd>
  523. </dl>
  524. </div>
  525. <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
  526. <dl class="settings">
  527. <dt>
  528. <strong>', $txt['preview'] , '</strong>
  529. </dt>
  530. <dd id="template_preview">
  531. ', !empty($context['template_preview']) ? $context['template_preview'] : '', '
  532. </dd>
  533. </dl>
  534. </div>
  535. <dl class="settings">
  536. <dt>
  537. <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
  538. </dt>
  539. <dd>
  540. <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30" class="input_text" />
  541. </dd>
  542. <dt>
  543. <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br />
  544. <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
  545. </dt>
  546. <dd>
  547. <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
  548. </dd>
  549. </dl>';
  550. if ($context['template_data']['can_edit_personal'])
  551. echo '
  552. <input type="checkbox" name="make_personal" id="make_personal" ', $context['template_data']['personal'] ? 'checked="checked"' : '', ' class="input_check" />
  553. <label for="make_personal">
  554. <strong>', $txt['mc_warning_template_personal'], '</strong>
  555. </label>
  556. <br />
  557. <span class="smalltext">', $txt['mc_warning_template_personal_desc'], '</span>
  558. <br />';
  559. echo '
  560. <hr class="hrcolor" />
  561. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
  562. <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" />
  563. </div>
  564. </div>
  565. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  566. <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '" />
  567. </form>
  568. </div>
  569. <script type="text/javascript"><!-- // --><![CDATA[
  570. $(document).ready(function() {
  571. $("#preview_button").click(function() {
  572. return ajax_getTemplatePreview();
  573. });
  574. });
  575. function ajax_getTemplatePreview ()
  576. {
  577. $.ajax({
  578. type: "POST",
  579. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  580. data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
  581. context: document.body,
  582. success: function(request){
  583. $("#box_preview").css({display:""});
  584. $("#template_preview").html($(request).find(\'body\').text());
  585. if ($(request).find("error").text() != \'\')
  586. {
  587. $("#errors").css({display:""});
  588. var errors_html = \'\';
  589. var errors = $(request).find(\'error\').each(function() {
  590. errors_html += $(this).text() + \'<br />\';
  591. });
  592. $(document).find("#error_list").html(errors_html);
  593. }
  594. else
  595. {
  596. $("#errors").css({display:"none"});
  597. $("#error_list").html(\'\');
  598. }
  599. return false;
  600. },
  601. });
  602. return false;
  603. }
  604. // ]]></script>';
  605. }
  606. ?>