annotate forum/Themes/default/Post.template.php @ 78:96118bc49f04 website

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