vmail-listusers-html.lsp 2.95 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
<script type="text/javascript">
        $(document).ready(function() {
Ted Trask's avatar
Ted Trask committed
20
                $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
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

27 28
<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<% local header_level2 = htmlviewfunctions.incrementheader(header_level) %>
29 30 31 32 33 34 35 36
<table id="list" class="tablesorter"><thead>
	<tr>
		<th>Action</th>
		<th>Extension</th>
		<th>First Name</th>
		<th>Last Name</th>
	</tr>		
</thead><tbody>
37 38
<% local username = cfe({ type="hidden", value="" }) %>
<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
39
<% for k,v in ipairs( view.value ) do %>
40 41
	<tr>
		<td>
42
		<% username.value = v.username %>
43
		<% if viewlibrary.check_permission("editusersettings") then %>
44
			<% htmlviewfunctions.displayitem(cfe({type="link", value={username=username, redir=redir}, label="", option="Edit", action="editusersettings"}), page_info, -1) %>
45 46
		<% end %>
		<% if viewlibrary.check_permission("deleteuser") then %>
47
			<% htmlviewfunctions.displayitem(cfe({type="form", value={username=username}, label="", option="Delete", action="deleteuser", class="deleteuser" }), page_info, -1) %>
48
		<% end %>
49 50 51 52 53
		</td>
                <td><%= html.html_escape(v.username) %></td>
                <td><%= html.html_escape(v.firstname) %></td>
                <td><%= html.html_escape(v.lastname) %></td>
	</tr>
54
<% end %>
55 56
</tbody>
</table>
57 58 59 60 61 62 63 64

<% 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 %>

65 66 67 68 69 70 71 72
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createuser") then %>
<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Create New User", option="Create", action="createuser" }), page_info, header_level2) %>
<% end %>

<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createmanyusers") then %>
<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Create Multiple Users", option="Create", action="createmanyusers" }), page_info, header_level2) %>
<% end %>

73
<% htmlviewfunctions.displaysectionend(header_level) %>