diff options
-rw-r--r-- | openssh-connectedpeers-html.lsp | 54 | ||||
-rw-r--r-- | openssh-listauth-html.lsp | 52 | ||||
-rw-r--r-- | openssh-listusers-html.lsp | 10 |
3 files changed, 67 insertions, 49 deletions
diff --git a/openssh-connectedpeers-html.lsp b/openssh-connectedpeers-html.lsp index aa8b1fa..9740e72 100644 --- a/openssh-connectedpeers-html.lsp +++ b/openssh-connectedpeers-html.lsp @@ -2,47 +2,47 @@ html = require("acf.html") %> -<H1>Connected peers</H1> +<h1>Connected peers</h1> <% if #data == 0 then - io.write("No peers found\n") + io.write("<p>No peers found</p>\n") end local col1="180px" for k,v in pairs(data) do - io.write("<H3>" .. html.html_escape(v.host)) + io.write("<h3>" .. html.html_escape(v.host)) if v.name and v.name ~= v.host then io.write(" - "..html.html_escape(v.name)) end - io.write("</H3>\n") - io.write("<DL><TABLE>") + io.write("</h3>\n") + io.write("<table>") for i=1, v.cnt do - io.write("<TR>") + io.write("<tr>") if (v.tty[i]) then - io.write("<TD WIDTH='20px' STYLE='padding-left:20px;vertical-align:top;'><IMG SRC='".. html.html_escape(page_info.wwwprefix..page_info.staticdir) .. "/tango/16x16/apps/utilities-terminal.png' HEIGHT='16' WIDTH='16'></TD>") - io.write("<TD STYLE='padding-bottom:10px'>\n") - io.write("<TABLE>") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session user:</TD><TD>".. html.html_escape(v.tty[i].user) .. "</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session TTY:</TD><TD>".. html.html_escape(v.tty[i].tty) .. "</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session Started:</TD><TD>".. html.html_escape(v.tty[i].time) .. "</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session Idle:</TD><TD>".. html.html_escape(v.tty[i].idle) .. "</TD></TR>\n") + io.write("<td width='20px' style='padding-left:20px;vertical-align:top;'><img src='".. html.html_escape(page_info.wwwprefix..page_info.staticdir) .. "/tango/16x16/apps/utilities-terminal.png' height='16' width='16'></td>") + io.write("<td style='padding-bottom:10px'>\n") + io.write("<table>") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session user:</td><td>".. html.html_escape(v.tty[i].user) .. "</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session TTY:</td><td>".. html.html_escape(v.tty[i].tty) .. "</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Started:</td><td>".. html.html_escape(v.tty[i].time) .. "</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Idle:</td><td>".. html.html_escape(v.tty[i].idle) .. "</td></tr>\n") - io.write("</TABLE>") - io.write("</TD>\n") + io.write("</table>") + io.write("</td>\n") else - io.write("<TD WIDTH='20px' STYLE='padding-left:20px;vertical-align:top;'><IMG SRC='".. html.html_escape(page_info.wwwprefix..page_info.staticdir) .. "/tango/16x16/emblems/emblem-unreadable.png' HEIGHT='16' WIDTH='16'></TD>") - io.write("<TD STYLE='padding-bottom:10px'>\n") - io.write("<TABLE>") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session user:</TD><TD>No records</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session TTY:</TD><TD>No records</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session Started:</TD><TD>No records</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Session Idle:</TD><TD>No records</TD></TR>\n") - io.write("<TR><TD WIDTH='"..col1.."' STYLE='font-weight:bold;'>Other:</TD><TD>This could be a sshfs session</TD></TR>\n") + io.write("<td width='20px' style='padding-left:20px;vertical-align:top;'><img src='".. html.html_escape(page_info.wwwprefix..page_info.staticdir) .. "/tango/16x16/emblems/emblem-unreadable.png' height='16' width='16'></td>") + io.write("<td style='padding-bottom:10px'>\n") + io.write("<table>") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session user:</td><td>No records</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session TTY:</td><td>No records</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Started:</td><td>No records</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Idle:</td><td>No records</td></tr>\n") + io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Other:</td><td>This could be a sshfs session</td></tr>\n") - io.write("</TABLE>") - io.write("</TD>\n") + io.write("</table>") + io.write("</td>\n") end - io.write("</TR>") + io.write("</tr>") end - io.write("</TABLE></DL>") + io.write("</table>") end %> 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}) %> diff --git a/openssh-listusers-html.lsp b/openssh-listusers-html.lsp index 23b14a3..69c80e0 100644 --- a/openssh-listusers-html.lsp +++ b/openssh-listusers-html.lsp @@ -1,10 +1,10 @@ <% local view, viewlibrary, page_info, session = ... %> <% html = require("acf.html") %> -<H1>System User Accounts</H1> -<DL> +<h1>System User Accounts</h1> <% for i,user in ipairs(view.value) do %> - <DT><IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/apps/system-users.png' HEIGHT='16' WIDTH='16'> <%= html.html_escape(user) %></DT> - <DD><A HREF='listauth?user=<%= html.html_escape(user) %>'>Edit this account</A></DD> + <div class='item'><div class='left'><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/apps/system-users.png' height='16' width='16'> <%= html.html_escape(user) %></div> + <div class='right'> + <a href='listauth?user=<%= html.html_escape(user) %>'>Edit this account</a> + </div></div><!-- end .item --> <% end %> -</DL> |