<% local data, 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({"deletefile", "expert", "rebuilddatabases"}, session) %> <% htmlviewfunctions.displaycommandresults({"createfile"}, session, true) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("status") end %> <% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> <% local filename = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,file in ipairs(data.value) do %> <% end %>
Action File Size Last Modified
<% filename.value = file.filename %> <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="expert"}), page_info, -1) %> <% if file.filename ~= "/etc/mail/aliases" then %> <% htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="deletefile"}), page_info, -1) %> <% end %> <%= html.html_escape(file.filename) %> <%= convertsize(file.filesize) %>b<%= html.html_escape(file.filesize) %> <%= html.html_escape(file.mtime) %>
<% htmlviewfunctions.displayitem(cfe({type="form", value={}, label="Rebuild Databases", option="Rebuild", action="rebuilddatabases"}), page_info, 0) %> <% htmlviewfunctions.displaysectionend(header_level) %> <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createfile") then local newfileform = viewlibrary.dispatch_component("createfile", nil, true) %> <% newfileform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createfile" htmlviewfunctions.displayitem(newfileform, page_info, htmlviewfunctions.incrementheader(header_level)) end %>