3 $count = pkgbase_comments_count($base_id, $include_deleted);
8 <?php
if (!isset($comments)): ?
>
9 <?php
$comments = $pinned ?
>
10 <a href
="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title
="<?= __('View all comments' , $count) ?> (<?= $count ?>)"><?
= __('Pinned Comments') ?
></a
>
11 <span
class="arrow"></span
>
13 <a href
="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title
="<?= __('View all comments' , $count) ?> (<?= $count ?>)"><?
= __('Latest Comments') ?
></a
>
14 <span
class="arrow"></span
>
18 <?php
while (list($indx, $row) = each($comments)): ?
>
20 $date_fmtd = gmdate('Y-m-d H:i', $row['CommentTS']);
21 if ($row['UserName']) {
22 $user_fmtd = html_format_username($row['UserName']);
23 $heading = __('%s commented on %s', $user_fmtd, $date_fmtd);
25 $heading = __('Anonymous comment on %s', $date_fmtd);
28 if ($row['EditedTS']) {
29 $date_fmtd = gmdate('Y-m-d H:i', $row['EditedTS']);
30 $heading .= ' <span class="edited">(';
31 if ($row['DelUsersID']) {
32 $user_fmtd = html_format_username($row['DelUserName']);
33 $heading .= __('deleted on %s by %s', $date_fmtd, $user_fmtd);
35 $user_fmtd = html_format_username($row['EditUserName']);
36 $heading .= __('last edited on %s by %s', $date_fmtd, $user_fmtd);
38 $heading .= ')</span>';
41 $row['DelUserName'] = html_format_username($row['DelUserName']);
42 $row['EditUserName'] = html_format_username($row['EditUserName']);
44 <h4 id
="comment-<?= $row['ID'] ?>"<?php
if ($row['DelUsersID']): ?
> class="comment-deleted"<?php
endif; ?
>>
46 <?php
if (!$row['DelUsersID'] && can_delete_comment_array($row)): ?
>
47 <form
class="delete-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
48 <fieldset style
="display:inline;">
49 <input type
="hidden" name
="action" value
="do_DeleteComment" />
50 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
51 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
52 <input type
="image" class="delete-comment" src
="/images/x.min.svg" width
="11" height
="11" alt
="<?= __('Delete comment') ?>" title
="<?= __('Delete comment') ?>" name
="submit" value
="1" />
56 <?php
if (!$row['DelUsersID'] && can_edit_comment_array($row)): ?
>
57 <a href
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name) . 'edit-comment/?comment_id=' . $row['ID'], ENT_QUOTES) ?>" class="edit-comment" title
="<?= __('Edit comment') ?>"><img src
="/images/pencil.min.svg" alt
="<?= __('Edit comment') ?>" width
="11" height
="11"></a
>
60 <?php
if (!$row['DelUsersID'] && !$row['PinnedTS'] && can_pin_comment_array($row) && !(pkgbase_comments_count($base_id, false, true) >= 5)): ?
>
61 <form
class="pin-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
62 <fieldset style
="display:inline;">
63 <input type
="hidden" name
="action" value
="do_PinComment" />
64 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
65 <input type
="hidden" name
="package_base" value
="<?= $base_id ?>" />
66 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
67 <input type
="image" class="pin-comment" src
="/images/pin.min.svg" width
="11" height
="11" alt
="<?= __('Pin comment') ?>" title
="<?= __('Pin comment') ?>" name
="submit" value
="1" />
72 <?php
if (!$row['DelUsersID'] && $row['PinnedTS'] && can_pin_comment_array($row)): ?
>
73 <form
class="pin-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
74 <fieldset style
="display:inline;">
75 <input type
="hidden" name
="action" value
="do_UnpinComment" />
76 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
77 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
78 <input type
="image" class="pin-comment" src
="/images/unpin.min.svg" width
="11" height
="11" alt
="<?= __('Unpin comment') ?>" title
="<?= __('Unpin comment') ?>" name
="submit" value
="1" />
83 <div
class="article-content<?php if ($row['DelUsersID']): ?> comment-deleted<?php endif; ?>">
85 <?
= parse_comment($row['Comments']) ?
>
90 <?php
if ($count > 10 && !isset($_GET['comments']) && !isset($pinned)): ?
>
92 <a href
="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title
="<?= __('View all comments') ?> (<?= $count ?>)"><?
= __('All comments', $count) ?
></a
>
97 $
(document
).ready(function() {
98 $
('.edit-comment').click(function () {
99 var parent_element
= this
.parentElement
,
100 parent_id
= parent_element
.id
,
101 comment_id
= parent_id
.substr(parent_id
.indexOf('-') +
1),
102 edit_form
= $
(parent_element
).next(),
104 add_busy_indicator(_this
);
105 $
.getJSON('<?= get_uri('/rpc
') ?>', {
106 type
: 'get-comment-form',
108 base_id
: <?
= intval($base_id) ?
>,
109 pkgbase_name
: <?
= json_encode($pkgbase_name) ?
>
111 remove_busy_indicator(_this
);
113 edit_form
.html(data
.form
);
114 edit_form
.find('textarea').focus();
122 function add_busy_indicator(sibling
) {
123 sibling
.after('<img src="/images/ajax-loader.gif" class="ajax-loader" width="16" height="11" alt="Busy…" />');
126 function remove_busy_indicator(sibling
) {
127 sibling
.next().remove();