local pageinfo , mainmenu, submenu, viewtable, session = ...
html=require("html") ?>
Status: 200 OK
Content-Type: text/html
if (session.id) then
io.write( html.cookie.set("sessionid", session.id) )
else
io.write (html.cookie.unset("sessionid"))
end
?>
-- FIXME: This needs to go in a library function somewhere (menubuilder?)
local ctlr = pageinfo.script .. "/acf-util/logon/"
if session.id == nil then
io.write ( html.link( { label = "Log in", value = ctlr .. "logon" } ) )
else
io.write (html.link( { label = "Logout as " .. ( session.name or "unkown") , value = ctlr .. "logout" } ) )
end
local cat, group
local liston=false
local selected
for k,v in ipairs(mainmenu) do
if v.cat ~= cat then
if liston == true then
io.write ("\n")
liston=false
end
cat = v.cat
io.write (string.format("
%s
\n", cat))
group = ""
end
if v.group ~= group then
group = v.group
if liston == false then
io.write ("
")
liston=true
end
if pageinfo.prefix == v.prefix .. "/" and
pageinfo.controller == v.controller then
selected=" id=\"selected\""
else
selected=""
end
io.write (string.format("- %s
\n",
selected, ENV.SCRIPT_NAME,v.prefix, v.controller, v.action, v.group))
end
end
?>