<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> <% htmlviewfunctions.displaycommandresults({"deleterequest", "editdevice"}, session) %> <% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Requests"}), page_info) %> <% local mac = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value="searchdevices" }) %> <% for k,v in ipairs( view.value ) do %> <% end %>
Action Timestamp MAC Address IP Address User Agent
<% mac.value = v.mac %> <% if viewlibrary.check_permission("deleterequest") then %> <% htmlviewfunctions.displayitem(cfe({type="form", value={mac=mac}, label="", option="Delete", action="deleterequest", class="deleterequest" }), page_info, -1) %> <% end %> <% if v.device_id then %> <% if viewlibrary.check_permission("searchdevices") then %> <% htmlviewfunctions.displayitem(cfe({type="form", value={id=cfe({type="hidden", value="device_id"}), value=cfe({type="hidden", value=v.device_id}), redir=redir}, label="", option="Search", action="searchdevices" }), page_info, -1) %> <% end %> <% else %> <% if viewlibrary.check_permission("createdevicefromrequest") then %> <% htmlviewfunctions.displayitem(cfe({type="form", value={mac=mac}, label="", option="Create", action="createdevicefromrequest" }), page_info, -1) %> <% end %> <% end %> <% local date = {} date.year, date.month, date.day, date.hour, date.min, date.sec, remainder = string.match(v.date, "(%d+)%-(%d+)%-(%d+) (%d+):(%d+):(%d+)") local rem = string.match(v.date, "%.%d+$") io.write((os.time(date) - 1318000000)..(rem or "")) %> <%= html.html_escape(v.date) %> <%= html.html_escape(v.mac) %> <%= html.html_escape(v.ip) %> <%= html.html_escape(v.agent) %>
<% htmlviewfunctions.displaysectionend(header_level) %>