1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

re-add and fix quoting from topic/post review

git-svn-id: file:///svn/phpbb/trunk@4832 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2004-02-15 07:52:33 +00:00
parent 171706a343
commit 7dc62cc5ed
3 changed files with 55 additions and 55 deletions

View File

@ -1472,7 +1472,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'U_POST_ID' => $row['post_id'],
'U_MINI_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&p=" . $row['post_id'] . '#' . $row['post_id'],
'U_QUOTE' => ($quote_status) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : '',
'U_QUOTE' => ($auth->acl_get('f_quote', $forum_id)) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : '',
'S_ROW_COUNT' => $i)
);

View File

@ -102,6 +102,59 @@ 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 addquote(post_id, username) {
var message_name = 'message_' + post_id;
var theSelection = '';
var divarea = false;
if (document.all)
{
eval("divarea = document.all." + message_name + ";");
}
else
{
eval("divarea = document.getElementById('" + message_name + "');");
}
// Get text selection - not only the post content :(
if (window.getSelection)
{
theSelection = window.getSelection().toString();
}
else if (document.getSelection)
{
theSelection = document.getSelection();
}
else if (document.selection)
{
theSelection = document.selection.createRange().text;
}
if (theSelection == '')
{
if (document.all)
{
theSelection = divarea.innerText;
}
else if (divarea.textContent)
{
theSelection = divarea.textContent;
}
else if (divarea.firstChild.nodeValue)
{
theSelection = divarea.firstChild.nodeValue;
}
}
if (theSelection)
{
insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
}
return;
}
function bbstyle(bbnumber) {
donotinsert = false;

View File

@ -1,58 +1,5 @@
<!-- $Id$ -->
<script language="JavaScript" type="text/javascript">
<!--
function insert_quote(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) == ' ' ? text + ' ' : text;
document.forms[form_name].elements[text_name].focus();
} else {
document.forms[form_name].elements[text_name].value += text;
document.forms[form_name].elements[text_name].focus();
}
}
function addquote(post_id, username) {
var message_name = 'message_' + post_id;
var theSelection = '';
// Get text selection - not only the post content :(
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text;
}
else if (window.getSelection)
{
theSelection = window.getSelection();
}
if (theSelection == '')
{
if (document.all)
{
eval("theSelection = document.all." + message_name + ".innerText;");
}
else
{
eval("theSelection = document.getElementById('" + message_name + "').firstChild.nodeValue;");
}
}
if (theSelection != '')
{
insert_quote('[quote="' + username + '"]' + theSelection + '[/quote]');
}
return;
}
//-->
</script>
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th align="center">{L_TOPIC_REVIEW} - {TOPIC_TITLE}</th>
@ -101,7 +48,7 @@ function addquote(post_id, username) {
<tr>
<td valign="top"><table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><div id="message_{topic_review_row.U_POST_ID}" class="postbody">{topic_review_row.MESSAGE}</div></td>
<td><div id="message_{topic_review_row.U_POST_ID}"><div class="postbody">{topic_review_row.MESSAGE}</div></div></td>
</tr>
</table></td>
</tr>