-
Notifications
You must be signed in to change notification settings - Fork 7
/
editMilestone.cfm
237 lines (206 loc) · 9.29 KB
/
editMilestone.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
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfparam name="form.completed" default="0">
<cfif StructKeyExists(form,"milestoneID")> <!--- update milestone --->
<cfif not compare(form.description,'<br />')>
<cfset form.description = "">
</cfif>
<cfset application.milestone.update(form.milestoneID,form.projectid,form.name,createDate(form.y,form.m,form.d),form.description,form.forID,form.rate,form.completed)>
<cfset application.activity.add(createUUID(),form.projectid,session.user.userid,'Milestone',form.milestoneID,form.name,'edited')>
<cfset application.notify.milestoneUpdate(form.projectid,form.milestoneID)>
<cfset project = application.project.get(projectID=form.projectid)>
<cfif application.settings.googlecal_enable and compare(project.googlecal,'') and isDate(createDate(form.y,form.m,form.d))>
<cfset application.calendar.milestoneUpdate(form.milestoneID,form.projectid,form.name,form.description,createDate(form.y,form.m,form.d),session.user.userid)>
</cfif>
<cfif StructKeyExists(url,"one")>
<cflocation url="milestone.cfm?p=#form.projectID#&m=#form.milestoneid#" addtoken="false">
<cfelse>
<cflocation url="milestones.cfm?p=#form.projectID#" addtoken="false">
</cfif>
<cfelseif StructKeyExists(form,"projectID")> <!--- add milestone --->
<cfset newID = createUUID()>
<cfif not compare(form.description,'<br />')>
<cfset form.description = "">
</cfif>
<cfset application.milestone.add(newID,form.projectID,form.name,createDate(form.y,form.m,form.d),form.description,form.forID,form.rate,form.completed,session.user.userid)>
<cfset application.activity.add(createUUID(),form.projectid,session.user.userid,'Milestone',newID,form.name,'added')>
<cfset application.notify.milestoneNew(form.projectid,newID)>
<cfset project = application.project.get(projectID=form.projectid)>
<cfif application.settings.googlecal_enable and compare(project.googlecal,'') and isDate(createDate(form.y,form.m,form.d))>
<cfset application.calendar.milestoneAdd(newID,form.projectid,form.name,form.description,createDate(form.y,form.m,form.d),session.user.userid)>
</cfif>
<cflocation url="milestones.cfm?p=#form.projectID#" addtoken="false">
</cfif>
<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>
<cfset projectUsers = application.project.projectUsers(url.p)>
<cfif not session.user.admin and not project.mstone_edit eq 1>
<cfoutput><h2>You do not have permission to <cfif StructKeyExists(url,"m")>edit<cfelse>add</cfif> milestones!!!</h2></cfoutput>
<cfabort>
</cfif>
<cfparam name="thisDay" default="#Day(Now())#">
<cfparam name="thisMonth" default="#Month(Now())#">
<cfparam name="thisYear" default="#Month(Now())#">
<cfparam name="name" default="">
<cfparam name="description" default="">
<cfparam name="rate" default="">
<cfparam name="variables.isCompleted" default="false">
<cfparam name="title_action" default="Add">
<cfif StructKeyExists(url,"m")>
<cfset thisMilestone = application.milestone.get(url.p,url.m)>
<cfset thisDay = datePart("d",thisMilestone.dueDate)>
<cfset thisMonth = datePart("m",thisMilestone.dueDate)>
<cfset thisYear = datePart("yyyy",thisMilestone.dueDate)>
<cfset name = thisMilestone.name>
<cfset description = thisMilestone.description>
<cfset rate = thisMilestone.rate>
<cfset variables.isCompleted = isDate(thisMilestone.completed)>
<cfset title_action = "Edit">
</cfif>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#project.name# » #title_action# Milestone" project="#project.name#" projectid="#url.p#" svnurl="#project.svnurl#">
<cfhtmlhead text="<script type='text/javascript'>
function confirmSubmit() {
var errors = '';
if (document.edit.name.value == '') {errors = errors + ' ** You must enter a milestone name.\n';}
if (errors != '') {
alert('Please correct the following errors:\n\n' + errors)
return false;
} else return true;
}
$(document).ready(function(){
$('##name').focus();
$('##duedate').jcalendar();
});
</script>
<script type='text/javascript' src='#application.settings.mapping#/js/jcalendar.js'></script>
<link rel='stylesheet' href='#application.settings.mapping#/css/jcalendar.css' media='screen,projection' type='text/css' />
">
<cfoutput>
<div id="container">
<cfif project.recordCount>
<!--- left column --->
<div class="left">
<div class="main">
<div class="header">
<span class="rightmenu">
<a href="javascript:history.back();" class="cancel">Cancel</a>
</span>
<h2 class="msg"><cfif StructKeyExists(url,"m")>Edit<cfelse>Add new</cfif> milestone <span style="font-size:.75em;font-weight:normal;color:##666;">Today is #LSDateFormat(DateAdd("h",session.tzOffset,DateConvert("local2Utc",Now())),"d mmm")#</span></h2>
</div>
<div class="content">
<form action="#cgi.script_name#?#cgi.query_string#" method="post" name="edit" id="edit" class="frm pb15" onsubmit="return confirmSubmit();">
<div style="padding:0 15px;float:left;margin-bottom:50px;border-right:2px solid ##ddd;height:400px;">
<strong>* When is it due?</strong>
<div id="duedate">
<div class="jcalendar-wrapper">
<div class="jcalendar-selects">
<select name="d" id="day" class="jcalendar-select-day">
<option value="0"></option>
<cfloop from="1" to="31" index="i">
<option value="#i#"<cfif thisDay eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
<select name="m" id="month" class="jcalendar-select-month">
<option value="0"></option>
<cfloop from="1" to="12" index="i">
<option value="#i#"<cfif thisMonth eq i> selected="selected"</cfif>>#MonthAsString(i)#</option>
</cfloop>
</select>
<select name="y" id="year" class="jcalendar-select-year">
<option value="0"></option>
<cfloop from="#Year(Now())-1#" to="#Year(Now())+5#" index="i">
<option value="#i#"<cfif thisYear eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
</div>
</div>
</div>
</div>
<div>
<div style="margin:10px 0;">
<label for="name" class="req">Name:</label>
<input type="text" name="name" id="name" value="#HTMLEditFormat(name)#" maxlength="50" style="width:350px;padding:2px;" />
</div>
<div style="margin:10px 0;">
<label for="description">Description:</label>
<cfif session.mobileBrowser>
<textarea name="description" id="description">#description#</textarea>
<cfelse>
<cfscript>
basePath = 'includes/fckeditor/';
fckEditor = createObject("component", "#basePath#fckeditor");
fckEditor.instanceName = "description";
fckEditor.value = '#description#';
fckEditor.basePath = basePath;
fckEditor.width = 360;
fckEditor.height = 300;
fckEditor.ToolbarSet = "Basic";
fckEditor.create(); // create the editor.
</cfscript>
</cfif>
</div>
<div style="margin:10px 0;">
<label for="forwho">Who's Responsible?</label>
<select name="forID" id="forwho">
<cfloop query="projectUsers">
<option value="#userID#"<cfif StructKeyExists(url,"m")><cfif not compare(thisMilestone.forID,userID)> selected="selected"</cfif><cfelseif not compare(session.user.userid,userID)> selected="selected"</cfif>>#lastName#, #firstName#</option>
</cfloop>
</select>
</div>
<cfif project.tab_billing and (session.user.admin or project.bill_edit eq 1)>
<div>
<label for="rate">Rate:</label>
$ <input type="text" name="rate" id="rate" value="#HTMLEditFormat(rate)#" maxlength="8" style="width:100px;padding:2px;" />
</div>
<cfelse>
<input type="hidden" name="rate" value="#rate#" />
</cfif>
<div style="margin:10px 0;">
<label for="completed">Completed?</label>
<input type="checkbox" name="completed" id="completed" value="1" class="checkbox"<cfif variables.isCompleted> checked="checked"</cfif> />
</div>
<div style="margin:10px 0;">
<label for="submit"> </label>
<cfif StructKeyExists(url,"m")>
<input type="submit" class="button" name="submit" id="submit" value="Update Milestone" onclick="return confirmSubmit();" />
<input type="hidden" name="milestoneID" value="#url.m#" />
<cfelse>
<input type="submit" class="button" name="submit" id="submit" value="Add Milestone" />
</cfif>
<input type="button" class="button" name="cancel" value="Cancel" onclick="history.back();" />
<input type="hidden" name="projectID" value="#url.p#" />
</div>
</div>
<br style="clear:both" />
</form>
</div>
</div>
<div class="bottom"> </div>
<div class="footer">
<cfinclude template="footer.cfm">
</div>
</div>
<!--- right column --->
<div class="right">
<!---
<div class="textheader"><h3>Categories</h3></div>
<div class="content">
<ul>
</ul>
</div>
--->
</div>
<cfelse>
<div class="alert">Project Not Found.</div>
</cfif>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">