<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> <% htmlviewfunctions.displaycommandresults({"editpasswdentry", "deletepasswdentry", "editpasswd", "editfile"}, session) %> <% htmlviewfunctions.displaycommandresults({"createpasswdentry"}, session, true) %> <% -- This is a hack to redirect back to viewing the same file local redir = page_info.orig_action.."?filename="..html.url_encode(view.value.filename.value) %> <% local editable = false if view.value.mode and string.match(view.value.mode.value, "^.w") then editable = true end %>

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

<% htmlviewfunctions.displayitem(view.value.filename) %> <% if view.value.mode then htmlviewfunctions.displayitem(view.value.mode) end %> <% if view.value.data then %> <% local containspasswd = 0 %>
<% for i,f in ipairs(view.value.fields.value) do %> <% if f == "Crypt-Password" then containspasswd = i end %> <% end %> <% for i,r in ipairs( view.value.data.value ) do %> <% for j,f in ipairs(r) do %> <% end %> <% end %>
Action<%= html.html_escape(f) %>
<% if editable then %> <% if viewlibrary.check_permission("editpasswdentry") then %> <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editpasswdentry?filename="..html.url_encode(view.value.filename.value).."&entry="..i.."&redir="..html.url_encode(redir), label="Edit "} %> <% end %> <% if viewlibrary.check_permission("deletepasswdentry") then %> <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletepasswdentry?submit=true&filename="..html.url_encode(view.value.filename.value).."&entry="..i, label="Delete "} %> <% end %> <% if 0 < containspasswd and r[containspasswd] ~= "" and viewlibrary.check_permission("editpasswd") then %> <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editpasswd?filename="..html.url_encode(view.value.filename.value).."&entry="..i.."&redir="..html.url_encode(redir), label="ChangePass "} %> <% end %> <% end %> <% if (j == containspasswd) and (f ~= "") then io.write("********") else io.write(html.html_escape(f)) end %>
<% end %> <% if editable and view.value.data and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("editfile") then %>

Expert

<% end %> <% if editable and view.value.data and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createpasswdentry") then local createform = viewlibrary.dispatch_component("createpasswdentry", {filename=view.value.filename.value, redir=redir}, true) %>

<%= html.html_escape(createform.label) %>

<% createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createpasswdentry" htmlviewfunctions.displayform(createform) end %>