Forum OpenACS Q&A: General Comments from Edit-This-Page Page

Hi, everyone,

I've been silently working on my server for the past couple of weeks. I have appreciated everyone's help with some of the beginning groundwork. You can see the current effort at http://shawnharrison.org, which is a 200 MHz machine in my study, ADSL at 300Kbps. Just a warning that performance isn't too good.

Two questions:
(1) I'm using "Edit-This-Page," and would like to add the comments mechanism to those pages. I see a parameter for "enable General Comments" in the site-map for each Edit-This-Page node. However, this doesn't do the job. Before I start editing the etp-master.tcl, Is there a non-programming way to do it (i.e., through-the-browser configuration)?

(2) It actually makes sense to me to use the Forums package instead of General Comments. The idea is this: A link on the page would connect with a forum thread about that page. If there isn't one yet, a new thread will be started when the link is selected (i.e., the user will get the create new message page) -- ideally, with the subject of the message already filled in with the title of the article. If there is a thread, the link goes to the thread to read it first.

This forum-thread-discussion-of-this-article idea would require that the Forums package have an API that is similar to that of the General Comments package -- a "create_link" proc that would let the ETP template put the right link on the page, given the ID of the page instance (pa.item_id, correct?). It would also be a nice option to be able to list the contents of the thread at the bottom of the page, using a proc similar to the general_comments_get_comments proc.

It doesn't seem that the Forums package has the API to do this. The closest I find is a get_url function, but it requires that the calling function know the object_id of the thread/message, which the ETP page won't know. Or, is there something I'm missing in the Forums API?

Thanks,
Shawn

Collapse
Posted by Sean Harrison on
As it turns out, I went ahead and tinkered with the Edit-This-Page article templates in order to put comments and a comment link at the bottom of the page. I know there's probably a better way to do this than putting Tcl and ADP code into each separate ETP template, but that's the best I can do right now. If anyone wants to add this to their own site, I posted the templates at http://shawnharrison.org/files/etp-article.tgz. The contents of the tarball would just go into the ETP/templates directory.
Collapse
Posted by Yves Goldberg on
Hello Shawn,

I'm trying to add comments to ETP and wanted to have a look at your code.

The above link doesn't work. Is it still possible to get your file?

thanks,
Yves.

Collapse
Posted by Sean Harrison on
Yves,

I apologize for the trouble. I've put the file in that location again.

Regards,
Shawn

Collapse
Posted by Yves Goldberg on
Thanks Shawn. It works fine now.

Yves.

Collapse
Posted by Pavel Boghita on
I have found another way of doing this. It was initially posted by Joel Aufrecht for the notes packages (https://openacs.org/forums/message-view?message_id=82750), but can be easily modified for any package. This is the edit-this-page version:

for tcl:

set comment_add_url "[general_comments_package_url]comment-add?[export_vars {
{ object_id $pa(item_id }
{ object_name $pa(title) }
{ return_url "[ad_conn url]?[ad_conn query]"}
}]"

set comments_html [general_comments_get_comments -print_content_p 1 $pa(item_id)]

the adp should not stay the same whatever the package:

<a href="@comment_add_url@">Add a comment</a>
<p>@comments_html@

Collapse
Posted by Malte Sussdorff on
I assume the *right* way to include this would be to change the default ETP application with the code Paul gave and add a parameter to ETP for enabling / disabling General Comments. Obviously the .adp file would have to be changed to include an <if> tag depending on the status of the parameter. Any volunteers ?
I apologise for bloating this thread but I had to add  this for clarity:

{ object_id $pa(item_id)} note the closing paranthesis after item_id

the adp should 'now' (not 'not') stay the same... etc