Forum OpenACS Q&A: Getting comments on ETP pages -

Collapse
Posted by Gilbert Price on
Hello All,

I've been trying to get "general-comments" to work on my ETP pages. I have tried following the instructions on this thread: https://openacs.org/forums/message-view?message_id=33822 , but they don't seem to work for me.

I'm currently using OACS 4.6 on Redhat 7.3 with Postgresql 7.2.3.

Any suggestions?

Thanks,

Collapse
Posted by Dave Bauer on
Gilbert,

Tell us what you did, what you expected to happen when you did it, and what actually happened, including code and log file snippets if they will help us understand what is happening.

Collapse
Posted by Gilbert Price on
Thanks for the quick reply.

Okay, I just did it again, so here is what I've done:

1.  I added etp::get_gc_link to the bottom of edit-this-page/templates/article-content.tcl right below etp::get_page_attributes

2.  I added:

<if @comments_link@ not nil>
@comments@
<p>
@comments_link@
</if>

to the /edit-this-page/templates/article-content.adp

3.  I modified the /edit-this-page/tcl/etp-gc.tcl by overwriting the current code and replacing with:

ad_proc -public get_gc_link { } { } {
        upvar pa pa
        upvar comments comments
        upvar comments_link comments_link
        set item_id $pa(item_id)
        set object_name $pa(title)
        set comments ""
        set comments_link ""

        append comments_link [general_comments_create_link -link_text "Blah Blah Add a comment" -object_name $object_name $item_id [ad_conn url]]
        append comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 $item_id ]
}

4.  I restarted the server.

I expected to see a "Blah Blah Add a comment" link at the bottom of the article pages.

When calling on of my pages I get this error page:

invalid command name "etp::get_gc_link"
    while executing
"etp::get_gc_link"
    ("uplevel" body line 22)
    invoked from within
"uplevel {
          # /packages/edit-this-page/templates/article-index.tcl

-snipped rest of page-

When I remove the etp::get_gc_link from the article-content.tcl without removing any of the other changes to any of the files, I get my article without the comments link as expected.

Thanks for any help you can provide...

Collapse
Posted by Tilmann Singer on
Maybe there's some error in the proc definition? Look in the server log messages after startup, where it sources the files that contains that proc.

Also you did install general-comments and mounted it in the site-map, right? You would then get an empty result instead of an error though, so that doesn't apply.

Collapse
Posted by Gilbert Price on
Thanks for popping in Tilmann,

The logs show no problem with the etp-procs.tcl file:

[05/Jan/2003:13:32:37][25473.1024][-main-] Debug: Loaded packages/download/tcl/download-procs.tcl.
[05/Jan/2003:13:32:37][25473.1024][-main-] Debug: Loading packages/edit-this-page/tcl/etp-procs.tcl...
[05/Jan/2003:13:32:37][25473.1024][-main-] Debug: Loaded packages/edit-this-page/tcl/etp-procs.tcl.
[05/Jan/2003:13:32:37][25473.1024][-main-] Debug: Loading packages/file-storage/tcl/file-storage-procs.tcl...

Should I have put the -

ad_proc -public get_gc_link { } { } {
        upvar pa pa
        upvar comments comments
        upvar comments_link comments_link
        set item_id $pa(item_id)
        set object_name $pa(title)
        set comments ""
        set comments_link ""

        append comments_link [general_comments_create_link -link_text "Blah Blah Add a comment" -object_name $object_name $item_id [ad_conn url]]
        append comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 $item_id ]
}

- code into etp-procs.tcl instead of the etp-gc.tcl or chould I rename etp-gc.tcl to etp-gc-procs.tcl?

Seems the direction we're heading here...

Thanks,

Collapse
Posted by Gilbert Price on
Okay, Okay,

Just fixed it, I renamed etp-gc.tcl to etp-gc-procs.tcl and the comments appear now. Altered them to be centered and changed the Blah Blah think to just "Add a Comment".

All is well, thanks Dave for getting me to retry, taking a closer look and documenting what I did. Thanks Tilmann for getting me on the right track with the -procs.tcl thing.

This has been vexing me for a while, but it hasn't really been needed til now...

THANKS!

Collapse
Posted by Eric Wolfram on
I'm going through all this right now and I keep getting the same error even when I put the following code into etp-gc.tcl, etp-gc-procs.tcl, or etp-procs.tcl

ad_proc -public get_gc_link { } { } {
        upvar pa pa
        upvar comments comments
        upvar comments_link comments_link
        set item_id $pa(item_id)
        set object_name $pa(title)
        set comments ""
        set comments_link ""

        append comments_link [general_comments_create_link -link_text "Blah Blah Add a comment" -object_name $object_name $item_id [ad_conn url]]
        append comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 $item_id ]
}

I get my application when I remove the etp::get_gc_link
from my application tcl page (/templates/reviews) Any thoughts on why the proc isn't loading? I've restarted. I've saved and cvs committed...I"m also kind of new at all this so I might be missing something obvious...

Collapse
Posted by Gilbert Price on
Okay, here's what I did:

*Make sure the "General Comments" package is loaded and mounted.

1.  I added etp::get_gc_link to the bottom of edit-this-page/templates/article-content.tcl right below etp::get_page_attributes

2.  I added:

<if @comments_link@ not nil>
@comments@
<p>
@comments_link@
</if>

to the /edit-this-page/templates/article-content.adp

3.  I modified the /edit-this-page/tcl/etp-gc.tcl by overwriting the current code and replacing with:

ad_proc -public get_gc_link { } { } {
        upvar pa pa
        upvar comments comments
        upvar comments_link comments_link
        set item_id $pa(item_id)
        set object_name $pa(title)
        set comments ""
        set comments_link ""

        append comments_link [general_comments_create_link -link_text "Add a comment" -object_name $object_name $item_id [ad_conn url]]
        append comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 $item_id ]
}

4.  Renamed etp-gc.tcl to etp-gc-procs.tcl and restart the server

This works for me as evidenced at http://www.pcs-sc.com/papers/lamps/rh8install or http://www.pcs-sc.com/papers/hardline/2003-02-07f

Hope this helps...

PS. If this doesn't work for you, I can attach the changed pages in an email to you. Let me know...

Collapse
Posted by Eric Wolfram on
Okay, I got this resolved. Here's what I did. First, I had that code you mention above in both:

etp_gc_procs.tcl
AND
etp_procs.tcl

And I'm unsure if that's what the problem was, because I also went here:

http://dev.openacs.org:8000/cvs/openacs.org-dev/packages/edit-this-page/tcl/etp-gc-procs.tcl?rev=1.1&content-type=text/x-cvsweb-markup

I took that code and pasted it into mine...I made all their stuff in the edit-this-page/tcl directory to be the same as my machine -- presto ... it's magic ... it worked!