-
Notifications
You must be signed in to change notification settings - Fork 7
/
project.cfm
469 lines (435 loc) · 19.3 KB
/
project.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
<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)>
<cfset projects = application.project.get()>
<cfelse>
<cfset project = application.project.get(session.user.userid,url.p)>
<cfset projects = application.project.get(session.user.userid)>
<cfif projects.recordCount eq 1>
<cfset projects_reg = application.project.getDistinct(allowReg=true)>
<cfquery name="active_projects" dbtype="query">
select * from projects where status = 'Active'
</cfquery>
<cfquery name="allow_reg_projects" dbtype="query">
select * from projects_reg where projectid not in (
<cfif active_projects.recordCount>'#replace(ValueList(active_projects.projectid),",","','","ALL")#'<cfelse>''</cfif>)
</cfquery>
</cfif>
</cfif>
<cfset projectUsers = application.project.projectUsers(url.p,'0','lastLogin desc')>
<cfif session.user.admin or project.mstone_view eq 1>
<cfset milestones_overdue = application.milestone.get(url.p,'','overdue')>
<cfset milestones_upcoming = application.milestone.get(url.p,'','upcoming','1')>
</cfif>
<cfif session.user.admin or project.issue_view eq 1>
<cfset issues = application.issue.get(url.p,'','New|Accepted|Assigned')>
</cfif>
<cfif session.user.admin or project.todolist_view eq 1>
<cfset todos_overdue = application.todo.get('','','','t.due','',url.p,'',1,'overdue')>
<cfset todos_upcoming = application.todo.get('','','','t.due','',url.p,'',1,'upcoming','1')>
</cfif>
<cfset activity = application.activity.get(url.p,'','true')>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#project.name# » Overview" project="#project.name#" projectid="#url.p#" svnurl="#project.svnurl#">
<cfsavecontent variable="js">
<cfoutput>
<script type='text/javascript'>
$(document).ready(function(){
<cfif project.issue_view and issues.recordCount>
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"severity-pre": function ( a ) {
// Add / alter the switch statement below to match your enum list
switch( a ) {
case "Trivial": return 1;
case "Minor": return 2;
case "Normal": return 3;
case "Major": return 4;
case "Critical": return 5;
default: return 6;
}
},
"severity-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"severity-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"status-pre": function ( a ) {
// Add / alter the switch statement below to match your enum list
switch( a ) {
case "New": return 1;
case "Accepted": return 2;
case "Assigned": return 3;
case "Resolved": return 4;
case "Closed": return 5;
default: return 6;
}
},
"status-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"status-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
$('##issues').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
null,
null,
{ "sType": "severity" },
{ "sType": "status" },
null,
null,
null,
null,
null
]
} );
</cfif>
<cfif activity.recordCount>
$('##activity').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[ 4, "desc" ]]
} );
</cfif>
});
</script>
</cfoutput>
</cfsavecontent>
<cfhtmlhead text="#js#">
<cfoutput>
<div id="container">
<cfif project.recordCount>
<!--- left column --->
<div class="left">
<div class="main">
<div class="header">
<span class="rightmenu">
<cfif session.user.admin or project.msg_edit eq 1>
<a href="editMessage.cfm?p=#url.p#" class="add">Message</a>
</cfif>
<cfif session.user.admin or project.todolist_edit eq 1>
| <a href="editTodolist.cfm?p=#url.p#" class="add">To-do list</a>
</cfif>
<cfif session.user.admin or project.mstone_edit eq 1>
| <a href="editMilestone.cfm?p=#url.p#" class="add">Milestone</a>
</cfif>
<cfif session.user.admin or project.issue_edit eq 1>
| <a href="editIssue.cfm?p=#url.p#" class="add">Issue</a>
</cfif>
</span>
<h2 class="overview">Project overview</h2>
</div>
<div class="content">
<div class="wrapper">
<cfif project.display and compare(project.description,'') and compare(project.description,'<br />')><div class="fs12 mb20">#project.description#</div></cfif>
<cfif project.mstone_view or project.issue_view or project.todolist_view>
<!--- due in next 14 days calendar --->
<cfif project.mstone_view>
<cfquery name="ms_next_14" dbtype="query">
select * from milestones_upcoming where dueDate <=
<cfqueryparam value="#CreateODBCDate(DateAdd("d",13,Now()))#" cfsqltype="CF_SQL_DATE" />
</cfquery>
</cfif>
<cfif project.issue_view>
<cfquery name="issues_next_14" dbtype="query">
select * from issues where dueDate <=
<cfqueryparam value="#CreateODBCDate(DateAdd("d",13,Now()))#" cfsqltype="CF_SQL_DATE" />
</cfquery>
</cfif>
<cfif project.todolist_view>
<cfquery name="todos_next_14" dbtype="query">
select * from todos_upcoming where due <=
<cfqueryparam value="#CreateODBCDate(DateAdd("d",13,Now()))#" cfsqltype="CF_SQL_DATE" />
</cfquery>
</cfif>
<cfif (project.mstone_view and ms_next_14.recordCount) or (project.issue_view and issues_next_14.recordCount) or (project.todolist_view and todos_next_14.recordCount)>
<div class="mb5 b" style="border-bottom:1px solid ##000;">Due in the next 14 days</div>
<cfset theDay = dayOfWeek(now())>
<table border="0" cellpadding="0" cellspacing="1" width="100%" id="milestone_cal">
<tr>
<cfloop index="i" from="0" to="6">
<th>#Left(dayOfWeekAsString(theDay),3)#</th>
<cfset theDay = theDay + 1>
<cfif theDay eq 8>
<cfset theDay = 1>
</cfif>
</cfloop>
</tr>
<cfloop index="i" from="0" to="13">
<cfif i mod 7 eq 0><tr></cfif>
<cfif project.mstone_view>
<cfquery name="todays_ms" dbtype="query">
select milestoneid,name from milestones_upcoming where dueDate =
<cfqueryparam value="#CreateODBCDate(DateAdd("d",i,Now()))#" cfsqltype="CF_SQL_DATE" />
</cfquery>
</cfif>
<cfif project.issue_view>
<cfquery name="todays_issues" dbtype="query">
select issueid,issue from issues where dueDate =
<cfqueryparam value="#CreateODBCDate(DateAdd("d",i,Now()))#" cfsqltype="CF_SQL_DATE" />
</cfquery>
</cfif>
<cfif project.todolist_view>
<cfquery name="todays_todos" dbtype="query">
select todoid,task from todos_upcoming where due =
<cfqueryparam value="#CreateODBCDate(DateAdd("d",i,Now()))#" cfsqltype="CF_SQL_DATE" />
</cfquery>
</cfif>
<cfif i eq 0>
<td class="today"><span class="b">TODAY</span>
<cfelse>
<cfif (project.mstone_view and todays_ms.recordCount) or (project.issue_view and todays_issues.recordCount gt 0)>
<td class="active"><span class="b"><cfif i eq 1 or DatePart("d",DateAdd("d",i,Now())) eq 1>#Left(MonthAsString(Month(DateAdd("d",i,Now()))),3)#</cfif>
#LSDateFormat(DateAdd("d",i,Now()),"d")#</span>
<cfelse>
<td><cfif i eq 1 or DatePart("d",DateAdd("d",i,Now())) eq 1>#Left(MonthAsString(Month(DateAdd("d",i,Now()))),3)#</cfif>
#LSDateFormat(DateAdd("d",i,Now()),"d")#
</cfif>
</cfif>
<ul class="cal_ms">
<cfif project.mstone_view and todays_ms.recordCount>
<cfloop query="todays_ms">
<li><a href="milestone.cfm?p=#url.p#&m=#milestoneID#">#name#</a> (milestone)</li>
</cfloop>
</cfif>
<cfif project.issue_view and todays_issues.recordCount>
<cfloop query="todays_issues">
<li><a href="issue.cfm?p=#url.p#&i=#issueID#">#issue#</a> (issue)</li>
</cfloop>
</cfif>
<cfif project.todolist_view and todays_todos.recordCount>
<cfloop query="todays_todos">
<li><a href="todo.cfm?p=#url.p#&t=#todoID#">#task#</a> (todo)</li>
</cfloop>
</cfif>
</ul>
</td>
<cfif i mod 7 eq 6></tr></cfif>
</cfloop>
</table>
<br />
</cfif>
<cfif project.mstone_view and milestones_overdue.recordCount>
<div class="overdue">
<div class="mb5 b" style="color:##f00;border-bottom:1px solid ##f00;">Late Milestones</div>
<ul class="nobullet">
<cfloop query="milestones_overdue">
<cfset daysDiff = DateDiff("d",dueDate,Now())>
<li><span class="b" style="color:##f00;"><cfif daysDiff eq 0>Today<cfelseif daysDiff eq 1>Yesterday<cfelse>#daysDiff# days ago</cfif>:</span>
<a href="milestone.cfm?p=#projectID#&m=#milestoneID#">#name#</a>
<cfif compare(lastName,'')><span class="sm">(#firstName# #lastName# is responsible)</span></cfif>
</li>
</cfloop>
</ul>
</div><br />
</cfif>
<cfif project.mstone_view and milestones_upcoming.recordCount>
<div class="mb5 b" style="border-bottom:1px solid ##000;">
<span style="float:right;font-size:.75em;"><a href="##" onclick="upcoming_milestones('#url.p#','1');$(this).addClass('subactive');$('##threem').removeClass('subactive');$('##all').removeClass('subactive');return false;" class="sublink subactive" id="onem">1 month</a> | <a href="##" onclick="upcoming_milestones('#url.p#','3');$('##onem').removeClass('subactive');$(this).addClass('subactive');$('##all').removeClass('subactive');return false;" class="sublink" id="threem">3 months</a> | <a href="##" onclick="upcoming_milestones('#url.p#','');$('##onem').removeClass('subactive');$('##threem').removeClass('subactive');$(this).addClass('subactive');return false;" class="sublink" id="all">All</a></span>
Upcoming Milestones</div>
<ul class="nobullet" id="upcoming_milestones">
<cfloop query="milestones_upcoming">
<cfset daysDiff = DateDiff("d",CreateDate(year(Now()),month(Now()),day(Now())),dueDate)>
<li><span class="b"><cfif daysDiff eq 0>Today<cfelseif daysDiff eq 1>Tomorrow<cfelse>#daysDiff# days away</cfif>:</span>
<a href="milestone.cfm?p=#projectID#&m=#milestoneID#">#name#</a>
<cfif compare(lastName,'')><span class="sm">(#firstName# #lastName# is responsible)</span></cfif>
</li>
</cfloop>
</ul><br />
</cfif>
<cfif project.todolist_view and todos_overdue.recordCount>
<div class="overdue">
<div class="mb5 b" style="color:##f00;border-bottom:1px solid ##f00;">Late ToDos</div>
<ul class="nobullet">
<cfloop query="todos_overdue">
<cfset daysDiff = DateDiff("d",due,Now())>
<li><span class="b" style="color:##f00;"><cfif daysDiff eq 0>Today<cfelseif daysDiff eq 1>Yesterday<cfelse>#daysDiff# days ago</cfif>:</span>
<a href="todo.cfm?p=#projectID#&t=#todoid#">#task#</a>
<cfif compare(lastName,'')><span class="sm">(#firstName# #lastName# is responsible)</span></cfif>
</li>
</cfloop>
</ul>
</div><br />
</cfif>
<cfif project.todolist_view and todos_upcoming.recordCount>
<div class="mb5 b" style="border-bottom:1px solid ##000;">
<span style="float:right;font-size:.75em;"><a href="##" onclick="upcoming_todos('#url.p#','1');$(this).addClass('subactive');$('##t_threem').removeClass('subactive');$('##t_all').removeClass('subactive');return false;" class="sublink subactive" id="t_onem">1 month</a> | <a href="##" onclick="upcoming_todos('#url.p#','3');$('##t_onem').removeClass('subactive');$(this).addClass('subactive');$('##all').removeClass('subactive');return false;" class="sublink" id="t_threem">3 months</a> | <a href="##" onclick="upcoming_todos('#url.p#','');$('##onem').removeClass('subactive');$('##t_threem').removeClass('subactive');$(this).addClass('subactive');return false;" class="sublink" id="t_all">All</a></span>
Upcoming Todos</div>
<ul class="nobullet" id="upcoming_todos">
<cfloop query="todos_upcoming">
<cfset daysDiff = DateDiff("d",CreateDate(year(Now()),month(Now()),day(Now())),due)>
<li><span class="b"><cfif daysDiff eq 0>Today<cfelseif daysDiff eq 1>Tomorrow<cfelse>#daysDiff# days away</cfif>:</span>
<a href="todo.cfm?p=#projectID#&t=#todoID#">#task#</a>
<cfif compare(lastName,'')><span class="sm">(#firstName# #lastName# is responsible)</span></cfif>
</li>
</cfloop>
</ul><br />
</cfif>
</cfif>
<cfif project.issue_view and issues.recordCount>
<div style="border:1px solid ##ddd;" class="mb20">
<div style="background-color:##eee;font-weight:bold;font-size:1.2em;padding:5px;margin-bottom:1px;">
Open Issues
</div>
<table class="activity table table-striped" id="issues">
<thead>
<tr>
<th>ID</th>
<th>Type</th>
<th>Severity</th>
<th>Status</th>
<th>Issue</th>
<th>Assigned To</th>
<th>Reported</th>
<th>Updated</th>
<th>Due Date</th>
</tr>
</thead>
<tbody>
<cfset thisRow = 1>
<cfloop query="issues">
<tr>
<td><a href="issue.cfm?p=#url.p#&i=#issueID#">#shortID#</a></td>
<td>#type#</td>
<td>#severity#</td>
<td>#status#</td>
<td><a href="issue.cfm?p=#url.p#&i=#issueID#">#issue#</a></td>
<td>#assignedFirstName# #assignedLastName#</td>
<td>#LSDateFormat(DateAdd("h",session.tzOffset,created),"mmm dd, yyyy")#</td>
<td><cfif isDate(updated)>#LSDateFormat(DateAdd("h",session.tzOffset,updated),"mmm dd, yyyy")#</cfif></td>
<td><cfif isDate(dueDate)>#LSDateFormat(dueDate,"mmm dd, yyyy")#</cfif></td>
</tr>
<cfset thisRow = thisRow + 1>
</cfloop>
</tbody>
</table>
</div>
</cfif>
<cfif activity.recordCount>
<div style="border:1px solid ##ddd;">
<div style="background-color:##eee;font-weight:bold;font-size:1.2em;padding:5px;margin-bottom:1px;">
<span class="feedlink"><a href="rss.cfm?u=#session.user.userID#&p=#url.p#&type=act" class="feed">RSS Feed</a></span>Recent Activity
</div>
<table class="activity table table-striped" id="activity">
<thead>
<tr>
<th>Type</th>
<th>Title</th>
<th>Action</th>
<th>User</th>
<th>Timestamp</th>
</tr>
</thead>
<tbody>
<cfset thisRow = 1>
<cfloop query="activity">
<cfif session.user.admin or ((not compareNoCase(type,'issue') and project.issue_view eq 1) or (not compareNoCase(type,'message') and project.msg_view eq 1) or (not compareNoCase(type,'milestone') and project.mstone_view eq 1) or (not compareNoCase(type,'to-do list') and project.todolist_view eq 1) or (not compareNoCase(type,'file') and project.file_view eq 1))>
<tr><td><div class="catbox
<cfswitch expression="#type#">
<cfcase value="Issue">issue">Issue</cfcase>
<cfcase value="Message">message">Message</cfcase>
<cfcase value="Milestone">milestone">Milestone</cfcase>
<cfcase value="To-Do List">todolist">To-Do List</cfcase>
<cfcase value="File">file">File</cfcase>
<cfcase value="Project">project">Project</cfcase>
<cfcase value="Screenshot">screenshot">Screenshot</cfcase>
<cfdefaultcase>#type#">#type#</cfdefaultcase>
</cfswitch>
</div></td>
<td><cfswitch expression="#type#">
<cfcase value="Issue"><a href="issue.cfm?p=#url.p#&i=#id#">#name#</a></cfcase>
<cfcase value="Message"><a href="message.cfm?p=#url.p#&m=#id#">#name#</a></cfcase>
<cfcase value="Milestone"><a href="milestones.cfm?p=#url.p#&m=#id#">#name#</a></cfcase>
<cfcase value="To-Do"><a href="todos.cfm?p=#url.p###id_#id#">#name#</a></cfcase>
<cfcase value="To-Do List"><a href="todos.cfm?p=#url.p#&t=#id#">#name#</a></cfcase>
<cfcase value="File"><a href="file.cfm?p=#url.p#&f=#id#">#name#</a></cfcase>
<cfcase value="Project"><a href="project.cfm?p=#url.p#">#name#</a></cfcase>
<cfcase value="Screenshot"><a href="issue.cfm?p=#url.p#&i=#id###screen">#name#</a></cfcase>
<cfdefaultcase>#name#</cfdefaultcase>
</cfswitch>
</td>
<td class="g">#activity# by</td>
<td>#firstName# #lastName#</td>
<td>#LSDateFormat(DateAdd("h",session.tzOffset,stamp),"mmm d, yyyy")# <cfif application.settings.clockHours eq 12>#LSTimeFormat(DateAdd("h",session.tzOffset,stamp),"h:mmtt")#<cfelse>#LSTimeFormat(DateAdd("h",session.tzOffset,stamp),"HH:mm")#</cfif></td>
</tr>
<cfset thisRow = thisRow + 1>
</cfif>
</cfloop>
</tbody>
</table>
</div>
<cfelse>
<div class="warn">There is no recent activity.</div>
</cfif>
</div>
</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 compare(project.clientID,'')>
<div class="header"><h3>Client</h3></div>
<div class="content">
<ul>
<li>#project.clientName#</li>
</ul>
</div>
</cfif>
<div class="header"><h3>Project Owner</h3></div>
<div class="content">
<ul>
<li>#project.ownerFirstName# #project.ownerLastName#</li>
</ul>
</div>
<div class="header"><h3>Status</h3></div>
<div class="content">
<ul>
<li>#project.status#</li>
</ul>
</div>
<div class="header"><h3>People on this project</h3></div>
<div class="content">
<ul class="people">
<cfloop query="projectUsers">
<li><div class="b">#firstName# #lastName#<cfif admin> (admin)</cfif></div>
<div class="sm g norm"><cfif compare(userID,session.user.userID)><cfif isDate(lastLogin)>Last login
#request.udf.relativeTime(DateAdd("h",session.tzOffset,lastLogin))#
<cfelse>Never logged in</cfif><cfelse>Currently logged in</cfif></div></li>
</cfloop>
</ul>
</div>
<cfif not session.user.admin and projects.recordCount eq 1 and allow_reg_projects.recordCount>
<div class="header"><h3>Projects you can join</h3></div>
<div class="content">
<ul>
<cfloop query="allow_reg_projects">
<li><a href="index.cfm?reg=1&p=#projectID#">#name#</a></li>
</cfloop>
</ul>
</div>
</cfif>
</div>
<cfelse>
<img src="./images/alert.gif" height="16" width="16" alt="Alert!" style="vertical-align:middle;" /> Project Not Found.
</cfif>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">