Dragonfly CMS v9 ⇒ CPG-BB (forum) ⇒ [mod] Multiquote / QuickQuote for CPG-BB ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum Index Modules & Blocks CPG-BB (forum)

[mod] Multiquote / QuickQuote for CPG-BB Reply to topic


Multiquote / QuickQuote for DragonFly Forums
Author: greenday2k (http://greenday2k.net greenday2k[at]gmail.com)
Versión: 1.0
DragonflyCMS Version: 9.2.1 CVS

The idea and everything else is based on the forum phpBB-3.0 developed by the phpBB Group under the GPL
(opensource).

How It Works?
It only works only when the poster clicks the "Post a Reply" Button, in the topic preview section.
Not in the quick Reply Option.

The Poster needs to click on the "Quote" button wich is next to the "username" (post owner name) located on the
Preview Topic Section (the iframe below the atachments area), then the "clicked message" is added to the "message" textarea.
You can select a few words/phrases/area (mouse selection) from a especific post, and ONLY
the selected text will be quoted.


Notes:

This MOD was tested on Dragon Fly 9.2.1 CVS with firefox 2.11 & IE 6.0


This MOD can be improved, If you do, please share it! =)

Files to edit:
1. /includes/javascript/bbcode.js
2. /themes/default/template/forums/posting_topic_review.html
3. /includes/phpBB/topic_review.php


1. /includes/javascript/bbcode.js

at the end of the file ADD:
/** * Add quote text to message */ function addquote(post_id, username) { // Find the object for the frame framename='preview'; theframe=parent[framename]; var message_name = 'message_' + post_id; var theSelection = ''; var divarea = false; if (theframe.document.all) { divarea = theframe.document.all[message_name]; } else { divarea = theframe.document.getElementById(message_name); } // Get text selection - not only the post content :( if (theframe.window.getSelection) { theSelection = theframe.window.getSelection().toString(); } else if (theframe.document.getSelection) { theSelection = theframe.document.getSelection(); } else if (theframe.document.selection) { theSelection = theframe.document.selection.createRange().text; } if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null) { if (divarea.innerHTML) { theSelection = divarea.innerHTML.replace(/<br>/ig, '\n'); theSelection = theSelection.replace(/<br\/>/ig, '\n'); theSelection = theSelection.replace(/&lt\;/ig, '<'); theSelection = theSelection.replace(/&gt\;/ig, '>'); theSelection = theSelection.replace(/&amp\;/ig, '&'); } else if (document.all) { theSelection = divarea.innerText; } else if (divarea.textContent) { theSelection = divarea.textContent; } else if (divarea.firstChild.nodeValue) { theSelection = divarea.firstChild.nodeValue; } } if (theSelection) { BBCwrite('post', 'message','','\n\n[quote="'+ username +'"]' + theSelection + '[/quote]', true); } return; }

2. /themes/default/template/forums/posting_topic_review.html


Find (about line 10):

<td width="22%" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span></td>

Change to or replace with:
<td style="width:22%" valign="top" class="{postrow.ROW_CLASS}"> <span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b>   <a href="javascript: window.top.addquote({postrow.U_POST_ID},'{postrow.POSTER_NAME}')" title="{postrow.QUOTE} {postrow.POSTER_NAME}" ><img src="{postrow.QUOTE_IMG}" alt="{postrow.QUOTE}" title="{postrow.QUOTE} {postrow.POSTER_NAME}" border="0" /></a> </span></td>

Now Find (about line 20)

<td colspan="2"><span class="postbody">{postrow.MESSAGE}</span>{postrow.ATTACHMENTS}</td>

Change to or replace with:

<td colspan="2"><span class="postbody">{postrow.MESSAGE}</span> <div id="message_{postrow.U_POST_ID}" style="display: none;">{postrow.MESSAGE_MQ}</div> {postrow.ATTACHMENTS}</td>

Find: (about line 36)

<td class="row1"><iframe width="100%" height="300" src="{U_REVIEW_TOPIC}" ></iframe></td>

Change to:
<td class="row1"><iframe width="100%" height="300" src="{U_REVIEW_TOPIC}" id="preview" name="preview"></iframe></td>
3. /includes/phpBB/topic_review.php

Find (about line 137)
$message = $row['post_text'];

Right After ADD:
$message_mq = $row['post_text']; $post_id = $row['post_id'];

Find (about line 560)

'S_POST_MESSAGE' => $post_message,

Right After Add

'MESSAGE_MQ' =>$message_mq, 'U_POST_ID'=>$post_id, 'QUOTE_IMG' => $images['icon_quote'], 'QUOTE' => $lang['Quote'],

Save All your docs and see if is working.

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


I'm guessing this needs updating a bit for the current forums?

I made all the edits, but nothing happens when you click on the quote button in topic review.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


I take it back, if you don't screw up the bbcode.js file it works just fine Smile

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Bookmarked, nice feature!

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


Your bookmark list must be getting pretty long by now nano!

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


I somehow missed this the 1st time around. Tried it now, but although the concept is sound, having to go through the Preview is perhaps too non-intuitive for anyone but power users?

Great as a hack, but if bookmarking for later inclusion, might I suggest a possible alternative implementation?

Multiple quotes is best done today by manual copy-and-paste then applying the Quote button, and repeat. But the tedious part is the insertion of the correct =username.

Could Javascript (not my bag) enable the existing Forum Quote button to notice if text was already selected, pick up the selected text (instead of the entire post) and paste it into the new post, along with the correct username as at present.

Then for multiple quotes, also add similar Javascript to the BBCode Quote button to notice if text was already selected, pick up the selected text and paste it at the end of the current textarea, adding the correct username at the same time?

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


I know Vbulletin has a multi quote button, in each post, seems to work ok.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Now I think about it, should be easy enough to move the button from review into the actual posts as is.

The only bugbear is you would need it working in Quick Reply, which I don't know how to do.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Had the same idea. Digging through the code a bit, it would mean substituting a javascript call for the standard Quote link (which is currently handled entirely in PHP). But that should be achievable totally within the template code.

Simplest solution to Quick Reply issue is possibly to enable full reply in place of Quick Reply. (My users prefer it that way anyway.) Then no need to use any PHP code in Quote, and it avoids having to change greenday2k's code to work with Quick Reply (which wouldn't be possible without at least including nbbcode.php anyway).

Still don't know how to mod the BBCode Quote button for subsequent (ie multi-) quotes though ... But even without that it would provide selected text quoting.

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


Well if it worked with quick reply, you could see what it was adding each time, which is what I would be after.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


No, sorry, what I meant was if you converted Quick Reply into a normal message reply. It was a long time ago, and I was using DF9.2.1CVS plus ForumsPlus, along with reDesign3, but I expect this will give you the general idea.

In viewtopic.php add to the quickreply.html template variables: 'L_BBCODE' => bbcode_table('message', 'post', 1), // lb add bbcodes 'L_SMILIES' => smilies_table('inline', 'message', 'post'),

Then in template quickreply.html:<!-- IF L_BBCODE --> <div class="post_reply"> <h4>{L_QUICK_REPLY}</h4> <div class="bbcode_table" style="float:left;width: 80%;padding-top:25px;">{L_BBCODE}</div> <div class="smilies" style="float:right">{L_SMILIES}</div><textarea name="message" rows="10" cols="70" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);"></textarea> <!-- ELSE --> <h3>{L_QUICK_REPLY}</h3> <textarea name="message" rows="10" cols="70"></textarea> <!-- ENDIF -->

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


If you mean having BB Code Buttons in the Quick Reply box, then yes, we have those on by default.

www.junglewraiths.net/...amp;t=4244

Though oddly only for logged in members apparently, just noticed there is no quick reply if logged out.

NVM, logged out here and that seems to be standard behaviour.

I think the problem here will be clicking the Quote Button takes you to Full Reply anyhow, so then you have to use the review panel to see what you want to quote anyhow.

Preferentially I would like another small "multi-quote" button to the left of the existing Quote button, which would then add the quotes into the quick reply box.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Yep, a quick reply box appearing (or not) is set by Members and Forums settings.

I was thinking of replacing the existing (goes to full reply) Quote button with the one that greenday2k defined. Which I think should work fine with the Quick Reply box (with BBCode buttons). I'd swap it out by just changing the viewtopic.html template (hopefully).

This would (again hopefully) allow user to select text and then hit Quote button as well. (Current behaviour is that Quote button adds whole post which you then have to delete unwanted parts from.)

Should be able to add a 2nd "Multi-Quote" button same way, but I'm not convinced as to the need. Because each replaced Quote button should now work as greenday2k spec'd.

Haven't had chance to try this yet - am in middle of code to allow remote images in coppermine Wink

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


I had a play, managed to add a second "multi-quote" button next to the original quote button, but failed to get it working, so thats it from me for now.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0

All times are UTC


Jump to: