5 /page/comments.mas - a mason component to provide page comments
9 Adds the user page comment feature to a web page. Users can peruse the comments, logged-in users can provide comments.
11 Only show for entities that have completely numeric identifiers.
13 Note: this code depends on the sgn.js script, which should be included in every SGN page.
21 The type of object being commented on.
25 The identifier of the object being commented on.
29 The page uri which displays these page comments.
35 Lukas Mueller <lam87@cornell.edu> - based on previous SGN Perl code.
47 <& /util/import_javascript.mas, classes=>[ 'CXGN.Page.Comments', 'MochiKit.Async' ] &>
53 use CXGN::Page::FormattingHelpers qw / info_section_html / ;
55 if ($object_id!~/^\d+$/) { return; }
58 # object_type would be something like "marker" or "bac"
59 # object_id would be the marker_id or the clone_id
61 my $placeholder = info_section_html(
62 title=>"User comments",
63 contents=>qq{<!-- check for comments only shows up when AJAX is not enabled
64 (old browsers, buggy ajax) -->
65 Please wait, checking for comments. (If comments do not show up, access them <a href="/forum/return_comments.pl?type=$object_type&id=$object_id">here</a>)}
68 my $encoded_referer = $urlencode{ $referer || '' };
75 <span class="noshow" id="referer"><% $encoded_referer %></span>
76 <span class="noshow" id="commentstype"><% $object_type %></span>
77 <span class="noshow" id="commentsid"><% $object_id %></span>
78 <div id="commentsarea">