[2526] | 1 | dotclear.viewCommentContent = function(line,action) { |
---|
[2531] | 2 | var action = action || 'toggle'; |
---|
[2566] | 3 | var commentId = $(line).attr('id').substr(1); |
---|
[0] | 4 | var tr = document.getElementById('ce'+commentId); |
---|
[2531] | 5 | |
---|
| 6 | if ( !tr && ( action == 'toggle' || action == 'open' ) ) { |
---|
[0] | 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); |
---|
[2566] | 13 | |
---|
[0] | 14 | // Get comment content |
---|
| 15 | $.get('services.php',{f:'getCommentById',id: commentId},function(data) { |
---|
| 16 | var rsp = $(data).children('rsp')[0]; |
---|
[2566] | 17 | |
---|
[0] | 18 | if (rsp.attributes[0].value == 'ok') { |
---|
| 19 | var comment = $(rsp).find('comment_display_content').text(); |
---|
[2566] | 20 | |
---|
[0] | 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(); |
---|
[2566] | 27 | |
---|
[0] | 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 | }); |
---|
[2566] | 39 | |
---|
[0] | 40 | $(line).toggleClass('expand'); |
---|
| 41 | line.parentNode.insertBefore(tr,line.nextSibling); |
---|
| 42 | } |
---|
[2531] | 43 | else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) |
---|
[0] | 44 | { |
---|
[2531] | 45 | $(tr).css('display', 'table-row'); |
---|
| 46 | $(line).addClass('expand'); |
---|
[0] | 47 | } |
---|
[2531] | 48 | else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) |
---|
[0] | 49 | { |
---|
[2531] | 50 | $(tr).css('display', 'none'); |
---|
| 51 | $(line).removeClass('expand'); |
---|
[0] | 52 | } |
---|
| 53 | }; |
---|
| 54 | |
---|
| 55 | $(function() { |
---|
[2531] | 56 | $.expandContent({ |
---|
| 57 | line:$('#form-comments tr:not(.line)'), |
---|
| 58 | lines:$('#form-comments tr.line'), |
---|
| 59 | callback:dotclear.viewCommentContent |
---|
[0] | 60 | }); |
---|
| 61 | $('.checkboxes-helpers').each(function() { |
---|
[3182] | 62 | dotclear.checkboxesHelpers(this,undefined,'#form-comments td input[type=checkbox]','#form-comments #do-action'); |
---|
[0] | 63 | }); |
---|
| 64 | $('#form-comments td input[type=checkbox]').enableShiftClick(); |
---|
| 65 | dotclear.commentsActionsHelper(); |
---|
[3182] | 66 | dotclear.condSubmit('#form-comments td input[type=checkbox]','#form-comments #do-action'); |
---|
[1049] | 67 | $('form input[type=submit][name=delete_all_spam]').click(function(){ |
---|
| 68 | return window.confirm(dotclear.msg.confirm_spam_delete); |
---|
| 69 | }); |
---|
[0] | 70 | }); |
---|