diff options
Diffstat (limited to 'openssh-listauth-html.lsp')
-rw-r--r-- | openssh-listauth-html.lsp | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/openssh-listauth-html.lsp b/openssh-listauth-html.lsp index de89648..8d8ebad 100644 --- a/openssh-listauth-html.lsp +++ b/openssh-listauth-html.lsp @@ -2,31 +2,49 @@ <% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> +<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() { + $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']}); + }); +</script> + <% htmlviewfunctions.displaycommandresults({"deleteauth"}, session) %> <% htmlviewfunctions.displaycommandresults({"addauth"}, session, true) %> -<H1>Authorized Keys for <%= html.html_escape(view.value.user.value) %></H1> -<DL><TABLE> - <TR style="background:#eee;font-weight:bold;"> - <TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Action</TD> - <TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">ID</TD> - <TD style="white-space:nowrap;text-align:left;" class="header">Key</TD> - </TR> +<h1>Authorized Keys for <%= html.html_escape(view.value.user.value) %></h1> +<table id="list" class="tablesorter"><thead> + <tr> + <th>Action</th> + <th>ID</th> + <th>Key</th> + </tr> +</thead><tbody> <% for i,auth in ipairs(view.value.auth.value) do %> - <TR> - <TD style="padding-right:20px;white-space:nowrap;"> -<form action="<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller.."/deleteauth") %>" method="POST"> + <tr> + <td> +<form action="<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller.."/deleteauth") %>" method="post"> <input class="hidden" type="hidden" name="user" value="<%= html.html_escape(view.value.user.value) %>"> <input class="hidden" type="hidden" name="auth" value="<%= html.html_escape(auth.id) %>"> -<input class="submit" type="submit" name="submit" value="Delete"></DD> +<input class="submit" type="submit" name="submit" value="Delete"> </form> - </TD> - <TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(auth.id) %></TD> - <TD style="white-space:nowrap;"><% if #auth.key>32 then io.write(html.html_escape(string.sub(auth.key,0,16)) .. " ... " .. html.html_escape(string.sub(auth.key, -16))) else io.write(html.html_escape(auth.key)) end %></TD> - </TR> + </td> + <td><%= html.html_escape(auth.id) %></td> + <td><% if #auth.key>32 then io.write(html.html_escape(string.sub(auth.key,0,16)) .. " ... " .. html.html_escape(string.sub(auth.key, -16))) else io.write(html.html_escape(auth.key)) end %></td> + </tr> <% end %> -</TABLE> +</tbody></table> <p>In order to preserve keys with lbu, you must add /<% if view.value.user.value ~= "root" then io.write("home/") end %><%= view.value.user.value %>/.ssh/authorized_keys to lbu include -</DL> <% viewlibrary.dispatch_component("addauth", {user=view.value.user.value}) %> |