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

6 7 8 9 10 11 12 13 14 15 16 17
<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>

18 19 20
<script type="text/javascript">
        $(document).ready(function() {
                $("#list").tablesorter({headers: {0:{sorter: false}}});
21
		$(".deleteuser").click(function(){ return confirm("Are you sure you want to delete this user?")});
22 23 24
        });
</script>

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

Ted Trask's avatar
Ted Trask committed
27
<h1>Users</h1>
28 29 30 31
<DL><TABLE id="list" class="tablesorter"><THEAD>
	<TR style="background:#eee;font-weight:bold;">
		<TH>Action</TH>
		<TH>Extension</TH>
32 33
		<TH>First Name</TH>
		<TH>Last Name</TH>
34 35 36 37 38 39 40 41 42
	</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 %>
43
			<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deleteuser?username="..v.username.."&submit=true", label="Delete ", class="deleteuser"} %>
44 45 46
		<% end %>
		</TD>
                <TD><%= html.html_escape(v.username) %></TD>
47 48
                <TD><%= html.html_escape(v.firstname) %></TD>
                <TD><%= html.html_escape(v.lastname) %></TD>
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
	</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>