Fixes highlighting of comments selected for multidelete.
NOTE: Also figured out the mystery about the duplicate function invertSelection, but will take care of that in a seperate commit. Documented it in a comment, though.
This commit is contained in:
@ -112,56 +112,54 @@
|
||||
{if is_array($comments)}
|
||||
<ul id="serendipity_comments_list" class="clearfix plainList zebra_list">
|
||||
{foreach $comments AS $comment}
|
||||
<li class="clearfix {cycle values="odd,even"}"><div class="form_check">
|
||||
<input id="serendipity_multidelete_comment_{$comment.id}" type="checkbox" name="serendipity[delete][{$comment.id}]" value="{$comment.entry_id}" onclick="highlightComment('comment_{$comment.id}', this.checked)" tabindex="{$i}">
|
||||
<li id="comment_{$comment.id}" class="clearfix {cycle values="odd,even"}"><div class="form_check">
|
||||
<input id="serendipity_multidelete_comment_{$comment.id}" class="serendipity_multidelete_comment" type="checkbox" name="serendipity[delete][{$comment.id}]" value="{$comment.entry_id}" data-commentid="comment_{$comment.id}">
|
||||
<label for="serendipity_multidelete_comment_{$comment.id}" class="visuallyhidden">Multiselect this comment</label> {* i18n *}
|
||||
</div>
|
||||
|
||||
<h4 id="c{$comment.id}">{($comment.type == 'NORMAL') ? $CONST.COMMENT : (($comment.type == 'TRACKBACK') ? $CONST.TRACKBACK : $CONST.PINGBACK )} #{$comment.id}, {$CONST.IN_REPLY_TO} <a href="{$comment.entry_url}">{$comment.title|escape}</a> {$CONST.ON} {$comment.timestamp|@formatTime:'%b %e %Y, %H:%M'}</h4>
|
||||
|
||||
<div id="comment_{$comment.id}">
|
||||
<dl class="comment_data clearfix">
|
||||
{* TODO: This should not emit any images *}
|
||||
<dt>{$CONST.AUTHOR}:</dt>
|
||||
<dd>{$comment.author|escape|truncate:30:"…"} {$comment.action_author}</dd>
|
||||
<dt>{$CONST.EMAIL}:</dt>
|
||||
<dd>{if empty($comment.email)}N/A{else}<a href="mailto:{$comment.email|escape}" title="{$comment.email|escape}">{$comment.email|escape|truncate:30:"…"}</a>{if $comment.subscribed == 'true'} <span class="serendipity_subscription_on">({$CONST.ACTIVE_COMMENT_SUBSCRIPTION})</span>{/if}{/if} {$comment.action_email}</dd>
|
||||
<dt>IP:</dt>
|
||||
<dd>{if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {$comment.action_ip}</dd>
|
||||
<dt>URL:</dt>
|
||||
<dd>{if empty($comment.url)}N/A{else}<a class="icon_link" href="{$comment.url|escape}" title="{$comment.url|escape}"><span class="icon-link"></span> {$comment.url|escape|truncate:30:"…"}</a> {/if} {$comment.action_url}</dd>
|
||||
<dt>{$CONST.REFERER}:</dt>
|
||||
<dd>{if empty($comment.referer)}N/A{else}<a href="{$comment.referer|escape}" title="{$comment.referer|escape}">{$comment.referer|escape|truncate:30:"…"}</a>{/if} {$comment.action_referer}</dd>
|
||||
</dl>
|
||||
|
||||
<div id="{$comment.id}_summary" class="comment_summary">{$comment.fullBody|truncate:120:"…"}</div>
|
||||
<dl class="comment_data clearfix">
|
||||
{* TODO: This should not emit any images *}
|
||||
<dt>{$CONST.AUTHOR}:</dt>
|
||||
<dd>{$comment.author|escape|truncate:30:"…"} {$comment.action_author}</dd>
|
||||
<dt>{$CONST.EMAIL}:</dt>
|
||||
<dd>{if empty($comment.email)}N/A{else}<a href="mailto:{$comment.email|escape}" title="{$comment.email|escape}">{$comment.email|escape|truncate:30:"…"}</a>{if $comment.subscribed == 'true'} <span class="serendipity_subscription_on">({$CONST.ACTIVE_COMMENT_SUBSCRIPTION})</span>{/if}{/if} {$comment.action_email}</dd>
|
||||
<dt>IP:</dt>
|
||||
<dd>{if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {$comment.action_ip}</dd>
|
||||
<dt>URL:</dt>
|
||||
<dd>{if empty($comment.url)}N/A{else}<a class="icon_link" href="{$comment.url|escape}" title="{$comment.url|escape}"><span class="icon-link"></span> {$comment.url|escape|truncate:30:"…"}</a> {/if} {$comment.action_url}</dd>
|
||||
<dt>{$CONST.REFERER}:</dt>
|
||||
<dd>{if empty($comment.referer)}N/A{else}<a href="{$comment.referer|escape}" title="{$comment.referer|escape}">{$comment.referer|escape|truncate:30:"…"}</a>{/if} {$comment.action_referer}</dd>
|
||||
</dl>
|
||||
|
||||
<div id="{$comment.id}_full" class="comment_full hidden">{$comment.fullBody}</div>
|
||||
<div id="{$comment.id}_summary" class="comment_summary">{$comment.fullBody|truncate:120:"…"}</div>
|
||||
|
||||
<ul class="plainList clearfix actions">
|
||||
{if ($comment.status == 'pending') || ($comment.status == 'confirm')}
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=approve&serendipity[id]={$comment.id}&{$urltoken}" title="{$CONST.APPROVE}"><span class="icon-lock-open"></span><span class="visuallyhidden">{$CONST.APPROVE}</span></a></li>
|
||||
{/if}
|
||||
{if ($comment.status == 'approved')}
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=pending&serendipity[id]={$comment.id}&{$urltoken}" title="{$CONST.SET_TO_MODERATED}"><span class="icon-lock"></span><span class="visuallyhidden"> {$CONST.SET_TO_MODERATED}</span></a></li>
|
||||
{/if}
|
||||
{if $comment.excerpt}
|
||||
<li><a class="button_link" href="#c{$comment.id}" onclick="FT_toggle({$comment.id}); return false;" title="{$CONST.TOGGLE_ALL}"><span id="{$comment.id}_text">{$CONST.TOGGLE_ALL}</span></a></li>
|
||||
{/if}
|
||||
<li><a class="button_link" href="{$comment.entrylink}" title="{$CONST.VIEW}"><span class="icon-eye"></span><span class="visuallyhidden"> {$CONST.VIEW}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=edit&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&{$urltoken}" title="{$CONST.EDIT}"><span class="icon-edit"></span><span class="visuallyhidden"> {$CONST.EDIT}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=delete&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&{$urltoken}" onclick='return confirm("{($CONST.COMMENT_DELETE_CONFIRM|sprintf:$comment.id:$comment.author)|escape}")' title="{$CONST.DELETE}"><span class="icon-trash"></span><span class="visuallyhidden"> {$CONST.DELETE}</span></a></li>
|
||||
<li><a class="button_link" onclick="cf = window.open(this.href, 'CommentForm', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1'); cf.focus(); return false;" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=reply&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&serendipity[noBanner]=true&serendipity[noSidebar]=true&{$urltoken}" title="{$CONST.REPLY}"><span class="icon-chat"></span><span class="visuallyhidden"> {$CONST.REPLY}</span></a></li>
|
||||
</ul>
|
||||
{$comment.action_more}
|
||||
</div>
|
||||
<div id="{$comment.id}_full" class="comment_full hidden">{$comment.fullBody}</div>
|
||||
|
||||
<ul class="plainList clearfix actions">
|
||||
{if ($comment.status == 'pending') || ($comment.status == 'confirm')}
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=approve&serendipity[id]={$comment.id}&{$urltoken}" title="{$CONST.APPROVE}"><span class="icon-lock-open"></span><span class="visuallyhidden">{$CONST.APPROVE}</span></a></li>
|
||||
{/if}
|
||||
{if ($comment.status == 'approved')}
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=pending&serendipity[id]={$comment.id}&{$urltoken}" title="{$CONST.SET_TO_MODERATED}"><span class="icon-lock"></span><span class="visuallyhidden"> {$CONST.SET_TO_MODERATED}</span></a></li>
|
||||
{/if}
|
||||
{if $comment.excerpt}
|
||||
<li><a class="button_link" href="#c{$comment.id}" onclick="FT_toggle({$comment.id}); return false;" title="{$CONST.TOGGLE_ALL}"><span id="{$comment.id}_text">{$CONST.TOGGLE_ALL}</span></a></li>
|
||||
{/if}
|
||||
<li><a class="button_link" href="{$comment.entrylink}" title="{$CONST.VIEW}"><span class="icon-eye"></span><span class="visuallyhidden"> {$CONST.VIEW}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=edit&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&{$urltoken}" title="{$CONST.EDIT}"><span class="icon-edit"></span><span class="visuallyhidden"> {$CONST.EDIT}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=delete&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&{$urltoken}" onclick='return confirm("{($CONST.COMMENT_DELETE_CONFIRM|sprintf:$comment.id:$comment.author)|escape}")' title="{$CONST.DELETE}"><span class="icon-trash"></span><span class="visuallyhidden"> {$CONST.DELETE}</span></a></li>
|
||||
<li><a class="button_link" onclick="cf = window.open(this.href, 'CommentForm', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1'); cf.focus(); return false;" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=reply&serendipity[id]={$comment.id}&serendipity[entry_id]={$comment.entry_id}&serendipity[noBanner]=true&serendipity[noSidebar]=true&{$urltoken}" title="{$CONST.REPLY}"><span class="icon-chat"></span><span class="visuallyhidden"> {$CONST.REPLY}</span></a></li>
|
||||
</ul>
|
||||
{$comment.action_more}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<div class="multidelete_actions form_buttons">
|
||||
<input name="toggle" type="button" value="{$CONST.INVERT_SELECTIONS}" onclick="invertSelection()">
|
||||
<input class="state_cancel" name="toggle" type="submit" value="{$CONST.DELETE_SELECTED_COMMENTS}" onclick="return confirm('{$CONST.COMMENTS_DELETE_CONFIRM}')" tabindex="{($i+1)}">
|
||||
<input class="state_cancel" name="toggle" type="submit" value="{$CONST.DELETE_SELECTED_COMMENTS}" onclick="return confirm('{$CONST.COMMENTS_DELETE_CONFIRM}')">
|
||||
<input name="serendipity[togglemoderate]" type="submit" value="{$CONST.MODERATE_SELECTED_COMMENTS}">
|
||||
</div>
|
||||
{* TODO: Clone pagination using JS *}
|
||||
|
@ -546,6 +546,10 @@ function invertSelection() {
|
||||
// Somebody needs to figure out why there were two functions of the same name
|
||||
// and which one is supposed to be used or if both should be used in different
|
||||
// contexts. Commented out since I assume that the first one is the proper one …
|
||||
//
|
||||
// … aaaand I was completely wrong. The second one (commented out) works, but it
|
||||
// only inverts the checkboxes. It does not highlight comments. This needs a
|
||||
// rewrite in jQuery anyway.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inverts a selection of checkboxes
|
||||
// NOTE: – also used in serendipity_event_karma
|
||||
@ -562,7 +566,7 @@ function invertSelection() {
|
||||
|
||||
// Purely cosmetic function to highlight/dehighlight a comment by toggling the class comment_selected
|
||||
function highlightComment(id, checkvalue) {
|
||||
$('#'+id).toggleClass('comment_selected');
|
||||
$('#' + id).toggleClass('comment_selected');
|
||||
}
|
||||
|
||||
(function($) {
|
||||
@ -696,6 +700,13 @@ function highlightComment(id, checkvalue) {
|
||||
$('#imagepreview').attr('src', $('#category_icon').val());
|
||||
});
|
||||
|
||||
// Comment selection for multidelete
|
||||
// onclick="highlightComment('comment_{$comment.id}', this.checked)"
|
||||
$('.serendipity_multidelete_comment').click(function(e) {
|
||||
var $el = $(this);
|
||||
highlightComment($el.attr('data-commentid'), $el.attr('checked'));
|
||||
});
|
||||
|
||||
// Add media db upload field
|
||||
var $uploadForm = $('body').has('#uploadform');
|
||||
|
||||
|
@ -1261,6 +1261,10 @@ form > .button_link:first-of-type { margin-top: 0; }
|
||||
#categories .odd,
|
||||
#serendipity_image_folders .odd { background: #eee; }
|
||||
|
||||
.zebra_list .comment_selected {
|
||||
border: 1px solid #b94a48;
|
||||
}
|
||||
|
||||
#entries_list h3,
|
||||
#serendipity_comments_list h4 {
|
||||
font-size: 1em;
|
||||
|
Reference in New Issue
Block a user