summaryrefslogtreecommitdiffstats
path: root/app/template-stream.lsp
blob: 9ed4ab7b48f3c01bc0d89c48eac01d3752596859 (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
<% local view, viewlibrary, page_info, session = ... %>
<%
local viewtable = view
if view.type == "group" then
	viewtable = nil
	for name,value in pairs(view.value) do
		if value.type == "raw" then
			viewtable = value
			break
		end
	end
	if not viewtable then
		return
	end
end
%>
Status: 200 OK
Content-Type: <% print(viewtable.option or "application/octet-stream") %>
<% if viewtable.length then %>
Content-Length: <%= viewtable.length %>
<% io.write("\n") %>
<% end %>
<% if viewtable.label ~= "" then %>
Content-Disposition: attachment; filename="<%= viewtable.label %>"
<% end %>
<% io.write("\n") %>
<% page_info.viewfunc(viewtable, viewlibrary, page_info, session) %>