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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
<? 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="page">
<div id="header">
<div class="leader">
<a href="#Content" class="hide">[Skip to main content]</a>
</div>
<h1><?= pageinfo.hostname or "AlpineLinux" ?></h1>
<p><?= pageinfo.alpineversion or "Alpine version: unknown"?></p>
<div class="tailer">
<!-- (Any use for this?) <p class="hide">[ this is header-tailer div text <a href="#Content">Goto content</a>]</p> -->
</div>
</div> <!-- header -->
<div id="main">
<div class="leader">
</div>
<div id="nav">
<div class="leader">
<h3 class="hide">[Main menu]</h3>
</div>
<?
-- FIXME: This needs to go in a library function somewhere (menubuilder?)
io.write ( "<ul>\n\t\t\t\t<li>Log in/out\n\t\t\t\t\t<ul>\n")
local ctlr = pageinfo.script .. "/acf-util/logon/"
if session.id == nil then
io.write ( string.format("\t\t\t\t\t\t<li><a href=\"%s\">Log in</a></li>\n", ctlr .. "logon" ) )
else
sess = session.name or "unknown"
io.write ( string.format("\t\t\t\t\t\t<li><a href=\"%s\">Log out as '" .. sess .. "'</a></li>\n", ctlr .. "logout" ) )
end
local cat, group
local class
for k,v in ipairs(mainmenu) do
if v.cat ~= cat then
cat = v.cat
if (cat ~= "") then -- Filter out empty categories
io.write (string.format("\t\t\t\t\t</ul>\n\t\t\t\t</li>\n\t\t\t\t<li>%s\n\t\t\t\t\t<ul>\n", cat)) --start row
end
group = ""
end
if v.group ~= group then
group = v.group
if pageinfo.prefix == v.prefix .. "/" and
pageinfo.controller == v.controller then
class="class='selected'"
else
class=""
end
io.write (string.format("\t\t\t\t\t\t<li %s><a href=\"%s%s/%s/%s\">%s</a></li>\n",
class,ENV.SCRIPT_NAME,v.prefix, v.controller, v.action, v.group ))
end
end ?>
</ul></li>
</ul>
</div> <!-- nav -->
<div class="postnav">
<h2><?= pageinfo.controller ?> : <?= pageinfo.action ?></h2>
<!-- FIXME: Next row is 'dead' data! Remove 'class=hide' when done! -->
<p class='hide'>[ welcome ] > [ login ] > [ bgp ] > [ firewall ] > [ content filter ] > [ interfaces ]</p>
</div> <!-- postnav -->
<a name="Content"></a>
<div id="subnav">
<div class="leader">
<h3 class="hide">[Submenu]</h3>
</div>
<? local class="" ?>
<? for k,v in pairs(submenu) do
if v == pageinfo.action then
class="class='selected'"
else
class=""
end
io.write (string.format('\t\t\t<a %s href="%s">%s</a>\n',class,v,v ))
end
?>
</div> <!-- subnav -->
<div id="content">
<? local func = haserl.loadfile(pageinfo.viewfile) ?>
<? func (viewtable) ?>
<div class="tailer">
</div>
</div> <!-- content -->
</div> <!-- main -->
<div id="footer">
<div class="leader">
</div>
Made with care by webconf
<div class="tailer">
</div>
</div> <!-- footer -->
</div> <!-- page -->
</body>
</html>
|