Advertisement:

Author Topic: Partial quoting and "to" button  (Read 46834 times)

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Partial quoting and "to" button
« on: December 10, 2004, 03:16:59 PM »
Would it be possible to quote only a highlited part of the post, like it is done, for instance, here: http://forums.referat.ru/?board=server&action=display&s=0&num=1101201074 [nofollow] (sorry, I only know a russian forum with this feature. The button I am talking about is at the bottom of the user info section of the post, to the right from the button saying ">>имя:").

Well, since I already started the topic, the button saying ">>имя:" is also useful as it pastes a name of the person you are responding to to a quick reply box. Can this be done too?


How to do it!

- in script.js add:
Code: [Select]
function quote_selection()
{
selection = document.getSelection ? document.getSelection() : document.selection.createRange().text;
document.postmodify.message.value += '\n[quote]' + selection + '[/quote]\n';
}

function to_name(char_name)
{
document.postmodify.message.value += '[b][u]2 [color=red]' + char_name + '[/color][/u][/b]: ';
}

- in Display.template.php look for:
Code: [Select]
<a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';add after:
Code: [Select]
echo '
<table><tr><td align="center" border="0">
<img src="', $settings['images_url'], '/author.gif" alt="Author" onclick="to_name(\'', $message['member']['name'], '\')" border="0" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td>
<td align="center" border="0">
<img src="', $settings['images_url'], '/quote1.gif" alt="Quote" onclick="quote_selection()" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td></tr></table> ';


[edit] added how to do it [/edit]
« Last Edit: December 19, 2004, 04:54:16 PM by A.M.A »

Offline Peter Duggan

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,664
  • Gender: Male
    • Peat Stack or Pete's Tack?
Re: Partial quoting and "to" button
« Reply #1 on: December 10, 2004, 05:49:29 PM »
Would it be possible to quote only a highlited part of the post, like it is done, for instance, here: http://forums.referat.ru/?board=server&action=display&s=0&num=1101201074 (sorry, I only know a russian forum with this feature. The button I am talking about is at the bottom of the user info section of the post, to the right from the button saying ">>имя:").

Assuming you already know you can delete what you don't want from the quote, split it into chunks, rearrange it and all that?

Quote
Well, since I already started the topic, the button saying ">>имя:" is also useful as it pastes a name of the person you are responding to to a quick reply box. Can this be done too?

Since neither of those buttons is doing anything for me, it's difficult to give a useful answer.

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #2 on: December 10, 2004, 07:49:58 PM »
Quote
Assuming you already know you can delete what you don't want from the quote, split it into chunks, rearrange it and all that?
Have been using this feature for 3 years and now feel armless without it. It decreases your number of clicks in complicated quoting by 3-4 times. After moving our community to a SMF-powered forum, every single user asked me for it.

Quote
Since neither of those buttons is doing anything for me, it's difficult to give a useful answer.
Strange. Did you check the quick reply box after clicking ">>имя:"? It basically pastes something like 2Peter Duggan: in your quick reply box with one single click. Very convenient.
« Last Edit: December 10, 2004, 07:51:52 PM by Slonarch »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Partial quoting and "to" button
« Reply #3 on: December 10, 2004, 08:14:10 PM »
That's a YaBB forum.  Looks like they've either installed some mod (which wouldn't be that difficult to port to SMF) or custom code.  However, the functionality doesn't seem at all to work with Firefox.

Slonarch, look at Peter Duggan's post.  Do you notice that he quotes you, and it says:
"Quote from: Slonarch on Today at 12:16:59 PM"

I may be reading you wrong, but that's what it sounds like you're asking for.  If you expand the quick reply box, and click "quote", this is what you get ;).  However, it won't just quote that text which you select... that's considerably more complicated.  And definitely browser dependent.

-[Unknown]

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #4 on: December 11, 2004, 09:28:35 AM »
Quote
That's a YaBB forum.  Looks like they've either installed some mod (which wouldn't be that difficult to port to SMF) or custom code.  However, the functionality doesn't seem at all to work with Firefox.
I am afraid they did it by themselves, but if I find a mod, will that help?

Quote
Slonarch, look at Peter Duggan's post.  Do you notice that he quotes you, and it says:
"Quote from: Slonarch on Today at 12:16:59 PM"
I did, but that button I mentioned would do it without quoting. Oftentimes you do not need to quote a person at all.

Quote
I may be reading you wrong, but that's what it sounds like you're asking for.  If you expand the quick reply box, and click "quote", this is what you get .  However, it won't just quote that text which you select... that's considerably more complicated.  And definitely browser dependent.
No, that is not exactly it. Assume you have a large smart post, and I disagree with 10 statements of yours. All I need to do with partial quoting is highlight and "partial quote" these 10 points, it will be done in 20 clicks, and my response will look very nice and structured :) Same result with usual quoting will require me to switch to a "post reply" mode and manually copy/paste the text and put tags around it (unless I get it all wrong :)), which is much harder.
« Last Edit: December 11, 2004, 10:26:02 AM by Slonarch »

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Partial quoting and "to" button
« Reply #5 on: December 12, 2004, 04:59:41 AM »
Hmm... let me see if I got this right. You want an automated way of splitting the post you're quoting into, let's say, it's paragraphs? Pretty much like what you just did with [Unknown]'s post?
Cristián Lávaque http://cristianlavaque.com

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #6 on: December 12, 2004, 07:34:59 AM »
2Anguz:
Yes, but not just paragraphs. Say I want to quote one single word from your post. I just highlight it with my mouse, click the button, and this word will be in my quick reply box within the "quote" tags.

An example of a discussion with the use of patial quoting (quotes are the grey text):
http://forums.ag.ru/?board=brehno&action=display&s=0&num=1094747302&start=25 [nofollow]
« Last Edit: December 12, 2004, 07:46:38 AM by Slonarch »

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Partial quoting and "to" button
« Reply #7 on: December 12, 2004, 07:56:01 AM »
I see, in fact, just see, cause I couldn't read read anything. Can't try it cause seems I need to be logged in to try the partial quote, of course, I have no idea what I tried doing for sure either.

Honestly, if it's just to save a copy/paste and clicking on the quote button once, I don't think it's really needed. :P

Just curious, does it work with any browser or only IE?
Cristián Lávaque http://cristianlavaque.com

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #8 on: December 12, 2004, 08:20:06 AM »
Quote
Honestly, if it's just to save a copy/paste and clicking on the quote button once, I don't think it's really needed. :P
Well, that's a typical thought about any new feature in a design that you are used to :) Since most people do not have experience with it, it is a matter of believing me and other 20 users of my resourse that asked for it after they have been using it for several years. In fact, if this is not done here, I am willing to study PHP for implementing this single feature :)

Quote
Just curious, does it work with any browser or only IE?
AFAIK, in most browsers it does.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Partial quoting and "to" button
« Reply #9 on: December 12, 2004, 08:27:39 AM »
This feature is mainly to do with JavaScript.  I don't believe it can even be done for Safari, but it's possible with other browsers - although some lose selection when you click, so it might have to handle onmousedown only.

PHP isn't really involved in this, actually.

-[Unknown]

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Partial quoting and "to" button
« Reply #10 on: December 12, 2004, 08:39:32 AM »
Quote
Since most people do not have experience with it, it is a matter of believing me and other 20 users of my resourse that asked for it after they have been using it for several years.

I know what you mean.
Cristián Lávaque http://cristianlavaque.com

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #11 on: December 12, 2004, 05:43:37 PM »
I alread found the script, just need to find out, how to paste it into this forum. It would simplify my life if sombedy told me how the variable containing the name of the user is called (in YaBB it is "$userprofile[1]") :)

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: Partial quoting and "to" button
« Reply #12 on: December 12, 2004, 06:40:17 PM »
$user_info['name'] should have it
I'm only a half geek really...

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Partial quoting and "to" button
« Reply #13 on: December 12, 2004, 11:49:32 PM »
Well, of the poster he probably means - which is $message['member']['name'].

-[Unknown]

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #14 on: December 18, 2004, 01:59:43 PM »
Just got a chance to try this yesterday and was not able to paste the code right away :)

That's what I have, it is a code from YaBB:

This goes to Display.template.php under the IM icons:

Code: [Select]
<table><tr><td align="center" border="0">
                <img src="$pic/author.gif" alt="Author" onclick='javascript:to_name("$userprofile[1]")' style='cursor:hand'>
                </td>
                <td align="center" border="0">
                <img src="$pic/quote1.gif" alt="Quote" onclick='javascript:quote_selection()'  style='cursor:hand'></td></tr></table>

I already know that $userprofile[1] should be changed to $user_info['name'], but for some reason even this single line with to_name function screwed up the whole page (I think I do not know how to deal with quotes).

And this goes to a javascript file (script.js ?):

Code: [Select]
function quote_selection() {
selection = (document.getSelection) ? document.getSelection() : document.selection.createRange().text;
document.postmodify.message.value += ' [quote]' + selection + '[/quote] ';
}

function to_name(char_name) {
document.postmodify.message.value += '[b][u]2 [color=Red]' + char_name + '[/color][/u][/b]: ';

Here I need to know what to put instead of document.postmodify.message.value. Should I create an object in the quick response form and be changing it's value?
« Last Edit: December 18, 2004, 02:18:13 PM by Slonarch »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Partial quoting and "to" button
« Reply #15 on: December 19, 2004, 12:25:23 AM »
I suggest:

Code: [Select]
<table><tr><td align="center" border="0">
                <a href="javscript:void(0);" onclick="to_name(\'', $message['member']['name'], '\'); return false;"><img src="', $settings['images_url'], '/author.gif" alt="Author" border="0" /></a>
                </td>
                <td align="center" border="0">
                <img src="', $settings['images_url'], '/quote1.gif" alt="Quote" onclick="quote_selection();" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" /></td></tr></table>
(cusor: hand is not very browser proof, and also onclick doesn't need the javascript: part.)

You can also add this to index.template.php, but assuming you want it in script.js, I suggest:

Code: [Select]
function quote_selection()
{
selection = document.getSelection ? document.getSelection() : document.selection.createRange().text;
document.postmodify.message.value += '\n[quote]' + selection + '[/quote]\n';
}

function to_name(char_name)
{
document.postmodify.message.value += '[b][u]2 [color=red]' + char_name + '[/color][/u][/b]: ';
}

In post and quick reply, it is document.postmodify.message... or should be.

-[Unknown]
« Last Edit: December 20, 2004, 02:17:35 AM by [Unknown] »

Offline Slonarch

  • Semi-Newbie
  • *
  • Posts: 17
Re: Partial quoting and "to" button
« Reply #16 on: December 19, 2004, 01:32:52 PM »
Thank you from me and my community, this was the most important mod I ever installed! However, it did not work exactly the way you wrote it (there were extra quotation marks after quote_selection function and the to_name function did not work at all for some reason), I had do modify it slightly. The only bug I found so far is that Opera does not copy the selected text, but most people on my forum use IE anyway :)

That's what I came up with:

Code: [Select]
echo '
<table><tr><td align="center" border="0">
<img src="', $settings['images_url'], '/author.gif" alt="Author" onclick="to_name(\'', $message['member']['name'], '\')" border="0" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td>
<td align="center" border="0">
<img src="', $settings['images_url'], '/quote1.gif" alt="Quote" onclick="quote_selection()" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td></tr></table> ';
goes to Display.template.php under the line saying
                     
Code: [Select]
<a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';
I left Javascript the way you wrote it.

I urge everybody to try it, it is a VERY convenient feature :)

Offline hfhs72

  • Semi-Newbie
  • *
  • Posts: 19
  • any landing you can walk away from is a good one
    • Henry Ford High School
Re: Partial quoting and "to" button
« Reply #17 on: January 15, 2005, 11:11:14 AM »
Hi Guys,
I've been following this thread with great interest. I'm the webmaster for a new website for our old high school. We've been using the Delphi message forum for the past few years and have over 2000 users. We would like to switch everyone over to our new site and use SMF for our forum. Those of you familiar with Delphi know that it uses profile names in the To and From header which allows users to reply directly to someone. The reply window also provides a drop down box with a dozen or so recent users that you can select if you want to change the Reply To.

Complaints that I've had so far are that SMF's Reply does not put in who the reply message is for.

Example: FROM: John Smith
                TO:      John Doe

The TO: would have a drop down box attached to it, that would allow the replyer to change who the reply message is for. The drop down box would have a list of recent users and an ALL selection.

I'm new to this forum and hope I am explaining myself clearly to you guys who know how SMF works and can add this Mod or actually put it into the code. I would love to see it soon so we can switch to SMF and stop paying those outrages charges that Delphi Charges.

Here are some links to Delphi and our web site it you need to see it.

http://henryfordhighschool.com/smf/index.php [nofollow]

http://forums.delphiforums.com [nofollow]

Regards,

Don


Offline hfhs72

  • Semi-Newbie
  • *
  • Posts: 19
  • any landing you can walk away from is a good one
    • Henry Ford High School
Re: Partial quoting and "to" button
« Reply #18 on: January 15, 2005, 11:20:40 AM »
Sorry Guys,

I see I'm not suppose to put requests in this thread. I'll post this in the Request Topic.

Don

Offline suren

  • Semi-Newbie
  • *
  • Posts: 45
  • Gender: Male
Re: Partial quoting and "to" button
« Reply #19 on: January 17, 2005, 11:17:23 PM »
how do make it so that the two new buttons (author & quote) are placed next to the normal quote button ??