forked from cfjedimaster/ColdFusion-Blog-Aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.cfm
93 lines (73 loc) · 2.47 KB
/
email.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
<!---
Name : email.cfm
Author : Raymond Camden
Created : August 5, 2007
Last Updated :
History :
Purpose :
--->
<cfset doneFlag = false>
<cfset errors = "">
<cfif structKeyExists(form, "selected") and form.selected is "email">
<cfif not structKeyExists(form, "dailyall")>
<cfset application.emailalert.removeDailyAll(session.user.getID())>
<cfelse>
<cfset application.emailalert.addDailyAll(session.user.getID())>
</cfif>
<cfif not structKeyExists(form, "dailytop")>
<cfset application.emailalert.removeDailyTop(session.user.getID())>
<cfelse>
<cfset application.emailalert.addDailyTop(session.user.getID())>
</cfif>
<cfif len(trim(form.newalert))>
<cfset application.emailalert.addAlert(session.user.getID(), trim(left(form.newalert,255)))>
</cfif>
<cfset doneFlag = true>
</cfif>
<cfif structKeyExists(url, "deletealert") and isNumeric(url.deletealert) and url.deletealert gte 1 and round(url.deletealert) is url.deletealert>
<cfset application.emailalert.deleteAlert(url.deletealert, session.user.getID())>
</cfif>
<cfset subtodailyall = application.emailalert.subscribedToDailyAll(session.user.getID())>
<cfset subtodailytop = application.emailalert.subscribedToDailyTop(session.user.getID())>
<cfset emailalerts = application.emailalert.getAlertsForUser(session.user.getID())>
<cfif doneFlag>
<p>
<b>Email preferences updated.</b>
</p>
</cfif>
<cfoutput>
<cfif len(errors)>
<p>
<b>Please correct these errors:<br/>#errors#</b>
</p>
</cfif>
<cfform action="email.cfm" method="post">
<p>
<label>Subscribe to daily email (all entries):</label>
<input name="dailyall" value="" type="checkbox" <cfif subtodailyall>checked</cfif> /> Yes
<label>Subscribe to daily email (top 10 entries):</label>
<input name="dailytop" value="" type="checkbox" <cfif subtodailytop>checked</cfif> /> Yes
</p>
<p>
<b>Email Alerts:</b><br />
The following lists your email alerts. When #application.siteName# finds a blog entry
that matches your keyword, an email will be sent. #application.siteName# will check your
alerts once an hour.
</p>
<p>
<cfif emailalerts.recordCount is 0>
You do not have any alerts yet.<br />
<cfelse>
<cfloop query="emailalerts">
<a href="#ajaxLink('email.cfm?deletealert=#id#')#">[Delete]</a> #keywords#<br />
</cfloop>
</cfif>
<label>New Alert:</label>
<input name="newalert">
</p>
<p>
<input class="button" type="submit" value="Update"/>
<input type="hidden" name="selected" value="email">
</p>
</cfform>
</cfoutput>