With the new direction, we have put the comments on the way side first to get the stuff running. Attached patches install the comment table just like in the 1.0 release and the JS and the form does much the same thing as 1.0.
Of course, the major difference is here we are doing it via Views. And so it begs the question, should this be a field in Views or should it be a style plugin?
The advantage to doing a style plugin is that you can control the view cleaner. Adjust how the fields are laid on on the screen. And it opens up theming possibilities.
On the other hand, is it really needed? Does it really add anything? Im not so sure.
For displaying see #391740: Need to display comments to activities
| Comment | File | Size | Author |
|---|---|---|---|
| #45 | activity_comments_rules.zip | 1.54 KB | DrakeRemory |
| #44 | activity_comments.module.patch | 471 bytes | DrakeRemory |
| #44 | activity_comments_rules.zip | 1.54 KB | DrakeRemory |
| #43 | activity_comments.zip | 29.91 KB | Scott Reynolds |
| #39 | activity_comments.zip | 30.36 KB | Scott Reynolds |
Comments
Comment #1
sirkitree commentedComment #2
sirkitree commentedPostponed until we make sure that we're actually on the right track here. Let's get a solid framework down first and then start in on these features.
Comment #3
liliplanet commentedIs there perhaps any update on this pls? Have tried the patch, but unfortunately not happening :)
Comment #4
alippai commentedI've a working activty_comments module, I'll post it here, when I finish it - but I have to talk about this with sirkitree.
Comment #5
sirkitree commentedYes there have been many changes to the module since this original patch was made which is why I'm sure it applies no longer. If anyone has updated code that applied to the latest dev that would be most appreciated.
Comment #6
alippai commentedinitial commit, only for review
Comment #7
alippai commentedadded doxygen, next step is the default view code
Comment #8
liliplanet commentedHi alippai,
So excited, thank you. Alippai, installed and added 'Activity comments: Comment text' to the view. What I'm perhaps missing is the css in the activity views, so that users can add a comment?
Look forward to your updates :)
Lilian
Comment #9
alippai commentedadded the default view and @todo comments
Comment #10
alippai commentedLiliplanet: this is still an alpha, or pre-alpha module which will add comment functionality (like on Facebook) to the activity module. I've attached a default view in comment #9, you can try it, but it's completely untested. I've more projects to work on today, so I'm slow now, maybe tomorrow I can work more quickly.
Comment #11
liliplanet commentedLooking forward, thank you Alippai!
Comment #12
alippai commentedbetter and more flexible views integration coming today
Comment #13
alippai commentedSo here is a better solution, it's uncompleted, but sirkitree you can see that I've changed the views integration from style plugins to fields. I don't know how to fix it, maybe we don't need to fix it, but now there is db_query call in pre_render.
This code needs review only by sirkitree or who wants to help with designing the db and the code.
Comment #14
liliplanet commentedHi,
So excited! Testing .. and form shows fine on view. When I add a comment ..
receive following error: "user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 60 = unsupported type for db_type_placeholder' at line 1 query: UPDATE activity SET WHERE 60 = unsupported type for db_type_placeholder in /Users/local/includes/common.inc on line 3436.
This will be a fabulous enhancement, thank you!
Comment #15
alippai commentedmore work, there are now new fields, works only with js enabled
Comment #16
alippai commentedmissed the attachment
Comment #17
Scott Reynolds commentedComments:
1.) remove all JavaScript and use AHAH (http://drupal.org/node/331941 and http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....)
and
2.) theme function for all comments needs to render ALL the comments and those that are below the limit need to be hidden by CSS. Add a simple link to then show All
Write a JS file that uses Drupal.behaviors instead of document.ready(), and attach to show all a click function.
3.) Remove drupal_add_js('jquery.forms') this is added by the expand_ahah process function, no need for it in the handler.
Ok so there is some of the issues I see. Not all code here will work as written, i have written them only here in this textarea not in an IDE. There are other issues as well with things like code style http://drupal.org/coding-standards
But this should get you started again.
Comment #18
Scott Reynolds commentedOk so pretty excited about this. i reworked it and I think i got it setup so it should be easy to extend. I compressed the 3 fields (activity all link, comment form, and the comment listing) into one field. Its a form with a bunch of markup in it. Using form_alters you should be able to move things around pretty easily.
It also works without JS (even the CSS rules handle that case as well).
Uses AHAH for the form submission. Lil bit of JS to handle the Default text (focus, blur events) and the 'show all' link.
What I need help with is getting rid of the damn list styling...
that didn't work. And any other styling, Im pretty blah at CSS.
Heres a screen shot
http://skitch.com/supermanscott/ndcc5/scotts-contrib
Comment #19
Scott Reynolds commentedForgot to add in the additional permission to the form wrapper so anon users for instance couldn't post if they weren't allowed via admin/user/permissions
Comment #20
Scott Reynolds commentedI also like it better without the form label ('#title')
Comment #21
pribeh commentedHey Scott and alippai, great work this. I'm going to try this on a fresh copy of my site but I'm getting the following when trying to post a comment:
Again, I'm going to try this on a fresh install.
Comment #22
Scott Reynolds commentedThat has to do with the AHAH stuff and its pretty strange. It basically is telling us that Drupal.ahah didn't post the form values properly.
Have you used a previous version of this before?
Are you sure the activity_comments.js is the proper one? As the old JS file grab the form button and posted other values that wouldn't match what AHAH posts. And because I didn't change the menu path, it will cause problems. Problems just like this.
Comment #23
pribeh commentedWill check all these things later today. Thanks Scott.
Comment #24
Scott Reynolds commentedOk spent some more time on this today
http://skitch.com/supermanscott/ndi5i/activity-comments
Improvements / Fixes
TODO
Delete comment. Write an menu access callback and leverage that when rendering the link in the 'form'JS cleanupThis is much closer to a finished product. Please take a chance to review.
@sirkitree do we want this to be rolled in with Activity download or would it be nicer as a separate project? drupal.org/project/activity_comments is open.
Also, I looked into auto growing the comment form like Facebook does. Involves a lil more JS but doable. There is a jQuery plugin that might do this ? sortof...
http://plugins.jquery.com/project/autogrow
Really what Facebook does is on focus add rows to the textarea and show the submit button.
Open Questions
Comment #25
Scott Reynolds commentedProbably also need some JS clean up
becomes
Comment #26
alippai commentedI've checked your code, it works perfectly except that it should not load all the comments. We should do that Facebook way, so load the extra comments via ajax.
On a page with 50 activities it means additional ~1-500 comments, which is not a good idea imho. (we need to load, process, transfer them and load them into the dom).
Comment #27
rjbrown99 commentedScott - another option for the facebook-style growing of the box is jQuery Elastic. I have successfully used this on my drupal sites for a similar function. I am using this on my site as a textarea and autogrow is enabled with no ability to turn it off.
I have a question about the intent of this module. Let's take an activity message like this:
"User XYZ commented 'this is a comment' about the node XYZ."
With this module, would an activity comment on that message be related to the activity message itself, or would it be posted as the next comment attached to the node XYZ? I.E. is it a new conversation about the activity message or is it a continuation of the conversation taking place on the node? I could see some value in both approaches, but for my personal use I'd want the conversations to relate back to the node itself.
Thanks in advance.
Comment #28
Scott Reynolds commentedI took my facebook feeds a 'representative' sample of the number of comments on messages. I had a total of 64 comments on 65 Facebook messages for an average of .98 comments per activity.
And thats Facebook. Who here knows of any site doing the same amount of traffic as Facebook? Not so sure its worth the effort.
I guess I would argue I don't want this performance improvement to hold it up. And it does add a level of trouble. It will slow down frontend performance (now its just a class toggle which means Show All is nearly instantaneous). You have to keep track of values and add another menu callback. There is some work there and its non-trivial.
Edit: The mode of the data was 8.
Comment #29
Scott Reynolds commentedThe comment is attached only to the activity message.
Comment #30
pribeh commentedConfirmed. #24 fixed all my problems. Great stuff!
Comment #31
Scott Reynolds commentedAddressed my TODOs from #24
One issue is the delete. It uses the drupal_get_destionation(). Which is fine usually. But if you were to submit a new comment. Then delete that comment, the redirect would be to the JS callback not back to the View.
It is because the drupal_get_destination() for the AHAH callback. The form will have to pass in the current path to the AHAH callback somehow? Not sure on how to achieve just yet.
Comment #32
sirkitree commentedSorry guys, I've been extremely busy with client work and am just now able to spend some time on this, so first of great work! You've really been kicking ass lately Scott!
Secondly - I really think this is large enough to warrant another project. I'm already having trouble keeping up with my current module maintainer-ship responsibilities and another large functionality piece is more than I think I can handle.
That being said, Scott, you've pretty much taken over the 2.x branch (and kudos!) so if you would rather maintain the comment portion within this project as a submodule, I say go for it. I leave it to you as I'm only really able to take a co-maintainer-ship role on the 2.x branch at this point.
I'll try to give this a proper review tomorrow.
Comment #33
Scott Reynolds commentedalippai asked me what was missing for this project so far
Here is my short todo
1.) Delete after you post a comment redirects you to the JSON response page. yuck
2.) Should we toggle expand and collapse instead of a show all. FB doesn't do that, but...
3.) Do we make the comment a textarea with a format? This would allow for WYSIWG as well as the autogrow thingie. Perhaps a textarea is more appropriate its what is used for node comments.
At least for number 3, we need to come up with an answer only because as a Feature request this will surface, so we better have a thought out answer for it.
Comment #34
Scott Reynolds commentedAny thoughts on #33's three points. Would like to commit a patch this weekend
Comment #35
sirkitree commented2) fb actually shows you the original message, how many are in between, and then like the last one or two. I think it is sufficient to simply show them all and leave any toggling up to themers.
3) I do not think it being a textarea with a format is necessary, but a small textarea makes sense. K.I.S.S.
Comment #36
DrakeRemory commentedI just fixed 1.) from #33 with a few lines of javascript. Since this bug only happens when js is enabled it is ok to fix it with js.
I added this at line 231 in activity_comments.module. This just passes the current destination to our settings in js.
drupal_add_js(array('activity_comments' => array('destination' => drupal_get_destination())), 'setting');This was added to activity_comments.js.
Comment #37
sirkitree commentedOther than the small typo in the main comment and not needing that commented alert(); - Looks alright.
Comment #38
Scott Reynolds commentedok change that to this as the above didn't affect the delete link which was the problem. And it prevents it from running on all the comments that have already been processed
still a problem with Views3. we hard code aid
Hopefully, i can improve once more then I will commit
Comment #39
Scott Reynolds commentedI think this is it. Would love a review
Comment #40
sorrow commentedIt seems to be working nicely, I’ve got a comment field in place and they’re updating/submitting fine. Only problem I see is within the view itself, I’ve got “Error: handler for activity > updates doesn't exist!” showing in the Sort criteria and “Missing style plugin” showing for the Style, the latter then disables Fields. In terms of the actual output, it’s emitting a HTML List (it reverts to this because of the missing style?). Additionally, when there’s more than one comment added to an activity it creates duplicates of that activity in the stream (turning on Distinct rectifies that). As initially stated though, it’s definitely functioning ok and not spitting out any errors.
Comment #41
Scott Reynolds commentedAhh right so that default view needs to go. I have forgotten about that.
What you really want to do to create a View is this
http://skitch.com/supermanscott/nek79/edit-view-all-activity-scotts-contrib
Comment #42
Scott Reynolds commentedMeant to note it needs work
Comment #43
Scott Reynolds commentedOk so in order to post comments, you need to use the field as describe in 41 (http://skitch.com/supermanscott/nek79/edit-view-all-activity-scotts-contrib)
But I decided to add a 'feature' that was partically implemented before, create a View of all the comments. So now you can do this:
1.) Create a View just of Activity Comments: http://skitch.com/supermanscott/nexim/views-scotts-contrib
2.) Relate this View to bring in more fields/filters/arguments http://skitch.com/supermanscott/nexic/edit-view-comment-test-scotts-contrib
3.) Add in these fields: http://skitch.com/supermanscott/nexit/edit-view-comment-test-scotts-contrib
I also removed the broken default view that referenced the old style plugin. Fixed a number of bad views handlers (views_handler_(field/filter)_number doesn't exist, its numeric)
We are close. I would like to store the last comment id in the stats table so that it can be pulled in along side the Activity View if you aren't using the comment form handler.
Does all this make sense?
Comment #44
DrakeRemory commentedI added an implementation of drupal_alter in activity_comments_form_submit so other modules can react to the insertion of an activity comment. I also attached a rules event implementation. I'm using it to send out an email to the user who carried out the activity. Maybe someone's interested.
Comment #45
DrakeRemory commentedI mixed up the users in the previous rules module. This one is correct.
Comment #46
pribeh commented#43-5 works extremely well together. I can see DrakeRemory's rules module coming in handy - tested mail/rules implementation and seems to work.
Question for you guys: is it possible to make a (configurable) "comment" link that once clicked would load the comment input field - like on FB? The view would look a lot cleaner if it wasn't initially populated with lots of comment input fields.
You guys rock.
Comment #47
pribeh commentedNever-mind, I figured out the conflict I reported is with FBSS.
Comment #48
pribeh commentedI've been trying to add user pictures to comments via template_preprocess_activity_comments_comment but to no avail. Any help? Thanks.
Comment #49
Bilmar commentedsubscribing
Comment #50
DrakeRemory commentedAfterwards you have a $picture variable in your template file.
Comment #51
pribeh commentedI'm stupid, nevermind.
Comment #52
tsi commentedSubscribing
Comment #53
youkho commentedCan't believe i've missed that now it's gonna be a long night of testings keep up the great work guys
Comment #54
BenK commentedSubscribing....
Comment #55
zuzu83 commentedSubscribing.... and FB comment link fonction #46
Comment #56
Scott Reynolds commentedOk committed a minimal implementation that handles what I think is the 90% case. It provides three fields for an Activity View, one is for posting comments, one is the comment count and the other is the comment timestamp.
The two remaining sub issues:
#683124: Create Activity Comments as a base table
#683130: Rules Integration for posting an Activity Comment
http://drupal.org/cvs?commit=313486
Comment #58
adam_c commentedI appologise if this is glaringly obvious but I cannot seem to get the comments list to hide comments and display the 'show all x comments' link. I have had a look through the code and it looks as though there is a limit of 10 set in the code and after that it starts hiding.
I can make far more then 10 comments and nothing happens. Am i missing something?
Comment #59
Michsk commentedWith the latest dev i'm still having the delete redirect problem. So when i post a comment and delete it i get the above AHAH issue.