From f43bf637de7b6e2d698888ef4d878c13d9d99aa7 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 22 Aug 2014 20:48:12 +0000 Subject: Initial commit for freeradius3 ACF Included support for status/startstop/logfile and list/edit/create/delete files --- freeradius3-listfiles-html.lsp | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 freeradius3-listfiles-html.lsp (limited to 'freeradius3-listfiles-html.lsp') diff --git a/freeradius3-listfiles-html.lsp b/freeradius3-listfiles-html.lsp new file mode 100644 index 0000000..8fb4f33 --- /dev/null +++ b/freeradius3-listfiles-html.lsp @@ -0,0 +1,80 @@ +<% local view, viewlibrary, page_info, session = ... +htmlviewfunctions = require("htmlviewfunctions") +html = require("acf.html") +%> + +<% +function convertsize(size) + if string.find(size, "k$") then + return tonumber(string.match(size, "[%d.]*")) * 1024.0 + elseif string.find(size, "M$") then + return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0 + elseif string.find(size, "G$") then + return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0 + else + return tonumber(string.match(size, "[%d.]*")) + end +end +%> + + + + + + + +<% htmlviewfunctions.displaycommandresults({"editfile", "deletefile"}, session) %> +<% htmlviewfunctions.displaycommandresults({"createfile"}, session, true) %> + +<% if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("status") +end %> + +<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Configuration"}), page_info) %> + + + + + + + + +<% local filename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> +<% for k,v in ipairs( view.value ) do %> + + + + + + +<% end %> +
ActionFileSizeLast Modified
+ <% filename.value = v.filename %> + <% if viewlibrary.check_permission("editfile") then %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="editfile"}), page_info, -1) %> + <% end %> + <% if viewlibrary.check_permission("deletefile") then %> + <% htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="deletefile", class="deletefile"}), page_info, -1) %> + <% end %> + <%= html.html_escape(v.filename) %><%= convertsize(v.size) %>b<%= html.html_escape(v.size) %><%= html.html_escape(v.mtime) %>
+ +<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createfile") then + local createform = viewlibrary.dispatch_component("createfile", nil, true) + createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createfile" + htmlviewfunctions.displayitem(createform, page_info, htmlviewfunctions.incrementheader(header_level)) +end %> +<% htmlviewfunctions.displaysectionend(header_level) %> -- cgit v1.2.3