-
Notifications
You must be signed in to change notification settings - Fork 7
/
files.cfm
156 lines (132 loc) · 5.63 KB
/
files.cfm
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
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfif not StructKeyExists(url,'p')>
<cfoutput><h2>No Project Selected!</h2></cfoutput><cfabort>
</cfif>
<cfif StructKeyExists(url,"df") and not compare(hash(url.df),url.dfh)>
<cfset application.file.delete(url.p,url.df,session.user.userID)>
</cfif>
<cfif StructKeyExists(url,"o")>
<cfset session.user.fileorder = url.o>
</cfif>
<cfparam name="url.c" default="">
<cfparam name="session.user.fileorder" default="date">
<cfif session.user.admin>
<cfset project = application.project.get(projectID=url.p)>
<cfelse>
<cfset project = application.project.get(session.user.userid,url.p)>
</cfif>
<cfset files = application.file.get(projectID=url.p,categoryID=url.c,orderBy=session.user.fileorder)>
<cfset categories = application.category.get(url.p,'file')>
<cfif not session.user.admin and not project.file_view eq 1>
<cfoutput><h2>You do not have permission to access files!!!</h2></cfoutput>
<cfabort>
</cfif>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#project.name# » Files" project="#project.name#" projectid="#url.p#" svnurl="#project.svnurl#">
<cfoutput>
<div id="container">
</cfoutput>
<cfif project.recordCount>
<cfoutput>
<!--- left column --->
<div class="left">
<div class="main">
<div class="header">
<h2 class="files">
<cfif compare(url.c,'')>
<cfset category = application.category.get(url.p,'file',url.c)>
Files in category: #category.category#
<cfelse>
All files
</cfif>
</h2>
</div>
<div class="content">
</cfoutput>
<cfif files.recordCount>
<cfif not compareNoCase(session.user.fileorder,'date')>
<cfset sortField = "uploadDate">
<cfelseif not compareNoCase(session.user.fileorder,'alpha')>
<cfset sortField = "leftChar">
</cfif>
<cfoutput query="files" group="#sortfield#">
<div class="stamp">
<cfif not compareNoCase(session.user.fileorder,'date')>
<cfif isDate(uploaddate)>#LSDateFormat(DateAdd("h",session.tzOffset,uploaddate),"dddd, d mmmm")#</cfif>
<cfelseif not compareNoCase(session.user.fileorder,'alpha')>
#leftChar#
</cfif>
</div>
<cfoutput>
<cfset attached = application.file.checkFile(fileID)>
<cfif listFind(ValueList(attached.type),'msg')>
<cfset msgAttached = true>
</cfif>
<cfif listFind(ValueList(attached.type),'issue')>
<cfset issueAttached = true>
</cfif>
<div class="wrapper itemlist fileLrg #filetype#Lrg">
<h3 class="padtop">#title#</h3>
<p>#description#</p>
<div class="byline">
<cfif Int(filesize/1024000) gte 1>
#NumberFormat(filesize/1024000,"0.00")#MB,
<cfelse>
#Int(filesize/1024)#K,
</cfif>
uploaded to <a href="#cgi.script_name#?p=#url.p#&c=#categoryID#">#category#</a> by #firstName# #lastName# on #LSDateFormat(DateAdd("h",session.tzOffset,uploaded),"mmm d")#
| <a href="download.cfm?p=#url.p#&f=#fileID#" class="download">Download</a>
<cfif session.user.userID eq uploadedBy or session.user.admin>
| <a href="editFile.cfm?p=#url.p#&f=#fileID#" class="edit">Edit</a>
| <a href="#cgi.script_name#?p=#url.p#&df=#fileID#&dfh=#hash(fileID)#" class="delete" onclick="return confirm('<cfif attached.recordCount>This file is currently attached to <cfif isDefined("msgAttached") and isDefined("issueAttached")> a message and issue<cfelseif isDefined("msgAttached")>a message<cfelseif isDefined("issueAttached")>an issue</cfif>.\n</cfif>Are you sure you wish to delete this file?');">Delete</a>
</cfif>
| <a href="file.cfm?p=#url.p#&f=#fileID#" class="comment"><cfif commentCount gt 0>#commentCount# Comments<cfelse>Post the first comment</cfif></a>
</div>
</div>
</cfoutput>
</cfoutput>
<cfelse>
<cfoutput><div class="wrapper"><div class="warn">No files have been uploaded.</div></div></cfoutput>
</cfif>
<cfoutput>
</div>
</div>
<div class="bottom"> </div>
<div class="footer">
<cfinclude template="footer.cfm">
</div>
</div>
<!--- right column --->
<div class="right">
<cfif compare(project.logo_img,'')>
<img src="#application.settings.userFilesMapping#/projects/#project.logo_img#" border="0" alt="#project.name#" class="projlogo" />
</cfif>
<cfif session.user.admin or project.file_edit>
<h3><a href="editFile.cfm?p=#url.p#" class="add">Upload a new file</a></h3><br />
</cfif>
<div class="header"><h3>Sort by</h3></div>
<div class="content">
<ul class="nobullet">
<li><input type="radio" name="sort" value="date"<cfif not compare(session.user.fileorder,'date')> checked="checked"</cfif> onclick="window.location='#cgi.script_name#?p=#url.p#&c=#url.c#&o=date'" /> Date and time</li>
<li><input type="radio" name="sort" value="alpha"<cfif not compare(session.user.fileorder,'alpha')> checked="checked"</cfif> onclick="window.location='#cgi.script_name#?p=#url.p#&c=#url.c#&o=alpha'" /> A-Z</li>
</ul>
</div>
<div class="header"><h3>Categories</h3></div>
<div class="content">
<ul>
<cfloop query="categories">
<li><a href="#cgi.script_name#?p=#url.p#&c=#categoryID#"<cfif not compareNoCase(url.c,categoryID)> class="b"</cfif>>#category#</a></li>
</cfloop>
</ul>
</div>
</div>
</cfoutput>
<cfelse>
<cfoutput><div class="alert">Project Not Found.</div></cfoutput>
</cfif>
<cfoutput>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">