/
email_accounts.tpl.html
279 lines (275 loc) · 10.7 KB
/
email_accounts.tpl.html
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
{extends "manage/manage.tpl.html"}
{block "manage_content"}
<script type="text/javascript">
<!--
function validateForm()
{
var f = $('#email_account_form');
if (f.find('[name=project]').val() == -1) {
alert('{t escape=js}Please choose the project to be associated with this email account.{/t}');
Validation.selectField('project');
return false;
}
if (f.find('[name=type]').val() == -1) {
alert('{t escape=js}Please choose the type of email server to be associated with this email account.{/t}');
Validation.selectField('type');
return false;
}
if (Validation.isFieldWhitespace('hostname')) {
alert('{t escape=js}Please enter the hostname for this email account.{/t}');
Validation.selectField('hostname');
return false;
}
var port_val = f.find('[name=port]').val();
if (Validation.isWhitespace(port_val)) {
alert('{t escape=js}Please enter the port number for this email account.{/t}');
Validation.selectField('port');
return false;
}
if (!Validation.isNumberOnly(port_val)) {
alert('{t escape=js}Please enter a valid port number for this email account.{/t}');
Validation.selectField('port');
return false;
}
var server_type = f.find('[name=type]').val();
if ((server_type.indexOf('imap') != -1) && (Validation.isFieldWhitespace('folder'))) {
alert('{t escape=js}Please enter the IMAP folder for this email account.{/t}');
Validation.selectField('folder');
return false;
}
if (Validation.isFieldWhitespace('username')) {
alert('{t escape=js}Please enter the username for this email account.{/t}');
Validation.selectField('username');
return false;
}
var password = Eventum.getField('password').val();
if (!Validation.isWhitespace(password) && password.length < 6) {
alert('{t escape=js}Please enter a password of at least 6 characters.{/t}');
Validation.selectField('password');
return false;
}
return true;
}
function toggleFolderField()
{
var element = $('#imap_folder');
var folder = element.find('input[name=folder]');
if ($('select[name=type]').val().indexOf('imap') != -1) {
element.show();
folder[0].disabled = false;
} else {
element.hide();
folder[0].disabled = true;
}
}
function checkDelete(f)
{
if (!Validation.hasOneChecked('items[]')) {
alert('{t escape=js}Please select at least one of the accounts.{/t}');
return false;
}
if (!confirm('{t escape=js}This action will remove the selected entries.{/t}')) {
return false;
} else {
return true;
}
}
$().ready(function() {
toggleFolderField();
$('#email_account_form').submit(validateForm);
$('.select_all').click(function() { Eventum.toggleCheckAll('items[]'); });
$('#testSettings').click(function(event) {
event.preventDefault();
$('#full_width_messages').removeClass().html('Please wait.. testing connection.').addClass('info');
var serializedData = $('#email_account_form').serialize();
$.ajax({
type: "POST",
url: "check_email_settings.php",
data: serializedData
}).done(function(response) {
$('#full_width_messages').html(response);
});
});
});
//-->
</script>
<form id="email_account_form" method="post">
{if $smarty.get.cat|default:'' == 'edit'}
<input type="hidden" name="cat" value="update">
<input type="hidden" name="id" value="{$smarty.get.id|intval}">
{else}
<input type="hidden" name="cat" value="new">
{/if}
<table class="bordered">
<tr class="title">
<th colspan="2">
{t}Manage Email Accounts{/t}
</th>
</tr>
<tr>
<th width="100">
<nobr>{t}Associated Project{/t}</nobr>
</th>
<td width="80%">
<select name="project">
<option value="-1"></option>
{html_options options=$all_projects selected=$info.ema_prj_id|default:''}
</select>
{include file="error_icon.tpl.html" field="project"}
</td>
</tr>
<tr>
<th width="100">
{t}Type{/t}
</th>
<td width="80%">
<select name="type" onChange="toggleFolderField(this.form);">
<option value="-1"></option>
<option value="imap" {if $info.ema_type|default:'' == 'imap'}selected{/if}>{t}IMAP{/t}</option>
<option value="imap/ssl" {if $info.ema_type|default:'' == 'imap/ssl'}selected{/if}>{t}IMAP over SSL{/t}</option>
<option value="imap/ssl/novalidate-cert" {if $info.ema_type|default:'' == 'imap/ssl/novalidate-cert'}selected{/if}>{t}IMAP over SSL (self-signed){/t}</option>
<option value="imap/notls" {if $info.ema_type|default:'' == 'imap/notls'}selected{/if}>{t}IMAP, no TLS{/t}</option>
<option value="imap/tls" {if $info.ema_type|default:'' == 'imap/tls'}selected{/if}>{t}IMAP, with TLS{/t}</option>
<option value="imap/tls/novalidate-cert" {if $info.ema_type|default:'' == 'imap/tls/novalidate-cert'}selected{/if}>{t}IMAP, with TLS (self-signed){/t}</option>
<option value="pop3" {if $info.ema_type|default:'' == 'pop3'}selected{/if}>{t}POP3{/t}</option>
<option value="pop3/ssl" {if $info.ema_type|default:'' == 'pop3/ssl'}selected{/if}>{t}POP3 over SSL{/t}</option>
<option value="pop3/ssl/novalidate-cert" {if $info.ema_type|default:'' == 'pop3/ssl/novalidate-cert'}selected{/if}>{t}POP3 over SSL (self-signed){/t}</option>
<option value="pop3/notls" {if $info.ema_type|default:'' == 'pop3/notls'}selected{/if}>{t}POP3, no TLS{/t}</option>
<option value="pop3/tls" {if $info.ema_type|default:'' == 'pop3/tls'}selected{/if}>{t}POP3, with TLS{/t}</option>
<option value="pop3/tls/novalidate-cert" {if $info.ema_type|default:'' == 'pop3/tls/novalidate-cert'}selected{/if}>{t}POP3, with TLS (self-signed){/t}</option>
</select>
</td>
</tr>
<tr>
<th width="100">
{t}Hostname{/t}
</th>
<td width="80%">
<input type="text" name="hostname" size="30" value="{$info.ema_hostname|default:''|escape:"html"}">
{include file="error_icon.tpl.html" field="hostname"}
</td>
</tr>
<tr>
<th width="100">
{t}Port{/t}
</th>
<td width="80%">
<input type="text" name="port" size="10" value="{$info.ema_port|default:''}"> <span>{t}(Tip: port defaults are 110 for POP3 servers and 143 for IMAP ones){/t}</span>
{include file="error_icon.tpl.html" field="port"}
</td>
</tr>
<tr id="imap_folder">
<th width="100">
{t}IMAP Folder{/t}
</th>
<td width="80%">
<input type="text" name="folder" size="20" value="{if $info.ema_folder|default:'' == ""}INBOX{else}{$info.ema_folder}{/if}"> <span>{t}(default folder is INBOX){/t}</span>
{include file="error_icon.tpl.html" field="folder"}
</td>
</tr>
<tr>
<th width="100">
{t}Username{/t}
</th>
<td width="80%">
<input type="text" name="username" size="20" value="{$info.ema_username|default:''|escape:"html"}">
{include file="error_icon.tpl.html" field="username"}
</td>
</tr>
<tr>
<th width="100">
{t}Password{/t}
</th>
<td width="80%">
<input type="password" name="password" size="20" value="" autocomplete="off">
<span>({t}leave empty to keep the current password{/t})</span>
{include file="error_icon.tpl.html" field="password"}
</td>
</tr>
<tr>
<th width="100">
{t}Advanced Options{/t}
</th>
<td width="80%">
<label>
<input type="checkbox" name="get_only_new" value="1" {if $info.ema_get_only_new|default:''}checked{/if}>
{t}Only Download Unread Messages{/t}
</label><br />
<label>
<input type="checkbox" name="leave_copy" value="1" {if $smarty.get.cat|default:'' == 'edit'}{if $info.ema_leave_copy|default:''}checked{/if}{else}checked{/if}>
{t}Leave Copy of Messages On Server{/t}
</label><br />
<label>
<input type="checkbox" name="use_routing" value="1" {if $info.ema_use_routing|default:''}checked{/if}>
{t escape="none"}Use account for non-subject based email/note/draft routing.{/t}
</label><br />
{t}Note{/t}: {t}If you check this, you cannot leave a copy of messages on the server.{/t}
</td>
</tr>
<tr class="buttons">
<td colspan="2">
<input id="testSettings" type="button" value="{t}Test Settings{/t}">
{if $smarty.get.cat|default:'' == 'edit'}
<input type="submit" value="{t}Update Account{/t}">
{else}
<input type="submit" value="{t}Create Account{/t}">
{/if}
<input type="reset" value="{t}Reset{/t}">
</td>
</tr>
</table>
</form>
<form onSubmit="return checkDelete(this);" method="post">
<input type="hidden" name="cat" value="delete">
<table class="bordered grid">
<tr class="title">
<th colspan="2">
{t}Existing Accounts{/t}
</th>
</tr>
<tr>
<th width="4" nowrap><input type="button" value="{t}All{/t}" class="select_all"></th>
<th> {t}Associated Project{/t}</th>
<th> {t}Hostname{/t}</th>
<th> {t}Type{/t}</th>
<th> {t}Port{/t}</th>
<th> {t}Username{/t}</th>
<th> {t}Mailbox{/t}</th>
<th> {t}Auto-Creation of Issues{/t}</th>
</tr>
{section name="i" loop=$list}
<tr class="{cycle values='odd,even'}">
<td width="4" align="center" nowrap><input type="checkbox" name="items[]" value="{$list[i].ema_id}"></td>
<td> {$list[i].prj_title|escape:"html"}</td>
<td width="30%">
<a href="{$core.rel_url}manage/email_accounts.php?cat=edit&id={$list[i].ema_id}" title="{t}update this entry{/t}">{$list[i].ema_hostname|escape:"html"}</a></td>
<td> {$list[i].ema_type}</td>
<td> {$list[i].ema_port}</td>
<td> {$list[i].ema_username|escape:"html"}</td>
<td> {$list[i].ema_folder}</td>
<td> <a href="issue_auto_creation.php?ema_id={$list[i].ema_id}">{strip}
{if $list[i].ema_issue_auto_creation}
{t}Enabled{/t}
{else}
{t}Disabled{/t}
{/if}
{/strip}</a></td>
</tr>
{sectionelse}
<tr class="no_results">
<td colspan="8">
{t}No email accounts could be found.{/t}
</td>
</tr>
{/section}
<tr class="buttons">
<td width="4" align="center">
<input type="button" value="{t}All{/t}" class="select_all">
</td>
<td colspan="7" align="center">
<input type="submit" value="{t}Delete{/t}">
</td>
</tr>
</table>
</form>
{/block}