<% local form, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>

<% htmlviewfunctions.displaycommandresults({"updateall", "upgradeall"}, session) %>

<%
local pattern = string.gsub(page_info.prefix..page_info.controller, "[%(%)%.%%%+%-%*%?%[%]%^%$]", "%%%1")
local func = haserl.loadfile(page_info.viewfile:gsub(pattern..".*$", "/") .. "filedetails-html.lsp")
func(form, viewlibrary, page_info, session)
%>

<% if viewlibrary.check_permission("updateall") or viewlibrary.check_permission("upgradeall") then %>
<H2>Update / Upgrade</H2>
<DL>
<% if viewlibrary.check_permission("updateall") then %>
	<DT>Update Index</DT>
	<DD><form action="updateall" method="POST">
		<input class="hidden" type="hidden" name="redir"  value="<%= html.html_escape(page_info.orig_action) %>" >
		<input class="submit" type="submit" name="submit" value="Update">
	</form></DD>
<% end %>
<% if viewlibrary.check_permission("upgradeall") then %>
	<DT>Upgrade All</DT>
	<DD><form action="upgradeall" method="POST">
		<input class="hidden" type="hidden" name="redir"  value="<%= html.html_escape(page_info.orig_action) %>" >
		<input class="submit" type="submit" name="submit" value="Upgrade">
	</form></DD>
<% end %>
</DL>
<% end %>
