summary refs log tree commit diff stats
path: root/theme/admin/comments.tpl
blob: 6d9f815b53d0524e3c107e01ad6d5c7c719beff2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<h2>Moderate Comments</h2>

<div class="clear"></div>

<script type="text/javascript">
function denyComment(id)
{
	if (confirm("Are you sure you would like to deny this comment?"))
	{
		postwith("/admin/comments.php?pageID=<!--PAGEID-->&amp;action=deny",{id:id});
	}
}

function approveComment(id)
{
	postwith("/admin/comments.php?pageID=<!--PAGEID-->&amp;action=approve",{id:id});
}

// following function taken from http://mentaljetsam.wordpress.com/2008/06/02/using-javascript-to-post-data-between-pages/
function postwith (to,p) {
  var myForm = document.createElement("form");
  myForm.method="post" ;
  myForm.action = to ;
  for (var k in p) {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
}

function bulkAction()
{
	var bulk=new Array();
	$(".the-check:checked").each(function() {
		bulk.push($(this).val());
	});
	var ids = bulk.join(",")

	if (ids != "")
	{
		if ($('#manage-bulk select').val() == "deny")
		{
			if (confirm("Are you sure you would like to deny the selected comments?"))
			{
				postwith("/admin/comments.php?pageID=<!--PAGEID-->&amp;action=denys",{ids:ids});
			}
		} else if ($('#manage-bulk select').val() == "approve")
		{
			if (confirm("Are you sure you would like to approve the selected comments?"))
			{
				postwith("/admin/comments.php?pageID=<!--PAGEID-->&amp;action=approves",{ids:ids});
			}
		}
	}	
}

$(document).ready(function() {
	$("input#all-check").click(function() {
		var what = this.checked;
		$("input.the-check").each(function() {
			this.checked = what;
		});
	});
});
</script>

<!--BEGIN AVAIL-->
<div id="manage-options">
	<div id="manage-bulk">
		<select name="bulk-type">
			<option value="approve">Approve</option>
			<option value="deny">Deny</option>
		</select>

		<button id="bulk" type="button" onclick="bulkAction()">Bulk</button>
	</div>
</div>

<div class="manage-pagination"><!--PAGINATION--></div>

<table>
	<tr class="table-header">
		<td class="table-checkbox"><input type="checkbox" id="all-check" /></td>
		<td>Comment</td>
		<td>Author</td>
		<td colspan="2">Actions</td>
	</tr>
	<!--BEGIN COMMENT-->
	<tr<!--COMMENT.ODD-->>
		<td class="table-checkbox"><input class="the-check" type="checkbox" name="bulk" value="<!--COMMENT.ID-->" /></td>
		<td style="line-height: 1.5em;"><!--COMMENT.TEXT--></td>
		<td class="table-author"><!--COMMENT.AUTHOR--></td>
		<td class="table-img"><a href="#" onclick="approveComment(<!--COMMENT.ID-->)"><img src="/theme/images/icons/thumb_up.png" alt="Approve" /></a></td>
		<td class="table-img"><a href="#" onclick="denyComment(<!--COMMENT.ID-->)"><img src="/theme/images/icons/thumb_down.png" alt="Delete" /></a></td>
	</tr>
	<!--END COMMENT-->
</table>

<div class="manage-pagination"><!--PAGINATION--></div>
<!--END AVAIL-->
<!--BEGIN NOTAVAIL-->
<div class="manage-pagination">There are no comments to moderate.</div>
<!--END NOTAVAIL-->