vmail-listusers-html.lsp 2.26 KB
Newer Older
1
<% local view, viewlibrary, page_info, session = ... 
2
require("htmlviewfunctions")
3
html = require("acf.html")
4 5 6 7 8 9 10
%>

<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
        $(document).ready(function() {
                $("#list").tablesorter({headers: {0:{sorter: false}}});
11
		$(".deleteuser").click(function(){ return confirm("Are you sure you want to delete this user?")});
12 13 14
        });
</script>

15
<% htmlviewfunctions.displaycommandresults({"createuser", "deleteuser", "editusersettings"}, session) %>
16

Ted Trask's avatar
Ted Trask committed
17
<h1>Users</h1>
18 19 20 21
<DL><TABLE id="list" class="tablesorter"><THEAD>
	<TR style="background:#eee;font-weight:bold;">
		<TH>Action</TH>
		<TH>Extension</TH>
22 23
		<TH>First Name</TH>
		<TH>Last Name</TH>
24 25 26 27 28 29 30 31 32
	</TR>		
</THEAD><TBODY>
<% for k,v in ipairs( view.value ) do %>
	<TR>
		<TD>
		<% if viewlibrary.check_permission("editusersettings") then %>
			<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editusersettings?username="..v.username, label="Edit "} %>
		<% end %>
		<% if viewlibrary.check_permission("deleteuser") then %>
33
			<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deleteuser?username="..v.username.."&submit=true", label="Delete ", class="deleteuser"} %>
34 35 36
		<% end %>
		</TD>
                <TD><%= html.html_escape(v.username) %></TD>
37 38
                <TD><%= html.html_escape(v.firstname) %></TD>
                <TD><%= html.html_escape(v.lastname) %></TD>
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
	</TR>
<% end %>
</TBODY>
</TABLE>

<% if view.errtxt then %>
<p class="error"><%= html.html_escape(view.errtxt) %></p>
<% end %>
<% if #view.value == 0 then %>
<p>No users found</p>
<% end %>

<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createuser") then %>
<H2>Create New User</H2>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) %>/createuser" method="POST">
<input class="hidden" type="hidden"  name="redir"  value="<%= html.html_escape(page_info.orig_action) %>" >
<dl><dt></dt><dd><input class="submit" type="submit" value="Create"></dd></dl>
</form>
<% end %>

</DL>