-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathget-new-file.rsp
36 lines (36 loc) · 949 Bytes
/
get-new-file.rsp
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
<%
if any [
validate/full [id integer! *]
all [
positive? request/content/id
empty? ticket: get-raw-ticket request/content/id
]
][
response/redirect "view-tickets.rsp"
]
params: request/content
if all [
positive? params/id
session/content/user-role = 'reporter
session/content/user-id <> ticket/17 ; ticket's owner allowed to edit
ticket/10 <> 6 ; dismissed ticket can't be edited by owner (Reporter)
][
deny-access
]
file: last either negative? params/id [
session/content/files
][
list-files params/id
]
small: join %public/files/ [file/2 %-small.png]
class: either exists? small [{class="withborder"}][
small: "img/document.png"
none
]
file-id: head clear find copy file/2 #"."
%>
<div class="attached-doc" id="<%=file-id%>" style="display:none">
<a href="get-file.rsp?id=<%=file-id%>" target="_blank">
<img <%=any [class ""]%>src="<%=small%>" title="<%=html-encode file/1%>">
</a>
</div>