blob: f944602df8bb003e1b81f6a28efba7462353ad3a (
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" or view.type == "form" 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
viewtable = cfe({label="error", value=view.errtxt or "Invalid stream output"})
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) %>
|