##
##
## Mod title: ATSI(Auto Tag&Smilies Insert)
##
## Mod version: 0.1
## Works on PunBB: 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4
## Release date: 2004-03-06
## Author: ximx
##
## Description: This mod help to automaticaly insert Tag&Smilies in messages
##
## Affected files: post.php
## viewtopic.php
##
## Affects DB: No
##
##
## DISCLAIMER: Please note that "mods" are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
##
#
#---------[ 1. OPEN ]---------------------------------------------------------
#
viewtopic.php
#
#---------[ 2. FIND (line 454) ]----------------------------------------------
#
<a href="help.php#bbcode" target="_blank"><?php echo $lang_common['BBCode'] ?></a>:
<?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?> <br>
<a href="help.php#img" target="_blank"><?php echo $lang_common['img tag'] ?></a>:
<?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?> <br>
<a href="help.php#smilies" target="_blank"><?php echo $lang_common['Smilies'] ?></a>:
<?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>
#
#---------[ 3. REPLACE WITH ]---------------------------------------------------
#
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%">
<tr>
<td width="100%">
<p align="center">
<a href="javascript:insertTag ( 'req_message', 'B', true )"><b>Bold</b></a>
<a href="javascript:insertTag ( 'req_message', 'I', true )"><i>Italic</i></a>
<a href="javascript:insertTag ( 'req_message', 'quote', true )">quotes</a>
<a href="javascript:insertTag ( 'req_message', 'img', true )">images</a>
</td>
</p>
</tr>
</table>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%">
<tr>
<td width="100%"><p align="center">
<a href="javascript:insertTag ( 'req_message', ' :) ', false )">
<img border="0" src="img/smilies/smile.png" alt=" :) "></a>
<a href="javascript:insertTag ( 'req_message', ' :D ', false )">
<img border="0" src="img/smilies/big_smile.png" alt=" :D " width="15" height="15"></a>
<a href="javascript:insertTag ( 'req_message', ' ;) ', false )">
<img border="0" src="img/smilies/wink.png" width="15" height="15" alt=" ;) "></a>
<a href="javascript:insertTag ( 'req_message', ' :( ', false )">
<img border="0" src="img/smilies/sad.png" alt=" :( " width="15" height="15"></a>
<a href="javascript:insertTag ( 'req_message', ' :x ', false )">
<img border="0" src="img/smilies/mad.png" width="15" height="15" alt=" :x "></a>
<a href="javascript:insertTag ( 'req_message', ' :rolleyes: ', false )">
<img border="0" src="img/smilies/roll.png" width="16" height="16" alt=" :rolleyes: "></a></p>
</td>
</tr>
</table>
#
#---------[ 4. FIND (line 491) ]----------------------------------------------
#
<textarea name="req_message" rows="7" cols="80"></textarea>
#
#---------[ 5. REPLACE WITH ]-------------------------------------------------
#
<script language=javascript>
<!--
function markSelection ( txtObj ) {
if ( txtObj.createTextRange ) {
txtObj.caretPos = document.selection.createRange().duplicate();
isSelected = true;
}
}
function insertTag ( txtName, tag, enclose ) {
var closeTag = tag;
if ( enclose ) {
var attribSplit = tag.indexOf ( ' ' );
if ( tag.indexOf ( ' ' ) > -1 )
closeTag = tag.substring ( 0, attribSplit );
}
if ( isSelected ) {
var txtObj = eval ( "document.forms[0]." + txtName );
if (txtObj.createTextRange && txtObj.caretPos) {
var caretPos = txtObj.caretPos;
caretPos.text = ( ( enclose ) ? "["+tag+"]"+caretPos.text+"[/"+closeTag+"]" : ""+tag+""+caretPos.text );
markSelection ( txtObj );
if ( txtObj.caretPos.text=='' ) {
isSelected=false;
txtObj.focus();
}
}
} else {
}
}
//-->
</script> <textarea name="req_message" rows="7" cols="80" ONCLICK="markSelection(this);" ONSELECT="markSelection(this);"></textarea>
#
#---------[ 6. SAVE/UPLOAD ]--------------------------------------------------
#
#
#---------[ 7. OPEN ]---------------------------------------------------------
#
post.php
#
#---------[ 8. FIND (line 467) ]----------------------------------------------
#
<a href="help.php#bbcode" target="_blank"><?php echo $lang_common['BBCode'] ?></a>:
<?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?> <br>
<a href="help.php#img" target="_blank"><?php echo $lang_common['img tag'] ?></a>:
<?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?> <br>
<a href="help.php#smilies" target="_blank"><?php echo $lang_common['Smilies'] ?></a>:
<?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>
#
#---------[ 9. REPLACE WITH ]---------------------------------------------------
#
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%">
<tr>
<td width="100%">
<p align="center">
<a href="javascript:insertTag ( 'req_message', 'B', true )"><b>Bold</b></a>
<a href="javascript:insertTag ( 'req_message', 'I', true )"><i>Italic</i></a>
<a href="javascript:insertTag ( 'req_message', 'quote', true )">quotes</a>
<a href="javascript:insertTag ( 'req_message', 'img', true )">images</a>
</td>
</p>
</tr>
</table>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%">
<tr>
<td width="100%"><p align="center">
<a href="javascript:insertTag ( 'req_message', ' :) ', false )">
<img border="0" src="img/smilies/smile.png" alt=" :) "></a>
<a href="javascript:insertTag ( 'req_message', ' :D ', false )">
<img border="0" src="img/smilies/big_smile.png" alt=" :D " width="15" height="15"></a>
<a href="javascript:insertTag ( 'req_message', ' ;) ', false )">
<img border="0" src="img/smilies/wink.png" width="15" height="15" alt=" ;) "></a>
<a href="javascript:insertTag ( 'req_message', ' :( ', false )">
<img border="0" src="img/smilies/sad.png" alt=" :( " width="15" height="15"></a>
<a href="javascript:insertTag ( 'req_message', ' :x ', false )">
<img border="0" src="img/smilies/mad.png" width="15" height="15" alt=" :x "></a>
<a href="javascript:insertTag ( 'req_message', ' :rolleyes: ', false )">
<img border="0" src="img/smilies/roll.png" width="16" height="16" alt=" :rolleyes: "></a></p>
</td>
</tr>
</table>
#
#---------[ 10. FIND (line 503) ]----------------------------------------------
#
<textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo $quote ?></textarea>
#
#---------[ 11. REPLACE WITH ]-------------------------------------------------
#
<script language=javascript>
<!--
function markSelection ( txtObj ) {
if ( txtObj.createTextRange ) {
txtObj.caretPos = document.selection.createRange().duplicate();
isSelected = true;
}
}
function insertTag ( txtName, tag, enclose ) {
var closeTag = tag;
if ( enclose ) {
var attribSplit = tag.indexOf ( ' ' );
if ( tag.indexOf ( ' ' ) > -1 )
closeTag = tag.substring ( 0, attribSplit );
}
if ( isSelected ) {
var txtObj = eval ( "document.forms[0]." + txtName );
if (txtObj.createTextRange && txtObj.caretPos) {
var caretPos = txtObj.caretPos;
caretPos.text = ( ( enclose ) ? "["+tag+"]"+caretPos.text+"[/"+closeTag+"]" : ""+tag+""+caretPos.text );
markSelection ( txtObj );
if ( txtObj.caretPos.text=='' ) {
isSelected=false;
txtObj.focus();
}
}
} else {
}
}
//-->
</script>
<textarea name="req_message" id="req_message" rows="20" cols="95" tabindex="<?php print $cur_index++ ?>" onkeyup="livepre(this);" ONCLICK="markSelection(this);" ONSELECT="markSelection(this);">
<?php print $quote ?></textarea>
#
#---------[ 12. SAVE/UPLOAD ]--------------------------------------------------