forked from joedanz/cf-project-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessages.cfm
192 lines (161 loc) · 7.48 KB
/
messages.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfif not StructKeyExists(url,'p')>
<cfoutput><h2>No Project Selected!</h2></cfoutput><cfabort>
</cfif>
<cfif session.user.admin>
<cfset project = application.project.get(projectID=url.p)>
<cfelse>
<cfset project = application.project.get(session.user.userid,url.p)>
</cfif>
<cfif not session.user.admin and not project.msg_view eq 1>
<cfoutput><h2>You do not have permission to access messages!!!</h2></cfoutput>
<cfabort>
</cfif>
<cfif StructKeyExists(url,"dm") and not compare(hash(url.dm),url.dmh)>
<cfset application.message.delete(url.p,url.dm)>
<cfelseif StructKeyExists(url,"v")>
<cfset session.user.msgview = url.v>
</cfif>
<cfparam name="session.user.msgview" default="full">
<cfparam name="url.c" default="">
<cfparam name="url.ms" default="">
<cfparam name="url.m" default="0">
<cfparam name="url.y" default="0">
<cfset messages = application.message.get(url.p,'',url.c,url.ms,url.m,url.y)>
<cfset categories = application.category.get(url.p,'msg')>
<cfset milestones = application.message.milestones(url.p)>
<cfset dates = application.message.dates(url.p)>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#project.name# » Messages" project="#project.name#" projectid="#url.p#" svnurl="#project.svnurl#">
<cfoutput>
<div id="container">
<cfif project.recordCount>
<!--- left column --->
<div class="left">
<div class="main">
<div class="header">
<cfif messages.recordCount>
<span class="rightmenu">
<cfif not compare(session.user.msgview,'full')><span class="current">Expanded View</span><cfelse><a href="#cgi.script_name#?p=#url.p#&v=full">Expanded View</a></cfif> |
<cfif not compare(session.user.msgview,'list')><span class="current">List View</span><cfelse><a href="#cgi.script_name#?p=#url.p#&v=list">List View</a></cfif>
</span>
</cfif>
<h2 class="msg">
<cfif compare(url.c,'')>
<cfset category = application.category.get(url.p,'msg',url.c)>
Messages in category: #category.category#
<cfelseif compare(url.ms,'')>
Messages for milestone: #messages.name#
<cfelseif compare(url.m,'0')>
Messages from #monthAsString(url.m)# #url.y#
<cfelse>
All messages
</cfif>
</h2>
</div>
<div class="content">
<cfif messages.recordCount>
<cfif not compare(session.user.msgview,'full')> <!--- expanded view --->
<cfloop query="messages">
<span class="stamp">
#LSDateFormat(DateAdd("h",session.tzOffset,stamp),"dddd, d mmmm")#
</span>
<div class="wrapper itemlist">
<h3 class="padtop">#title#</h3>
<cfif commentCount>
<cfset comment = application.comment.get(url.p,'msg',messageID,'1')>
<a class="b" href="message.cfm?p=#url.p#&m=#messageID###comments">#commentCount# comment<cfif commentCount gt 1>s</cfif></a>
<span style="color:##666;">
Last by #comment.firstName# #comment.lastName# on #LSDateFormat(DateAdd("h",session.tzOffset,comment.stamp),"ddd, mmm d")# at <cfif application.settings.clockHours eq 12>#LSTimeFormat(DateAdd("h",session.tzOffset,comment.stamp),"h:mmtt")#<cfelse>#LSTimeFormat(DateAdd("h",session.tzOffset,comment.stamp),"HH:mm")#</cfif>
</span>
</cfif>
<p>#message#</p>
<cfif compare(name,'')><div class="ms">Milestone: #name#</div></cfif>
<div class="byline">
Posted by #firstName# #lastName# in <a href="#cgi.script_name#?p=#url.p#&c=#categoryID#">#category#</a>
<cfif session.user.admin or project.msg_edit eq 1 or userID eq session.user.userID> | <a href="editMessage.cfm?p=#url.p#&m=#messageID#&mh=#hash(messageID)#" class="edit">Edit</a>
| <a href="messages.cfm?p=#url.p#&dm=#messageID#&dmh=#hash(messageID)#" class="delete" onclick="return confirm('Are you sure you wish to delete this message and all associated comments?')">Delete</a></cfif>
<cfif allowComments> | <a href="message.cfm?p=#url.p#&m=#messageID###comments" class="comment"><cfif not commentCount>Post the first comment<cfelse>#commentCount# comment<cfif commentCount gt 1>s</cfif> posted</cfif></a></cfif>
<cfif attachcount gt 0> | <a href="message.cfm?p=#url.p#&m=#messageID###attach" class="attach">#attachcount# file<cfif attachcount gt 1>s</cfif> attached</a></cfif>
</div>
</div>
</cfloop>
<cfelse> <!--- list view --->
<div class="wrapper">
<cfloop query="messages">
<div style="border-bottom:1px solid ##ccc;padding:10px 5px;">
<div style="float:right;width:250px;">
<cfif commentCount eq 0><span class="comment g">No comments posted.</span><cfelse>
<cfset comment = application.comment.get(url.p,'msg',messageID,'1')>
<span class="comment g">
Last comment by #firstName# #lastName#<br />
#request.udf.relativeTime(DateAdd("h",session.tzOffset,stamp))#
</span>
</cfif>
</div>
<div style="float:right;width:120px;margin-right:20px;">
<cfif attachcount gt 0><a href="message.cfm?p=#url.p#&m=#messageID###attach" class="attach">#attachcount# file<cfif attachcount gt 1>s</cfif> attached</a></cfif>
</div>
<a href="message.cfm?p=#url.p#&m=#messageID#" class="fs12">#title#</a><br />
by #firstName# #lastName# on #LSDateFormat(DateAdd("h",session.tzOffset,stamp),"ddd, d mmm")# at <cfif application.settings.clockHours eq 12>#LSTimeFormat(DateAdd("h",session.tzOffset,stamp),"h:mmtt")#<cfelse>#LSTimeFormat(DateAdd("h",session.tzOffset,stamp),"HH:mm")#</cfif>
</div>
</cfloop>
</div>
</cfif> <!--- end list view --->
<cfelse>
<div class="wrapper"><div class="warn">No messages have been posted.</div></div>
</cfif>
</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.msg_edit eq 1>
<h3><a href="editMessage.cfm?p=#url.p#" class="add">Post a new message</a></h3><br />
</cfif>
<cfif categories.recordCount>
<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>
</cfif>
<cfif milestones.recordCount>
<div class="header"><h3>Milestones</h3></div>
<div class="content">
<ul>
<cfloop query="milestones">
<li><a href="#cgi.script_name#?p=#url.p#&ms=#milestoneid#"<cfif not compareNoCase(url.ms,milestoneID)> class="b"</cfif>>#name#</a></li>
</cfloop>
</ul>
</div>
</cfif>
<cfif dates.recordCount>
<div class="header"><h3>Timeframe</h3></div>
<div class="content">
<ul>
<cfloop query="dates">
<li><a href="#cgi.script_name#?p=#url.p#&m=#m#&y=#y#"<cfif not compareNoCase(url.m,m) and not compareNoCase(url.y,y)> class="b"</cfif>>#monthAsString(m)# #y#</a></li>
</cfloop>
</ul>
</div>
</cfif>
</div>
<cfelse>
<div class="alert">Project Not Found.</div>
</cfif>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">