Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
This patch adds support for nodecomment module (it's automatic and will not interfere if nodecomment is not enabled). It also adds javascript (which can be disabled) that will make the quote link simply add the quote directly to the comment if the comment input textarea is on the same page.
The DruBB project requires both quote and nodecomment, and will need this patch in order for quoting to be valuable. I think this patch generally improves the usability of quote.module, so I hope you'll accept it.
Comment | File | Size | Author |
---|---|---|---|
#13 | javascript-and-nodecomment_3.patch | 7.78 KB | tom_o_t |
#11 | javascript-and-nodecomment_2.patch | 7.78 KB | TwoD |
#5 | javascript-and-nodecomment.patch | 7.38 KB | neclimdul |
#3 | javascript-and-nodecomment.patch | 8.2 KB | merlinofchaos |
javascript-and-nodecomment.patch | 6.29 KB | merlinofchaos | |
Comments
Comment #1
MichelleCan I bow down and worship you for a while? LOL! I have been wanting this forever!
Michelle
Comment #2
neclimdulcoolness. think you forgot to include the quote.js file though.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedWhoops. Forgot to fakeadd it. Try this one.
Comment #4
neclimdulOn pages with a lot posts we're creating a lot of duplicate onload code. I wonder if this would be better fit in a settings variable that could be parsed as needed or as a ahah/ajax callback.
I've talked to merlin about using settings and he feels its "six of one, half a dozen of the other" so I'm going to play with putting it in a settings array since I think it will lower the amount of js added to a page.
Comment #5
neclimdulHere's a version that uses the Drupal.settings object.
It also internalizes some of the code using some javascript namespace voodoo.
On a page with 3 replies(4 posts) that where fairly short, the page was just under 1k smaller(911 bytes).
Comment #6
Eidolon NightDownloaded the dev, applied the patch just fine (quote.js is there), but the javascript stuff isn't working.
Comment #7
neclimdulJS Works great for me. Any more information you can give? information from your js error log, browser you used, etc.
Comment #8
Michelle#5 works just fine for me.
Michelle
Comment #9
MichelleI just found a problem with this. It doesn't work with WYSIWYG. I realize that's not a problem for DruBB, which is what this is coming from, but it's a problem in that normal functionality is broken when using a WYSIWYG. Not only does the javascript not work, but then you've lost the old way of it going to a new page with the reply. So the quote button is there but does nothing.
Ideally, this would be made to work with WYSIWYG but I don't have the skills to pull that off. :( If that's not possible, could it be made to detect WYSIWYG and not attempt to use the javascript in that case? Failing all those, I guess it could be set back to RTBC with a note that the javascript option needs to be turned off if you use WYSIWYG but I'm crossing my fingers someone with javascript skills will make it work. :)
Michelle
Comment #10
crea CreditAttribution: crea commentedSubscribing
Comment #11
TwoDI added support for the Wysiwyg module to the patch in #5.
The only changes are the addition of the below code to the insertAtCursor function.
The quote tag is kept intact unless the editor has BBCode output enabled, in which case the original author's name is removed. A possible way to get around that, and also add a nice WYSIWYG touch would be to implement editor plugins which replace the quote tag with a 'rendered' placeholder div, and then back again when the editor is detached. Also note that editors like to wrap text in paragraphs, but that does not seem to be a problem in this case.
The insert method used here is part of the implementation layer of the most common editors like TinyMCE, FCKeditor and CKEditor. It's about to be added for more editors as well and I'm going to push at making it a required method for subsequent releases.
(While writing this I noticed a quirk in the Wysiwyg's 'none' editor (used when another editor is disabled), worked around that using
Drupal.wysiwyg.instances[object.id].field == object.id
.)Comment #12
TwoDDidn't see the status.
Comment #13
tom_o_t CreditAttribution: tom_o_t commentedLines 111 and 143 of this patch (code from merlinofchaos' original patch) were causing problems for me.
and
changed to strict comparison
and
Comparing the two node objects was throwing php error "PHP Fatal error: Nesting level too deep - recursive dependency"
This is a php 5.2 issue.
Comment #14
Einkahumor CreditAttribution: Einkahumor commentedThis patch (#13) seems to be working quite well for me. I have a suggestion though I have no idea on how to implement it:
Make it possible to quote only selected text from the post. That way a user can select (highlight with the mouse) some bit of text from a long post and then click Quote and automatically only use the selected text will be quoted.
I'm no code warrior but I know this can be done, a friend of mine once did this with javascript on a custom built forum. I could ask him to dig up how it was done if anyone's interested in trying to implement it.
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commentedHm. I thought the patch I did actually DID select only highlighted text if it was highlighted.
Comment #16
Einkahumor CreditAttribution: Einkahumor commentedThat did not work in my tests. Tell me if you need more info on my setup.
Edit: I did a little more testing to be sure. This selected test feature does not work on a raw Drupal setup with only Demo, NodeComment, Poormanscron, Quote (patched) and Views enabled. Tested on Safari 4.0.4 and FireFox 3.6 on Mac OS X 10.5.8.
Are you sure this feature has been implemented?
Comment #17
MichelleI just tried it and confirmed that quoting selected text doesn't work for me, either. I didn't even realize it was supposed to so never tried it before. That would be cool to have; I often end up deleting large swaths of what I'm quoting.
Michelle
Comment #18
neclimdulThe original patch did not insert selected text, it inserts text in the cursor location in the text box. This wasn't ever a feature supported by this patch. Do we need to support it to get the patch in or can it be an additional feature request?
Comment #19
Einkahumor CreditAttribution: Einkahumor commentedI also just noticed (because I just enabled it) that this patch doesn't entirely work with wysiwyg. It does insert the quote text into the comment textarea but it doesn't scroll down to the box, which is very confusing because the user doesn't see anything happen. This might be because of different ID's with wysiwyg+tinymce than without.
Does anyone else have this problem?
Comment #20
TwoDI noticed that too now that you pointed it out. When I tested with CKEditor it scrolled down to the beginning of the form, just like it does without an editor, while with most other editors this doesn't seem to happen. I don't think we can control this behavior in Wysiwyg at the moment. Manually triggering a piece of 'scroll to element X'-code after the Drupal.wysiwyg.instances[element X].insert() call would probably take care of it though.
Comment #21
tom_o_t CreditAttribution: tom_o_t commentedG-son/Zen - it would be great to get some feedback on this patch, and what's required to get it committed. It's the last outstanding patch required for the DruBB project (http://drupal.org/project/drubb) so I'd love to do whatever's necessary.
Cheers!
Thomas
Comment #22
tom_o_t CreditAttribution: tom_o_t commentedAny feedback? Any chance of this getting committed?
Comment #23
locomo CreditAttribution: locomo commentedsubscribe
Comment #24
MichelleOk, now that Quote has a new version, I had to re-add this patch. I could have sworn that quoting directly to the textbox on the same page was working but now it's not. So here's where we're at:
* This patch is needed to work with Nodecomment. Even if it's not 100% ready, I'd like to see it committed for that reason and we can work on improving it in separate issues.
* Could someone else confirm whether the quote to same page is working for you? For me, quote is taking it to another page. And, yes, I checked that I have the javascript setting checked.
* I'm no longer using WYSIWYG so can't test that. Is the problem I mentioned in #9 resolved?
* Quoting just the selected text would be awesome but seems like it could be in another issue.
Any other thoughts?
Michelle
Comment #25
0liverg CreditAttribution: 0liverg commentedPatch http://drupal.org/node/496910#comment-1731150 works fine, but unfortunately not for the preview-function.
The behavior is, that clicking preview-button reproduces the original quote and insert it again to the text, each time the preview-button is clicked.
I applied patch http://drupal.org/node/585428 ... but with noch luck :-(
Same behavior occurs ...
Any hints on this ??
THX to merlinofchaos and all others to make "quote" available in node_comments.
It's working in general ... but I need some support in detail, if possible.
Greetings
Oliver
Working with:
Drupal 6.19
Quote 1.1 (patched)
Node Comments 6.x-2.0-beta6
Advanced Forum 6.x-2.0-alpha3
BUEditor 6.x-2.1
Comment #26
zero1eye CreditAttribution: zero1eye commented#13 worked well for me with php 5.2
THANK YOU!
Comment #27
Zen CreditAttribution: Zen commentedGreetings and apologies for the delay in my reply,
I've looked at the patch and while the JavaScript quoting feature is certainly nice to have, accomplishing this by embedding the comment bodies of every comment on the page in the JS is not an efficient solution to say the least.
As for nodecomment, I'd much rather see all the code wrapped in a sub-module or otherwise and keep the changes in Quote as minimal as possible.
-K
Comment #28
MichelleAh, too bad. Since merlinofchaos has moved on, he's not going to rewrite it. Hopefully someone else who knows javascript can pick up this very important patch and run with it.
Michelle
Comment #29
merlinofchaos CreditAttribution: merlinofchaos commentedBut it is necessary, because you need the unfiltered version of the body to quote or you will quote incorrectly. :/
Comment #30
Zen CreditAttribution: Zen commentedAny reason why an AHAH implementation has been discounted?
Also: #264075: Ajax: instant quotes, multiple quotes on a single comment
Comment #31
merlinofchaos CreditAttribution: merlinofchaos commentedahah.js won't really work well in this context. In D7 the framework could do it.
Comment #32
JonoB CreditAttribution: JonoB commentedWould it be possible to get this patch in, so that it works with nodecomments?
Comment #33
dunx CreditAttribution: dunx commented+1
I see Michelle's CouleeRegionOnline doesn't have any quote functionality, so assume this is current a no go and she's just using the BUeditor quote process instead.
Comment #34
MichelleActually, I just forgot to re-apply the patch the last time I updated Quote and haven't gotten to it, yet. The patch works for making it work with Nodecomment. There's just other stuff in the patch that isn't working.
Michelle
Comment #35
Wallack CreditAttribution: Wallack commentedEDIT:
Forgot my previous post.
One problem I have. Ajax quote doesn't work if I use panels and nodecomment view to show the comments instead of normal render.
Comment #36
dunx CreditAttribution: dunx commentedYup, applied the patch at #13 to current version of 6-2a3 ADF and 6-1.2 quote and all works fine once configured.
Remember to turn on quote for your forum and "reply" nodes via the node settings screen and tweak filters so quote is enabled for the relevant filters and arrange the filters (tab on the filter config screen) so quote comes below HTML filter, but above line-break and bbcode filters.
Comment #37
Wallack CreditAttribution: Wallack commentedWell I have now this problem:
I want to completely customize the way I show the page.
I have a panel and I would like to use a customized view but I have a problem. If I use a customized view to show the comments, for example, there's no way to show an ajax working link.
I mean, if I write directly a link with the same syntax as the original links, it won't load the comment content into the reply form with the [quote]...[/quote] that's because if you don't use a view with the view-style set as node it won't build the js statements to load the content into the reply box.
I mean this statements:
"quote-link-node-95": { "author": "MGPBuzo", "body": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum [b]is that it has a more-or-less normal distribution of le[/b]tters, as opposed to using \'Content here, content here\', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for \'l[b]orem ipsum\' will u[/b]ncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).", "textarea": "#edit-body" },
So what I really want si to be able to have the javascript quoting when using a custom view to show the comments. (creating a node-contentype.tpl isn't an option).
Any idea on how to do this ?
Comment #38
Wallack CreditAttribution: Wallack commentedOkay, here is my problem solved. Maybe someone can add it to a module? I don't know how, but when this system I don't really need quote module. Anyways I've integrated it with it, here is my solution:
I use the quote module but I want to put everything by my own in my views. O I have a view to show the original node and a view to show all the comments (with the structure I want).
I add the next link with html format and the class 'quotajax':
http://localhost/node/add/comment/26/103?quote=1#comment-form
Is the same link as the quote system uses. The first number is the main node ID and the second one is the comment node ID (as I use nodecommentes, It WON'T work without nodecomments).
I added the link in a view for each comment shown so I can place it exactly where I want to with full customization via view. What wouldbe nice to be done here, is to add a field to the node type views to be able to add directly a field with the quote link but I don't know how to add fields to the views.
The next part is to add a .js to the theme, going into themename.info:
The next part is to develop the quotajax.js file, very simple:
The function will run after all quotajax class elements and will add to them the onclick behaviour needed to do an ajax call to a php file.
Here is the simple php file:
This is very simple as is the first try to see if it works. It will return the [quote=authorname]commentbody[/quite] format to the .js file wich is going to add it to the comment textarea.
Now with this JS and PHP I'm able to completely customize where I want to show the quote link.
What I would like to do is to add it to a module. Because I would like to have it fully integrated so ... do anyone know how to integrate it into a module and also make that this new module needs nodecomment and views to work? I'd also like to add a field to the views under the node section something like quote link as now there are edit and delete links.
Thanks and regards.
EDIT: as I said at the start of the post, I've integrated it with the quote module just keeping the quotes links as the quote module has it so if JS don't work you will be redirected to the reply page with the quote already in the textarea.
Comment #39
mr.j CreditAttribution: mr.j commentedWallack, I have been using a similar solution for a couple of years now but for whatever reason it has never been added to the module (Zen linked to it in #30) ...
#264075: Ajax: instant quotes, multiple quotes on a single comment
Comment #40
drupalfan2 CreditAttribution: drupalfan2 commentedI do not need javascript working here.
But what we all need is a working version of the quote module using advanced forum, node comments and wysiwyg and the preview function.
How can I apply a patch to get this working?
Comment #41
drupalfan2 CreditAttribution: drupalfan2 commentedThe preview doubles all quotes: problem #25 still exists. How can this be solved?
At the moment there is no working solution for quote with advanced forum + node_comments + preview button used!
(I applyed patch #11).
Comment #42
MichelleThis patch is trying to do several things. Of these, the one thing that does work is making Quote work with Node Comments. Could someone who knows javascript please pull out that part of the patch and make an issue with it so we can get that committed? The rest of it is nice to have but making it work with Node Comments is critical to people who use Node Comments.
Thanks,
Michelle
Comment #43
Zen CreditAttribution: Zen commentedThe JS quote feature is now being handled at #1082332: Multiquote feature and JS support
Comment #44
crea CreditAttribution: crea commentedI'm interested in making it work with Node Comments. I have a site with quote module which I plan to migrate to Node Comments. Do we have a summary of what is left to be done ?
Comment #45
MichelleThe original patch made it work with Node Comments. Unless either module has changed significantly since then, it should still work. I stopped using Quote on my site because I kept forgetting to re-apply the patch and eventually just said heck with it until it got committed. At this rate, I suspect I'll have stopped using Node Comments before the modules work together without patching.
Michelle
Comment #46
crea CreditAttribution: crea commented@Michelle Did you know you can keep your own git repo with core and contrib, so when you update core or any module, all patches apply automatically ? I use that workflow for a long time, it's great.
@Zen The only issue I see reported here is it doesn't work with preview button. Is there anything else that is needed to commit this ? Please note I'm also Node Comments maintainer, and I'm very interested in making this work
Comment #47
MichelleI suppose I could but that's a bit overkill to keep one module patched. :)
Is Node Comments getting some love again? I thought it had been abandoned...
Michelle
Comment #48
crea CreditAttribution: crea commentedIt was never abandoned. It's minimally maintained, though. But that's off-topic here anyway.
Comment #49
MichelleYeah, definitely OT, sorry. I was just surprised to see it getting any attention. After Sony pulled out I thought it was done for.
So..... back to the patch. :)
Michelle
Comment #50
Zen CreditAttribution: Zen commented@crea: Please reroll against Quote 6-2 and nodecomment 6-3 sans all the JS stuff. If there's a D7 branch somewhere, a patch against the quote's D7 branch and then a backport is preferable.
Thank you.
-K
Comment #51
ivnish CreditAttribution: ivnish commentedComment #52
ivnish CreditAttribution: ivnish commentedSorry. D6 branch is unsupported