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

<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}}});
10
		$(".deleteuser").click(function(){ return confirm("Are you sure you want to delete this user?")});
11 12 13 14 15
        });
</script>

<% displaycommandresults({"createuser", "deleteuser", "editusersettings"}, session) %>

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