comparison forum/Themes/default/Post.template.php @ 76:e3e11437ecea website

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