<% 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({"deletetemplate", "edittemplate"}, session) %> <% htmlviewfunctions.displaycommandresults({"createtemplate"}, session, true) %> <% local header_level = htmlviewfunctions.displaysectionstart(view, 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 %>
Action File Name Label Sequence File Size Last Modified
<% filename.value = v.filename %> <% if viewlibrary.check_permission("edittemplate") and v.label then %> <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="edittemplate"}), page_info, -1) %> <% end %> <% if viewlibrary.check_permission("deletetemplate") and v.label then %> <% htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="deletetemplate", class="deletetemplate"}), page_info, -1) %> <% end %> <% if viewlibrary.check_permission("createtemplate") and not v.label then %> <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Create", action="createtemplate"}), page_info, -1) %> <% end %> <%= html.html_escape(v.filename) %> <%= html.html_escape(v.label) %> <%= html.html_escape(v.seq) %> <%= convertsize(v.filesize) %>b<%= html.html_escape(v.filesize) %> <%= html.html_escape(v.mtime) %>
<% if view.errtxt then %>

<%= html.html_escape(view.errtxt) %>

<% end %> <% if #view.value == 0 then %>

No templates found

<% end %> <% htmlviewfunctions.displaysectionend(header_level) %> <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createtemplate") then viewlibrary.dispatch_component("createtemplate") end %>