mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-08 17:56:52 +02:00
- user avatar, user signature, user attachments
git-svn-id: file:///svn/phpbb/trunk@5365 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -57,6 +57,7 @@ $user->theme['primary']['pagination_sep'] = '';
|
||||
|
||||
// Set custom template for admin area
|
||||
$template->set_custom_template($phpbb_admin_path . 'style', 'admin');
|
||||
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
|
||||
|
||||
// Instantiate new module
|
||||
$module = new p_master();
|
||||
|
@@ -15,7 +15,6 @@
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<!-- IF PAGINATION -->
|
||||
<div class="pagination">
|
||||
<!-- IF PAGINATION -->
|
||||
<a href="javascript:jumpto();" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • <span>{PAGINATION}</span>
|
||||
@@ -23,7 +22,6 @@
|
||||
{S_ON_PAGE}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .log -->
|
||||
<table cellspacing="1">
|
||||
|
@@ -437,6 +437,224 @@
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_AVATAR -->
|
||||
|
||||
<form id="avatar_settings" method="post" action="{U_ACTION}"<!-- IF S_CAN_UPLOAD --> enctype="multipart/form-data"<!-- ENDIF -->>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_ACP_USER_AVATAR}</legend>
|
||||
<dl>
|
||||
<dt><label>{L_CURRENT_IMAGE}:</label><br /><span>{L_AVATAR_EXPLAIN}</span></dt>
|
||||
<dd>{AVATAR_IMAGE}</dd>
|
||||
<dd><input type="checkbox" name="delete" /> <span>{L_DELETE_AVATAR}</span></dd>
|
||||
</dl>
|
||||
<!-- IF not S_IN_AVATAR_GALLERY -->
|
||||
<!-- IF S_CAN_UPLOAD -->
|
||||
<dl>
|
||||
<dt><label for="uploadfile">{L_UPLOAD_AVATAR_FILE}:</label></dt>
|
||||
<dd><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_MAX_FILESIZE}" /><input type="file" id="uploadfile" name="uploadfile" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="uploadurl">{L_UPLOAD_AVATAR_URL}:</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></dt>
|
||||
<dd><input name="uploadurl" type="text" id="uploadurl" value="" /></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<dl>
|
||||
<dt><label for="remotelink">{L_LINK_REMOTE_AVATAR}:</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></dt>
|
||||
<dd><input name="remotelink" type="text" id="remotelink" value="" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="width">{L_LINK_REMOTE_SIZE}:</label><br /><span>{L_LINK_REMOTE_SIZE_EXPLAIN}</span></dt>
|
||||
<dd><input name="width" type="text" id="width" size="3" value="{USER_AVATAR_WIDTH}" /> <span>px X </span> <input type="text" name="height" size="3" value="{USER_AVATAR_HEIGHT}" /> <span>px</span></dd>
|
||||
</dl>
|
||||
<!-- IF S_DISPLAY_GALLERY -->
|
||||
<dl>
|
||||
<dt><label>{L_AVATAR_GALLERY}:</label></dt>
|
||||
<dd><input class="button2" type="submit" name="display_gallery" value="{L_DISPLAY_GALLERY}" /></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<!-- ELSE -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_AVATAR_GALLERY}</legend>
|
||||
<dl>
|
||||
<dt><label for="category">{L_AVATAR_CATEGORY}:</label></dt>
|
||||
<dd><select name="category" id="category">{S_CAT_OPTIONS}</select> <input class="button2" type="submit" value="{L_GO}" name="display_gallery" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<table cellspacing="1">
|
||||
<!-- BEGIN avatar_row -->
|
||||
<tr>
|
||||
<!-- BEGIN avatar_column -->
|
||||
<td class="row1" style="text-align: center;"><img src="{avatar_row.avatar_column.AVATAR_IMAGE}" alt="{avatar_row.avatar_column.AVATAR_NAME}" title="{avatar_row.avatar_column.AVATAR_NAME}" /></td>
|
||||
<!-- END avatar_column -->
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- BEGIN avatar_option_column -->
|
||||
<td class="row2" style="text-align: center;"><input type="radio" name="avatar_select" value="{avatar_row.avatar_option_column.S_OPTIONS_AVATAR}" /></td>
|
||||
<!-- END avatar_option_column -->
|
||||
</tr>
|
||||
<!-- END avatar_row -->
|
||||
</table>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="quick" style="margin-top: -15px;">
|
||||
<input class="button2" type="submit" name="cancel" value="{L_CANCEL}" />
|
||||
</fieldset>
|
||||
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="quick">
|
||||
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_SIGNATURE -->
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
var form_name = 'user_signature';
|
||||
var text_name = 'signature';
|
||||
|
||||
// Define the bbCode tags
|
||||
bbcode = new Array();
|
||||
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
|
||||
imageTag = false;
|
||||
|
||||
// Helpline messages
|
||||
b_help = "{L_BBCODE_B_HELP}";
|
||||
i_help = "{L_BBCODE_I_HELP}";
|
||||
u_help = "{L_BBCODE_U_HELP}";
|
||||
q_help = "{L_BBCODE_Q_HELP}";
|
||||
c_help = "{L_BBCODE_C_HELP}";
|
||||
l_help = "{L_BBCODE_L_HELP}";
|
||||
o_help = "{L_BBCODE_O_HELP}";
|
||||
p_help = "{L_BBCODE_P_HELP}";
|
||||
w_help = "{L_BBCODE_W_HELP}";
|
||||
a_help = "{L_BBCODE_A_HELP}";
|
||||
s_help = "{L_BBCODE_S_HELP}";
|
||||
f_help = "{L_BBCODE_F_HELP}";
|
||||
e_help = "{L_BBCODE_E_HELP}";
|
||||
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript" src="{T_TEMPLATE_PATH}/editor.js"></script>
|
||||
|
||||
<form id="user_signature" method="post" action="{U_ACTION}">
|
||||
|
||||
<!-- IF SIGNATURE_PREVIEW -->
|
||||
<fieldset>
|
||||
<legend>{L_ADMIN_SIG_PREVIEW}</legend>
|
||||
<p>{SIGNATURE_PREVIEW}</p>
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_SIGNATURE}</legend>
|
||||
<p>{L_SIGNATURE_EXPLAIN}</p>
|
||||
<div id="format-buttons">
|
||||
<input class="button2" type="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" onmouseover="helpline('b')" />
|
||||
<input class="button2" type="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" onmouseover="helpline('i')" />
|
||||
<input class="button2" type="button" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" onmouseover="helpline('u')" />
|
||||
<input class="button2" type="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" />
|
||||
<input class="button2" type="button" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" />
|
||||
<input class="button2" type="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" />
|
||||
<input class="button2" type="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" />
|
||||
<input class="button2" type="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" />
|
||||
<input class="button2" type="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" onmouseover="helpline('w')" />
|
||||
{L_FONT_SIZE}: <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" onmouseover="helpline('f')">
|
||||
<option value="7">{L_FONT_TINY}</option>
|
||||
<option value="9">{L_FONT_SMALL}</option>
|
||||
<option value="12" selected="selected">{L_FONT_NORMAL}</option>
|
||||
<option value="18">{L_FONT_LARGE}</option>
|
||||
<option value="24">{L_FONT_HUGE}</option>
|
||||
</select>
|
||||
<a href="javascript:bbstyle(-1)" onmouseover="helpline('a')">{L_CLOSE_TAGS}</a>
|
||||
</div>
|
||||
<p><input type="text" name="helpbox" value="{L_STYLES_TIP}" class="full" style="border: 0; background: none;" /></p>
|
||||
<dl>
|
||||
<dt style="width: 110px;"><script type="text/javascript"><!--
|
||||
colorPalette('v', 17, 5);
|
||||
//--></script>
|
||||
</dt>
|
||||
<dd style="text-align: left; margin-left: 110px;"><textarea name="signature" rows="10" cols="60" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{SIGNATURE}</textarea></dd>
|
||||
<dd style="text-align: left; margin-left: 110px;">
|
||||
<!-- IF S_HTML_ALLOWED --><input type="checkbox" name="disable_html"{S_HTML_CHECKED} /> {L_DISABLE_HTML} <!-- ENDIF -->
|
||||
<!-- IF S_BBCODE_ALLOWED --><input type="checkbox" name="disable_bbcode"{S_BBCODE_CHECKED} /> {L_DISABLE_BBCODE} <!-- ENDIF -->
|
||||
<!-- IF S_SMILIES_ALLOWED --><input type="checkbox" name="disable_smilies"{S_SMILIES_CHECKED} /> {L_DISABLE_SMILIES} <!-- ENDIF -->
|
||||
<input type="checkbox" name="disable_magic_url"{S_MAGIC_URL_CHECKED} /> {L_DISABLE_MAGIC_URL}
|
||||
<br /><br /><strong>{L_OPTIONS}: </strong>{HTML_STATUS} :: {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {SMILIES_STATUS}
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="quick">
|
||||
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="submit" name="preview" value="{L_PREVIEW}" />
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_ATTACHMENTS -->
|
||||
|
||||
<form id="user_attachments" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset class="quick" style="float: left;">
|
||||
{L_SORT_BY}: <select name="sk">{S_SORT_KEY}</select> <select name="sd">{S_SORT_DIR}</select>
|
||||
<input class="button2" type="submit" value="{L_GO}" name="sort" />
|
||||
</fieldset>
|
||||
|
||||
<div class="pagination" style="float: right;">
|
||||
<!-- IF PAGINATION -->
|
||||
<a href="javascript:jumpto();" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • <span>{PAGINATION}</span>
|
||||
<!-- ELSE -->
|
||||
{S_ON_PAGE}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<!-- IF .attach -->
|
||||
<table cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_FILENAME}</th>
|
||||
<th>{L_POST_TIME}</th>
|
||||
<th>{L_FILESIZE}</th>
|
||||
<th>{L_DOWNLOADS}</th>
|
||||
<th>{L_DELETE}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN attach -->
|
||||
<!-- IF attach.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td><a href="{attach.U_DOWNLOAD}">{attach.REAL_FILENAME}</a><br /><span class="small"><!-- IF attach.S_IN_MESSAGE --><b>{L_PM}: </b><!-- ELSE --><b>{L_TOPIC}: </b><!-- ENDIF --><a href="{attach.U_VIEW_TOPIC}">{attach.TOPIC_TITLE}</a></span></td>
|
||||
<td>{attach.POST_TIME}</td>
|
||||
<td>{attach.SIZE}</td>
|
||||
<td>{attach.DOWNLOAD_COUNT}</td>
|
||||
<td><input type="checkbox" name="mark[]" value="{attach.ATTACH_ID}" /></td>
|
||||
</tr>
|
||||
<!-- END attach -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ELSE -->
|
||||
<div class="errorbox">
|
||||
<p>{L_NO_ENTRIES}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<fieldset class="quick">
|
||||
<b class="small"><a href="#" onclick="marklist('user_attachments', true);">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('user_attachments', false);">{L_UNMARK_ALL}</a></b><br />
|
||||
<input class="button2" type="submit" name="delmarked" value="{L_DELETE_MARKED}" />
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
@@ -352,6 +352,25 @@ td {
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
table.type2 {
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
table.type2 th {
|
||||
background: none;
|
||||
border-top: none;
|
||||
text-align: center;
|
||||
color: #FFA34F;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
table.type2 td {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* General form styles
|
||||
----------------------------------------*/
|
||||
fieldset {
|
||||
@@ -778,6 +797,17 @@ a.button2, a.button2:link, a.button2:visited, a.button2:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Format Buttons for signature editor
|
||||
*/
|
||||
#format-buttons {
|
||||
margin: 15px 0 2px 0;
|
||||
}
|
||||
|
||||
#format-buttons input, #format-buttons select {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Nice method for clearing floated blocks without having to insert any extra markup
|
||||
From http://www.positioniseverything.net/easyclearing.html */
|
||||
.clearfix:after, #tabs:after, .row:after, #content:after, fieldset dl:after, #page-body:after {
|
||||
|
306
phpBB/adm/style/editor.js
Normal file
306
phpBB/adm/style/editor.js
Normal file
@@ -0,0 +1,306 @@
|
||||
// bbCode control by subBlue design [ www.subBlue.com ]
|
||||
// Includes unixsafe colour palette selector by SHS`
|
||||
|
||||
// Startup variables
|
||||
var imageTag = false;
|
||||
var theSelection = false;
|
||||
|
||||
// Check for Browser & Platform for PC & IE specific bits
|
||||
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
|
||||
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
|
||||
var clientVer = parseInt(navigator.appVersion); // Get browser version
|
||||
|
||||
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
|
||||
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
|
||||
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
|
||||
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
|
||||
|
||||
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
|
||||
var is_mac = (clientPC.indexOf("mac")!=-1);
|
||||
|
||||
// Shows the help messages in the helpline window
|
||||
function helpline(help) {
|
||||
document.forms[form_name].helpbox.value = eval(help + "_help");
|
||||
}
|
||||
|
||||
// Replacement for arrayname.length property
|
||||
function getarraysize(thearray) {
|
||||
for (i = 0; i < thearray.length; i++) {
|
||||
if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
|
||||
return i;
|
||||
}
|
||||
return thearray.length;
|
||||
}
|
||||
|
||||
// Replacement for arrayname.push(value) not implemented in IE until version 5.5
|
||||
// Appends element to the array
|
||||
function arraypush(thearray,value) {
|
||||
thearray[ getarraysize(thearray) ] = value;
|
||||
}
|
||||
|
||||
// Replacement for arrayname.pop() not implemented in IE until version 5.5
|
||||
// Removes and returns the last element of an array
|
||||
function arraypop(thearray) {
|
||||
thearraysize = getarraysize(thearray);
|
||||
retval = thearray[thearraysize - 1];
|
||||
delete thearray[thearraysize - 1];
|
||||
return retval;
|
||||
}
|
||||
|
||||
function smiley(text) {
|
||||
text = ' ' + text + ' ';
|
||||
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
|
||||
var caretPos = document.forms[form_name].elements[text_name].caretPos;
|
||||
|
||||
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
} else {
|
||||
var selStart = document.forms[form_name].elements[text_name].selectionStart;
|
||||
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
|
||||
|
||||
mozWrap(document.forms[form_name].elements[text_name], text, '')
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
document.forms[form_name].elements[text_name].selectionStart = selStart + text.length;
|
||||
document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length;
|
||||
}
|
||||
}
|
||||
|
||||
function bbfontstyle(bbopen, bbclose) {
|
||||
if ((clientVer >= 4) && is_ie && is_win) {
|
||||
theSelection = document.selection.createRange().text;
|
||||
if (!theSelection) {
|
||||
insert_text(bbopen + bbclose);
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
return;
|
||||
}
|
||||
document.selection.createRange().text = bbopen + theSelection + bbclose;
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
return;
|
||||
} else {
|
||||
insert_text(bbopen + bbclose);
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
return;
|
||||
}
|
||||
storeCaret(document.forms[form_name].elements[text_name]);
|
||||
}
|
||||
|
||||
function insert_text(text) {
|
||||
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
|
||||
var caretPos = document.forms[form_name].elements[text_name].caretPos;
|
||||
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
|
||||
} else {
|
||||
var selStart = document.forms[form_name].elements[text_name].selectionStart;
|
||||
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
|
||||
|
||||
mozWrap(document.forms[form_name].elements[text_name], text, '')
|
||||
document.forms[form_name].elements[text_name].selectionStart = selStart + text.length;
|
||||
document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length;
|
||||
}
|
||||
}
|
||||
|
||||
function attach_inline() {
|
||||
insert_text('[attachment=' + document.forms[form_name].elements['attachments'].value + ']' + document.forms[form_name].elements['attachments'].options[document.forms[form_name].elements['attachments'].selectedIndex].text + '[/attachment]');
|
||||
}
|
||||
|
||||
function bbstyle(bbnumber) {
|
||||
|
||||
donotinsert = false;
|
||||
theSelection = false;
|
||||
bblast = 0;
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
|
||||
if (bbnumber == -1) { // Close all open tags & default button names
|
||||
while (bbcode[0]) {
|
||||
butnumber = arraypop(bbcode) - 1;
|
||||
document.forms[form_name].elements[text_name].value += bbtags[butnumber + 1];
|
||||
buttext = eval('document.forms[form_name].addbbcode' + butnumber + '.value');
|
||||
if (buttext != "[*]")
|
||||
{
|
||||
eval('document.forms[form_name].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
|
||||
}
|
||||
}
|
||||
document.forms[form_name].addbbcode10.value = "List";
|
||||
bbtags[10] = "[list]";
|
||||
document.forms[form_name].addbbcode12.value = "List=";
|
||||
bbtags[12] = "[list=]";
|
||||
imageTag = false; // All tags are closed including image tags :D
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((clientVer >= 4) && is_ie && is_win)
|
||||
{
|
||||
theSelection = document.selection.createRange().text; // Get text selection
|
||||
if (theSelection) {
|
||||
// Add tags around selection
|
||||
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
theSelection = '';
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
|
||||
{
|
||||
mozWrap(document.forms[form_name].elements[text_name], bbtags[bbnumber], bbtags[bbnumber+1]);
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
theSelection = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// Find last occurance of an open tag the same as the one just clicked
|
||||
for (i = 0; i < bbcode.length; i++) {
|
||||
if (bbcode[i] == bbnumber+1) {
|
||||
bblast = i;
|
||||
donotinsert = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bbnumber == 10) && (bbtags[10] != "[*]"))
|
||||
{
|
||||
if (donotinsert)
|
||||
{
|
||||
document.forms[form_name].addbbcode12.value = "List=";
|
||||
tmp_help = o_help;
|
||||
o_help = e_help;
|
||||
e_help = tmp_help;
|
||||
bbtags[12] = "[list=]";
|
||||
}
|
||||
else
|
||||
{
|
||||
document.forms[form_name].addbbcode12.value = "[*]";
|
||||
tmp_help = o_help;
|
||||
o_help = e_help;
|
||||
e_help = tmp_help;
|
||||
bbtags[12] = "[*]";
|
||||
}
|
||||
}
|
||||
|
||||
if ((bbnumber == 12) && (bbtags[12] != "[*]"))
|
||||
{
|
||||
if (donotinsert)
|
||||
{
|
||||
document.forms[form_name].addbbcode10.value = "List";
|
||||
tmp_help = l_help;
|
||||
l_help = e_help;
|
||||
e_help = tmp_help;
|
||||
bbtags[10] = "[list]";
|
||||
}
|
||||
else
|
||||
{
|
||||
document.forms[form_name].addbbcode10.value = "[*]";
|
||||
tmp_help = l_help;
|
||||
l_help = e_help;
|
||||
e_help = tmp_help;
|
||||
bbtags[10] = "[*]";
|
||||
}
|
||||
}
|
||||
|
||||
if (donotinsert) { // Close all open tags up to the one just clicked & default button names
|
||||
while (bbcode[bblast]) {
|
||||
butnumber = arraypop(bbcode) - 1;
|
||||
if (bbtags[butnumber] != "[*]")
|
||||
{
|
||||
insert_text(bbtags[butnumber + 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
insert_text(bbtags[butnumber]);
|
||||
}
|
||||
buttext = eval('document.forms[form_name].addbbcode' + butnumber + '.value');
|
||||
if (bbtags[butnumber] != "[*]")
|
||||
{
|
||||
eval('document.forms[form_name].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
|
||||
}
|
||||
imageTag = false;
|
||||
}
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
return;
|
||||
} else { // Open tags
|
||||
|
||||
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
|
||||
insert_text(bbtags[15]);
|
||||
|
||||
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
|
||||
document.forms[form_name].addbbcode14.value = "Img"; // Return button back to normal state
|
||||
imageTag = false;
|
||||
}
|
||||
|
||||
// Open tag
|
||||
insert_text(bbtags[bbnumber]);
|
||||
|
||||
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
|
||||
if (bbtags[bbnumber] != "[*]")
|
||||
{
|
||||
arraypush(bbcode,bbnumber+1);
|
||||
eval('document.forms[form_name].addbbcode'+bbnumber+'.value += "*"');
|
||||
}
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
return;
|
||||
}
|
||||
|
||||
storeCaret(document.forms[form_name].elements[text_name]);
|
||||
}
|
||||
|
||||
// From http://www.massless.org/mozedit/
|
||||
function mozWrap(txtarea, open, close)
|
||||
{
|
||||
var selLength = txtarea.textLength;
|
||||
var selStart = txtarea.selectionStart;
|
||||
var selEnd = txtarea.selectionEnd;
|
||||
if (selEnd == 1 || selEnd == 2)
|
||||
selEnd = selLength;
|
||||
|
||||
var s1 = (txtarea.value).substring(0,selStart);
|
||||
var s2 = (txtarea.value).substring(selStart, selEnd)
|
||||
var s3 = (txtarea.value).substring(selEnd, selLength);
|
||||
txtarea.value = s1 + open + s2 + close + s3;
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert at Claret position. Code from
|
||||
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
|
||||
function storeCaret(textEl) {
|
||||
if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); }
|
||||
}
|
||||
|
||||
function colorPalette(dir, width, height)
|
||||
{
|
||||
var r = 0, g = 0, b = 0;
|
||||
var numberList = new Array(6);
|
||||
numberList[0] = "00";
|
||||
numberList[1] = "40";
|
||||
numberList[2] = "80";
|
||||
numberList[3] = "BF";
|
||||
numberList[4] = "FF";
|
||||
document.writeln('<table class="type2">');
|
||||
for(r = 0; r < 5; r++)
|
||||
{
|
||||
if (dir == 'h')
|
||||
{
|
||||
document.writeln('<tr>');
|
||||
}
|
||||
for(g = 0; g < 5; g++)
|
||||
{
|
||||
if (dir == 'v')
|
||||
{
|
||||
document.writeln('<tr>');
|
||||
}
|
||||
for(b = 0; b < 5; b++)
|
||||
{
|
||||
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
|
||||
document.write('<td bgcolor="#' + color + '">');
|
||||
document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');" onmouseover="helpline(\'s\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
|
||||
document.writeln('</td>');
|
||||
}
|
||||
if (dir == 'v')
|
||||
{
|
||||
document.writeln('</tr>');
|
||||
}
|
||||
}
|
||||
if (dir == 'h')
|
||||
{
|
||||
document.writeln('</tr>');
|
||||
}
|
||||
}
|
||||
document.writeln('</table>');
|
||||
}
|
Reference in New Issue
Block a user