2 /*********************************************************************************
3 * SugarCRM is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
37 /*********************************************************************************
39 * Created On: Oct 17, 2005
40 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
41 * All Rights Reserved.
42 * Contributor(s): Chris Nojima
43 ********************************************************************************/
45 <div id="testSettingsDiv"></div>
46 <div id="selectFoldersDiv"></div>
50 <script type='text/javascript' src='include/javascript/sugar_grp_overlib.js'></script>
52 <form action="index.php" method="post" name="EditView" id="EditView">
53 <input type="hidden" name="module" value="{MODULE}">
54 <input type="hidden" name="record" value="{ID}">
55 <input type="hidden" name="isDuplicate" value=false>
56 <input type="hidden" name="action">
57 <input type="hidden" name="group_id" value="{GROUP_ID}">
58 <input type="hidden" name="return_module">
59 <input type="hidden" name="return_action">
60 <input type="hidden" name="return_id">
61 <input type="hidden" name="personal" value="{PERSONAL}">
62 <input type="hidden" name="searchField" value="">
63 <input type="hidden" id="mailbox_type" name="mailbox_type" value="{MAILBOX_TYPE}">
65 <table width="100%" cellpadding="0" cellspacing="0" border="0">
68 <input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save'; {CHOOSER_SCRIPT} this.form.return_id.value='{RETURN_ID}'; return checkformdata()" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " {IE_DISABLED}>
69 <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
70 <input title="{MOD.LBL_TEST_BUTTON_TITLE}"
72 accessKey="{MOD.LBL_TEST_BUTTON_KEY}"
74 onClick='ie_test_open_popup_with_submit("InboundEmail", "Popup", "Popup", 400, 300, trim(this.form.server_url.value), this.form.protocol.value, trim(this.form.port.value), trim(this.form.email_user.value), Rot13.write(this.form.email_password.value), trim(this.form.mailbox.value), this.form.ssl.checked, this.form.personal.value, "EditView");'
75 name="button" value=" {MOD.LBL_TEST_SETTINGS} " {IE_DISABLED}>
77 <td align="right" width="20%" NOWRAP><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
78 <td align='right'>{ADMIN_EDIT}</td>
82 <div class="edit view">
83 <table width="100%" border=0 cellspacing="{GRIDLINE}" cellpadding="0">
85 <th align="left" scope="row" colspan="1"><h4>{MOD.LBL_BASIC}</h4></th>
89 <td style="vertical-align:bottom;"><a href="javascript:void(0);" onclick="javascript:prefillGmailDefaults();">{APP.LBL_EMAIL_ACCOUNTS_GMAIL_DEFAULTS}</a> </td>
92 <td valign="top" scope="row" width="15%" NOWRAP>
93 <slot>{MOD.LBL_NAME}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
94 <td valign="top" width="35%">
95 <slot><input name='name' tabindex='10' size='30' maxlength='255' type="text" value="{NAME}" {IE_DISABLED}></slot></td>
96 <td valign="top" scope="row">
97 <slot>{MOD.LBL_STATUS}: </slot></td>
98 <td valign="top" width="35%"><slot>
99 <select name='status' tabindex='60' {IE_DISABLED}>{STATUS}</select></slot></td>
102 <td valign="top" scope="row">
103 <slot>{MOD.LBL_SERVER_URL}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
104 <td valign="top" width="35%">
105 <slot><input id='server_url' name='server_url' tabindex='20' size='30' maxlength='100' type="text" value="{SERVER_URL}" {IE_DISABLED}></slot></td>
106 <td valign="top" scope="row">
107 <slot>{MOD.LBL_LOGIN}:
108 <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
109 <td valign="top" width="35%">
110 <slot><input name='email_user' tabindex='70' size='30' maxlength='100' type="text" value="{USER}" autocomplete="off" {IE_DISABLED}></slot></td>
113 <td valign="top" scope="row" width="15%" NOWRAP>
114 <slot>{MOD.LBL_SERVER_TYPE}:
115 <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
116 <td valign="top" width="35%">
118 <select name='protocol' id="protocol" tabindex='30' onchange="toggle_monitored_folder(this); setPortDefault();" {IE_DISABLED}>{PROTOCOL}</select></slot></td>
119 <td valign="top" scope="row">
120 <slot>{MOD.LBL_PASSWORD}:
121 <span class="required">{APP.LBL_REQUIRED_SYMBOL} </slot></td>
122 <td valign="top" width="35%">
124 <input name='email_password' id="email_password" tabindex='80' size='30' maxlength='100' type="password" autocomplete="off" {IE_DISABLED}>
125 <a href="javascript:void(0)" id='email_password_link' onClick="SUGAR.util.setEmailPasswordEdit('email_password')" style="display: none">{APP.LBL_CHANGE_PASSWORD}</a>
129 <td valign="top" scope="row" width="15%" NOWRAP>
130 <slot>{MOD.LBL_PORT}:
131 <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
132 <td valign="top" width="35%">
134 <input name='port' id='port' tabindex="40" value="{PORT}" size='10' {IE_DISABLED}>
135 <td valign="top" scope="row" width="15%" NOWRAP>
136 <slot><span id="label_inbox" >{MOD.LBL_MAILBOX}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></span> </slot></td>
137 <td valign="top" width="35%">
138 <slot><input id="mailbox" name='mailbox' tabindex='90' size='30' maxlength='500' type="text" value="{MAILBOX}">
139 <input type="button" id="subscribeFolderButton" style="display:none;" class="button" onclick='javascript:getFoldersListForInboundAccount("InboundEmail", "ShowInboundFoldersList", "Popup", 400, 300, this.form.server_url.value, this.form.protocol.value, this.form.port.value, this.form.email_user.value, Rot13.write(this.form.email_password.value), this.form.mailbox.value, this.form.ssl.checked, this.form.personal.value, this.form.searchField.value, "EditView");' value="{MOD.LBL_SELECT}">
143 <td valign="top" scope="row" width="15%" NOWRAP>
144 <slot><span>{MOD.LBL_SSL}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_SSL_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></span></slot>
146 <td valign="top" width="35%">
148 <input name='ssl' id='ssl' tabindex='45' {CERT} value='1' type='checkbox' {SSL} onClick="setPortDefault();" {IE_DISABLED}>
151 <td id="trashFolderRow" valign="top" scope="row" width="15%" NOWRAP>
152 <slot>{MOD.LBL_TRASH_FOLDER}:
153 <span name="trashRequiredSpan" id="trashRequiredSpan" class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
154 <td id="trashFolderRow1" valign="top" width="35%">
156 <input name='trashFolder' id='trashFolder' tabindex="92" value="{TRASHFOLDER}" size='30' maxlength='100' type="text">
157 <input type="button" id="trashFolderButton" class="button" onclick='javascript:getFoldersListForInboundAccount("InboundEmail", "ShowInboundFoldersList", "Popup", 400, 300, this.form.server_url.value, this.form.protocol.value, this.form.port.value, this.form.email_user.value, Rot13.write(this.form.email_password.value), this.form.trashFolder.value, this.form.ssl.checked, this.form.personal.value, "trash", "EditView");' value="{MOD.LBL_SELECT}">
159 <tr id="sentFolderRow">
160 <td valign="top" scope="row">
161 <slot> </slot></td>
162 <td valign="top" width="35%"><slot>
164 <td valign="top" scope="row" width="15%" NOWRAP>
165 <slot>{MOD.LBL_SENT_FOLDER}:</slot></td>
166 <td valign="top" width="35%">
167 <slot><input id="sentFolder" name='sentFolder' tabindex='95' size='30' maxlength='100' type="text" value="{SENTFOLDER}">
168 <input type="button" id="sentFolderButton" class="button" onclick='javascript:getFoldersListForInboundAccount("InboundEmail", "ShowInboundFoldersList", "Popup", 400, 300, this.form.server_url.value, this.form.protocol.value, this.form.port.value, this.form.email_user.value, Rot13.write(this.form.email_password.value), this.form.sentFolder.value, this.form.ssl.checked, this.form.personal.value, "sent", "EditView");' value="{MOD.LBL_SELECT}">
174 <div class="edit view">
175 <table width="100%" border="0" cellspacing="{GRIDLINE}" cellpadding="0">
177 <th align="left" scope="row" colspan="4"><h4>{EMAIL_OPTIONS}</h4></th>
180 <td valign="top" scope="row" width="15%" NOWRAP>
184 <td valign="top" width="35%">
187 <td valign="top" scope="row" width="15%" NOWRAP>
188 <slot>{MOD.LBL_FROM_NAME}:<span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
189 <td valign="top" width="35%">
190 <slot><input tabindex="300" name="from_name" id="from_name" value="{FROM_NAME}" {IE_DISABLED}> </slot></td>
193 <td valign="top" scope="row" width="15%" NOWRAP>
194 <slot><span style="{AUTO_IMPORT_STYLE}">{MOD.LBL_ENABLE_AUTO_IMPORT}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_ASSIGN_TO_GROUP_FOLDER_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></span></slot>
196 <td valign="top" width="15%" NOWRAP>
197 <input name='is_auto_import' style="{AUTO_IMPORT_STYLE}" id='is_auto_import' onclick="showWarningsIfChaningAutoImport();"tabindex='45' type='checkbox' {IS_AUTO_IMPORT}>
199 <td valign="top" scope="row" width="15%" NOWRAP>
200 <slot>{MOD.LBL_FROM_ADDR}:<span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td>
201 <td valign="top" width="35%">
202 <slot><input tabindex="310" name="from_addr" id="from_addr" value="{FROM_ADDR}" {IE_DISABLED}></slot></td>
205 <td valign="top" scope="row">
206 <slot style="{MAILBOX_TYPE_STYLE}">{MOD.LBL_CREATE_CASE}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_CREATE_CASE_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></slot></td>
207 <td valign="top" width="35%"><slot style="{MAILBOX_TYPE_STYLE}">
208 <input name='is_create_case' id='is_create_case' onclick="showCreateCaseRow();"tabindex='45' type='checkbox' {IS_CREATE_CASE} {IE_DISABLED}></slot></td>
209 <td valign="top" scope="row" width="15%" NOWRAP>
210 {MOD.LBL_REPLY_TO_NAME}:
212 <td valign="top" width="35%">
213 <input tabindex="320" name="reply_to_name" value="{REPLY_TO_NAME}" {IE_DISABLED}>
216 <tr id="createCaseRow" style="{CREATE_CASE_ROW_STYLE}">
217 <td valign="top" scope="row">
218 <slot>{MOD.LBL_DISTRIBUTION_METHOD}: </slot></td>
219 <td valign="top" width="35%"><slot>
220 <select name='distrib_method' tabindex='241'>{DISTRIBUTION_METHOD}</select></slot></td>
221 <td valign="top" scope="row">
222 <slot> </slot></td>
223 <td valign="top" width="35%"><slot>
226 <tr id="createCaseRow1" style="{CREATE_CASE_ROW_STYLE}">
227 <td valign="top" scope="row" width="15%" NOWRAP >
228 <slot>{MOD.LBL_CREATE_CASE_REPLY_TEMPLATE}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_CREATE_CASE_REPLY_TEMPLATE_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></slot></td>
229 <td colspan="3" valign="top" width="35%">
231 <select tabindex='330' id="create_case_template_id" name='create_case_template_id' onchange="show_edit_template_link(this, 'create_case_edit_template');" {IE_DISABLED}>{CREATE_CASE_EMAIL_TEMPLATE_OPTIONS}</select>
232 <input type="button" class="button" onclick="javascript:open_email_template_form('create_case_template_id')" value="{MOD.LBL_CREATE_TEMPLATE}" {IE_DISABLED}>
233 <input type="button" class="button" name='create_case_edit_template' id='create_case_edit_template' style="{CREATE_CASE_EDIT_TEMPLATE}" onclick="javascript:edit_email_template_form('create_case_template_id')" value="{MOD.LBL_EDIT_TEMPLATE}">
238 <td valign="top" scope="row">
239 <slot> </slot></td>
240 <td valign="top" width="35%"><slot>
242 <td valign="top" scope="row" width="15%" NOWRAP>
243 {MOD.LBL_REPLY_TO_ADDR}:
245 <td valign="top" width="35%">
246 <input tabindex="340" name="reply_to_addr" value="{REPLY_TO_ADDR}" {IE_DISABLED}>
249 <tr style="MAILBOX_TYPE_STYLE">
250 <td valign="top" scope="row">
251 <slot> </slot></td>
252 <td valign="top" width="35%"><slot>
254 <td valign="top" scope="row" width="15%" >
255 <slot style="{MAILBOX_TYPE_STYLE}">{MOD.LBL_ALLOW_OUTBOUND_GROUP_USAGE}:
256 <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_ALLOW_OUTBOUND_GROUP_USAGE_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span>
259 <td valign="top" width="35%">
260 <slot style="{MAILBOX_TYPE_STYLE}"><input name='allow_outbound_group_usage' id='allow_outbound_group_usage' tabindex='45' value='1' type='checkbox' {ALLOW_OUTBOUND_USAGE} ></slot>
264 <td valign="top" scope="row" width="15%" NOWRAP>
265 <slot style="{CREATE_GROUP_FOLDER_STYLE}">{MOD.LBL_AUTOREPLY}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_AUTOREPLY_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></slot></td>
266 <td colspan="3" valign="top" width="35%">
267 <slot style="{CREATE_GROUP_FOLDER_STYLE}">
268 <select tabindex='251' id="template_id" name='template_id' onchange="show_edit_template_link(this, 'edit_template');" {IE_DISABLED}>{EMAIL_TEMPLATE_OPTIONS}</select>
269 <input type="button" class="button" onclick="javascript:open_email_template_form('template_id')" value="{MOD.LBL_CREATE_TEMPLATE}" {IE_DISABLED}>
270 <input type="button" value="{MOD.LBL_EDIT_TEMPLATE}" class="button" onclick="javascript:edit_email_template_form('template_id')" name='edit_template' id='edit_template' style="{EDIT_TEMPLATE}">
275 <td valign="top" scope="row" width="18%" NOWRAP>
276 <slot style="{CREATE_GROUP_FOLDER_STYLE}">{MOD.LBL_FILTER_DOMAIN}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_FILTER_DOMAIN_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></slot></td>
277 <td valign="top" width="35%">
278 <slot style="{CREATE_GROUP_FOLDER_STYLE}"><input tabindex="270" name="filter_domain" value="{FILTER_DOMAIN}" {IE_DISABLED}></slot></td>
279 <td valign="top" scope="row">
280 <slot><span style="{CREATE_GROUP_FOLDER_STYLE}">{MOD.LBL_MAX_AUTO_REPLIES}: <span valign="bottom" onmouseout="return nd();" onmouseover="return overlib('{MOD.LBL_MAX_AUTO_REPLIES_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></span></span></slot></td>
281 <td valign="top" width="35%">
282 <slot><input tabindex="271" style="{CREATE_GROUP_FOLDER_STYLE}" name="email_num_autoreplies_24_hours" value="{EMAIL_NUM_AUTOREPLIES_24_HOURS}"></slot></td>
284 <tr id = "leaveMessagesOnMailServerRow" style="{LEAVEMESSAGESONMAILSERVER_STYLE}">
285 <td valign="top" scope="row" width='20%'>
286 <slot>{MOD.LBL_MARK_READ}:</slot></td>
287 <td valign="top" width='30%'>
288 <select name='leaveMessagesOnMailServer' tabindex='253'>{LEAVEMESSAGESONMAILSERVER}</select></td>
289 <td valign="top" scope="row">
290 <slot> </slot></td>
291 <td valign="top" width="35%"><slot>
300 <script type="text/javascript" lang="Javascript" src="modules/InboundEmail/InboundEmail.js"></script>
301 <script type="text/javascript">
303 var fieldToSetValue = '';
304 function checkformdata() {
305 return (check_form('EditView') && checkOtherFields() && checkTrashFolder() );
308 function prefillGmailDefaults(){
310 document.getElementById('server_url').value = "imap.gmail.com";
311 document.getElementById('ssl').checked = true;
312 document.getElementById('protocol').value = "imap";
314 toggle_monitored_folder(document.getElementById('protocol'));
317 function checkOtherFields() {
318 var from_name = document.getElementById('from_name').value;
319 var from_addr = document.getElementById('from_addr').value;
320 if (trim(from_name) == '' || trim(from_addr) == '') {
321 requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
322 invalidTxt = SUGAR.language.get('app_strings', 'ERR_INVALID_VALUE');
323 if (trim(from_name) == '') {
324 add_error_style('EditView', 'from_name', requiredTxt + " From Name");
326 if (trim(from_addr) == '') {
327 add_error_style('EditView', 'from_addr', requiredTxt + " From Address");
336 function checkTrashFolder() {
337 var field1=document.getElementById('protocol');
338 if (field1.value == 'imap') {
339 var trashFolderValue = document.getElementById("trashFolder").value;
340 if (trim(trashFolderValue).length <= 0) {
341 requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
342 invalidTxt = SUGAR.language.get('app_strings', 'ERR_INVALID_VALUE');
343 add_error_style('EditView', 'trashFolder', requiredTxt + " Trash Folder");
353 function showCreateCaseRow() {
354 var createCaseRow = document.getElementById('createCaseRow');
355 var createCaseRow1 = document.getElementById('createCaseRow1');
356 var isCreateCase = document.getElementById('is_create_case').checked;
357 var autoImportEl = document.getElementById('is_auto_import');
360 createCaseRow.style.display = '';
361 createCaseRow1.style.display = '';
362 autoImportEl.checked = true;
364 createCaseRow.style.display = 'none';
365 createCaseRow1.style.display = 'none';
366 possibleActionChange();
370 function possibleActionChange() {
371 var maliBoxType = document.getElementById('mailbox_type');
372 var trashRequiredSpan = document.getElementById('trashRequiredSpan');
373 if(maliBoxType.value == 'bounce') {
375 trashRequiredSpan.style.display = 'none';
376 trashRequiredSpan.style.display = 'none';
378 trashRequiredSpan.style.display = '';
379 trashRequiredSpan.style.display = '';
383 function show_edit_template_link(field, editTemplate) {
384 var field1=document.getElementById(editTemplate);
385 if (field.selectedIndex == 0) {
386 field1.style.visibility="hidden";
389 field1.style.visibility="visible";
393 function refresh_email_template_list(template_id, template_name) {
394 var field=document.getElementById(fieldToSetValue);
396 for (var i=0; i < field.options.length; i++) {
397 if (field.options[i].value == template_id) {
398 if (field.options[i].selected==false) {
399 field.options[i].selected=true;
401 field.options[i].text = template_name;
405 //add item to selection list.
407 var newElement=document.createElement('option');
408 newElement.text=template_name;
409 newElement.value=template_id;
410 field.options.add(newElement);
411 newElement.selected=true;
414 //enable the edit button.
415 var editButtonName = 'edit_template';
416 if (fieldToSetValue == 'create_case_template_id') {
417 editButtonName = 'create_case_edit_template';
419 var field1=document.getElementById(editButtonName);
420 field1.style.visibility="visible";
422 var applyListToTemplateField = 'template_id';
423 if (fieldToSetValue == 'template_id') {
424 applyListToTemplateField = 'create_case_template_id';
426 var field=document.getElementById(applyListToTemplateField);
428 for (var i=0; i < field.options.length; i++) {
429 if (field.options[i].value == template_id) {
430 field.options[i].text = template_name;
435 var newElement=document.createElement('option');
436 newElement.text=template_name;
437 newElement.value=template_id;
438 field.options.add(newElement);
443 function open_email_template_form(fieldToSet) {
444 fieldToSetValue = fieldToSet;
445 URL="index.php?module=EmailTemplates&action=EditView&inboundEmail=true&show_js=1";
446 windowName = 'email_template';
447 windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
449 win = window.open(URL, windowName, windowFeatures);
452 // put the focus on the popup if the browser supports the focus() method
456 function edit_email_template_form(templateField) {
457 fieldToSetValue = templateField;
458 var field=document.getElementById(templateField);
459 URL="index.php?module=EmailTemplates&action=EditView&inboundEmail=true&show_js=1";
460 if (field.options[field.selectedIndex].value != 'undefined') {
461 URL+="&record="+field.options[field.selectedIndex].value;
463 windowName = 'email_template';
464 windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
466 win = window.open(URL, windowName, windowFeatures);
469 // put the focus on the popup if the browser supports the focus() method
473 function open_group_folder_form() {
474 URL="index.php?module=InboundEmail&action=EditGroupFolder&target=Popup&to_pdf=1";
475 windowName = 'group_folder_popup_window';
476 windowFeatures = 'width=400' + ',height=300' + ',resizable=1,scrollbars=1';
478 win = window.open(URL, windowName, windowFeatures);
481 // put the focus on the popup if the browser supports the focus() method
486 function edit_group_folder_form() {
487 URL="index.php?module=InboundEmail&action=EditGroupFolder&target=Popup&to_pdf=1";
488 var field=document.getElementById('group_folder_id');
489 if (field.options[field.selectedIndex].value != 'undefined') {
490 URL+="&record="+field.options[field.selectedIndex].value;
492 windowName = 'edit_group_folder_popup_window';
493 windowFeatures = 'width=400' + ',height=300' + ',resizable=1,scrollbars=1';
495 win = window.open(URL, windowName, windowFeatures);
498 // put the focus on the popup if the browser supports the focus() method
503 function refresh_group_folder_list(groupFolder_id, groupFolder_name) {
504 var field=document.getElementById('group_folder_id');
506 for (var i=0; i < field.options.length; i++) {
507 if (field.options[i].value == groupFolder_id) {
508 if (field.options[i].selected==false) {
509 field.options[i].selected=true;
511 field.options[i].text = groupFolder_name;
515 //add item to selection list.
517 var newElement=document.createElement('option');
518 newElement.text=groupFolder_name;
519 newElement.value=groupFolder_id;
520 field.options.add(newElement);
521 newElement.selected=true;
523 //enable the edit button.
524 var field1=document.getElementById('edit_group');
525 field1.style.visibility="visible";
527 showHideLeaveMessagesOnMailServer();
530 function show_edit_group_folder_link(field) {
532 var field1=document.getElementById('edit_group');
533 if (field.selectedIndex == 0) {
536 field1.style.visibility="visible";
539 showHideLeaveMessagesOnMailServer();
542 function showHideLeaveMessagesOnMailServer() {
543 var field=document.getElementById('group_folder_id');
544 var leaveMessagesOnMailServerRow = document.getElementById('leaveMessagesOnMailServerRow');
545 if (field.selectedIndex == 0) {
546 leaveMessagesOnMailServerRow.style.display="none";
549 leaveMessagesOnMailServerRow.style.display='';
554 function showWarningsIfChaningAutoImport() {
556 var isAutoImportOn = document.getElementById('is_auto_import').checked;
557 var isCreateCase = document.getElementById('is_create_case').checked
558 var record = document.forms['EditView'].record.value;
559 //Alert if changing for an existing record only.
561 alert(warningForAutoChange);
562 //If the user has create case enabled then auto import must be on.
563 if( !isAutoImportOn && isCreateCase)
565 document.getElementById('is_auto_import').checked = true;
566 alert(warningForAutoChangeWithCreateCase);
569 toggle_monitored_folder(document.getElementById('protocol'));
571 possibleActionChange();
573 var warningForAutoChange = '{MOD.LBL_WARNING_CHANGING_AUTO_IMPORT}';
574 var warningForAutoChangeWithCreateCase = '{MOD.LBL_WARNING_CHANGING_AUTO_IMPORT_WITH_CREATE_CASE}';
575 if(window.addEventListener){
576 window.addEventListener("load", function() { SUGAR.util.setEmailPasswordDisplay('email_password', {HAS_PASSWORD}); }, false);
578 window.attachEvent("onload", function() { SUGAR.util.setEmailPasswordDisplay('email_password', {HAS_PASSWORD}); });