// This function displays all the stuff you'd expect to see with a message box, the box, BBC buttons and of course smileys.
function template_postbox(&$message)
{
global $context, $settings, $options, $txt, $modSettings;
// Now start printing all of the smileys.
if (!empty($context['smileys']['postform']))
{
echo '
<tr>
<td align="right"></td>
<td valign="middle">';
// Show each row of smileys;).
foreach ($context['smileys']['postform'] as $smiley_row)
{
foreach ($smiley_row['smileys'] as $smiley)
{
$smiley_src= $settings['smileys_url'] . '/' . $smiley['filename'];
print "<img style='cursor:hand;cursor:pointer' onmousedown=\"if(editor_type==1){WriteHTML('< img src=$smiley_src>','editor');}else{WriteTEXT('\[IMG\]$smiley_src\[\/IMG\]','editor');}\" src=\"$smiley_src\" alt=\"$smiley[description]\" title=\"$smiley[description]\" /> ";
}
// If this isn't the last row, show a break.
if (empty($smiley_row['last']))
echo '<br />';
}
// If the smileys popup is to be shown... show it!
if (!empty($context['smileys']['popup']))
echo '
<a href="java script:moreSmileys();">[', $txt['more_smileys'], ']</a>';
echo '
</td>
</tr>';
}
// If there are additional smileys then ensure we provide the javascript for them.
if (!empty($context['smileys']['popup']))
{
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smileys = [';
foreach ($context['smileys']['popup'] as $smiley_row)
{
echo '
[';
foreach ($smiley_row['smileys'] as $smiley)
{
echo '
["', $smiley['code'], '","', $smiley['filename'], '","', $smiley['js_description'], '"]';
if (empty($smiley['last']))
echo ',';
}
echo ']';
if (empty($smiley_row['last']))
echo ',';
}
echo '];
var smileyPopupWindow;
function moreSmileys()
{
var row, i;
if (smileyPopupWindow)
smileyPopupWindow.close();
smileyPopupWindow = window.open("", "add_smileys", "toolbar=no,location=no,status=no,menubar=no, sc
ollbars=yes,width=480,height=220,resizable=yes&quo t;);
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>\');
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>\');
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">\');
for (row = 0; row < smileys.length; row++)
{
for (i = 0; i < smileys[row].length; i++)
{
smileys[row][i][2] = smileys[row][i][2].replace(/"/g, \'"\');
smileyPopupWindow.document.write(\'<a href="java script:void(0);" onclick="window.opener.replaceText(" \' + smileys[row][i][0] + \'", 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> \');
}
smileyPopupWindow.document.write("<br />");
}
smileyPopupWindow.document.write(\'</td></tr>\n\t\t\t<tr><td align="center" class="windowbg"><a href="java script:window.close();\\">', $txt['more_smileys_close_window'], '</a></td></tr>\n\t\t</table>\n\t</body>\n</html>\');
smileyPopupWindow.document.close();
}
// ]]></script>';
}
// Finally the most important bit - the actual Hoteditor box to write in!
//HotEditor MOD
print<<<HTML_CODE
<tr>
<td valign="top" align="right"></td>
<td>
<textarea style="visibility:hidden;position:absolute;to p:-20;left:-20;width:1px;height:1px" class="editor" id="hoteditor_holder" name="$context[post_box_name]" >$message</textarea>
<style type="text/css">@import url(richedit/styles/office2007/style.css);</style>
<script language="JavaScript" type="text/javascript" src="richedit/editor.js?version=4.2"></script>
<script language="JavaScript" type="text/javascript">
var getdata =document.getElementById("hoteditor_holder&qu ot;).value;
getdata=getdata.replace(/\[S\]/gi,"[STRIKE]");
getdata=getdata.replace(/\[\/S\]/gi,"[/STRIKE]");
Instantiate("max","editor", getdata , "100%", "300px");
function get_hoteditor_data(){
if (HTML_ON == "no"){
alert ("Please uncheck the HTML checkbox");
return false;
}
else{
setCodeOutput();
var bbcode_output=document.getElementById("hotedi tor_bbcode_ouput_editor").value;//Output to BBCode
document.getElementById("hoteditor_holder&quo t;).value = bbcode_output;
}
}
</script>
</td>
</tr>
HTML_CODE;
}
function template_postbox_old(&$message)