weblog-listsources-html.lsp 2.52 KB
Newer Older
Ted Trask's avatar
Ted Trask committed
1
<% local data, viewlibrary, page_info, session = ... 
2
htmlviewfunctions = require("htmlviewfunctions")
3
html = require("acf.html")
Ted Trask's avatar
Ted Trask committed
4 5
%>

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<script type="text/javascript">
	if (typeof jQuery == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
	}
</script>

<script type="text/javascript">
	if (typeof $.tablesorter == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
	}
</script>

<script type="text/javascript">
	$(document).ready(function() {
		$("#sources").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
	});
</script>

24
<% htmlviewfunctions.displaycommandresults({"deletesource", "editsource", "testsource", "createsource", "importlogs"}, session) %>
Ted Trask's avatar
Ted Trask committed
25 26

<h1><%= html.html_escape(data.label) %></h1>
27 28 29 30 31 32 33 34 35
<table id="sources" class="tablesorter"><thead>
	<tr>
		<th>Action</th>
		<th>Name</th>
		<th>Enabled</th>
		<th>Source</th>
		<th>Method</th>
	</tr>		
</thead><tbody>
Ted Trask's avatar
Ted Trask committed
36 37

<% for i,source in ipairs(data.value) do %>
38 39
	<tr>
		<td>
Ted Trask's avatar
Ted Trask committed
40
		<%= html.link{value = "editsource?sourcename=" .. source.sourcename.."&redir="..page_info.orig_action, label="Edit "} %>
41 42
		<%= html.link{value = "deletesource?submit=true&sourcename=" .. source.sourcename, label="Delete "} %>
		<%= html.link{value = "testsource?submit=true&sourcename=" .. source.sourcename, label="Test "} %>
43 44 45 46 47 48
		</td>
		<td><%=  html.html_escape(source.sourcename) %></td>
		<td><%= html.html_escape(tostring(source.enabled)) %></td>
		<td><%= html.html_escape(source.source) %></td>
		<td><%= html.html_escape(source.method) %></td>
	</tr>
Ted Trask's avatar
Ted Trask committed
49
<% end %>
50 51
</tbody>
</table>
Ted Trask's avatar
Ted Trask committed
52 53 54 55 56 57 58 59

<% if data.errtxt then %>
<p class='error'><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value == 0 then %>
<p>No sources found</p>
<% end %>

60

Ted Trask's avatar
Ted Trask committed
61
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/createsource") %>">
62 63
<div class='item'><p class='left'>Create New Source</p>
<div class='right'>
Ted Trask's avatar
Ted Trask committed
64
<input class="hidden" type="hidden"  name="redir"  value="<%= html.html_escape(page_info.orig_action) %>" >
65 66
<input class="submit" type="submit" value="Create">
</div></div><!-- end .item -->
Ted Trask's avatar
Ted Trask committed
67 68 69
</form>

<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/importlogs") %>">
70 71 72 73
<div class='item'><p class='left'>Import Logs</p>
<div class='right'>
<input class="submit" type="submit" name="submit" value="Import">
</div></div><!-- end .item -->
Ted Trask's avatar
Ted Trask committed
74
</form>