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 $is_deleted = $row['DelTS'];
29 $is_edited = $row['EditedTS'];
30 $is_pinned = $row['PinnedTS'];
32 if ($uid && $is_deleted) {
33 $date_fmtd = gmdate('Y-m-d H:i', $row['DelTS']);
34 $heading .= ' <span class="edited">(';
35 if ($row['DelUserName']) {
36 $user_fmtd = html_format_username($row['DelUserName']);
37 $heading .= __('deleted on %s by %s', $date_fmtd, $user_fmtd);
39 $heading .= __('deleted on %s', $date_fmtd);
41 $heading .= ')</span>';
42 } elseif ($uid && $is_edited) {
43 $date_fmtd = gmdate('Y-m-d H:i', $row['EditedTS']);
44 $heading .= ' <span class="edited">(';
45 if ($row['EditUserName']) {
46 $user_fmtd = html_format_username($row['EditUserName']);
47 $heading .= __('edited on %s by %s', $date_fmtd, $user_fmtd);
49 $heading .= __('edited on %s', $date_fmtd);
51 $heading .= ')</span>';
54 <h4 id
="<?= isset($pinned) ? "pinned
-" : "comment
-" ?><?= $row['ID'] ?>"<?php
if ($is_deleted): ?
> class="comment-deleted"<?php
endif; ?
>>
56 <?php
if ($is_deleted && has_credential(CRED_COMMENT_UNDELETE
)): ?
>
57 <form
class="undelete-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
58 <fieldset style
="display:inline;">
59 <input type
="hidden" name
="action" value
="do_UndeleteComment" />
60 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
61 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
62 <input type
="image" class="undelete-comment" src
="/images/action-undo.min.svg" width
="11" height
="11" alt
="<?= __('Undelete comment') ?>" title
="<?= __('Undelete comment') ?>" name
="submit" value
="1" />
67 <?php
if (!$is_deleted && can_delete_comment_array($row)): ?
>
68 <form
class="delete-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
69 <fieldset style
="display:inline;">
70 <input type
="hidden" name
="action" value
="do_DeleteComment" />
71 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
72 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
73 <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" />
78 <?php
if (!$is_deleted && can_edit_comment_array($row)): ?
>
79 <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
>
82 <?php
if (!$is_deleted && !$is_pinned && can_pin_comment_array($row) && !(pkgbase_comments_count($base_id, false, true) >= 5)): ?
>
83 <form
class="pin-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
84 <fieldset style
="display:inline;">
85 <input type
="hidden" name
="action" value
="do_PinComment" />
86 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
87 <input type
="hidden" name
="package_base" value
="<?= $base_id ?>" />
88 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
89 <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" />
94 <?php
if (!$is_deleted && $is_pinned && can_pin_comment_array($row)): ?
>
95 <form
class="pin-comment-form" method
="post" action
="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
96 <fieldset style
="display:inline;">
97 <input type
="hidden" name
="action" value
="do_UnpinComment" />
98 <input type
="hidden" name
="comment_id" value
="<?= $row['ID'] ?>" />
99 <input type
="hidden" name
="token" value
="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
100 <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" />
105 <div
class="article-content<?php if ($is_deleted): ?> comment-deleted<?php endif; ?>">
107 <?
= parse_comment($row['Comments']) ?
>
112 <?php
if ($count > 10 && !isset($_GET['comments']) && !isset($pinned)): ?
>
114 <a href
="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title
="<?= __('View all comments') ?> (<?= $count ?>)"><?
= __('All comments', $count) ?
></a
>
119 $
(document
).ready(function() {
120 $
('.edit-comment').click(function () {
121 var parent_element
= this
.parentElement
,
122 parent_id
= parent_element
.id
,
123 comment_id
= parent_id
.substr(parent_id
.indexOf('-') +
1),
124 edit_form
= $
(parent_element
).next(),
126 add_busy_indicator(_this
);
127 $
.getJSON('<?= get_uri('/rpc
') ?>', {
128 type
: 'get-comment-form',
130 base_id
: <?
= intval($base_id) ?
>,
131 pkgbase_name
: <?
= json_encode($pkgbase_name) ?
>
133 remove_busy_indicator(_this
);
135 edit_form
.html(data
.form
);
136 edit_form
.find('textarea').focus();
144 function add_busy_indicator(sibling
) {
145 sibling
.after('<img src="/images/ajax-loader.gif" class="ajax-loader" width="16" height="11" alt="Busy…" />');
148 function remove_busy_indicator(sibling
) {
149 sibling
.next().remove();