summaryrefslogtreecommitdiffstats
path: root/template-html.lsp
blob: e8c5ace17b5dea2b44f494b9c40b190883b8c1c4 (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
<% 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>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=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

local class
local tabs
for x,cat in ipairs(session.menu.cats) do
  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
      curcat = html.html_escape(cat.name)
      curgroup = html.html_escape(group.name)
    end
  end
end
%>
<title><%= html.html_escape(hostname .. " - " .. pageinfo.controller .. "->" .. pageinfo.action) %></title>

<link rel="stylesheet" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.skin.."/") %>themes/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.skin.."/") %>themes/jqmobile-skin.min.css" />
<link rel="stylesheet" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.staticdir) %>/jqmobile/jquery.mobile.structure.css" />
<link rel="stylesheet" href="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.skin.."/") %>jqmobile.css"/>

<script type="text/javascript" src="<%= html.html_escape(pageinfo.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript" src="<%= html.html_escape(pageinfo.wwwprefix..pageinfo.skin.."/") %>jqmobile.js"></script>
<script type="text/javascript" src="<%= html.html_escape(pageinfo.wwwprefix) %>/js/jquery.mobile.js"></script>

</head>
<body>
<div id="page" data-role="page" class="type-index" data-dom-cache="false" data-theme="c">

<div id="header" data-role="header" data-theme="f">
  <h1><%= html.html_escape(pageinfo.controller) %></h1>
  <a href="<%= html.html_escape(pageinfo.script) %>" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
  <a href="#" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
</div><!-- /header -->

<!-- main -->
<div id="main" data-role="content">
<% if session.userinfo and session.userinfo.userid then %>
<h2><%= curcat %> > <%= curgroup %> </h2>
<% else %>
<h2><i>Session expired, please login</i>... </h2>
<% end %>
  <a id="top"></a>
  <!-- subnav -->
  <div id="subnav">
    <ul data-role="controlgroup" data-type="horizontal" class="localnav">
    <% 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='ui-btn-active'"
    else
      class=""
    end
        io.write (string.format('<li><a %s href="%s%s%s/%s" data-role="button" data-transition="fade">%s</a></li>\n',
            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>
  <!-- /subnav -->

  <!-- content -->
  <div id="content" class="flexcols flexcols-1-4" data-mini="true" data-role="collapsible" data-collapsed="false" data-theme="e" data-content-theme="c">
    <% pageinfo.viewfunc(viewtable, viewlibrary, pageinfo, session) %>
  </div>
  <!-- /content -->

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

<!-- footer -->
<div id="footer" data-role="footer" class="footer-docs" data-theme="c">
  <p>Page generated in <%= html.html_escape(os.clock()) %> seconds on <%= html.html_escape(os.date()) %>.</p>
  <p>&copy; 2012 Alpine Linux</p>
</div>
<!-- /footer -->

</div><!-- page -->

<% 
if pageinfo.viewfile then
  fs=require("acf.fs")
  local sf = posix.dirname(pageinfo.viewfile) .. '/' .. pageinfo.controller .. '-' .. pageinfo.action ..'-popups-html.lsp'
  if fs.is_file(sf) then
%><!-- multipage -->
<% 
    local func = haserl.loadfile(sf)
    func (viewtable, viewlibrary, pageinfo, session)
%><!-- /multipage -->
<% end %>
<% end %>

<!-- multipage -->
<div data-role="page" id="infopage">
    <div data-role="header" data-theme="e"><h2>Information</h2></div>
    <div data-role="content" data-theme="d" class="content"></div>
    <div data-role="footer" class="ui-bar">
    <a href="<%= pageurl %>#page" data-rel="back" data-role="button" data-icon="check">Close</a>&nbsp;
    <a href="<%= html.html_escape(pageinfo.script) %>" data-direction="reverse" data-role="button" data-icon="home">Home</a>
    </div>
</div>
<!-- /multipage -->



<script type="text/javascript">
	$(function(){
		$(":input:not(:submit):enabled:not([readonly]):first").focus();
	});</script>

</body>
</html>