1 | dotclear.viewCommentContent = function(line,action) { |
---|
2 | var action = action || 'toggle'; |
---|
3 | var commentId = $(line).attr('id').substr(1); |
---|
4 | var tr = document.getElementById('ce'+commentId); |
---|
5 | |
---|
6 | if ( !tr && ( action == 'toggle' || action == 'open' ) ) { |
---|
7 | tr = document.createElement('tr'); |
---|
8 | tr.id = 'ce'+commentId; |
---|
9 | var td = document.createElement('td'); |
---|
10 | td.colSpan = 6; |
---|
11 | td.className = 'expand'; |
---|
12 | tr.appendChild(td); |
---|
13 | |
---|
14 | // Get comment content |
---|
15 | $.get('services.php',{f:'getCommentById',id: commentId},function(data) { |
---|
16 | var rsp = $(data).children('rsp')[0]; |
---|
17 | |
---|
18 | if (rsp.attributes[0].value == 'ok') { |
---|
19 | var comment = $(rsp).find('comment_display_content').text(); |
---|
20 | |
---|
21 | if (comment) { |
---|
22 | $(td).append(comment); |
---|
23 | var comment_email = $(rsp).find('comment_email').text(); |
---|
24 | var comment_site = $(rsp).find('comment_site').text(); |
---|
25 | var comment_ip = $(rsp).find('comment_ip').text(); |
---|
26 | var comment_spam_disp = $(rsp).find('comment_spam_disp').text(); |
---|
27 | |
---|
28 | $(td).append('<p><strong>' + dotclear.msg.website + |
---|
29 | '</strong> ' + comment_site + '<br />' + |
---|
30 | '<strong>' + dotclear.msg.email + '</strong> ' + comment_email + '<br />' + |
---|
31 | '<strong>' + dotclear.msg.ip_address + |
---|
32 | '</strong> <a href="comments.php?ip=' + comment_ip + '">' + comment_ip + '</a>' + |
---|
33 | '<br />' + comment_spam_disp + '</p>'); |
---|
34 | } |
---|
35 | } else { |
---|
36 | alert($(rsp).find('message').text()); |
---|
37 | } |
---|
38 | }); |
---|
39 | |
---|
40 | $(line).toggleClass('expand'); |
---|
41 | line.parentNode.insertBefore(tr,line.nextSibling); |
---|
42 | } |
---|
43 | else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) |
---|
44 | { |
---|
45 | $(tr).css('display', 'table-row'); |
---|
46 | $(line).addClass('expand'); |
---|
47 | } |
---|
48 | else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) |
---|
49 | { |
---|
50 | $(tr).css('display', 'none'); |
---|
51 | $(line).removeClass('expand'); |
---|
52 | } |
---|
53 | }; |
---|
54 | |
---|
55 | $(function() { |
---|
56 | $.expandContent({ |
---|
57 | line:$('#form-comments tr:not(.line)'), |
---|
58 | lines:$('#form-comments tr.line'), |
---|
59 | callback:dotclear.viewCommentContent |
---|
60 | }); |
---|
61 | $('.checkboxes-helpers').each(function() { |
---|
62 | dotclear.checkboxesHelpers(this); |
---|
63 | }); |
---|
64 | $('#form-comments td input[type=checkbox]').enableShiftClick(); |
---|
65 | dotclear.commentsActionsHelper(); |
---|
66 | $('form input[type=submit][name=delete_all_spam]').click(function(){ |
---|
67 | return window.confirm(dotclear.msg.confirm_spam_delete); |
---|
68 | }); |
---|
69 | }); |
---|