1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<? 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
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DDD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><?= pageinfo.hostname .. " - " .. pageinfo.controller .. "->" .. pageinfo.action ?></title>
<link rel="stylesheet" type="text/css"
href=<?= "/"..pageinfo.skin.."/"..pageinfo.skin..".css" ?> ">
</head>
<body>
<div id=head>
<p>Host: <em><?= pageinfo.hostname ?></em></p>
</div>
<div id=logo>
<h2><?= pageinfo.prefix ?> > <?= pageinfo.controller .. " > " .. pageinfo.action ?></h2>
</div>
<div id="mainmenu">
<?
-- 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 ("</ul>\n")
liston=false
end
cat = v.cat
io.write (string.format("<h3>%s</h3>\n", cat))
group = ""
end
if v.group ~= group then
group = v.group
if liston == false then
io.write ("<ul>")
liston=true
end
if pageinfo.prefix == v.prefix .. "/" and
pageinfo.controller == v.controller then
selected=" id=\"selected\""
else
selected=""
end
io.write (string.format("<li%s><a href=\"%s%s/%s/%s\">%s</a></li>\n",
selected, ENV.SCRIPT_NAME,v.prefix, v.controller, v.action, v.group))
end
end
?>
</ul>
<div id="footer">
<p><center>Made with care by acf</center></p>
</div>
</div>
<div id="submenu">
<ul>
<? for k,v in pairs(submenu) do
if v == pageinfo.action then
io.write (string.format('<li id="selected">%s</li>\n',
v, v ))
else
io.write (string.format('<li><a href="%s">%s</a></li>\n',
v, v ))
end
end
?>
</ul>
</div>
<div id="content">
<? local func = haserl.loadfile(pageinfo.viewfile)
func (viewtable) ?>
</div>
</body>
</html>
|