annotate forum/Themes/classic/Post.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
rev   line source
Chris@76 1 <?php
Chris@76 2 // Version: 1.1; Post
Chris@76 3
Chris@76 4 function template_main()
Chris@76 5 {
Chris@76 6 global $context, $settings, $options, $txt, $scripturl, $modSettings;
Chris@76 7
Chris@76 8 if ($context['show_spellchecking'])
Chris@76 9 echo '
Chris@76 10 <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . '/spellcheck.js"></script>';
Chris@76 11
Chris@76 12 echo '
Chris@76 13 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[';
Chris@76 14
Chris@76 15 // Start with message icons - and any missing from this theme.
Chris@76 16 echo '
Chris@76 17 var icon_urls = {';
Chris@76 18 foreach ($context['icons'] as $icon)
Chris@76 19 echo '
Chris@76 20 "', $icon['value'], '": "', $icon['url'], '"', $icon['is_last'] ? '' : ',';
Chris@76 21 echo '
Chris@76 22 };';
Chris@76 23
Chris@76 24 // The actual message icon selector.
Chris@76 25 echo '
Chris@76 26 function showimage()
Chris@76 27 {
Chris@76 28 document.images.icons.src = icon_urls[document.forms.postmodify.icon.options[document.forms.postmodify.icon.selectedIndex].value];
Chris@76 29 }';
Chris@76 30
Chris@76 31 // The functions used to preview a posts without loading a new page.
Chris@76 32 echo '
Chris@76 33 var current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ';
Chris@76 34 var make_poll = ', $context['make_poll'] ? 'true' : 'false', ';
Chris@76 35 var txt_preview_title = "', $txt['preview_title'], '";
Chris@76 36 var txt_preview_fetch = "', $txt['preview_fetch'], '";
Chris@76 37
Chris@76 38 function previewPost()
Chris@76 39 {', $context['browser']['is_firefox'] ? '
Chris@76 40 // Firefox doesn\'t render <marquee> that have been put it using javascript
Chris@76 41 if (document.forms.postmodify.elements["message"].value.indexOf("[move]") != -1)
Chris@76 42 {
Chris@76 43 return submitThisOnce(document.forms.postmodify);
Chris@76 44 }' : '', '
Chris@76 45 if (window.XMLHttpRequest)
Chris@76 46 {
Chris@76 47 // Opera didn\'t support setRequestHeader() before 8.01.
Chris@76 48 if (typeof(window.opera) != "undefined")
Chris@76 49 {
Chris@76 50 var test = new XMLHttpRequest();
Chris@76 51 if (typeof(test.setRequestHeader) != "function")
Chris@76 52 return submitThisOnce(document.forms.postmodify);
Chris@76 53 }
Chris@76 54 // !!! Currently not sending poll options and option checkboxes.
Chris@76 55 var i, x = new Array();
Chris@76 56 var textFields = ["subject", "message", "icon", "guestname", "email", "evtitle", "question", "topic"];
Chris@76 57 var numericFields = [
Chris@76 58 "board", "topic", "num_replies",
Chris@76 59 "eventid", "calendar", "year", "month", "day",
Chris@76 60 "poll_max_votes", "poll_expire", "poll_change_vote", "poll_hide"
Chris@76 61 ];
Chris@76 62 var checkboxFields = [
Chris@76 63 "ns",
Chris@76 64 ];
Chris@76 65
Chris@76 66 for (i in textFields)
Chris@76 67 if (document.forms.postmodify.elements[textFields[i]])
Chris@76 68 x[x.length] = textFields[i] + "=" + escape(textToEntities(document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#38;#"))).replace(/\+/g, "%2B");
Chris@76 69 for (i in numericFields)
Chris@76 70 if (document.forms.postmodify.elements[numericFields[i]] && typeof(document.forms.postmodify[numericFields[i]].value) != "undefined")
Chris@76 71 x[x.length] = numericFields[i] + "=" + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
Chris@76 72 for (i in checkboxFields)
Chris@76 73 if (document.forms.postmodify.elements[checkboxFields[i]] && document.forms.postmodify.elements[checkboxFields[i]].checked)
Chris@76 74 x[x.length] = checkboxFields[i] + "=" + document.forms.postmodify.elements[checkboxFields[i]].value;
Chris@76 75
Chris@76 76 sendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);
Chris@76 77
Chris@76 78 document.getElementById("preview_section").style.display = "";
Chris@76 79 setInnerHTML(document.getElementById("preview_subject"), txt_preview_title);
Chris@76 80 setInnerHTML(document.getElementById("preview_body"), txt_preview_fetch);
Chris@76 81
Chris@76 82 return false;
Chris@76 83 }
Chris@76 84 else
Chris@76 85 return submitThisOnce(document.forms.postmodify);
Chris@76 86 }
Chris@76 87 function onDocSent(XMLDoc)
Chris@76 88 {
Chris@76 89 if (!XMLDoc)
Chris@76 90 {
Chris@76 91 document.forms.postmodify.preview.onclick = new function ()
Chris@76 92 {
Chris@76 93 return true;
Chris@76 94 }
Chris@76 95 document.forms.postmodify.preview.click();
Chris@76 96 }
Chris@76 97
Chris@76 98 // Show the preview section.
Chris@76 99 var i, preview = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("preview")[0];
Chris@76 100 setInnerHTML(document.getElementById("preview_subject"), preview.getElementsByTagName("subject")[0].firstChild.nodeValue);
Chris@76 101
Chris@76 102 var bodyText = "";
Chris@76 103 for (i = 0; i < preview.getElementsByTagName("body")[0].childNodes.length; i++)
Chris@76 104 bodyText += preview.getElementsByTagName("body")[0].childNodes[i].nodeValue;
Chris@76 105
Chris@76 106 setInnerHTML(document.getElementById("preview_body"), bodyText);
Chris@76 107 document.getElementById("preview_body").className = "post";
Chris@76 108
Chris@76 109 // Show a list of errors (if any).
Chris@76 110 var errors = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("errors")[0];
Chris@76 111 var numErrors = errors.getElementsByTagName("error").length, errorList = new Array();
Chris@76 112 for (i = 0; i < numErrors; i++)
Chris@76 113 errorList[errorList.length] = errors.getElementsByTagName("error")[i].firstChild.nodeValue;
Chris@76 114 document.getElementById("errors").style.display = numErrors == 0 ? "none" : "";
Chris@76 115 document.getElementById("error_serious").style.display = errors.getAttribute("serious") == 1 ? "" : "none";
Chris@76 116 setInnerHTML(document.getElementById("error_list"), numErrors == 0 ? "" : errorList.join("<br />"));
Chris@76 117
Chris@76 118 // Show a warning if the topic has been locked.
Chris@76 119 document.getElementById("lock_warning").style.display = errors.getAttribute("topic_locked") == 1 ? "" : "none";
Chris@76 120
Chris@76 121 // Adjust the color of captions if the given data is erroneous.
Chris@76 122 var captions = errors.getElementsByTagName("caption"), numCaptions = errors.getElementsByTagName("caption").length;
Chris@76 123 for (i = 0; i < numCaptions; i++)
Chris@76 124 if (document.getElementById("caption_" + captions[i].getAttribute("name")))
Chris@76 125 document.getElementById("caption_" + captions[i].getAttribute("name")).style.color = captions[i].getAttribute("color");
Chris@76 126
Chris@76 127 if (errors.getElementsByTagName("post_error").length == 1)
Chris@76 128 document.forms.postmodify.message.style.border = "1px solid red";
Chris@76 129 else if (document.forms.postmodify.message.style.borderColor == "red" || document.forms.postmodify.message.style.borderColor == "red red red red")
Chris@76 130 {
Chris@76 131 if (typeof(document.forms.postmodify.message.runtimeStyle) == "undefined")
Chris@76 132 document.forms.postmodify.message.style.border = null;
Chris@76 133 else
Chris@76 134 document.forms.postmodify.message.style.borderColor = "";
Chris@76 135 }
Chris@76 136
Chris@76 137 // Set the new number of replies
Chris@76 138 if (document.forms.postmodify.elements["num_replies"])
Chris@76 139 document.forms.postmodify.num_replies.value = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("num_replies")[0].firstChild.nodeValue;
Chris@76 140
Chris@76 141 var newPosts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("new_posts")[0] ? XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("new_posts")[0].getElementsByTagName("post") : {length: 0};
Chris@76 142 var numNewPosts = newPosts.length;
Chris@76 143 if (numNewPosts != 0)
Chris@76 144 {
Chris@76 145 var newTable = \'<span id="new_replies"></span><table width="100%" class="windowbg" cellspacing="0" cellpadding="2" align="center" style="table-layout: fixed;">\';
Chris@76 146 for (i = 0; i < numNewPosts; i++)
Chris@76 147 newTable += \'<tr class="catbg"><td colspan="2" align="left" class="smalltext"><div style="float: right;">', $txt[280], ': \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \' <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt['preview_new'], '" border="0" /></div>', $txt[279], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</td></tr><tr class="windowbg2"><td colspan="2" class="smalltext" id="msg\' + newPosts[i].getAttribute("id") + \'" width="100%"><div align="right" class="smalltext"><a href="#top" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');">', $txt[260], '</a></div><div class="post">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'</div></td></tr>\';
Chris@76 148 newTable += \'</table>\';
Chris@76 149 setOuterHTML(document.getElementById("new_replies"), newTable);
Chris@76 150 }
Chris@76 151
Chris@76 152 if (typeof(smf_codeFix) != "undefined")
Chris@76 153 smf_codeFix();
Chris@76 154 }';
Chris@76 155
Chris@76 156 // A function needed to discern HTML entities from non-western characters.
Chris@76 157 echo '
Chris@76 158 function saveEntities()
Chris@76 159 {
Chris@76 160 var textFields = ["subject", "message", "guestname", "evtitle", "question"];
Chris@76 161 for (i in textFields)
Chris@76 162 if (document.forms.postmodify.elements[textFields[i]])
Chris@76 163 document.forms.postmodify[textFields[i]].value = document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#38;#");
Chris@76 164 for (var i = document.forms.postmodify.elements.length - 1; i >= 0; i--)
Chris@76 165 if (document.forms.postmodify.elements[i].name.indexOf("options") == 0)
Chris@76 166 document.forms.postmodify.elements[i].value = document.forms.postmodify.elements[i].value.replace(/&#/g, "&#38;#");
Chris@76 167 }';
Chris@76 168
Chris@76 169 if (!empty($settings['additional_options_collapsable']))
Chris@76 170 echo '
Chris@76 171 var currentSwap = false;
Chris@76 172 function swapOptions()
Chris@76 173 {
Chris@76 174 document.getElementById("postMoreExpand").src = smf_images_url + "/" + (currentSwap ? "collapse.gif" : "expand.gif");
Chris@76 175 document.getElementById("postMoreExpand").alt = currentSwap ? "-" : "+";
Chris@76 176
Chris@76 177 document.getElementById("postMoreOptions").style.display = currentSwap ? "" : "none";
Chris@76 178
Chris@76 179 if (document.getElementById("postAttachment"))
Chris@76 180 document.getElementById("postAttachment").style.display = currentSwap ? "" : "none";
Chris@76 181 if (document.getElementById("postAttachment2"))
Chris@76 182 document.getElementById("postAttachment2").style.display = currentSwap ? "" : "none";
Chris@76 183
Chris@76 184 if (typeof(document.forms.postmodify.additional_options) != "undefined")
Chris@76 185 document.forms.postmodify.additional_options.value = currentSwap ? "1" : "0";
Chris@76 186
Chris@76 187 currentSwap = !currentSwap;
Chris@76 188 }';
Chris@76 189
Chris@76 190 // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
Chris@76 191 if ($context['make_poll'])
Chris@76 192 echo '
Chris@76 193 function pollOptions()
Chris@76 194 {
Chris@76 195 var expireTime = document.getElementById("poll_expire");
Chris@76 196
Chris@76 197 if (isEmptyText(expireTime) || expireTime.value == 0)
Chris@76 198 {
Chris@76 199 document.forms.postmodify.poll_hide[2].disabled = true;
Chris@76 200 if (document.forms.postmodify.poll_hide[2].checked)
Chris@76 201 document.forms.postmodify.poll_hide[1].checked = true;
Chris@76 202 }
Chris@76 203 else
Chris@76 204 document.forms.postmodify.poll_hide[2].disabled = false;
Chris@76 205 }
Chris@76 206
Chris@76 207 var pollOptionNum = 0, pollTabIndex;
Chris@76 208 function addPollOption()
Chris@76 209 {
Chris@76 210 if (pollOptionNum == 0)
Chris@76 211 {
Chris@76 212 for (var i = 0; i < document.forms.postmodify.elements.length; i++)
Chris@76 213 if (document.forms.postmodify.elements[i].id.substr(0, 8) == "options-")
Chris@76 214 {
Chris@76 215 pollOptionNum++;
Chris@76 216 pollTabIndex = document.forms.postmodify.elements[i].tabIndex;
Chris@76 217 }
Chris@76 218 }
Chris@76 219 pollOptionNum++
Chris@76 220
Chris@76 221 setOuterHTML(document.getElementById("pollMoreOptions"), \'<br /><label for="options-\' + pollOptionNum + \'">', $txt['smf22'], ' \' + pollOptionNum + \'</label>: <input type="text" name="options[\' + pollOptionNum + \']" id="options-\' + pollOptionNum + \'" value="" size="25" tabindex="\' + pollTabIndex + \'" /><span id="pollMoreOptions"></span>\');
Chris@76 222 }';
Chris@76 223
Chris@76 224 if ($context['make_event'])
Chris@76 225 echo '
Chris@76 226 var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
Chris@76 227
Chris@76 228 function generateDays()
Chris@76 229 {
Chris@76 230 var days = 0, selected = 0;
Chris@76 231 var dayElement = document.getElementById("day"), yearElement = document.getElementById("year"), monthElement = document.getElementById("month");
Chris@76 232
Chris@76 233 monthLength[1] = 28;
Chris@76 234 if (yearElement.options[yearElement.selectedIndex].value % 4 == 0)
Chris@76 235 monthLength[1] = 29;
Chris@76 236
Chris@76 237 selected = dayElement.selectedIndex;
Chris@76 238 while (dayElement.options.length)
Chris@76 239 dayElement.options[0] = null;
Chris@76 240
Chris@76 241 days = monthLength[monthElement.value - 1];
Chris@76 242
Chris@76 243 for (i = 1; i <= days; i++)
Chris@76 244 dayElement.options[dayElement.length] = new Option(i, i);
Chris@76 245
Chris@76 246 if (selected < days)
Chris@76 247 dayElement.selectedIndex = selected;
Chris@76 248 }';
Chris@76 249
Chris@76 250 echo '
Chris@76 251 // ]]></script>
Chris@76 252
Chris@76 253 <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" onsubmit="submitonce(this);saveEntities();" enctype="multipart/form-data">
Chris@76 254 <table width="75%" align="center" cellpadding="0" cellspacing="0">
Chris@76 255 <tr>
Chris@76 256 <td valign="bottom" colspan="2">
Chris@76 257 ', theme_linktree(), '
Chris@76 258 </td>
Chris@76 259 </tr>
Chris@76 260 </table>';
Chris@76 261
Chris@76 262 echo '
Chris@76 263 <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
Chris@76 264 <table width="75%" cellpadding="3" cellspacing="1" border="0" align="center" class="bordercolor">
Chris@76 265 <tr class="titlebg">
Chris@76 266 <td id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</td>
Chris@76 267 </tr>
Chris@76 268 <tr>
Chris@76 269 <td class="windowbg">
Chris@76 270 <div class="post" id="preview_body">', empty($context['preview_message']) ? '' : $context['preview_message'], '</div>
Chris@76 271 </td>
Chris@76 272 </tr>
Chris@76 273 </table><br />
Chris@76 274 </div>';
Chris@76 275
Chris@76 276 if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
Chris@76 277 echo '
Chris@76 278 <input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
Chris@76 279
Chris@76 280 echo '
Chris@76 281 <table border="0" width="75%" align="center" cellspacing="1" cellpadding="3" class="bordercolor">
Chris@76 282 <tr class="titlebg">
Chris@76 283 <td>' . $context['page_title'] . '</td>
Chris@76 284 </tr>
Chris@76 285 <tr>
Chris@76 286 <td class="windowbg">' . (isset($context['current_topic']) ? '
Chris@76 287 <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '') . '
Chris@76 288 <table border="0" cellpadding="3" width="100%">';
Chris@76 289
Chris@76 290 // If an error occurred, explain what happened.
Chris@76 291 echo '
Chris@76 292 <tr', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
Chris@76 293 <td></td>
Chris@76 294 <td align="left">
Chris@76 295 <div style="padding: 0px; font-weight: bold;', empty($context['error_type']) || $context['error_type'] != 'serious' ? ' display: none;' : '', '" id="error_serious">
Chris@76 296 ', $txt['error_while_submitting'], '
Chris@76 297 </div>
Chris@76 298 <div style="color: red; margin: 1ex 0 2ex 3ex;" id="error_list">
Chris@76 299 ', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
Chris@76 300 </div>
Chris@76 301 </td>
Chris@76 302 </tr>';
Chris@76 303
Chris@76 304 // If it's locked, show a message to warn the replyer.
Chris@76 305 echo '
Chris@76 306 <tr', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning">
Chris@76 307 <td></td>
Chris@76 308 <td align="left">
Chris@76 309 ', $txt['smf287'], '
Chris@76 310 </td>
Chris@76 311 </tr>';
Chris@76 312
Chris@76 313 // Guests have to put in their name and email...
Chris@76 314 if (isset($context['name']) && isset($context['email']))
Chris@76 315 {
Chris@76 316 echo '
Chris@76 317 <tr>
Chris@76 318 <td align="right" style="font-weight: bold;', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? 'color: red;' : '', '" id="caption_guestname">
Chris@76 319 ', $txt[68], ':
Chris@76 320 </td>
Chris@76 321 <td>
Chris@76 322 <input type="text" name="guestname" size="25" value="', $context['name'], '" />
Chris@76 323 </td>
Chris@76 324 </tr>';
Chris@76 325
Chris@76 326 if (empty($modSettings['guest_post_no_email']))
Chris@76 327 echo '
Chris@76 328 <tr>
Chris@76 329 <td align="right" style="font-weight: bold;', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? 'color: red;' : '', '" id="caption_email">
Chris@76 330 ', $txt[69], ':
Chris@76 331 </td>
Chris@76 332 <td>
Chris@76 333 <input type="text" name="email" size="25" value="', $context['email'], '" />
Chris@76 334 </td>
Chris@76 335 </tr>';
Chris@76 336 }
Chris@76 337
Chris@76 338 // Are you posting a calendar event?
Chris@76 339 if ($context['make_event'])
Chris@76 340 {
Chris@76 341 echo '
Chris@76 342 <tr>
Chris@76 343 <td align="right" style="font-weight: bold;', isset($context['post_error']['no_event']) ? 'color: red;' : '', '" id="caption_evtitle">
Chris@76 344 ', $txt['calendar12'], '
Chris@76 345 </td>
Chris@76 346 <td class="smalltext">
Chris@76 347 <input type="text" name="evtitle" maxlength="30" size="30" value="', $context['event']['title'], '" />
Chris@76 348 </td>
Chris@76 349 </tr><tr>
Chris@76 350 <td></td>
Chris@76 351 <td class="smalltext">
Chris@76 352 <input type="hidden" name="calendar" value="1" />', $txt['calendar10'], '&nbsp;
Chris@76 353 <select name="year" id="year" onchange="generateDays();">';
Chris@76 354
Chris@76 355 // Show a list of all the years we allow...
Chris@76 356 for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
Chris@76 357 echo '
Chris@76 358 <option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '</option>';
Chris@76 359
Chris@76 360 echo '
Chris@76 361 </select>&nbsp;
Chris@76 362 ', $txt['calendar9'], '&nbsp;
Chris@76 363 <select name="month" id="month" onchange="generateDays();">';
Chris@76 364
Chris@76 365 // There are 12 months per year - ensure that they all get listed.
Chris@76 366 for ($month = 1; $month <= 12; $month++)
Chris@76 367 echo '
Chris@76 368 <option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>';
Chris@76 369
Chris@76 370 echo '
Chris@76 371 </select>&nbsp;
Chris@76 372 ', $txt['calendar11'], '&nbsp;
Chris@76 373 <select name="day" id="day">';
Chris@76 374
Chris@76 375 // This prints out all the days in the current month - this changes dynamically as we switch months.
Chris@76 376 for ($day = 1; $day <= $context['event']['last_day']; $day++)
Chris@76 377 echo '
Chris@76 378 <option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';
Chris@76 379
Chris@76 380 echo '
Chris@76 381 </select>
Chris@76 382 </td>
Chris@76 383 </tr>';
Chris@76 384
Chris@76 385 // If events can span more than one day then allow the user to select how long it should last.
Chris@76 386 if (!empty($modSettings['cal_allowspan']))
Chris@76 387 {
Chris@76 388 echo '
Chris@76 389 <tr>
Chris@76 390 <td align="right"><b>', $txt['calendar54'], '</b></td>
Chris@76 391 <td class="smalltext">
Chris@76 392 <select name="span">';
Chris@76 393
Chris@76 394 for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++)
Chris@76 395 echo '
Chris@76 396 <option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '</option>';
Chris@76 397
Chris@76 398 echo '
Chris@76 399 </select>
Chris@76 400 </td>
Chris@76 401 </tr>';
Chris@76 402 }
Chris@76 403
Chris@76 404 // If this is a new event let the user specify which board they want the linked post to be put into.
Chris@76 405 if ($context['event']['new'] && $context['is_new_post'])
Chris@76 406 {
Chris@76 407 echo '
Chris@76 408 <tr>
Chris@76 409 <td align="right"><b>', $txt['calendar13'], '</b></td>
Chris@76 410 <td class="smalltext">
Chris@76 411 <select name="board">';
Chris@76 412
Chris@76 413 foreach ($context['event']['boards'] as $board)
Chris@76 414 echo '
Chris@76 415 <option value="', $board['id'], '"', $board['id'] == $context['event']['board'] ? ' selected="selected"' : '', '>', $board['cat']['name'], ' - ', $board['prefix'], $board['name'], '</option>';
Chris@76 416
Chris@76 417 echo '
Chris@76 418 </select>
Chris@76 419 </td>
Chris@76 420 </tr>';
Chris@76 421 }
Chris@76 422 }
Chris@76 423
Chris@76 424 // Now show the subject box for this post.
Chris@76 425 echo '
Chris@76 426 <tr>
Chris@76 427 <td align="right" style="font-weight: bold;', isset($context['post_error']['no_subject']) ? 'color: red;' : '', '" id="caption_subject">
Chris@76 428 ', $txt[70], ':
Chris@76 429 </td>
Chris@76 430 <td>
Chris@76 431 <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' size="80" maxlength="80" />
Chris@76 432 </td>
Chris@76 433 </tr>
Chris@76 434 <tr>
Chris@76 435 <td align="right">
Chris@76 436 <b>', $txt[71], ':</b>
Chris@76 437 </td>
Chris@76 438 <td>
Chris@76 439 <select name="icon" id="icon" onchange="showimage()">';
Chris@76 440
Chris@76 441 // Loop through each message icon allowed, adding it to the drop down list.
Chris@76 442 foreach ($context['icons'] as $icon)
Chris@76 443 echo '
Chris@76 444 <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
Chris@76 445
Chris@76 446 echo '
Chris@76 447 </select>
Chris@76 448 <img src="', $context['icon_url'], '" name="icons" border="0" hspace="15" alt="" />
Chris@76 449 </td>
Chris@76 450 </tr>';
Chris@76 451
Chris@76 452 // If this is a poll then display all the poll options!
Chris@76 453 if ($context['make_poll'])
Chris@76 454 {
Chris@76 455 echo '
Chris@76 456 <tr>
Chris@76 457 <td align="right" style="font-weight: bold;', isset($context['post_error']['no_question']) ? 'color: red;' : '', '" id="caption_question">
Chris@76 458 ', $txt['smf21'], ':
Chris@76 459 </td>
Chris@76 460 <td align="left">
Chris@76 461 <input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" size="80" />
Chris@76 462 </td>
Chris@76 463 </tr>
Chris@76 464 <tr>
Chris@76 465 <td align="right"></td>
Chris@76 466 <td>';
Chris@76 467
Chris@76 468 // Loop through all the choices and print them out.
Chris@76 469 foreach ($context['choices'] as $choice)
Chris@76 470 {
Chris@76 471 echo '
Chris@76 472 <label for="options-', $choice['id'], '">', $txt['smf22'], ' ', $choice['number'], '</label>: <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" size="25" />';
Chris@76 473
Chris@76 474 if (!$choice['is_last'])
Chris@76 475 echo '<br />';
Chris@76 476 }
Chris@76 477
Chris@76 478 echo '
Chris@76 479 <span id="pollMoreOptions"></span> <a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a>
Chris@76 480 </td>
Chris@76 481 </tr>
Chris@76 482 <tr>
Chris@76 483 <td align="right"><b>', $txt['poll_options'], ':</b></td>
Chris@76 484 <td class="smalltext"><input type="text" name="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" /> ', $txt['poll_options5'], '</td>
Chris@76 485 </tr>
Chris@76 486 <tr>
Chris@76 487 <td align="right"></td>
Chris@76 488 <td class="smalltext">', $txt['poll_options1a'], ' <input type="text" id="poll_expire" name="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" /> ', $txt['poll_options1b'], '</td>
Chris@76 489 </tr>
Chris@76 490 <tr>
Chris@76 491 <td align="right"></td>
Chris@76 492 <td class="smalltext"><label for="poll_change_vote"><input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll_options']['change_vote']) ? ' checked="checked"' : '', ' class="check" /> ', $txt['poll_options7'], '</label></td>
Chris@76 493 </tr>
Chris@76 494 <tr>
Chris@76 495 <td align="right"></td>
Chris@76 496 <td class="smalltext">
Chris@76 497 <input type="radio" id="poll_hide" name="poll_hide" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="check" /> ', $txt['poll_options2'], '<br />
Chris@76 498 <input type="radio" id="poll_hide" name="poll_hide" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="check" /> ', $txt['poll_options3'], '<br />
Chris@76 499 <input type="radio" id="poll_hide" name="poll_hide" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? ' disabled="disabled"' : '', ' class="check" /> ', $txt['poll_options4'], '<br />
Chris@76 500 <br />
Chris@76 501 </td>
Chris@76 502 </tr>';
Chris@76 503 }
Chris@76 504
Chris@76 505 // The below function prints the BBC, smileys and the message itself out.
Chris@76 506 theme_postbox($context['message']);
Chris@76 507
Chris@76 508 // If this message has been edited in the past - display when it was.
Chris@76 509 if (isset($context['last_modified']))
Chris@76 510 echo '
Chris@76 511 <tr>
Chris@76 512 <td valign="top" align="right">
Chris@76 513 <b>', $txt[211], ':</b>
Chris@76 514 </td>
Chris@76 515 <td>
Chris@76 516 ', $context['last_modified'], '
Chris@76 517 </td>
Chris@76 518 </tr>';
Chris@76 519
Chris@76 520 // If the admin has enabled the hiding of the additional options - show a link and image for it.
Chris@76 521 if (!empty($settings['additional_options_collapsable']))
Chris@76 522 echo '
Chris@76 523 <tr>
Chris@76 524 <td colspan="2" style="padding-left: 5ex;">
Chris@76 525 <a href="javascript:swapOptions();"><img src="', $settings['images_url'], '/expand.gif" alt="+" border="0" id="postMoreExpand" /></a> <a href="javascript:swapOptions();"><b>', $txt['post_additionalopt'], '</b></a>
Chris@76 526 </td>
Chris@76 527 </tr>';
Chris@76 528
Chris@76 529 // Display the check boxes for all the standard options - if they are available to the user!
Chris@76 530 echo '
Chris@76 531 <tr>
Chris@76 532 <td></td>
Chris@76 533 <td>
Chris@76 534 <div id="postMoreOptions">
Chris@76 535 <table width="80%" cellpadding="0" cellspacing="0" border="0">
Chris@76 536 <tr>
Chris@76 537 <td class="smalltext">', $context['can_notify'] ? '<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="check" /> ' . $txt['smf14'] . '</label>' : '', '</td>
Chris@76 538 <td class="smalltext">', $context['can_lock'] ? '<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="check" /> ' . $txt['smf15'] . '</label>' : '', '</td>
Chris@76 539 </tr>
Chris@76 540 <tr>
Chris@76 541 <td class="smalltext"><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="check" /> ' . $txt['back_to_topic'] . '</label></td>
Chris@76 542 <td class="smalltext">', $context['can_sticky'] ? '<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="check" /> ' . $txt['sticky_after2'] . '</label>' : '', '</td>
Chris@76 543 </tr>
Chris@76 544 <tr>
Chris@76 545 <td class="smalltext"><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked="checked"', ' value="NS" class="check" /> ', $txt[277], '</label></td>', '
Chris@76 546 <td class="smalltext">', $context['can_move'] ? '<input type="hidden" name="move" value="0" /><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1" class="check" /> ' . $txt['move_after2'] . '</label>' : '', '</td>
Chris@76 547 </tr>', $context['can_announce'] && $context['is_first_post'] ? '
Chris@76 548 <tr>
Chris@76 549 <td class="smalltext"><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1" class="check" /> ' . $txt['announce_topic'] . '</label></td>
Chris@76 550 <td class="smalltext"></td>
Chris@76 551 </tr>' : '', '
Chris@76 552 </table>
Chris@76 553 </div>
Chris@76 554 </td>
Chris@76 555 </tr>';
Chris@76 556
Chris@76 557 // If this post already has attachments on it - give information about them.
Chris@76 558 if (!empty($context['current_attachments']))
Chris@76 559 {
Chris@76 560 echo '
Chris@76 561 <tr id="postAttachment">
Chris@76 562 <td align="right" valign="top">
Chris@76 563 <b>', $txt['smf119b'], ':</b>
Chris@76 564 </td>
Chris@76 565 <td class="smalltext">
Chris@76 566 <input type="hidden" name="attach_del[]" value="0" />
Chris@76 567 ', $txt['smf130'], ':<br />';
Chris@76 568 foreach ($context['current_attachments'] as $attachment)
Chris@76 569 echo '
Chris@76 570 <input type="checkbox" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="check" /> ', $attachment['name'], '<br />';
Chris@76 571 echo '
Chris@76 572 <br />
Chris@76 573 </td>
Chris@76 574 </tr>';
Chris@76 575 }
Chris@76 576
Chris@76 577 // Is the user allowed to post any additional ones? If so give them the boxes to do it!
Chris@76 578 if ($context['can_post_attachment'])
Chris@76 579 {
Chris@76 580 echo '
Chris@76 581 <tr id="postAttachment2">
Chris@76 582 <td align="right" valign="top">
Chris@76 583 <b>', $txt['smf119'], ':</b>
Chris@76 584 </td>
Chris@76 585 <td class="smalltext">
Chris@76 586 <input type="file" size="48" name="attachment[]" />';
Chris@76 587
Chris@76 588 // Show more boxes only if they aren't approaching their limit.
Chris@76 589 if ($context['num_allowed_attachments'] > 1)
Chris@76 590 echo '
Chris@76 591 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 592 var allowed_attachments = ', $context['num_allowed_attachments'], ' - 1;
Chris@76 593
Chris@76 594 function addAttachment()
Chris@76 595 {
Chris@76 596 if (allowed_attachments <= 0)
Chris@76 597 return alert("', $txt['more_attachments_error'], '");
Chris@76 598
Chris@76 599 setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /><span id="moreAttachments"></span>\');
Chris@76 600 allowed_attachments = allowed_attachments - 1;
Chris@76 601
Chris@76 602 return true;
Chris@76 603 }
Chris@76 604 // ]]></script>
Chris@76 605 <span id="moreAttachments"></span> <a href="javascript:addAttachment(); void(0);">(', $txt['more_attachments'], ')</a><br />
Chris@76 606 <noscript><input type="file" size="48" name="attachment[]" /><br /></noscript>';
Chris@76 607 else
Chris@76 608 echo '
Chris@76 609 <br />';
Chris@76 610
Chris@76 611 // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
Chris@76 612 if (!empty($modSettings['attachmentCheckExtensions']))
Chris@76 613 echo '
Chris@76 614 ', $txt['smf120'], ': ', $context['allowed_extensions'], '<br />';
Chris@76 615 echo '
Chris@76 616 ', $txt['smf121'], ': ', $modSettings['attachmentSizeLimit'], ' ' . $txt['smf211'], !empty($modSettings['attachmentNumPerPostLimit']) ? ', ' . $txt['maxAttachPerPost'] . ': ' . $modSettings['attachmentNumPerPostLimit'] : '', '
Chris@76 617 </td>
Chris@76 618 </tr>';
Chris@76 619 }
Chris@76 620
Chris@76 621 // Finally, the submit buttons - and some javascript to hide the additional options on load.
Chris@76 622 echo '
Chris@76 623 <tr>
Chris@76 624 <td align="center" colspan="2">';
Chris@76 625 if (!empty($settings['additional_options_collapsable']) && !$context['show_additional_options'])
Chris@76 626 echo '
Chris@76 627 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 628 swapOptions();
Chris@76 629 // ]]></script>';
Chris@76 630 echo '
Chris@76 631 <span class="smalltext"><br />' . $txt['smf16'] . '</span><br />
Chris@76 632 <input type="submit" name="post" value="', $context['submit_label'], '" onclick="return submitThisOnce(this);" accesskey="s" />
Chris@76 633 <input type="submit" name="preview" value="', $txt[507], '" onclick="return event.ctrlKey || previewPost();" accesskey="p" />';
Chris@76 634
Chris@76 635 // Option to delete an event if user is editing one.
Chris@76 636 if ($context['make_event'] && !$context['event']['new'])
Chris@76 637 echo '
Chris@76 638 <input type="submit" name="deleteevent" value="', $txt['calendar22'], '" onclick="return confirm(\'', $txt['calendar21'], '\');" />';
Chris@76 639
Chris@76 640 // Spell check button if the option is enabled.
Chris@76 641 if ($context['show_spellchecking'])
Chris@76 642 echo '
Chris@76 643 <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" />';
Chris@76 644
Chris@76 645 echo '
Chris@76 646 </td>
Chris@76 647 </tr>
Chris@76 648 <tr>
Chris@76 649 <td colspan="2"></td>
Chris@76 650 </tr>
Chris@76 651 </table>
Chris@76 652 </td>
Chris@76 653 </tr>
Chris@76 654 </table>';
Chris@76 655
Chris@76 656 // Assuming this isn't a new topic pass across the number of replies when the topic was created.
Chris@76 657 if (isset($context['num_replies']))
Chris@76 658 echo '
Chris@76 659 <input type="hidden" name="num_replies" value="', $context['num_replies'], '" />';
Chris@76 660
Chris@76 661 echo '
Chris@76 662 <input type="hidden" name="additional_options" value="', $context['show_additional_options'] ? 1 : 0, '" />
Chris@76 663 <input type="hidden" name="sc" value="', $context['session_id'], '" />
Chris@76 664 <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
Chris@76 665 </form>';
Chris@76 666
Chris@76 667 // A hidden form to post data to the spell checking window.
Chris@76 668 if ($context['show_spellchecking'])
Chris@76 669 echo '
Chris@76 670 <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';
Chris@76 671
Chris@76 672 // If the user is replying to a topic show the previous posts.
Chris@76 673 if (isset($context['previous_posts']) && count($context['previous_posts']) > 0)
Chris@76 674 {
Chris@76 675 echo '
Chris@76 676 <br /><br />
Chris@76 677
Chris@76 678 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 679 function insertQuoteFast(messageid)
Chris@76 680 {
Chris@76 681 if (window.XMLHttpRequest)
Chris@76 682 getXMLDocument("', $scripturl, '?action=quotefast;quote=" + messageid + ";sesc=', $context['session_id'], ';xml", onDocReceived);
Chris@76 683 else
Chris@76 684 reqWin("', $scripturl, '?action=quotefast;quote=" + messageid + ";sesc=', $context['session_id'], '", 240, 90);
Chris@76 685
Chris@76 686 return true;
Chris@76 687 }
Chris@76 688 function onDocReceived(XMLDoc)
Chris@76 689 {
Chris@76 690 var text = "";
Chris@76 691 for (var i = 0; i < XMLDoc.getElementsByTagName("quote")[0].childNodes.length; i++)
Chris@76 692 text += XMLDoc.getElementsByTagName("quote")[0].childNodes[i].nodeValue;
Chris@76 693
Chris@76 694 replaceText(text, document.forms.postmodify.message);
Chris@76 695 }
Chris@76 696 // ]]></script>
Chris@76 697
Chris@76 698 <table cellspacing="1" cellpadding="0" width="75%" align="center" class="bordercolor">
Chris@76 699 <tr>
Chris@76 700 <td>
Chris@76 701 <table class="windowbg" cellspacing="0" cellpadding="2" width="100%" align="center">
Chris@76 702 <tr class="titlebg">
Chris@76 703 <td colspan="2">' . $txt[468] . '</td>
Chris@76 704 </tr>
Chris@76 705 </table>
Chris@76 706 <span id="new_replies"></span>
Chris@76 707 <table class="windowbg" cellspacing="0" cellpadding="2" width="100%" align="center">';
Chris@76 708 foreach ($context['previous_posts'] as $post)
Chris@76 709 echo '
Chris@76 710 <tr class="catbg">
Chris@76 711 <td align="left" class="smalltext">
Chris@76 712 ', $txt[279], ': ', $post['poster'], '
Chris@76 713 </td>
Chris@76 714 <td align="right" class="smalltext">
Chris@76 715 ', $txt[280], ': ', $post['time'], $post['is_new'] ? ' <img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['preview_new'] . '" border="0" />' : '', '
Chris@76 716 </td>
Chris@76 717 </tr><tr class="windowbg2">
Chris@76 718 <td align="right" colspan="2" class="smalltext">
Chris@76 719 <a href="#top" onclick="return insertQuoteFast(', $post['id'], ');">' . $txt[260] . '</a>
Chris@76 720 </td>
Chris@76 721 </tr><tr class="windowbg2">
Chris@76 722 <td colspan="2" class="smalltext" id="msg' . $post['id'] . '">
Chris@76 723 <div class="post">' . $post['message'] . '</div>
Chris@76 724 </td>
Chris@76 725 </tr>';
Chris@76 726 echo '
Chris@76 727 </table>
Chris@76 728 </td>
Chris@76 729 </tr>
Chris@76 730 </table>';
Chris@76 731 }
Chris@76 732 }
Chris@76 733
Chris@76 734 function template_postbox(&$message)
Chris@76 735 {
Chris@76 736 global $context, $settings, $options, $txt;
Chris@76 737
Chris@76 738 if ($context['show_bbc'])
Chris@76 739 {
Chris@76 740 echo '
Chris@76 741 <tr>
Chris@76 742 <td align="right" valign="top">
Chris@76 743 <b>' . $txt[252] . ':</b>
Chris@76 744 </td>
Chris@76 745 <td align="left" valign="middle">';
Chris@76 746
Chris@76 747 $context['bbc_tags'] = array();
Chris@76 748 $context['bbc_tags'][] = array(
Chris@76 749 'bold' => array('code' => 'b', 'before' => '[b]', 'after' => '[/b]', 'description' => $txt[253]),
Chris@76 750 'italicize' => array('code' => 'i', 'before' => '[i]', 'after' => '[/i]', 'description' => $txt[254]),
Chris@76 751 'underline' => array('code' => 'u', 'before' => '[u]', 'after' => '[/u]', 'description' => $txt[255]),
Chris@76 752 'strike' => array('code' => 's', 'before' => '[s]', 'after' => '[/s]', 'description' => $txt[441]),
Chris@76 753 array(),
Chris@76 754 'glow' => array('code' => 'glow', 'before' => '[glow=red,2,300]', 'after' => '[/glow]', 'description' => $txt[442]),
Chris@76 755 'shadow' => array('code' => 'shadow', 'before' => '[shadow=red,left]', 'after' => '[/shadow]', 'description' => $txt[443]),
Chris@76 756 'move' => array('code' => 'move', 'before' => '[move]', 'after' => '[/move]', 'description' => $txt[439]),
Chris@76 757 array(),
Chris@76 758 'pre' => array('code' => 'pre', 'before' => '[pre]', 'after' => '[/pre]', 'description' => $txt[444]),
Chris@76 759 'left' => array('code' => 'left', 'before' => '[left]', 'after' => '[/left]', 'description' => $txt[445]),
Chris@76 760 'center' => array('code' => 'center', 'before' => '[center]', 'after' => '[/center]', 'description' => $txt[256]),
Chris@76 761 'right' => array('code' => 'right', 'before' => '[right]', 'after' => '[/right]', 'description' => $txt[446]),
Chris@76 762 array(),
Chris@76 763 'hr' => array('code' => 'hr', 'before' => '[hr]', 'description' => $txt[531]),
Chris@76 764 array(),
Chris@76 765 'size' => array('code' => 'size', 'before' => '[size=10pt]', 'after' => '[/size]', 'description' => $txt[532]),
Chris@76 766 'face' => array('code' => 'font', 'before' => '[font=Verdana]', 'after' => '[/font]', 'description' => $txt[533]),
Chris@76 767 );
Chris@76 768 $context['bbc_tags'][] = array(
Chris@76 769 'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt[433]),
Chris@76 770 'img' => array('code' => 'img', 'before' => '[img]', 'after' => '[/img]', 'description' => $txt[435]),
Chris@76 771 'url' => array('code' => 'url', 'before' => '[url]', 'after' => '[/url]', 'description' => $txt[257]),
Chris@76 772 'email' => array('code' => 'email', 'before' => '[email]', 'after' => '[/email]', 'description' => $txt[258]),
Chris@76 773 'ftp' => array('code' => 'ftp', 'before' => '[ftp]', 'after' => '[/ftp]', 'description' => $txt[434]),
Chris@76 774 array(),
Chris@76 775 'table' => array('code' => 'table', 'before' => '[table]', 'after' => '[/table]', 'description' => $txt[436]),
Chris@76 776 'tr' => array('code' => 'td', 'before' => '[tr]', 'after' => '[/tr]', 'description' => $txt[449]),
Chris@76 777 'td' => array('code' => 'td', 'before' => '[td]', 'after' => '[/td]', 'description' => $txt[437]),
Chris@76 778 array(),
Chris@76 779 'sup' => array('code' => 'sup', 'before' => '[sup]', 'after' => '[/sup]', 'description' => $txt[447]),
Chris@76 780 'sub' => array('code' => 'sub', 'before' => '[sub]', 'after' => '[/sub]', 'description' => $txt[448]),
Chris@76 781 'tele' => array('code' => 'tt', 'before' => '[tt]', 'after' => '[/tt]', 'description' => $txt[440]),
Chris@76 782 array(),
Chris@76 783 'code' => array('code' => 'code', 'before' => '[code]', 'after' => '[/code]', 'description' => $txt[259]),
Chris@76 784 'quote' => array('code' => 'quote', 'before' => '[quote]', 'after' => '[/quote]', 'description' => $txt[260]),
Chris@76 785 array(),
Chris@76 786 'list' => array('code' => 'list', 'before' => '[list]\n[li]', 'after' => '[/li]\n[li][/li]\n[/list]', 'description' => $txt[261]),
Chris@76 787 );
Chris@76 788
Chris@76 789 foreach ($context['bbc_tags'] as $i => $row)
Chris@76 790 {
Chris@76 791 foreach ($row as $image => $tag)
Chris@76 792 {
Chris@76 793 // Is this tag disabled?
Chris@76 794 if (!empty($tag['code']) && !empty($context['disabled_tags'][$tag['code']]))
Chris@76 795 continue;
Chris@76 796
Chris@76 797 if (isset($tag['before']))
Chris@76 798 echo '<a href="javascript:' . (isset($tag['after']) ? 'surround' : 'replace') . 'Text(\'' . $tag['before'] . '\'' . (isset($tag['after']) ? ', \'' . $tag['after'] . '\'' : '') . ', document.forms.' . $context['post_form'] . '.' . $context['post_box_name'] . ');"><img src="' . $settings['images_url'] . '/bbc/' . $image . '.gif" align="bottom" width="23" height="22" alt="' . $tag['description'] . '" border="0" /></a>';
Chris@76 799 }
Chris@76 800
Chris@76 801 if ($i != count($context['bbc_tags']) - 1)
Chris@76 802 echo '<br />';
Chris@76 803 }
Chris@76 804
Chris@76 805 echo '
Chris@76 806 <select onchange="surroundText(\'[color=\' + this.options[this.selectedIndex].value.toLowerCase() + \']\',\'[/color]\', document.forms.' . $context['post_form'] . '.' . $context['post_box_name'] . '); this.selectedIndex = 0;">
Chris@76 807 <option value="" selected="selected">', $txt['change_color'], '</option>
Chris@76 808 <option value="Black">' . $txt[262] . '</option>
Chris@76 809 <option value="Red">' . $txt[263] . '</option>
Chris@76 810 <option value="Yellow">' . $txt[264] . '</option>
Chris@76 811 <option value="Pink">' . $txt[265] . '</option>
Chris@76 812 <option value="Green">' . $txt[266] . '</option>
Chris@76 813 <option value="Orange">' . $txt[267] . '</option>
Chris@76 814 <option value="Purple">' . $txt[268] . '</option>
Chris@76 815 <option value="Blue">' . $txt[269] . '</option>
Chris@76 816 <option value="Beige">' . $txt[270] . '</option>
Chris@76 817 <option value="Brown">' . $txt[271] . '</option>
Chris@76 818 <option value="Teal">' . $txt[272] . '</option>
Chris@76 819 <option value="Navy">' . $txt[273] . '</option>
Chris@76 820 <option value="Maroon">' . $txt[274] . '</option>
Chris@76 821 <option value="LimeGreen">' . $txt[275] . '</option>
Chris@76 822 </select>
Chris@76 823 </td>
Chris@76 824 </tr>';
Chris@76 825 }
Chris@76 826 // Now start printing all of the smileys.
Chris@76 827 if (!empty($context['smileys']['postform']))
Chris@76 828 {
Chris@76 829 echo '
Chris@76 830 <tr>
Chris@76 831 <td align="right"></td>
Chris@76 832 <td valign="middle">';
Chris@76 833
Chris@76 834 // Show each row of smileys ;).
Chris@76 835 foreach ($context['smileys']['postform'] as $smiley_row)
Chris@76 836 {
Chris@76 837 foreach ($smiley_row['smileys'] as $smiley)
Chris@76 838 echo '
Chris@76 839 <a href="javascript:replaceText(\' ', $smiley['code'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], ');"><img src="', $settings['smileys_url'], '/', $smiley['filename'], '" align="bottom" alt="', $smiley['description'], '" title="', $smiley['description'], '" border="0" /></a>';
Chris@76 840
Chris@76 841 // If this isn't the last row, show a break.
Chris@76 842 if (empty($smiley_row['last']))
Chris@76 843 echo '<br />';
Chris@76 844 }
Chris@76 845
Chris@76 846 // If the smileys popup is to be shown... show it!
Chris@76 847 if (!empty($context['smileys']['popup']))
Chris@76 848 echo '
Chris@76 849 <a href="javascript:moreSmileys();">[', $txt['more_smileys'], ']</a>';
Chris@76 850
Chris@76 851 echo '
Chris@76 852 </td>
Chris@76 853 </tr>';
Chris@76 854 }
Chris@76 855
Chris@76 856 // Show an extra link for additional smileys (if there are any).
Chris@76 857 if (!empty($context['smileys']['popup']))
Chris@76 858 {
Chris@76 859 echo '
Chris@76 860 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 861 var smileys = [';
Chris@76 862
Chris@76 863 foreach ($context['smileys']['popup'] as $smiley_row)
Chris@76 864 {
Chris@76 865 echo '
Chris@76 866 [';
Chris@76 867 foreach ($smiley_row['smileys'] as $smiley)
Chris@76 868 {
Chris@76 869 echo '
Chris@76 870 ["', $smiley['code'], '","', $smiley['filename'], '","', $smiley['description'], '"]';
Chris@76 871 if (empty($smiley['last']))
Chris@76 872 echo ',';
Chris@76 873 }
Chris@76 874
Chris@76 875 echo ']';
Chris@76 876 if (empty($smiley_row['last']))
Chris@76 877 echo ',';
Chris@76 878 }
Chris@76 879
Chris@76 880 echo '];
Chris@76 881 var smileyPopupWindow;
Chris@76 882
Chris@76 883 function moreSmileys()
Chris@76 884 {
Chris@76 885 var row, i;
Chris@76 886
Chris@76 887 if (smileyPopupWindow)
Chris@76 888 smileyPopupWindow.close();
Chris@76 889
Chris@76 890 smileyPopupWindow = window.open("", "add_smileys", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=200,resizable=no");
Chris@76 891 smileyPopupWindow.document.write(\'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html>\');
Chris@76 892 smileyPopupWindow.document.write(\'\n\t<head>\n\t\t<title>', $txt['more_smileys_title'], '</title>\n\t\t<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />\n\t</head>\');
Chris@76 893 smileyPopupWindow.document.write(\'\n\t<body style="margin: 1ex;">\n\t\t<table width="100%" cellpadding="5" cellspacing="0" border="0" class="tborder">\n\t\t\t<tr class="titlebg"><td align="left">', $txt['more_smileys_pick'], '</td></tr>\n\t\t\t<tr class="windowbg"><td align="left">\');
Chris@76 894
Chris@76 895 for (row = 0; row < smileys.length; row++)
Chris@76 896 {
Chris@76 897 for (i = 0; i < smileys[row].length; i++)
Chris@76 898 {
Chris@76 899 smileys[row][i][2] = smileys[row][i][2].replace(/"/g, \'&quot;\');
Chris@76 900 smileyPopupWindow.document.write(\'<a href="javascript:void(0);" onclick="window.opener.replaceText(&quot; \' + smileys[row][i][0] + \'&quot;, window.opener.document.forms.', $context['post_form'], '.', $context['post_box_name'], '); window.focus(); return false;"><img src="', $settings['smileys_url'], '/\' + smileys[row][i][1] + \'" alt="\' + smileys[row][i][2] + \'" title="\' + smileys[row][i][2] + \'" style="padding: 4px;" border="0" /></a> \');
Chris@76 901 }
Chris@76 902 smileyPopupWindow.document.write("<br />");
Chris@76 903 }
Chris@76 904
Chris@76 905 smileyPopupWindow.document.write(\'</td></tr>\n\t\t\t<tr><td align="center" class="windowbg"><a href="javascript:window.close();\\">', $txt['more_smileys_close_window'], '</a></td></tr>\n\t\t</table>\n\t</body>\n</html>\');
Chris@76 906 smileyPopupWindow.document.close();
Chris@76 907 }
Chris@76 908 // ]]></script>';
Chris@76 909 }
Chris@76 910
Chris@76 911 echo '
Chris@76 912 <tr>
Chris@76 913 <td valign="top" align="right">
Chris@76 914 <b' . (isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="color: red;"' : '') . '>' . $txt[72] . ':</b>
Chris@76 915 </td>
Chris@76 916 <td>
Chris@76 917 <textarea class="editor" name="' . $context['post_box_name'] . '" rows="' . $context['post_box_rows'] . '" cols="' . $context['post_box_columns'] . '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '">' . $message . '</textarea>
Chris@76 918 </td>
Chris@76 919 </tr>';
Chris@76 920 }
Chris@76 921
Chris@76 922 function template_spellcheck()
Chris@76 923 {
Chris@76 924 global $context, $settings, $options, $txt;
Chris@76 925
Chris@76 926 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Chris@76 927 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
Chris@76 928 <head>
Chris@76 929 <title>', $txt['spell_check'], '</title>
Chris@76 930 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
Chris@76 931 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />
Chris@76 932 <style type="text/css">
Chris@76 933 body, td
Chris@76 934 {
Chris@76 935 font-size: small;
Chris@76 936 margin: 0;
Chris@76 937 }
Chris@76 938 .highlight
Chris@76 939 {
Chris@76 940 color: red;
Chris@76 941 font-weight: bold;
Chris@76 942 }
Chris@76 943 #spellview
Chris@76 944 {
Chris@76 945 border-style: outset;
Chris@76 946 border: 1px solid black;
Chris@76 947 padding: 5px;
Chris@76 948 width: 98%;
Chris@76 949 height: 344px;
Chris@76 950 overflow: auto;
Chris@76 951 }';
Chris@76 952
Chris@76 953 if ($context['browser']['needs_size_fix'])
Chris@76 954 echo '
Chris@76 955 @import(', $settings['default_theme_url'], '/fonts-compat.css);';
Chris@76 956
Chris@76 957 echo '
Chris@76 958 </style>
Chris@76 959 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 960 var spell_formname = window.opener.spell_formname;
Chris@76 961 var spell_fieldname = window.opener.spell_fieldname;
Chris@76 962 // ]]></script>
Chris@76 963 <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>
Chris@76 964 <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>
Chris@76 965 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 966 ', $context['spell_js'], '
Chris@76 967 // ]]></script>
Chris@76 968 </head>
Chris@76 969 <body onload="nextWord(false);">
Chris@76 970 <form action="#" method="post" accept-charset="', $context['character_set'], '" name="spellingForm" id="spellingForm" onsubmit="return false;" style="margin: 0;">
Chris@76 971 <div id="spellview">&nbsp;</div>
Chris@76 972 <table border="0" cellpadding="4" cellspacing="0" width="100%"><tr class="windowbg">
Chris@76 973 <td width="50%" valign="top">
Chris@76 974 ', $txt['spellcheck_change_to'], '<br />
Chris@76 975 <input type="text" name="changeto" style="width: 98%;" />
Chris@76 976 </td>
Chris@76 977 <td width="50%">
Chris@76 978 ', $txt['spellcheck_suggest'], '<br />
Chris@76 979 <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 980 </select>
Chris@76 981 </td>
Chris@76 982 </tr></table>
Chris@76 983 <div class="titlebg" align="right" style="padding: 4px;">
Chris@76 984 <input type="button" name="change" value="', $txt['spellcheck_change'], '" onclick="replaceWord();" />
Chris@76 985 <input type="button" name="changeall" value="', $txt['spellcheck_change_all'], '" onclick="replaceAll();" />
Chris@76 986 <input type="button" name="ignore" value="', $txt['spellcheck_ignore'], '" onclick="nextWord(false);" />
Chris@76 987 <input type="button" name="ignoreall" value="', $txt['spellcheck_ignore_all'], '" onclick="nextWord(true);" />
Chris@76 988 </div>
Chris@76 989 </form>
Chris@76 990 </body>
Chris@76 991 </html>';
Chris@76 992 }
Chris@76 993
Chris@76 994 function template_quotefast()
Chris@76 995 {
Chris@76 996 global $context, $settings, $options, $txt;
Chris@76 997
Chris@76 998 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Chris@76 999 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
Chris@76 1000 <head>
Chris@76 1001 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
Chris@76 1002 <title>', $txt['retrieving_quote'], '</title>
Chris@76 1003 <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>
Chris@76 1004 </head>
Chris@76 1005 <body>
Chris@76 1006 ', $txt['retrieving_quote'], '
Chris@76 1007 <div id="temporary_posting_area" style="display: none;"></div>
Chris@76 1008 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[';
Chris@76 1009
Chris@76 1010 if ($context['close_window'])
Chris@76 1011 echo '
Chris@76 1012 window.close();';
Chris@76 1013 else
Chris@76 1014 {
Chris@76 1015 // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;).
Chris@76 1016 echo '
Chris@76 1017 var quote = \'', $context['quote']['text'], '\';
Chris@76 1018 var stage = document.createElement ? document.createElement("DIV") : document.getElementById("temporary_posting_area");
Chris@76 1019
Chris@76 1020 if (typeof(DOMParser) != "undefined" && typeof(window.opera) == "undefined")
Chris@76 1021 {
Chris@76 1022 var xmldoc = new DOMParser().parseFromString("<temp>" + \'', $context['quote']['mozilla'], '\'.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_") + "</temp>", "text/xml");
Chris@76 1023 quote = xmldoc.childNodes[0].textContent.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
Chris@76 1024 }
Chris@76 1025 else if (typeof(stage.innerText) != "undefined")
Chris@76 1026 {
Chris@76 1027 setInnerHTML(stage, quote.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_").replace(/</g, "&lt;").replace(/>/g, "&gt;"));
Chris@76 1028 quote = stage.innerText.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
Chris@76 1029 }
Chris@76 1030
Chris@76 1031 if (typeof(window.opera) != "undefined")
Chris@76 1032 quote = quote.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, \'"\').replace(/&amp;/g, "&");
Chris@76 1033
Chris@76 1034 window.opener.replaceText(quote, window.opener.document.forms.postmodify.message);
Chris@76 1035
Chris@76 1036 window.focus();
Chris@76 1037 setTimeout("window.close();", 400);';
Chris@76 1038 }
Chris@76 1039 echo '
Chris@76 1040 // ]]></script>
Chris@76 1041 </body>
Chris@76 1042 </html>';
Chris@76 1043 }
Chris@76 1044
Chris@76 1045 function template_announce()
Chris@76 1046 {
Chris@76 1047 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1048
Chris@76 1049 echo '
Chris@76 1050 <form action="', $scripturl, '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '">
Chris@76 1051 <table width="600" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder">
Chris@76 1052 <tr class="titlebg">
Chris@76 1053 <td>', $txt['announce_title'], '</td>
Chris@76 1054 </tr><tr class="windowbg">
Chris@76 1055 <td class="smalltext" style="padding: 2ex;">', $txt['announce_desc'], '</td>
Chris@76 1056 </tr><tr>
Chris@76 1057 <td class="windowbg2">
Chris@76 1058 ', $txt['announce_this_topic'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0">', $context['topic_subject'], '</a><br />
Chris@76 1059 </td>
Chris@76 1060 </tr><tr>
Chris@76 1061 <td class="windowbg2">';
Chris@76 1062
Chris@76 1063 foreach ($context['groups'] as $group)
Chris@76 1064 echo '
Chris@76 1065 <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked="checked" class="check" /> ', $group['name'], '</label> <i>(', $group['member_count'], ')</i><br />';
Chris@76 1066
Chris@76 1067 echo '
Chris@76 1068 <br />
Chris@76 1069 <label for="checkall"><input type="checkbox" id="checkall" class="check" onclick="invertAll(this, this.form);" checked="checked" /> <i>', $txt[737], '</i></label>
Chris@76 1070 </td>
Chris@76 1071 </tr><tr>
Chris@76 1072 <td class="windowbg2" style="padding-bottom: 1ex;" align="center">
Chris@76 1073 <input type="submit" value="', $txt[105], '" />
Chris@76 1074 </td>
Chris@76 1075 </tr>
Chris@76 1076 </table>
Chris@76 1077 <input type="hidden" name="sc" value="', $context['session_id'], '" />
Chris@76 1078 <input type="hidden" name="topic" value="', $context['current_topic'], '" />
Chris@76 1079 <input type="hidden" name="move" value="', $context['move'], '" />
Chris@76 1080 <input type="hidden" name="goback" value="', $context['go_back'], '" />
Chris@76 1081 </form>';
Chris@76 1082 }
Chris@76 1083
Chris@76 1084 function template_announcement_send()
Chris@76 1085 {
Chris@76 1086 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1087
Chris@76 1088 echo '
Chris@76 1089 <form action="' . $scripturl . '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
Chris@76 1090 <table width="600" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder">
Chris@76 1091 <tr class="titlebg">
Chris@76 1092 <td>
Chris@76 1093 ', $txt['announce_sending'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0" target="_blank">', $context['topic_subject'], '</a>
Chris@76 1094 </td>
Chris@76 1095 </tr><tr>
Chris@76 1096 <td class="windowbg2"><b>', $context['percentage_done'], '% ', $txt['announce_done'], '</b></td>
Chris@76 1097 </tr><tr>
Chris@76 1098 <td class="windowbg2" style="padding-bottom: 1ex;" align="center">
Chris@76 1099 <input type="submit" name="b" value="', $txt['announce_continue'], '" />
Chris@76 1100 </td>
Chris@76 1101 </tr>
Chris@76 1102 </table>
Chris@76 1103 <input type="hidden" name="sc" value="', $context['session_id'], '" />
Chris@76 1104 <input type="hidden" name="topic" value="', $context['current_topic'], '" />
Chris@76 1105 <input type="hidden" name="move" value="', $context['move'], '" />
Chris@76 1106 <input type="hidden" name="goback" value="', $context['go_back'], '" />
Chris@76 1107 <input type="hidden" name="start" value="', $context['start'], '" />
Chris@76 1108 <input type="hidden" name="membergroups" value="', $context['membergroups'], '" />
Chris@76 1109 </form>
Chris@76 1110 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
Chris@76 1111 var countdown = 2;
Chris@76 1112 doAutoSubmit();
Chris@76 1113
Chris@76 1114 function doAutoSubmit()
Chris@76 1115 {
Chris@76 1116 if (countdown == 0)
Chris@76 1117 document.forms.autoSubmit.submit();
Chris@76 1118 else if (countdown == -1)
Chris@76 1119 return;
Chris@76 1120
Chris@76 1121 document.forms.autoSubmit.b.value = "', $txt['announce_continue'], ' (" + countdown + ")";
Chris@76 1122 countdown--;
Chris@76 1123
Chris@76 1124 setTimeout("doAutoSubmit();", 1000);
Chris@76 1125 }
Chris@76 1126 // ]]></script>';
Chris@76 1127 }
Chris@76 1128
Chris@76 1129 ?>