summaryrefslogtreecommitdiffstats
path: root/app/template-html.lsp
blob: ae051d2cfecb611585d98bb3b24eb3853620c4f6 (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<% local viewtable, viewlibrary, pageinfo, session = ... 
   html=require("acf.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//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%
local hostname = ""
if viewlibrary and viewlibrary.dispatch_component then
	local result = viewlibrary.dispatch_component("alpine-baselayout/hostname/read", nil, true)
	if result and result.value then
		hostname = result.value
	end
end
%>
<title><%= html.html_escape(hostname .. " - " .. pageinfo.controller .. "->" .. pageinfo.action) %></title>
<link rel="stylesheet" type="text/css" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.staticdir) %>/reset.css">
<link rel="stylesheet" type="text/css" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.skin.."/"..posix.basename(pageinfo.skin)..".css") %>">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.skin.."/"..posix.basename(pageinfo.skin).."-ie.css") %>">
<![endif]-->
<script type="text/javascript" src="<%= html.html_escape(pageinfo.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript">
	$(function(){
		$(":input:not(:submit):enabled:not([readonly]):first").focus();
	});</script>
</head>
<body>

<div id="page">
	<div id="header">
		<div class="leader">
			<a href="#Content" class="hide">[Skip to main content]</a>
		</div>
		<div id="logo">
			<div class="leader"></div>
			<h1>AlpineLinux</h1>
			<p><%= html.html_escape(hostname or "unknown hostname") %></p>
			<div class="tailer"></div>
		</div>
		<span class="mute">
			<p>
			<% local ctlr = pageinfo.script .. "/acf-util/logon/"
			
			if session.userinfo and session.userinfo.userid then
			   io.write ( string.format("\t\t\t\t\t\t<a href=\"%s\">Log out as '" .. html.html_escape(session.userinfo.userid) .. "'</a>\n", html.html_escape(ctlr) .. "logout" ) )
			else
			   io.write ( string.format("\t\t\t\t\t\t<a href=\"%s\">Log in</a>\n", html.html_escape(ctlr) .. "logon" ) )
			end %>
			 | 
			<a href="<%= html.html_escape(pageinfo.wwwprefix) %>/">home</a> | 
			<a href="http://www.alpinelinux.org">about</a>
			</p></span>
		<div class="tailer"></div>
	</div>	<!-- header -->

	<div id="main">
		<div class="leader">
		</div>

		<div id="nav">
			<div class="leader">
				<h3 class="hide">[Main menu]</h3>
			</div>

			<% 
			local class
			local tabs
			io.write ( "<ul>")
			for x,cat in ipairs(session.menu.cats) do
				io.write (string.format("\n\t\t\t\t<li>%s\n\t\t\t\t\t<ul>\n", html.html_escape(cat.name)))	--start row
				for y,group in ipairs(cat.groups) do
					class=""
					if not tabs and group.controllers[pageinfo.prefix .. pageinfo.controller] then
						class="class='selected'"
						tabs = group.tabs
					end
					io.write (string.format("\t\t\t\t\t\t<li %s><a %s href=\"%s%s%s/%s\">%s</a></li>\n", 
						class,class,html.html_escape(pageinfo.script),html.html_escape(group.tabs[1].prefix), html.html_escape(group.tabs[1].controller), html.html_escape(group.tabs[1].action), html.html_escape(group.name) ))
				end
				io.write ( "\t\t\t\t\t</ul>" )
			  end
			io.write ( "\n\t\t\t\t</li>\n\t\t\t</ul>\n")
			%>

			<div class="tailer">
			</div>
		</div>	<!-- nav -->


		<div id="postnav">
			<div class="leader">
			</div>
			<h2><%= html.html_escape(pageinfo.controller) %> : <%= html.html_escape(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 class="tailer">
			</div>
		</div>	<!-- postnav -->

		<a name="Content"></a>

		<div id="subnav">
			<div class="leader">
				<h3 class="hide">[Submenu]</h3>
			</div>

			<ul>
			<% local class="" %>
			<% for x,tab in pairs(tabs or {})  do
				if tab.prefix == pageinfo.prefix and tab.controller == pageinfo.controller and tab.action == pageinfo.action then
					class="class='selected'"
				else
					class=""
				end
				io.write (string.format('<li %s><a %s href="%s%s%s/%s">%s</a></li>\n',
							class,class,html.html_escape(pageinfo.script),html.html_escape(tab.prefix),html.html_escape(tab.controller),html.html_escape(tab.action),html.html_escape(tab.name) ))
			end
			%>
			</ul>

			<div class="tailer">
			</div>
		</div> <!-- subnav -->

<div id="content">
	<div class="leader">
	</div>

	<% pageinfo.viewfunc(viewtable, viewlibrary, pageinfo, session) %>

	<div class="tailer">
	</div>
</div>	<!-- content -->

	</div> <!-- main -->

	<div id="footer">
		<div class="leader">
		</div>
		<p>Page generated in <%= html.html_escape(os.clock()) %> seconds on <%= html.html_escape(os.date()) %>.</p>
		<div class="tailer">
		</div>
	</div> <!-- footer -->
</div> <!-- page -->

</body>
</html>