summary refs log tree commit diff stats
path: root/theme/admin/drafts.tpl
blob: e798fd9daeeaf3ee2ebc0eb8830b6f259c17ec1a (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
<h2>Manage Drafts</h2>

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

<script type="text/javascript">
function deletePost(id)
{
	if (confirm("Are you sure you would like to delete this draft?"))
	{
		postwith("/admin/drafts.php?pageID=<!--PAGEID-->&action=delete",{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() == "delete")
		{
			if (confirm("Are you sure you would like to delete the selected drafts?"))
			{
				postwith("/admin/drafts.php?pageID=<!--PAGEID-->&action=deletes",{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-->
<form action="javascript:alert('Not yet implemented');" method="get">
	<div id="manage-options">
		<div id="manage-bulk">
			<select name="bulk-type">
				<option value="delete">Delete</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>Post Name</td>
			<td>Author</td>
			<td colspan="3">Actions</td>
		</tr>
		<!--BEGIN POST-->
		<tr<!--POST.ODD-->>
			<td class="table-checkbox"><input class="the-check" type="checkbox" name="bulk" value="<!--POST.ID-->" /></td>
			<td><!--POST.TITLE--></td>
			<td class="table-author"><!--POST.AUTHOR--></td>
			<td class="table-img"><a href="/admin/editPost.php?type=drafts&amp;id=<!--POST.ID-->"><img src="/theme/images/icons/page_edit.png" alt="Edit" /></a></td>
			<td class="table-img"><a href="#" onclick="deletePost(<!--POST.ID-->);"><img src="/theme/images/icons/page_delete.png" alt="Delete" /></a></td>
			<td class="table-img"><a href="/viewPost.php?type=drafts&amp;id=<!--POST.ID-->"><img src="/theme/images/icons/page_go.png" alt="View" /></a></td>
		</tr>
		<!--END POST-->
	</table>

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