Post.template.php 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  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. // The main template for the post page.
  13. function template_main()
  14. {
  15. global $context, $settings, $options, $txt, $scripturl, $modSettings, $counter;
  16. // Start the javascript... and boy is there a lot.
  17. echo '
  18. <script type="text/javascript"><!-- // --><![CDATA[';
  19. // When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
  20. if (isBrowser('is_firefox'))
  21. echo '
  22. window.addEventListener("pageshow", reActivate, false);';
  23. // Start with message icons - and any missing from this theme.
  24. echo '
  25. var icon_urls = {';
  26. foreach ($context['icons'] as $icon)
  27. echo '
  28. \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
  29. echo '
  30. };';
  31. // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
  32. if ($context['make_poll'])
  33. echo '
  34. var pollOptionNum = 0, pollTabIndex;
  35. function addPollOption()
  36. {
  37. if (pollOptionNum == 0)
  38. {
  39. for (var i = 0, n = document.forms.postmodify.elements.length; i < n; i++)
  40. if (document.forms.postmodify.elements[i].id.substr(0, 8) == \'options-\')
  41. {
  42. pollOptionNum++;
  43. pollTabIndex = document.forms.postmodify.elements[i].tabIndex;
  44. }
  45. }
  46. pollOptionNum++
  47. setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<li><label for="options-'), ' + pollOptionNum + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>: <input type="text" name="options['), ' + pollOptionNum + ', JavaScriptEscape(']" id="options-'), ' + pollOptionNum + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text" /></li><li id="pollMoreOptions"></li>'), ');
  48. }';
  49. // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
  50. if ($context['make_event'])
  51. echo '
  52. var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];';
  53. // End of the javascript, start the form and display the link tree.
  54. echo '
  55. // ]]></script>
  56. <form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="', ($context['becomes_approved'] ? '' : 'alert(\'' . $txt['js_post_will_require_approval'] . '\');'), 'submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'', $context['post_box_name'], '\', \'guestname\', \'evtitle\', \'question\'], \'options\');" enctype="multipart/form-data">';
  57. // If the user wants to see how their message looks - the preview section is where it's at!
  58. echo '
  59. <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
  60. <div class="cat_bar">
  61. <h3 class="catbg">
  62. <span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
  63. </h3>
  64. </div>
  65. <div class="windowbg">
  66. <span class="topslice"><span></span></span>
  67. <div class="content">
  68. <div class="post" id="preview_body">
  69. ', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
  70. </div>
  71. </div>
  72. <span class="botslice"><span></span></span>
  73. </div>
  74. </div><br />';
  75. if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
  76. echo '
  77. <input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
  78. // Start the main table.
  79. echo '
  80. <div class="cat_bar">
  81. <h3 class="catbg">', $context['page_title'], '</h3>
  82. </div>
  83. <div>
  84. <span class="upperframe"><span></span></span>
  85. <div class="roundframe">', isset($context['current_topic']) ? '
  86. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '';
  87. // If an error occurred, explain what happened.
  88. echo '
  89. <div class="errorbox"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
  90. <dl>
  91. <dt>
  92. <strong style="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'display: none;' : '', '" id="error_serious">', $txt['error_while_submitting'], '</strong>
  93. </dt>
  94. <dt class="error" id="error_list">
  95. ', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
  96. </dt>
  97. </dl>
  98. </div>';
  99. // If this won't be approved let them know!
  100. if (!$context['becomes_approved'])
  101. {
  102. echo '
  103. <p class="information">
  104. <em>', $txt['wait_for_approval'], '</em>
  105. <input type="hidden" name="not_approved" value="1" />
  106. </p>';
  107. }
  108. // If it's locked, show a message to warn the replyer.
  109. echo '
  110. <p class="information"', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning">
  111. ', $txt['topic_locked_no_reply'], '
  112. </p>';
  113. // The post header... important stuff
  114. echo '
  115. <dl id="post_header">';
  116. // Guests have to put in their name and email...
  117. if (isset($context['name']) && isset($context['email']))
  118. {
  119. echo '
  120. <dt>
  121. <span', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? ' class="error"' : '', ' id="caption_guestname">', $txt['name'], ':</span>
  122. </dt>
  123. <dd>
  124. <input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  125. </dd>';
  126. if (empty($modSettings['guest_post_no_email']))
  127. echo '
  128. <dt>
  129. <span', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</span>
  130. </dt>
  131. <dd>
  132. <input type="text" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  133. </dd>';
  134. }
  135. // Now show the subject box for this post.
  136. echo '
  137. <dt>
  138. <span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
  139. </dt>
  140. <dd>
  141. <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />
  142. </dd>
  143. <dt class="clear_left">
  144. ', $txt['message_icon'], ':
  145. </dt>
  146. <dd>
  147. <select name="icon" id="icon" onchange="showimage()">';
  148. // Loop through each message icon allowed, adding it to the drop down list.
  149. foreach ($context['icons'] as $icon)
  150. echo '
  151. <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
  152. echo '
  153. </select>
  154. <img src="', $context['icon_url'], '" name="icons" hspace="15" alt="" />
  155. </dd>
  156. </dl><hr class="clear" />';
  157. // Are you posting a calendar event?
  158. if ($context['make_event'])
  159. {
  160. echo '
  161. <div id="post_event">
  162. <fieldset id="event_main">
  163. <legend><span', isset($context['post_error']['no_event']) ? ' class="error"' : '', ' id="caption_evtitle">', $txt['calendar_event_title'], '</span></legend>
  164. <input type="text" name="evtitle" maxlength="255" size="60" value="', $context['event']['title'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  165. <div class="smalltext">
  166. <input type="hidden" name="calendar" value="1" />', $txt['calendar_year'], '
  167. <select name="year" id="year" tabindex="', $context['tabindex']++, '" onchange="generateDays();">';
  168. // Show a list of all the years we allow...
  169. for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
  170. echo '
  171. <option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '&nbsp;</option>';
  172. echo '
  173. </select>
  174. ', $txt['calendar_month'], '
  175. <select name="month" id="month" onchange="generateDays();">';
  176. // There are 12 months per year - ensure that they all get listed.
  177. for ($month = 1; $month <= 12; $month++)
  178. echo '
  179. <option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '&nbsp;</option>';
  180. echo '
  181. </select>
  182. ', $txt['calendar_day'], '
  183. <select name="day" id="day">';
  184. // This prints out all the days in the current month - this changes dynamically as we switch months.
  185. for ($day = 1; $day <= $context['event']['last_day']; $day++)
  186. echo '
  187. <option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '&nbsp;</option>';
  188. echo '
  189. </select>
  190. </div>
  191. </fieldset>';
  192. if (!empty($modSettings['cal_allowspan']) || ($context['event']['new'] && $context['is_new_post']))
  193. {
  194. echo '
  195. <fieldset id="event_options">
  196. <legend>', $txt['calendar_event_options'], '</legend>
  197. <div class="event_options smalltext">
  198. <ul class="event_options">';
  199. // If events can span more than one day then allow the user to select how long it should last.
  200. if (!empty($modSettings['cal_allowspan']))
  201. {
  202. echo '
  203. <li>
  204. ', $txt['calendar_numb_days'], '
  205. <select name="span">';
  206. for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++)
  207. echo '
  208. <option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '&nbsp;</option>';
  209. echo '
  210. </select>
  211. </li>';
  212. }
  213. // If this is a new event let the user specify which board they want the linked post to be put into.
  214. if ($context['event']['new'] && $context['is_new_post'])
  215. {
  216. echo '
  217. <li>
  218. ', $txt['calendar_post_in'], '
  219. <select name="board">';
  220. foreach ($context['event']['categories'] as $category)
  221. {
  222. echo '
  223. <optgroup label="', $category['name'], '">';
  224. foreach ($category['boards'] as $board)
  225. echo '
  226. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
  227. echo '
  228. </optgroup>';
  229. }
  230. echo '
  231. </select>
  232. </li>';
  233. }
  234. echo '
  235. </ul>
  236. </div>
  237. </fieldset>';
  238. }
  239. echo '
  240. </div>';
  241. }
  242. // If this is a poll then display all the poll options!
  243. if ($context['make_poll'])
  244. {
  245. echo '
  246. <div id="edit_poll">
  247. <fieldset id="poll_main">
  248. <legend><span ', (isset($context['poll_error']['no_question']) ? ' class="error"' : ''), '>', $txt['poll_question'], '</span></legend>
  249. <input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" class="input_text" />
  250. <ul class="poll_main">';
  251. // Loop through all the choices and print them out.
  252. foreach ($context['choices'] as $choice)
  253. {
  254. echo '
  255. <li>
  256. <label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], '</label>:
  257. <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255" class="input_text" />
  258. </li>';
  259. }
  260. echo '
  261. <li id="pollMoreOptions"></li>
  262. </ul>
  263. <strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong>
  264. </fieldset>
  265. <fieldset id="poll_options">
  266. <legend>', $txt['poll_options'], '</legend>
  267. <dl class="settings poll_options">
  268. <dt>
  269. <label for="poll_max_votes">', $txt['poll_max_votes'], ':</label>
  270. </dt>
  271. <dd>
  272. <input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" class="input_text" />
  273. </dd>
  274. <dt>
  275. <label for="poll_expire">', $txt['poll_run'], ':</label><br />
  276. <em class="smalltext">', $txt['poll_run_limit'], '</em>
  277. </dt>
  278. <dd>
  279. <input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" maxlength="4" class="input_text" /> ', $txt['days_word'], '
  280. </dd>
  281. <dt>
  282. <label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label>
  283. </dt>
  284. <dd>
  285. <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked="checked"' : '', ' class="input_check" />
  286. </dd>';
  287. if ($context['poll_options']['guest_vote_enabled'])
  288. echo '
  289. <dt>
  290. <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
  291. </dt>
  292. <dd>
  293. <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked="checked"' : '', ' class="input_check" />
  294. </dd>';
  295. echo '
  296. <dt>
  297. ', $txt['poll_results_visibility'], ':
  298. </dt>
  299. <dd>
  300. <input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_anyone">', $txt['poll_results_anyone'], '</label><br />
  301. <input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_voted">', $txt['poll_results_voted'], '</label><br />
  302. <input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? 'disabled="disabled"' : '', ' class="input_radio" /> <label for="poll_results_expire">', $txt['poll_results_after'], '</label>
  303. </dd>
  304. </dl>
  305. </fieldset>
  306. </div>';
  307. }
  308. // Show the actual posting area...
  309. if ($context['show_bbc'])
  310. {
  311. echo '
  312. <div id="bbcBox_message"></div>';
  313. }
  314. // What about smileys?
  315. if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
  316. echo '
  317. <div id="smileyBox_message"></div>';
  318. echo '
  319. ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
  320. // If this message has been edited in the past - display when it was.
  321. if (isset($context['last_modified']))
  322. echo '
  323. <div class="padding smalltext">
  324. <strong>', $txt['last_edit'], ':</strong>
  325. ', $context['last_modified'], '
  326. </div>';
  327. // If the admin has enabled the hiding of the additional options - show a link and image for it.
  328. if (!empty($settings['additional_options_collapsable']))
  329. echo '
  330. <div id="postAdditionalOptionsHeader">
  331. <img src="', $settings['images_url'], '/collapse.gif" alt="-" id="postMoreExpand" style="display: none;" /> <strong><a href="#" id="postMoreExpandLink">', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
  332. </div>';
  333. // Display the check boxes for all the standard options - if they are available to the user!
  334. echo '
  335. <div id="postMoreOptions" class="smalltext">
  336. <ul class="post_options">
  337. ', $context['can_notify'] ? '<li><input type="hidden" name="notify" value="0" /><label for="check_notify"><input type="checkbox" name="notify" id="check_notify"' . ($context['notify'] || !empty($options['auto_notify']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['notify_replies'] . '</label></li>' : '', '
  338. ', $context['can_lock'] ? '<li><input type="hidden" name="lock" value="0" /><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['lock_topic'] . '</label></li>' : '', '
  339. <li><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['back_to_topic'] . '</label></li>
  340. ', $context['can_sticky'] ? '<li><input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['sticky_after'] . '</label></li>' : '', '
  341. <li><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked="checked"', ' value="NS" class="input_check" /> ', $txt['dont_use_smileys'], '</label></li>', '
  342. ', $context['can_move'] ? '<li><input type="hidden" name="move" value="0" /><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1" class="input_check" ' . (!empty($context['move']) ? 'checked="checked" ' : '') . '/> ' . $txt['move_after2'] . '</label></li>' : '', '
  343. ', $context['can_announce'] && $context['is_first_post'] ? '<li><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1" class="input_check" ' . (!empty($context['announce']) ? 'checked="checked" ' : '') . '/> ' . $txt['announce_topic'] . '</label></li>' : '', '
  344. ', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
  345. </ul>
  346. </div>';
  347. // If this post already has attachments on it - give information about them.
  348. if (!empty($context['current_attachments']))
  349. {
  350. echo '
  351. <dl id="postAttachment">
  352. <dt>
  353. ', $txt['attached'], ':
  354. </dt>
  355. <dd class="smalltext">
  356. <input type="hidden" name="attach_del[]" value="0" />
  357. ', $txt['uncheck_unwatchd_attach'], ':
  358. </dd>';
  359. foreach ($context['current_attachments'] as $attachment)
  360. echo '
  361. <dd class="smalltext">
  362. <label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
  363. </dd>';
  364. echo '
  365. </dl>';
  366. }
  367. // Is the user allowed to post any additional ones? If so give them the boxes to do it!
  368. if ($context['can_post_attachment'])
  369. {
  370. echo '
  371. <dl id="postAttachment2">
  372. <dt>
  373. ', $txt['attach'], ':
  374. </dt>
  375. <dd class="smalltext">
  376. <input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';
  377. // Show more boxes only if they aren't approaching their limit.
  378. if ($context['num_allowed_attachments'] > 1)
  379. echo '
  380. <script type="text/javascript"><!-- // --><![CDATA[
  381. var allowed_attachments = ', $context['num_allowed_attachments'], ';
  382. var current_attachment = 1;
  383. function addAttachment()
  384. {
  385. allowed_attachments = allowed_attachments - 1;
  386. current_attachment = current_attachment + 1;
  387. if (allowed_attachments <= 0)
  388. return alert("', $txt['more_attachments_error'], '");
  389. setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '</a>)\' + \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');
  390. return true;
  391. }
  392. // ]]></script>
  393. </dd>
  394. <dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';
  395. echo '
  396. <dd class="smalltext">';
  397. // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
  398. if (!empty($modSettings['attachmentCheckExtensions']))
  399. echo '
  400. ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';
  401. if (!empty($context['attachment_restrictions']))
  402. echo '
  403. ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';
  404. if (!$context['can_post_attachment_unapproved'])
  405. echo '
  406. <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';
  407. echo '
  408. </dd>
  409. </dl>';
  410. }
  411. // Is visual verification enabled?
  412. if ($context['require_verification'])
  413. {
  414. echo '
  415. <div class="post_verification">
  416. <span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '>
  417. <strong>', $txt['verification'], ':</strong>
  418. </span>
  419. ', template_control_verification($context['visual_verification_id'], 'all'), '
  420. </div>';
  421. }
  422. // Finally, the submit buttons.
  423. echo '
  424. <p class="smalltext" id="shortcuts">
  425. ', isBrowser('is_firefox') ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
  426. </p>
  427. <p id="post_confirm_buttons" class="righttext">
  428. ', template_control_richedit_buttons($context['post_box_name']);
  429. // Option to delete an event if user is editing one.
  430. if ($context['make_event'] && !$context['event']['new'])
  431. echo '
  432. <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" onclick="return confirm(\'', $txt['event_delete_confirm'], '\');" class="button_submit" />';
  433. echo '
  434. </p>
  435. </div>
  436. <span class="lowerframe"><span></span></span>
  437. </div>
  438. <br class="clear" />';
  439. // Assuming this isn't a new topic pass across the last message id.
  440. if (isset($context['topic_last_message']))
  441. echo '
  442. <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />';
  443. echo '
  444. <input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
  445. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  446. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  447. </form>';
  448. echo '
  449. <script type="text/javascript"><!-- // --><![CDATA[';
  450. // The functions used to preview a posts without loading a new page.
  451. echo '
  452. var current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ';
  453. var make_poll = ', $context['make_poll'] ? 'true' : 'false', ';
  454. var txt_preview_title = "', $txt['preview_title'], '";
  455. var txt_preview_fetch = "', $txt['preview_fetch'], '";
  456. var new_replies = new Array();
  457. var reply_counter = ', empty($counter) ? 0 : $counter, ';
  458. function previewPost()
  459. {';
  460. if (isBrowser('is_firefox'))
  461. echo '
  462. // Firefox doesn\'t render <marquee> that have been put it using javascript
  463. if (document.forms.postmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
  464. {
  465. return submitThisOnce(document.forms.postmodify);
  466. }';
  467. echo '
  468. if (window.XMLHttpRequest)
  469. {
  470. // Opera didn\'t support setRequestHeader() before 8.01.
  471. if (\'opera\' in window)
  472. {
  473. var test = new XMLHttpRequest();
  474. if (!(\'setRequestHeader\' in test))
  475. return submitThisOnce(document.forms.postmodify);
  476. }
  477. // @todo Currently not sending poll options and option checkboxes.
  478. var x = new Array();
  479. var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', \'icon\', \'guestname\', \'email\', \'evtitle\', \'question\', \'topic\'];
  480. var numericFields = [
  481. \'board\', \'topic\', \'last_msg\',
  482. \'eventid\', \'calendar\', \'year\', \'month\', \'day\',
  483. \'poll_max_votes\', \'poll_expire\', \'poll_change_vote\', \'poll_hide\'
  484. ];
  485. var checkboxFields = [
  486. \'ns\'
  487. ];
  488. for (var i = 0, n = textFields.length; i < n; i++)
  489. if (textFields[i] in document.forms.postmodify)
  490. {
  491. // Handle the WYSIWYG editor.
  492. if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
  493. x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  494. else
  495. x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  496. }
  497. for (var i = 0, n = numericFields.length; i < n; i++)
  498. if (numericFields[i] in document.forms.postmodify && \'value\' in document.forms.postmodify[numericFields[i]])
  499. x[x.length] = numericFields[i] + \'=\' + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
  500. for (var i = 0, n = checkboxFields.length; i < n; i++)
  501. if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked)
  502. x[x.length] = checkboxFields[i] + \'=\' + document.forms.postmodify.elements[checkboxFields[i]].value;
  503. sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=post2\' + (current_board ? \';board=\' + current_board : \'\') + (make_poll ? \';poll\' : \'\') + \';preview;xml\', x.join(\'&\'), onDocSent);
  504. document.getElementById(\'preview_section\').style.display = \'\';
  505. setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
  506. setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);
  507. return false;
  508. }
  509. else
  510. return submitThisOnce(document.forms.postmodify);
  511. }
  512. function onDocSent(XMLDoc)
  513. {
  514. if (!XMLDoc)
  515. {
  516. document.forms.postmodify.preview.onclick = new function ()
  517. {
  518. return true;
  519. }
  520. document.forms.postmodify.preview.click();
  521. }
  522. // Show the preview section.
  523. var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
  524. setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);
  525. var bodyText = \'\';
  526. for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
  527. bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;
  528. setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
  529. document.getElementById(\'preview_body\').className = \'post\';
  530. // Show a list of errors (if any).
  531. var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
  532. var errorList = new Array();
  533. for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
  534. errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
  535. document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
  536. document.getElementById(\'error_serious\').style.display = errors.getAttribute(\'serious\') == 1 ? \'\' : \'none\';
  537. setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br />\'));
  538. // Show a warning if the topic has been locked.
  539. document.getElementById(\'lock_warning\').style.display = errors.getAttribute(\'topic_locked\') == 1 ? \'\' : \'none\';
  540. // Adjust the color of captions if the given data is erroneous.
  541. var captions = errors.getElementsByTagName(\'caption\');
  542. for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
  543. if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
  544. document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');
  545. if (errors.getElementsByTagName(\'post_error\').length == 1)
  546. document.forms.postmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
  547. else if (document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\')
  548. {
  549. if (\'runtimeStyle\' in document.forms.postmodify.', $context['post_box_name'], ')
  550. document.forms.postmodify.', $context['post_box_name'], '.style.borderColor = \'\';
  551. else
  552. document.forms.postmodify.', $context['post_box_name'], '.style.border = null;
  553. }
  554. // Set the new last message id.
  555. if (\'last_msg\' in document.forms.postmodify)
  556. document.forms.postmodify.last_msg.value = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'last_msg\')[0].firstChild.nodeValue;
  557. // Remove the new image from old-new replies!
  558. for (i = 0; i < new_replies.length; i++)
  559. document.getElementById(\'image_new_\' + new_replies[i]).style.display = \'none\';
  560. new_replies = new Array();
  561. var ignored_replies = new Array(), ignoring;
  562. var newPosts = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0] ? XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0].getElementsByTagName(\'post\') : {length: 0};
  563. var numNewPosts = newPosts.length;
  564. if (numNewPosts != 0)
  565. {
  566. var newPostsHTML = \'<span id="new_replies"><\' + \'/span>\';
  567. for (var i = 0; i < numNewPosts; i++)
  568. {
  569. new_replies[new_replies.length] = newPosts[i].getAttribute("id");
  570. ignoring = false;
  571. if (newPosts[i].getElementsByTagName("is_ignored")[0].firstChild.nodeValue != 0)
  572. ignored_replies[ignored_replies.length] = ignoring = newPosts[i].getAttribute("id");
  573. newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \' core_posts"><span class="topslice"><span></span></span><div class="content" id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <img src="\' + smf_images_url + \'/', $context['user']['language'], '/new.gif" alt="', $txt['preview_new'], '" id="image_new_\' + newPosts[i].getAttribute("id") + \'" /></div>\';';
  574. if ($context['can_quote'])
  575. echo '
  576. newPostsHTML += \'<ul class="reset smalltext quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li class="quote_button"><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');"><span>',$txt['bbc_quote'],'</span><\' + \'/a></li></ul>\';';
  577. echo '
  578. newPostsHTML += \'<br class="clear" />\';
  579. if (ignoring)
  580. newPostsHTML += \'<div id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_prompt" class="smalltext">', $txt['ignoring_user'], '<a href="#" id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a></div>\';
  581. newPostsHTML += \'<div class="list_posts smalltext" id="msg_\' + newPosts[i].getAttribute("id") + \'_body">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'<\' + \'/div></div><span class="botslice"><span></span></span></div>\';
  582. }
  583. setOuterHTML(document.getElementById(\'new_replies\'), newPostsHTML);
  584. }
  585. var numIgnoredReplies = ignored_replies.length;
  586. if (numIgnoredReplies != 0)
  587. {
  588. for (var i = 0; i < numIgnoredReplies; i++)
  589. {
  590. aIgnoreToggles[ignored_replies[i]] = new smc_Toggle({
  591. bToggleEnabled: true,
  592. bCurrentlyCollapsed: true,
  593. aSwappableContainers: [
  594. \'msg_\' + ignored_replies[i] + \'_body\',
  595. \'msg_\' + ignored_replies[i] + \'_quote\',
  596. ],
  597. aSwapLinks: [
  598. {
  599. sId: \'msg_\' + ignored_replies[i] + \'_ignored_link\',
  600. msgExpanded: \'\',
  601. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  602. }
  603. ]
  604. });
  605. }
  606. }
  607. if (typeof(smf_codeFix) != \'undefined\')
  608. smf_codeFix();
  609. }';
  610. // Code for showing and hiding additional options.
  611. if (!empty($settings['additional_options_collapsable']))
  612. echo '
  613. var oSwapAdditionalOptions = new smc_Toggle({
  614. bToggleEnabled: true,
  615. bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
  616. funcOnBeforeCollapse: function () {
  617. document.getElementById(\'additional_options\').value = \'0\';
  618. },
  619. funcOnBeforeExpand: function () {
  620. document.getElementById(\'additional_options\').value = \'1\';
  621. },
  622. aSwappableContainers: [
  623. \'postMoreOptions\',
  624. \'postAttachment\',
  625. \'postAttachment2\',
  626. \'postAttachment3\'
  627. ],
  628. aSwapImages: [
  629. {
  630. sId: \'postMoreExpand\',
  631. srcExpanded: smf_images_url + \'/collapse.gif\',
  632. altExpanded: \'-\',
  633. srcCollapsed: smf_images_url + \'/expand.gif\',
  634. altCollapsed: \'+\'
  635. }
  636. ],
  637. aSwapLinks: [
  638. {
  639. sId: \'postMoreExpandLink\',
  640. msgExpanded: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ',
  641. msgCollapsed: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), '
  642. }
  643. ]
  644. });';
  645. echo '
  646. // ]]></script>';
  647. // If the user is replying to a topic show the previous posts.
  648. if (isset($context['previous_posts']) && count($context['previous_posts']) > 0)
  649. {
  650. echo '
  651. <div id="recent" class="flow_hidden main_section">
  652. <div class="cat_bar">
  653. <h3 class="catbg">', $txt['topic_summary'], '</h3>
  654. </div>
  655. <span id="new_replies"></span>';
  656. $ignored_posts = array();
  657. foreach ($context['previous_posts'] as $post)
  658. {
  659. $ignoring = false;
  660. if (!empty($post['is_ignored']))
  661. $ignored_posts[] = $ignoring = $post['id'];
  662. echo '
  663. <div class="', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
  664. <span class="topslice"><span></span></span>
  665. <div class="content" id="msg', $post['id'], '">
  666. <div class="floatleft">
  667. <h5>', $txt['posted_by'], ': ', $post['poster'], '</h5>
  668. <span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $post['time'], '&nbsp;&#187;</span>
  669. </div>';
  670. if ($context['can_quote'])
  671. {
  672. echo '
  673. <ul class="reset smalltext quickbuttons" id="msg_', $post['id'], '_quote">
  674. <li class="quote_button"><a href="#postmodify" onclick="return insertQuoteFast(', $post['id'], ');"><span>',$txt['bbc_quote'],'</span></a></li>
  675. </ul>';
  676. }
  677. echo '
  678. <br class="clear" />';
  679. if ($ignoring)
  680. {
  681. echo '
  682. <div id="msg_', $post['id'], '_ignored_prompt" class="smalltext">
  683. ', $txt['ignoring_user'], '
  684. <a href="#" id="msg_', $post['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
  685. </div>';
  686. }
  687. echo '
  688. <div class="list_posts smalltext" id="msg_', $post['id'], '_body">', $post['message'], '</div>
  689. </div>
  690. <span class="botslice"><span></span></span>
  691. </div>';
  692. }
  693. echo '
  694. </div>
  695. <script type="text/javascript"><!-- // --><![CDATA[
  696. var aIgnoreToggles = new Array();';
  697. foreach ($ignored_posts as $post_id)
  698. {
  699. echo '
  700. aIgnoreToggles[', $post_id, '] = new smc_Toggle({
  701. bToggleEnabled: true,
  702. bCurrentlyCollapsed: true,
  703. aSwappableContainers: [
  704. \'msg_', $post_id, '_body\',
  705. \'msg_', $post_id, '_quote\',
  706. ],
  707. aSwapLinks: [
  708. {
  709. sId: \'msg_', $post_id, '_ignored_link\',
  710. msgExpanded: \'\',
  711. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  712. }
  713. ]
  714. });';
  715. }
  716. echo '
  717. function insertQuoteFast(messageid)
  718. {
  719. if (window.XMLHttpRequest)
  720. getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), onDocReceived);
  721. else
  722. reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), 240, 90);
  723. return true;
  724. }
  725. function onDocReceived(XMLDoc)
  726. {
  727. var text = \'\';
  728. for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
  729. text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
  730. oEditorHandle_', $context['post_box_name'], '.insertText(text, false, true);
  731. }
  732. // ]]></script>';
  733. }
  734. }
  735. // The template for the spellchecker.
  736. function template_spellcheck()
  737. {
  738. global $context, $settings, $options, $txt;
  739. // The style information that makes the spellchecker look... like the forum hopefully!
  740. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  741. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  742. <head>
  743. <title>', $txt['spell_check'], '</title>
  744. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  745. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index.css" />
  746. <style type="text/css">
  747. body, td
  748. {
  749. font-size: small;
  750. margin: 0;
  751. background: #f0f0f0;
  752. color: #000;
  753. padding: 10px;
  754. }
  755. .highlight
  756. {
  757. color: red;
  758. font-weight: bold;
  759. }
  760. #spellview
  761. {
  762. border-style: outset;
  763. border: 1px solid black;
  764. padding: 5px;
  765. width: 95%;
  766. height: 314px;
  767. overflow: auto;
  768. background: #ffffff;
  769. }';
  770. // As you may expect - we need a lot of javascript for this... load it form the separate files.
  771. echo '
  772. </style>
  773. <script type="text/javascript"><!-- // --><![CDATA[
  774. var spell_formname = window.opener.spell_formname;
  775. var spell_fieldname = window.opener.spell_fieldname;
  776. // ]]></script>
  777. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>
  778. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
  779. <script type="text/javascript"><!-- // --><![CDATA[
  780. ', $context['spell_js'], '
  781. // ]]></script>
  782. </head>
  783. <body onload="nextWord(false);">
  784. <form action="#" method="post" accept-charset="', $context['character_set'], '" name="spellingForm" id="spellingForm" onsubmit="return false;" style="margin: 0;">
  785. <div id="spellview">&nbsp;</div>
  786. <table border="0" cellpadding="4" cellspacing="0" width="100%"><tr class="windowbg">
  787. <td width="50%" valign="top">
  788. ', $txt['spellcheck_change_to'], '<br />
  789. <input type="text" name="changeto" style="width: 98%;" class="input_text" />
  790. </td>
  791. <td width="50%">
  792. ', $txt['spellcheck_suggest'], '<br />
  793. <select name="suggestions" style="width: 98%;" size="5" onclick="if (this.selectedIndex != -1) this.form.changeto.value = this.options[this.selectedIndex].text;" ondblclick="replaceWord();">
  794. </select>
  795. </td>
  796. </tr></table>
  797. <div class="righttext" style="padding: 4px;">
  798. <input type="button" name="change" value="', $txt['spellcheck_change'], '" onclick="replaceWord();" class="button_submit" />
  799. <input type="button" name="changeall" value="', $txt['spellcheck_change_all'], '" onclick="replaceAll();" class="button_submit" />
  800. <input type="button" name="ignore" value="', $txt['spellcheck_ignore'], '" onclick="nextWord(false);" class="button_submit" />
  801. <input type="button" name="ignoreall" value="', $txt['spellcheck_ignore_all'], '" onclick="nextWord(true);" class="button_submit" />
  802. </div>
  803. </form>
  804. </body>
  805. </html>';
  806. }
  807. function template_quotefast()
  808. {
  809. global $context, $settings, $options, $txt;
  810. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  811. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  812. <head>
  813. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  814. <title>', $txt['retrieving_quote'], '</title>
  815. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
  816. </head>
  817. <body>
  818. ', $txt['retrieving_quote'], '
  819. <div id="temporary_posting_area" style="display: none;"></div>
  820. <script type="text/javascript"><!-- // --><![CDATA[';
  821. if ($context['close_window'])
  822. echo '
  823. window.close();';
  824. else
  825. {
  826. // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;).
  827. echo '
  828. var quote = \'', $context['quote']['text'], '\';
  829. var stage = \'createElement\' in document ? document.createElement("DIV") : document.getElementById("temporary_posting_area");
  830. if (\'DOMParser\' in window && !(\'opera\' in window))
  831. {
  832. var xmldoc = new DOMParser().parseFromString("<temp>" + \'', $context['quote']['mozilla'], '\'.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_") + "</temp>", "text/xml");
  833. quote = xmldoc.childNodes[0].textContent.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
  834. }
  835. else if (\'innerText\' in stage)
  836. {
  837. setInnerHTML(stage, quote.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_").replace(/</g, "&lt;").replace(/>/g, "&gt;"));
  838. quote = stage.innerText.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
  839. }
  840. if (\'opera\' in window)
  841. quote = quote.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, \'"\').replace(/&amp;/g, "&");
  842. window.opener.oEditorHandle_', $context['post_box_name'], '.InsertText(quote);
  843. window.focus();
  844. setTimeout("window.close();", 400);';
  845. }
  846. echo '
  847. // ]]></script>
  848. </body>
  849. </html>';
  850. }
  851. function template_announce()
  852. {
  853. global $context, $settings, $options, $txt, $scripturl;
  854. echo '
  855. <div id="announcement">
  856. <form action="', $scripturl, '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '">
  857. <div class="cat_bar">
  858. <h3 class="catbg">', $txt['announce_title'], '</h3>
  859. </div>
  860. <div class="information">
  861. ', $txt['announce_desc'], '
  862. </div>
  863. <div class="windowbg2">
  864. <span class="topslice"><span></span></span>
  865. <div class="content">
  866. <p>
  867. ', $txt['announce_this_topic'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0">', $context['topic_subject'], '</a>
  868. </p>
  869. <ul class="reset">';
  870. foreach ($context['groups'] as $group)
  871. echo '
  872. <li>
  873. <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked="checked" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em>
  874. </li>';
  875. echo '
  876. <li>
  877. <label for="checkall"><input type="checkbox" id="checkall" class="input_check" onclick="invertAll(this, this.form);" checked="checked" /> <em>', $txt['check_all'], '</em></label>
  878. </li>
  879. </ul>
  880. <div id="confirm_buttons">
  881. <input type="submit" value="', $txt['post'], '" class="button_submit" />
  882. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  883. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  884. <input type="hidden" name="move" value="', $context['move'], '" />
  885. <input type="hidden" name="goback" value="', $context['go_back'], '" />
  886. </div>
  887. </div>
  888. <span class="botslice"><span></span></span>
  889. </div>
  890. </form>
  891. </div>
  892. <br />';
  893. }
  894. function template_announcement_send()
  895. {
  896. global $context, $settings, $options, $txt, $scripturl;
  897. echo '
  898. <div id="announcement">
  899. <form action="' . $scripturl . '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  900. <div class="windowbg2">
  901. <span class="topslice"><span></span></span>
  902. <div class="content">
  903. <p>', $txt['announce_sending'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0" target="_blank" class="new_win">', $context['topic_subject'], '</a></p>
  904. <p><strong>', $context['percentage_done'], '% ', $txt['announce_done'], '</strong></p>
  905. <div id="confirm_buttons">
  906. <input type="submit" name="b" value="', $txt['announce_continue'], '" class="button_submit" />
  907. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  908. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  909. <input type="hidden" name="move" value="', $context['move'], '" />
  910. <input type="hidden" name="goback" value="', $context['go_back'], '" />
  911. <input type="hidden" name="start" value="', $context['start'], '" />
  912. <input type="hidden" name="membergroups" value="', $context['membergroups'], '" />
  913. </div>
  914. </div>
  915. <span class="botslice"><span></span></span>
  916. </div>
  917. </form>
  918. </div>
  919. <br />
  920. <script type="text/javascript"><!-- // --><![CDATA[
  921. var countdown = 2;
  922. doAutoSubmit();
  923. function doAutoSubmit()
  924. {
  925. if (countdown == 0)
  926. document.forms.autoSubmit.submit();
  927. else if (countdown == -1)
  928. return;
  929. document.forms.autoSubmit.b.value = "', $txt['announce_continue'], ' (" + countdown + ")";
  930. countdown--;
  931. setTimeout("doAutoSubmit();", 1000);
  932. }
  933. // ]]></script>';
  934. }
  935. ?>