diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-04-12 04:08:02 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-04-12 04:08:02 +0000 |
commit | eb046ff591c5abe9f2cd1f493ab8756d0abf61cf (patch) | |
tree | 4ab164ef446c989131b087d9db258b409b150402 | |
parent | 0d87bb5527f504012fa877a988f1a3e7591ba584 (diff) | |
download | acf-openssh-eb046ff591c5abe9f2cd1f493ab8756d0abf61cf.tar.bz2 acf-openssh-eb046ff591c5abe9f2cd1f493ab8756d0abf61cf.tar.xz |
Changes to use new htmlviewfunctions functions and change connectedpeers to return cfe
-rw-r--r-- | openssh-config-html.lsp | 2 | ||||
-rw-r--r-- | openssh-connectedpeers-html.lsp | 19 | ||||
-rw-r--r-- | openssh-listauth-html.lsp | 12 | ||||
-rw-r--r-- | openssh-listusers-html.lsp | 13 | ||||
-rw-r--r-- | openssh-model.lua | 6 | ||||
-rw-r--r-- | openssh-welcome-html.lsp | 2 |
6 files changed, 30 insertions, 24 deletions
diff --git a/openssh-config-html.lsp b/openssh-config-html.lsp index 2da497b..34e58b4 100644 --- a/openssh-config-html.lsp +++ b/openssh-config-html.lsp @@ -7,4 +7,4 @@ html = require("acf.html") viewlibrary.dispatch_component("status") end %> -<% htmlviewfunctions.displayitem(form, 1, page_info) %> +<% htmlviewfunctions.displayitem(form, page_info) %> diff --git a/openssh-connectedpeers-html.lsp b/openssh-connectedpeers-html.lsp index 9740e72..363d726 100644 --- a/openssh-connectedpeers-html.lsp +++ b/openssh-connectedpeers-html.lsp @@ -1,17 +1,19 @@ -<% local data, viewlibrary, page_info = ... +<% local data, viewlibrary, page_info, session = ... +htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> -<h1>Connected peers</h1> +<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> +<% local header_level2 = htmlviewfunctions.incrementheader(header_level) %> <% -if #data == 0 then +if #data.value == 0 then 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)) - if v.name and v.name ~= v.host then io.write(" - "..html.html_escape(v.name)) end - io.write("</h3>\n") +for k,v in pairs(data.value) do + local label = v.host + if v.name and v.name ~= v.host then label = label.." - "..html.html_escape(v.name) end + htmlviewfunctions.displaysectionstart(cfe({label=label}), page_info, header_level2) io.write("<table>") for i=1, v.cnt do io.write("<tr>") @@ -43,6 +45,7 @@ for k,v in pairs(data) do io.write("</tr>") end io.write("</table>") + htmlviewfunctions.displaysectionend(header_level2) end %> - +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/openssh-listauth-html.lsp b/openssh-listauth-html.lsp index 8d8ebad..d0b5e3e 100644 --- a/openssh-listauth-html.lsp +++ b/openssh-listauth-html.lsp @@ -23,7 +23,7 @@ <% htmlviewfunctions.displaycommandresults({"deleteauth"}, session) %> <% htmlviewfunctions.displaycommandresults({"addauth"}, session, true) %> -<h1>Authorized Keys for <%= html.html_escape(view.value.user.value) %></h1> +<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Authorized Keys for "..view.value.user.value}), page_info) %> <table id="list" class="tablesorter"><thead> <tr> <th>Action</th> @@ -31,14 +31,13 @@ <th>Key</th> </tr> </thead><tbody> +<% local user = cfe({ type="hidden", value=view.value.user.value }) %> +<% local authid = cfe({ type="hidden", value="" }) %> <% for i,auth in ipairs(view.value.auth.value) do %> <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"> -</form> + <% authid.value = auth.id %> + <% htmlviewfunctions.displayitem(cfe({type="form", value={user=user, auth=authid}, label="", option="Delete", action="deleteauth"}), page_info, -1) %> </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> @@ -46,5 +45,6 @@ <% end %> </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 +<% htmlviewfunctions.displaysectionend(header_level) %> <% viewlibrary.dispatch_component("addauth", {user=view.value.user.value}) %> diff --git a/openssh-listusers-html.lsp b/openssh-listusers-html.lsp index 69c80e0..ea6da7c 100644 --- a/openssh-listusers-html.lsp +++ b/openssh-listusers-html.lsp @@ -1,10 +1,13 @@ <% local view, viewlibrary, page_info, session = ... %> +<% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> -<h1>System User Accounts</h1> +<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="System User Accounts"}), page_info) %> <% for i,user in ipairs(view.value) do %> - <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 --> + <% htmlviewfunctions.displayitemstart() %> + <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) %> + <% htmlviewfunctions.displayitemmiddle() %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={user=cfe({type="hidden", value=user})}, label="", option="Edit", action="listauth"}), page_info, -1) %> + <% htmlviewfunctions.displayitemend() %> <% end %> +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/openssh-model.lua b/openssh-model.lua index 8eb946b..d672960 100644 --- a/openssh-model.lua +++ b/openssh-model.lua @@ -124,7 +124,7 @@ function mymodule.update_config(self, config) end function mymodule.list_conn_peers() - local output = {} + local output = cfe({ type="structure", value={}, label="Connected peers" }) local netstat = {} local ps = {} local who = {} @@ -172,8 +172,8 @@ function mymodule.list_conn_peers() end end end - table.insert(output, v) - output[#output]['host'] = peer + output.value[#output.value+1] = v + output.value[#output.value].host = peer end return output diff --git a/openssh-welcome-html.lsp b/openssh-welcome-html.lsp index e194aec..f5394c5 100644 --- a/openssh-welcome-html.lsp +++ b/openssh-welcome-html.lsp @@ -1,7 +1,7 @@ <% local data, viewlibrary, page_info, session = ... %> -<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("connectedpeers") then +<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("status") then viewlibrary.dispatch_component("status") end %> |