News:

Wondering if this will always be free?  See why free is better.

Main Menu

Partial quoting and "to" button

Started by Slonarch, December 10, 2004, 03:16:59 PM

Previous topic - Next topic

Slonarch

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:
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:
<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:
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]

Peter Duggan

Quote from: Slonarch 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 (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?

QuoteWell, 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.

Slonarch

#2
QuoteAssuming 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.

QuoteSince 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.

[Unknown]

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]

Slonarch

#4
QuoteThat'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?

QuoteSlonarch, 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.

QuoteI 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.

Anguz

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

Slonarch

#6
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]

Anguz

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

Slonarch

QuoteHonestly, 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 :)

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

[Unknown]

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]

Anguz

QuoteSince 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

Slonarch

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]") :)

Grudge

I'm only a half geek really...

[Unknown]

Well, of the poster he probably means - which is $message['member']['name'].

-[Unknown]

Slonarch

#14
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:

<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 ?):

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?

[Unknown]

#15
I suggest:

<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:

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]

Slonarch

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:

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
                     <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 :)

hfhs72

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


hfhs72

Sorry Guys,

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

Don

suren

how do make it so that the two new buttons (author & quote) are placed next to the normal quote button ??

Advertisement: