-
Notifications
You must be signed in to change notification settings - Fork 4
/
top.cfm
executable file
·412 lines (367 loc) · 13.4 KB
/
top.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
<!---
Name : C:\JRun4\servers\cfmx7\cf\CFIDE\administrator\spoolmail\top.cfm
Author : Raymond Camden
Created : 01/16/06
Last Updated : 12/17/06
History : Fixes by Scott Krebs ([email protected]) to handle 0-length files. (rkc 1/26/06)
: Select All functionality by Steve 'Cutter' Blades (no.junk at comcast.net) (rkc 1/27/06)
: Paging, show size (rkc 12/7/06)
: html fix (rkc 12/17/06)
--->
<cfif structKeyExists(form,"start") and IsNumeric(form.start) and Not structKeyExists(url,"start")>
<cfset url.start = form.start>
</cfif>
<cfif structKeyExists(form,"zPerPage") and IsNumeric(form.zPerPage) and form.zPerPage NEQ application.perpage>
<cfset application.perpage = form.zPerPage>
</cfif>
<cfif structKeyExists(url,"PerPage") and IsNumeric(url.PerPage) and url.PerPage NEQ application.perpage>
<cfset application.perpage = url.PerPage>
</cfif>
<cfif structKeyExists(form,"delete_id") and form.delete_id neq "">
<cffile action="delete" file="#application.maildir#/#form.delete_id#">
</cfif>
<cfif (structKeyExists(form,"delete") or structKeyExists(form, "delete.x")) and structKeyExists(form, "doit") and len(form.doit)>
<cfloop index="theFile" list="#form.doit#">
<cfif fileExists(application.maildir & "/" & theFile)>
<cffile action="delete" file="#application.maildir#/#theFile#">
</cfif>
</cfloop>
</cfif>
<cfif (structKeyExists(form,"move") or structKeyExists(form,"move.x")) and structKeyExists(form, "doit") and len(form.doit)>
<cfloop index="theFile" list="#form.doit#">
<cfif fileExists(application.maildir & "/" & theFile)>
<cffile action="move" source="#application.maildir#/#theFile#" destination="#application.spooldir#/#thefile#">
</cfif>
</cfloop>
</cfif>
<!--- TODO: fix line ending issues as this only works on a Windows Box --->
<cfif structKeyExists(form,"server") and structKeyExists(form, "doit") and len(form.doit)>
<cfloop index="theFile" list="#form.doit#">
<cfif fileExists(application.maildir & "/" & theFile)>
<cffile action="read" file="#application.maildir#/#theFile#" variable="vMail">
<cfset vMail = ListRest(vMail,chr(13))>
<cfset vMail = "server: " & form.zServer & vMail>
<cffile action="write" file="#application.spooldir#/#theFile#" output="#vMail#">
<cffile action="delete" file="#application.maildir#/#theFile#">
</cfif>
</cfloop>
</cfif>
<!--- TODO: fix line ending issues as this only works on a Windows Box --->
<cfif structKeyExists(form,"redirect") and structKeyExists(form, "doit") and len(form.doit)>
<cfloop index="theFile" list="#form.doit#">
<cfif fileExists(application.maildir & "/" & theFile) and Len(Form.zRedirect) GT 0>
<cffile action="read" file="#application.maildir#/#theFile#" variable="vMail">
<cfset vPos1 = ListContainsNoCase(vMail, "to: ",chr(13))>
<cfset vTO = ListGetAt(vMail,vPos1,chr(13))>
<cfset vPos2 = ListContainsNoCase(vMail, "subject: ",chr(13))>
<cfset vSubject = ListGetAt(vMail,vPos2,chr(13))>
<cfset vTO = ReplaceNoCase(vTO,"to: ","")>
<cfset vTO = Replace(vTO,chr(10),"")>
<cfset vNewTO = chr(10) & "to: " & form.zRedirect>
<cfset vNewSubj = vSubject & " [" & HTMLEditFormat(vTo) & "]">
<cfset vMail = ListSetAt(vMail,vPos1,vNewTO,chr(13))>
<cfset vMail = ListSetAt(vMail,vPos2,vNewSubj,chr(13))>
<cffile action="write" file="#application.maildir#/#theFile#" output="#vMail#">
</cfif>
</cfloop>
</cfif>
<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lte 0 or url.start neq round(url.start)>
<cfset url.start = 1>
</cfif>
<cfdirectory action="list" name="qMail" directory="#application.maildir#" filter="*.cfmail" sort="datelastmodified desc">
<cfoutput>
<!---
// Author: Steve 'Cutter' Blades (no.junk at comcast.net)
// Revision: Add js scripting for a 'Select All' type checkbox
// Aside from the below javascript the following line are required:
// on the 'Select All' checkbox input element you will need and
// onclick event of 'toggleCheckboxes(this,document.forms.#formname#.#checkfields#)',
// and on the checkbox fields (all of the same id/name) you will need
// an onclick event of 'uncheckSelectAllBox(document.forms.#formname#.#selectallfieldname#,this)
--->
<script language="javascript" type="text/javascript">
// Functions for checking and unchecking all checkboxes passed by name
function toggleCheckboxes(checkItFldObj, fldObj){
if (checkItFldObj.checked){
checkAll(fldObj);
} else {
uncheckAll(fldObj);
}
}
// Function to check all fields
function checkAll(field){
//alert(field.length);
if (!field.length){
field.checked = true;
} else {
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
}
// Function to uncheck all fields
function uncheckAll(field){
//alert(field.length);
if (!field.length){
field.checked = false;
} else {
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
}
// Function to uncheck the 'Select All' checkbox if an item is unchecked
function uncheckSelectAllBox(checkItFldObj,fldObj){
if ((fldObj.checked == false) && (checkItFldObj.checked == true))
checkItFldObj.checked = false;
}
//added 6/27/06 by Todd Sharp - function to refresh the bottom iframe.
//this is called onclick of the two submit btns below
function refreshBottom(){
parent.document.getElementById('bottom').src='bottom.cfm';
}
function doHide(vElement)
{
var oRef = document.getElementById(vElement)
switch(oRef.style.display)
{
case 'none':
oRef.style.display = 'block';
break;
case 'block':
oRef.style.display = 'none';
break;
default:
break;
}
}
function doPerPage(oRef)
{
var oPage = document.getElementById('PerPage')
oRef.href = oRef.href + "&PerPage=" + oPage.value;
}
function doDelete(id) {
var dID = document.getElementById('delete_id');
dID.value = id;
document.MailRecords.submit();
}
</script>
<style>
##gradient-style {
font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size:12px;
width:94%;
text-align:left;
border-collapse:collapse;
margin:20px;
}
##gradient-style th {
font-size:13px;
font-weight:normal;
background:##b9c9fe url("images/gradhead.png") repeat-x;
border-top:2px solid ##d3ddff;
border-bottom:1px solid ##fff;
color:##039;
padding:8px;
}
##gradient-style td {
border-bottom:1px solid ##fff;
color:##669;
border-top:1px solid ##fff;
background:##e8edff url("images/gradback.png") repeat-x;
padding:8px;
}
##gradient-style tfoot tr td {
background:##e8edff;
font-size:12px;
color:##99c;
}
##gradient-style tbody tr:hover td {
background:##d0dafd url("images/gradhover.png") repeat-x;
color:##339;
}
tr {
border-color:inherit;
display:table-row;
vertical-align:inherit;
}
td, p {
font-family: Arial;
font-size: 11px;
}
th {
font-family: Arial;
font-size: 11px;
font-weight: bold;
}
.rowA {
background-color: ##e2fee6;
}
.rowB {
background-color: ##ffffff;
}
.header {
background-color: ##B9C9FE;
border-bottom:10px solid white;
font-weight:13px;
padding:8px;
}
td a {
color: black;
}
.box {
background-color:##ffffcc;
border: 1px solid ##cccccc;
padding: 0px 2px;
}
##hBox {
position: absolute;
left: 15px;
top: 50px;
background-color: white;
border: 2px solid black;
padding: 10px;
text-align: right;
}
##mailbar {
position: relative;
margin: 0px 0px 5px 0px;
padding-left:10px;
width:94%;
}
##mButtons {
float: left;
padding-left:12px;
margin-top:8px;
}
##pageCount {
float: right;
text-align: right;
font-family: Arial;
font-size: small;
padding-right:60px;
margin-top:8px;
}
</style>
<cfoutput>
<form action="top.cfm" method="post" name="mailStatus">
<input type="Hidden" name="start" value="#url.start#"
<div id="mailbar">
<div id="mButtons">
<input type="Image" name="reload" onClick="refreshBottom();" src="images/reload.png" value="reload" alt="reload" title="reload">
<cfif qMail.recordCount>
<img src="images/pixel.gif">
<input type="Image" name="delete" src="images/delete.png" onClick="refreshBottom();" value="delete" alt="delete email" title="delete email">
<img src="images/pixel.gif">
<input type="Image" name="move" src="images/respool.png" onClick="refreshBottom();" value="move" alt="reprocess email" title="reprocess email">
<!---
<img src="images/sep.jpg">
<input type="Image" name="server" src="images/server.jpg" value="server" onClick="refreshBottom();" alt="Change EMail Server" title="change email server">
<input type="Image" name="redirect" src="images/redirect.jpg" value="redirect" alt="redirect email" title="redirect email">
<img src="images/show.jpg" onclick="doHide('hBox');" alt="get server / redirect info" title="get server / redirect info">
--->
</cfif>
</div>
<div ID="hBox" style="display:none;">
server: <input type="Text" name="zServer" value="username:password@server:port" maxlength="80" size="70" class="box"><br>
redirect: <input type="Text" name="zRedirect" value="[email protected]" maxlength="80" size="70" class="box">
</div>
</cfoutput>
<cfif url.Start GT qMail.recordCount>
<cfset url.start = qMail.recordCount - application.perpage>
<cfif url.start LTE 0>
<cfset url.start = 1>
</cfif>
</cfif>
<div id="pageCount">
queue as of <b>#DateFormat(now(),"d-mmm-yyyy")# #TimeFormat(now(),"H:mm:ss")#</b><br>
<cfif qMail.recordCount and qMail.recordCount GT application.perpage>
<cfif url.start gt 1>
<a href="top.cfm?start=#url.start-application.perpage#" onclick="doPerPage(this)">Previous</a>
<cfelse>
Previous
</cfif>
/
<cfif url.start + application.perpage lt qMail.recordCount>
<a href="top.cfm?start=#url.start+application.perpage#" onclick="doPerPage(this)">Next</a>
<cfelse>
Next
</cfif>
#url.start# - #min(url.start+application.perpage, qMail.recordcount)# of #qMail.recordcount# emails
<cfelseif qMail.recordCount GT 0>
#url.start# - #min(url.start+application.perpage, qMail.recordcount)# emails
</cfif>
<cfif qMail.recordCount GT 0>
<select name="zPerPage" id="PerPage">
<cfloop index="x" list="5,10,15,20,25,50,75,100">
<cfif x EQ application.perpage>
<option value="#x#" selected>#x#</option>
<cfelse>
<option value="#x#">#x#</option>
</cfif>
</cfloop>
</select>
</cfif>
</div>
<div style="clear:both;"></div>
</div>
<form action="top.cfm" method="post" name="mailRecords">
<input type="Hidden" name="start" value="#url.start#">
<input type="Hidden" name="delete_id" id="delete_id" value="">
<table width="98%" cellspacing=0 cellpadding=3 border=0 id="gradient-style">
<thead>
<tr class="header">
<th class="norightborder">
<cfif qMail.recordcount gt 1>
<input type="checkbox" name="checkit" id="checkit" onclick="toggleCheckboxes(this,document.forms.mailStatus.doit);" />
All
<cfelse>
</cfif>
</th>
<th>Subject</th>
<th>Sender</th>
<th>To</th>
<th>Size</th>
<th>Date</th>
</tr>
</thead>
</cfoutput>
<cfif qMail.recordCount>
<tbody>
<cfoutput query="qMail" startrow="#url.start#" maxrows="#application.perpage#">
<cfset info = getMail(filename=name, isMailBodyDesired=false)><!--- body can be huge, and isn't needed for list of emails --->
<cfif currentRow mod 2>
<cfset vClass = "class=""rowA""">
<cfelse>
<cfset vClass = "class=""rowB""">
</cfif>
<tr #vClass#>
<!--- Cutter 01.25.06: Split 'Subject' column in two to separate checkboxes from message subjects --->
<td class="norightborder" style="text-align:left">
<!--- Cutter 01.25.06: Add onclick function call to check 'Select All' box --->
<input type="checkbox" name="doit" id="doit" value="#name#" <cfif qMail.recordcount gt 1>onClick="uncheckSelectAllBox(document.forms.mailStatus.checkit,this)"</cfif> />
<!--- add delete button to delete messages individually --->
<input type="Image" name="delete_message" src="images/delete_mail.png" onClick="doDelete('#name#');" value="delete" alt="delete message" title="delete message" />
</td>
<td onclick="parent.bottom.location='bottom.cfm?mail=#urlEncodedFormat(name)#';"><a href="bottom.cfm?mail=#urlEncodedFormat(name)#" target="bottom"><cfif structKeyExists(info,"subject") and len(info.subject)>#info.subject#<cfelse>n/a</cfif></a></td>
<td onclick="parent.bottom.location='bottom.cfm?mail=#urlEncodedFormat(name)#';"><cfif structKeyExists(info, "sender") and len(info.sender)>#info.sender#<cfelse>n/a</cfif></td>
<td onclick="parent.bottom.location='bottom.cfm?mail=#urlEncodedFormat(name)#';"><cfif structKeyExists(info,"to") and len(info.to)>#info.to#<cfelse>n/a</cfif></td>
<td onclick="parent.bottom.location='bottom.cfm?mail=#urlEncodedFormat(name)#';">#fncFileSize(size)#</td>
<td onclick="parent.bottom.location='bottom.cfm?mail=#urlEncodedFormat(name)#';"><cfif structKeyExists(info, "sent") and isDate(info.sent)>#dateFormat(info.sent)# #timeFormat(info.sent)#<cfelse>n/a</cfif></td>
</tr>
</cfoutput>
</tbody>
<cfelse>
<cfoutput>
<tr>
<td colspan="6">Sorry, but there is no mail in the undelivered folder.</td>
</tr>
</cfoutput>
</cfif>
<cfoutput>
</table>
</form>
</cfoutput>
<cfoutput>
</form>
</cfoutput>