/
var
/
www
/
html
/
sugardemo
/
modules
/
InboundEmail
/
Upload File
HOME
<!-- /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ --> <div id="testSettingsDiv"></div> <div id="selectFoldersDiv"></div> <!-- BEGIN: main --> {MODULE_TITLE} {ERROR_STRING} <form action="index.php" method="post" name="EditView" id="EditView"> {sugar_csrf_form_token} <input type="hidden" name="module" value="{MODULE}"> <input type="hidden" name="record" value="{ID}"> <input type="hidden" name="origin_id" value="{ORIGIN_ID}"> <input type="hidden" name="isDuplicate" value=false> <input type="hidden" name="action"> <input type="hidden" name="group_id" value="{GROUP_ID}"> <input type="hidden" name="return_module"> <input type="hidden" name="return_action"> <input type="hidden" name="return_id"> <input type="hidden" name="personal" value="{PERSONAL}"> <input type="hidden" name="searchField" value=""> <input type="hidden" id="mailbox_type" name="mailbox_type" value="{MAILBOX_TYPE}"> <input type="hidden" name="eapm_id" id="eapm_id" value="{EAPM_ID}" /> <input type="hidden" name="authorized_account" id="authorized_account" value="{AUTHORIZED_ACCOUNT}" /> <input type="hidden" name="auth_type" id="auth_type" value="{AUTH_TYPE}" /> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td> <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 save_form_data()" type="submit" name="button" id="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " {IE_DISABLED}> <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" id="emailCancel" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'; if(this.form.record.value == '' && this.form.origin_id.value != '') this.form.record.value=this.form.origin_id.value;" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} "> <input title="{MOD.LBL_TEST_BUTTON_TITLE}" type='button' class="button" id="emailTestSettings" 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", this.form.origin_id.value?this.form.origin_id.value:this.form.record.value, this.form.eapm_id.value);' name="button" value=" {MOD.LBL_TEST_SETTINGS} " {IE_DISABLED}> </td> <td align="right" width="20%" NOWRAP><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td> <td align='right'>{ADMIN_EDIT}</td> </tr> </table> <div class="edit view"> <table width="100%" border=0 cellspacing="{GRIDLINE}" cellpadding="0"> <tr> <th align="left" scope="row" colspan="4"><h4>{MOD.LBL_BASIC}</h4></th> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_NAME}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" width="35%"> <slot><input name='name' id='name' tabindex='10' size='30' maxlength='255' type="text" value="{NAME}" {IE_DISABLED}></slot></td> <td colspan="2"> </td> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_EMAIL_PROVIDER}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" colspan="3"> <slot><select name='email_provider' id="email_provider" onchange="toggle_email_provider(true);" {IE_DISABLED}>{EMAIL_PROVIDER}</select></slot></td> </tr> <tr id="prefill"> <td colspan="4"><br/><a href="javascript:void(0);" id="prefill_gmail_defaults_link" onclick="javascript:prefillGmailDefaults();">{APP.LBL_EMAIL_ACCOUNTS_GMAIL_DEFAULTS}</a> </td> </tr> <tr id="auth_block" style="display:none"> <td colspan="4"> <div id="auth_warning" style="color:#BA0F1B;font-weight:bold;padding:5px;margin:2px"> Placeholder </div> <button type="button" id="auth_button" name="auth_button" style="padding:5px;margin:10px 2px" onclick="authorize();">{APP.LBL_EMAIL_AUTHORIZE}</button> </td> </tr> <tr> <td valign="top" scope="row"> <slot>{MOD.LBL_STATUS}: </slot></td> <td valign="top" width="35%"><slot> <select name='status' tabindex='60' {IE_DISABLED}>{STATUS}</select></slot></td> <td valign="top" scope="row" id="email_user_label"> <slot>{MOD.LBL_LOGIN}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" width="35%" id="email_user_field"> <slot><input name='email_user' id='email_user' tabindex='70' size='30' maxlength='100' type="text" value="{USER}" autocomplete="off" {IE_DISABLED}></slot></td> <td valign="top" scope="row" id="auth_status_label" style="display:none"> <slot>{MOD.LBL_AUTH_STATUS}: </slot></td> <td valign="top" width="35%" id="auth_status_field" style="display:none"> <slot><input id='auth_status' name='auth_status' size='30' maxlength='100' type="text" value="" {IE_DISABLED} disabled></slot></td> </tr> <tr> <td valign="top" scope="row"> <slot>{MOD.LBL_SERVER_URL}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" width="35%"> <slot><input id='server_url' name='server_url' tabindex='20' size='30' maxlength='100' type="text" value="{SERVER_URL}" {IE_DISABLED}></slot></td> <td valign="top" scope="row" id="email_password_label"> <slot>{MOD.LBL_PASSWORD}: <span class="required">{EMAIL_PASS_REQ_SYMB} </slot></td> <td valign="top" width="35%" id="email_password_field"> <slot> <input name='email_password' id="email_password" tabindex='80' size='30' {PASSWORD_MAX_LENGTH_ATTRIBUTE}type="password" autocomplete="off" {IE_DISABLED}> <a href="javascript:void(0)" id='email_password_link' onClick="SUGAR.util.setEmailPasswordEdit('email_password')" style="display: none">{APP.LBL_CHANGE_PASSWORD}</a> </slot></td> <td valign="top" scope="row" id="auth_email_label" style="display:none"> <slot>{MOD.LBL_AUTHORIZED_ACCOUNT}: </slot></td> <td valign="top" width="35%" id="auth_email_field" style="display:none"> <slot><input id='auth_email' name='auth_email' size='30' maxlength='100' type="text" value="" {IE_DISABLED} disabled></slot></td> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_SERVER_TYPE}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" width="35%"> <slot> <select name='protocol' id="protocol" tabindex='30' onchange="toggle_monitored_folder(this); setPortDefault();" {IE_DISABLED}>{PROTOCOL}</select></slot></td> <td id="mailboxRow" valign="top" scope="row" width="15%" NOWRAP> <slot><span id="label_inbox">{MOD.LBL_MAILBOX}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></span> </slot></td> <td id="mailboxRow1" valign="top" width="35%"> <slot><input id="mailbox" name='mailbox' tabindex='90' size='30' maxlength='500' type="text" value="{MAILBOX}"> <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", this.form.eapm_id.value);' value="{MOD.LBL_SELECT}"> </slot></td> </tr> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_PORT}: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" width="35%"> <slot> <input name='port' id='port' tabindex="40" value="{PORT}" size='10' {IE_DISABLED}> <td id="trashFolderRow" valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_TRASH_FOLDER}: <span name="trashRequiredSpan" id="trashRequiredSpan" class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td id="trashFolderRow1" valign="top" width="35%"> <slot> <input name='trashFolder' id='trashFolder' tabindex="92" value="{TRASHFOLDER}" size='30' maxlength='100' type="text"> <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", this.form.eapm_id.value);' value="{MOD.LBL_SELECT}"> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot><span>{MOD.LBL_SSL}: {TIPS.LBL_SSL_DESC}</span></slot> </td> <td valign="top" width="35%"> <slot> <input name='ssl' id='ssl' tabindex='45' {CERT} value='1' type='checkbox' {SSL} onClick="setPortDefault();" {IE_DISABLED}> </slot> </td> <td id="sentFolderRow" valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_SENT_FOLDER}:</slot></td> <td id="sentFolderRow1" valign="top" width="35%"> <slot><input id="sentFolder" name='sentFolder' tabindex='95' size='30' maxlength='100' type="text" value="{SENTFOLDER}"> <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", this.form.eapm_id.value);' value="{MOD.LBL_SELECT}"> </slot> </td> </tr> </table> </div> <div class="edit view"> <table width="100%" border="0" cellspacing="{GRIDLINE}" cellpadding="0"> <tr> <th align="left" scope="row" colspan="4"><h4>{EMAIL_OPTIONS}</h4></th> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot> {MOD.LBL_ASSIGN_TEAM}:<span span name="teamSpanRequired" id="teamSpanRequired" class="required">{APP.LBL_REQUIRED_SYMBOL}</span>{TIPS.LBL_ASSIGN_TO_TEAM_DESC} </slot></td> <td valign="top" width="35%"> <slot> {TEAM_SET_FIELD} </slot></td> <td valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_FROM_NAME}:<span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> </slot></td> <td valign="top" width="35%"> <slot><input tabindex="300" name="from_name" id="from_name" value="{FROM_NAME}" {IE_DISABLED}> </slot></td> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot><span style="{AUTO_IMPORT_STYLE}">{MOD.LBL_ENABLE_AUTO_IMPORT}: {TIPS.LBL_ASSIGN_TO_GROUP_FOLDER_DESC}</span></slot> </td> <td valign="top" width="15%" NOWRAP> <input name='is_auto_import' style="{AUTO_IMPORT_STYLE}" id='is_auto_import' onclick="showWarningsIfChaningAutoImport();"tabindex='45' type='checkbox' {IS_AUTO_IMPORT}> </td> <td valign="top" scope="row" width="15%" NOWRAP> <slot>{MOD.LBL_FROM_ADDR}:<span class="required">{APP.LBL_REQUIRED_SYMBOL}</span>{TIPS.LBL_FROM_ADDR_DESC}</slot></td> <td valign="top" width="35%"> <slot><input tabindex="310" name="from_addr" id="from_addr" value="{FROM_ADDR}" {IE_DISABLED}></slot></td> </tr> <tr> <td valign="top" scope="row"> <slot style="{MAILBOX_TYPE_STYLE}">{MOD.LBL_CREATE_CASE}: {TIPS.LBL_CREATE_CASE_HELP}</slot></td> <td valign="top" width="35%"><slot style="{MAILBOX_TYPE_STYLE}"> <input name='is_create_case' id='is_create_case' onclick="showCreateCaseRow();"tabindex='45' type='checkbox' {IS_CREATE_CASE} {IE_DISABLED}></slot></td> <td valign="top" scope="row" width="15%" NOWRAP> {MOD.LBL_REPLY_TO_NAME}: </td> <td valign="top" width="35%"> <input tabindex="320" name="reply_to_name" value="{REPLY_TO_NAME}" {IE_DISABLED}> </td> </tr> <tr id="createCaseRow" style="{CREATE_CASE_ROW_STYLE}"> <td valign="top" scope="row"> <slot>{MOD.LBL_DISTRIBUTION_METHOD}: </slot></td> <td valign="top" width="35%"><slot> <select name='distrib_method' tabindex='241'>{DISTRIBUTION_METHOD}</select></slot></td> <td valign="top" scope="row"> <slot> </slot></td> <td valign="top" width="35%"><slot> </slot></td> </tr> <tr id="createCaseRow1" style="{CREATE_CASE_ROW_STYLE}"> <td valign="top" scope="row" width="15%" NOWRAP > <slot>{MOD.LBL_CREATE_CASE_REPLY_TEMPLATE}: {TIPS.LBL_CREATE_CASE_REPLY_TEMPLATE_HELP}</slot></td> <td colspan="3" valign="top" width="35%"> <slot> <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> <input type="button" class="button" onclick="javascript:open_email_template_form('create_case_template_id')" value="{MOD.LBL_CREATE_TEMPLATE}" {IE_DISABLED}> <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}"> </slot> </td> </tr> <tr> <td valign="top" scope="row"> <slot> </slot></td> <td valign="top" width="35%"><slot> </slot></td> <td valign="top" scope="row" width="15%" NOWRAP> {MOD.LBL_REPLY_TO_ADDR}: </td> <td valign="top" width="35%"> <input tabindex="340" name="reply_to_addr" value="{REPLY_TO_ADDR}" {IE_DISABLED}> </td> </tr> <tr> <td valign="top" scope="row" width="15%" NOWRAP> <slot style="{CREATE_GROUP_FOLDER_STYLE}">{MOD.LBL_AUTOREPLY}: {TIPS.LBL_AUTOREPLY_HELP}</slot></td> <td colspan="3" valign="top" width="35%"> <slot style="{CREATE_GROUP_FOLDER_STYLE}"> <select tabindex='251' id="template_id" name='template_id' onchange="show_edit_template_link(this, 'edit_template');" {IE_DISABLED}>{EMAIL_TEMPLATE_OPTIONS}</select> <input type="button" class="button" onclick="javascript:open_email_template_form('template_id')" value="{MOD.LBL_CREATE_TEMPLATE}" {IE_DISABLED}> <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}"> </slot> </td> </tr> <tr> <td valign="top" scope="row" width="18%" NOWRAP> <slot style="{CREATE_GROUP_FOLDER_STYLE}">{MOD.LBL_FILTER_DOMAINS}: {TIPS.LBL_FILTER_DOMAINS_DESC}</slot></td> <td valign="top" width="35%"> <slot style="{CREATE_GROUP_FOLDER_STYLE}"><input tabindex="270" name="filter_domains" value="{FILTER_DOMAINS}" {IE_DISABLED}></slot></td> <td valign="top" scope="row"> <slot><span style="{CREATE_GROUP_FOLDER_STYLE}">{MOD.LBL_MAX_AUTO_REPLIES}: {TIPS.LBL_MAX_AUTO_REPLIES_DESC}</span></slot></td> <td valign="top" width="35%"> <slot><input tabindex="271" style="{CREATE_GROUP_FOLDER_STYLE}" name="email_num_autoreplies_24_hours" value="{EMAIL_NUM_AUTOREPLIES_24_HOURS}"></slot></td> </tr> <tr id = "leaveMessagesOnMailServerRow" style="{LEAVEMESSAGESONMAILSERVER_STYLE}"> <td valign="top" scope="row" width='20%'> <slot>{MOD.LBL_MARK_READ}:</slot></td> <td valign="top" width='30%'> <select name='leaveMessagesOnMailServer' tabindex='253'>{LEAVEMESSAGESONMAILSERVER}</select></td> <td valign="top" scope="row"> <slot> </slot></td> <td valign="top" width="35%"><slot> </slot></td> </tr> </table> </div> </form> <script type="text/javascript" lang="Javascript" src="modules/InboundEmail/InboundEmail.js?v={VERSION_MARK}"></script> <script type="text/javascript"> var authInfo = {AUTH_INFO}; function save_form_data() { var eapmId = document.getElementById('EditView').eapm_id.value; var authAccount = document.getElementById('authorized_account').value; var authType = document.getElementById('auth_type').value; if (authType === 'oauth2' && (trim(eapmId) === '' || trim(authAccount) === '')) { errorMessage = "{APP.LBL_EMAIL_PLEASE_AUTHORIZE}"; alert(errorMessage); return false; } return checkformdata(); } function toggle_email_provider(resetFields) { var provider = document.getElementById('EditView').email_provider.value; if (authInfo[provider]) { document.getElementById('EditView').auth_type.value = 'oauth2'; document.getElementById('EditView').authorized_account.value = authInfo[provider].authorized_account || ''; document.getElementById('EditView').eapm_id.value = authInfo[provider].eapm_id || ''; document.getElementById('EditView').auth_status.value = authInfo[provider].eapm_id ? '{APP.LBL_EMAIL_AUTHORIZED}' : '{APP.LBL_EMAIL_NOT_AUTHORIZED}'; document.getElementById('EditView').auth_email.value = authInfo[provider].authorized_account || ''; document.getElementById('EditView').email_user.value = authInfo[provider].email_user || ''; document.getElementById('EditView').email_password.value = 'N/A'; document.getElementById('EditView').server_url.value = authInfo[provider].server_url || ''; document.getElementById('EditView').port.value = authInfo[provider].port || ''; document.getElementById('protocol').value = 'imap'; document.getElementById('ssl').checked = true; if (!authInfo[provider]['auth_url']) { document.getElementById("auth_warning").style.display = 'block'; document.getElementById("auth_warning").innerHTML = authInfo[provider]['auth_warning']; document.getElementById("auth_button").disabled = true; } else { document.getElementById("auth_warning").style.display = 'none'; document.getElementById("auth_button").disabled = false; } if (document.getElementById('EditView').eapm_id.value === '') { document.getElementById("subscribeFolderButton").disabled = true; document.getElementById("trashFolderButton").disabled = true; document.getElementById("sentFolderButton").disabled = true; document.getElementById("emailTestSettings").disabled = true; } else { document.getElementById("subscribeFolderButton").disabled = false; document.getElementById("trashFolderButton").disabled = false; document.getElementById("sentFolderButton").disabled = false; document.getElementById("emailTestSettings").disabled = false; } document.getElementById("auth_block").style.display = ''; document.getElementById("auth_status_label").style.display = ''; document.getElementById("auth_status_field").style.display = ''; document.getElementById("auth_email_label").style.display = ''; document.getElementById("auth_email_field").style.display = ''; document.getElementById("prefill").style.display = 'none'; document.getElementById("email_user_label").style.display = 'none'; document.getElementById("email_password_label").style.display = 'none'; document.getElementById("email_user_field").style.display = 'none'; document.getElementById("email_password_field").style.display = 'none'; } else if (resetFields) { document.getElementById('EditView').auth_type.value = ''; document.getElementById('EditView').authorized_account.value = ''; document.getElementById('EditView').eapm_id.value = ''; document.getElementById('EditView').email_user.value = ''; document.getElementById('EditView').email_password.value = ''; document.getElementById("auth_block").style.display = 'none'; document.getElementById("auth_status_label").style.display = 'none'; document.getElementById("auth_status_field").style.display = 'none'; document.getElementById("auth_email_label").style.display = 'none'; document.getElementById("auth_email_field").style.display = 'none'; document.getElementById("prefill").style.display = 'block'; document.getElementById("email_user_label").style.display = ''; document.getElementById("email_password_label").style.display = ''; document.getElementById("email_user_field").style.display = ''; document.getElementById("email_password_field").style.display = ''; document.getElementById("subscribeFolderButton").disabled = false; document.getElementById("trashFolderButton").disabled = false; document.getElementById("sentFolderButton").disabled = false; document.getElementById("emailTestSettings").disabled = false; } } function authorize() { var provider = document.getElementById('EditView').email_provider.value; if (authInfo[provider]['auth_url']) { window.addEventListener('message', handleOauthComplete); var height = 600; var width = 600; var left = (window.parent.screen.width - width) / 2; var top = (window.parent.screen.height - height) / 4; var submitWindow = window.open('/', '_blank', 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',resizable=1'); submitWindow.location.href = 'about:blank'; submitWindow.location.href = authInfo[provider]['auth_url']; } } function handleOauthComplete(e) { var provider = document.getElementById('EditView').email_provider.value; var data = JSON.parse(e.data); if (!data.dataSource || !authInfo[provider] || data.dataSource !== authInfo[provider]['dataSource']) { return; } if (data.eapmId && data.emailAddress) { authInfo[provider]['eapm_id'] = data.eapmId; authInfo[provider]['authorized_account'] = data.emailAddress; authInfo[provider]['email_user'] = data.userName || data.emailAddress; document.getElementById('eapm_id').value = data.eapmId; document.getElementById('auth_status').value = '{APP.LBL_EMAIL_AUTHORIZED}'; document.getElementById('authorized_account').value = data.emailAddress; document.getElementById('auth_email').value = data.emailAddress; document.getElementById('email_user').value = data.userName || data.emailAddress; document.getElementById("subscribeFolderButton").disabled = false; document.getElementById("trashFolderButton").disabled = false; document.getElementById("sentFolderButton").disabled = false; document.getElementById("emailTestSettings").disabled = false; } else { alert('{APP.LBL_EMAIL_AUTH_FAILURE}'); } window.removeEventListener('message', handleOauthComplete); } var fieldToSetValue = ''; function checkformdata() { return (check_form('EditView') && checkOtherFields() && checkTrashFolder() ); } function prefillGmailDefaults(){ document.getElementById('server_url').value = "imap.gmail.com"; document.getElementById('ssl').checked = true; document.getElementById('protocol').value = "imap"; toggle_monitored_folder(document.getElementById('protocol')); setPortDefault(); } function checkOtherFields() { var from_name = document.getElementById('from_name').value; var from_addr = document.getElementById('from_addr').value; if (trim(from_name) == '' || trim(from_addr) == '') { requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS'); invalidTxt = SUGAR.language.get('app_strings', 'ERR_INVALID_VALUE'); if (trim(from_name) == '') { add_error_style('EditView', 'from_name', requiredTxt + " From Name"); } // if if (trim(from_addr) == '') { add_error_style('EditView', 'from_addr', requiredTxt + " From Address"); } // if return false; } else { return true; } // else } // fn function checkTrashFolder() { if (document.getElementById('protocol').value == 'imap' && document.getElementById('mailbox_type').value != 'bounce') { var trashFolderValue = document.getElementById("trashFolder").value; if (trim(trashFolderValue).length <= 0) { requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS'); invalidTxt = SUGAR.language.get('app_strings', 'ERR_INVALID_VALUE'); add_error_style('EditView', 'trashFolder', requiredTxt + " Trash Folder"); return false; } else { return true; } } else { return true; } // else } // fn function showCreateCaseRow() { var createCaseRow = document.getElementById('createCaseRow'); var createCaseRow1 = document.getElementById('createCaseRow1'); var isCreateCase = document.getElementById('is_create_case').checked; var autoImportEl = document.getElementById('is_auto_import'); if (isCreateCase) { createCaseRow.style.display = ''; createCaseRow1.style.display = ''; autoImportEl.checked = true; } else { createCaseRow.style.display = 'none'; createCaseRow1.style.display = 'none'; possibleActionChange(); } // else } // fn function possibleActionChange() { var mailBoxType = document.getElementById('mailbox_type'); var trashRequiredSpan = document.getElementById('trashRequiredSpan'); var teamSpanRequired = document.getElementById('teamSpanRequired'); if(mailBoxType.value == 'bounce') { trashRequiredSpan.style.display = 'none'; trashRequiredSpan.style.display = 'none'; teamSpanRequired.style.display = 'none'; teamSpanRequired.style.display = 'none'; } else { trashRequiredSpan.style.display = ''; trashRequiredSpan.style.display = ''; teamSpanRequired.style.display = ''; teamSpanRequired.style.display = ''; } // else } function show_edit_template_link(field, editTemplate) { var field1=document.getElementById(editTemplate); if (field.selectedIndex == 0) { field1.style.visibility="hidden"; } else { field1.style.visibility="visible"; } } function refresh_email_template_list(template_id, template_name) { var field=document.getElementById(fieldToSetValue); var bfound=0; for (var i=0; i < field.options.length; i++) { if (field.options[i].value == template_id) { if (field.options[i].selected==false) { field.options[i].selected=true; } field.options[i].text = template_name; bfound=1; } } //add item to selection list. if (bfound == 0) { var newElement=document.createElement('option'); newElement.text=template_name; newElement.value=template_id; field.options.add(newElement); newElement.selected=true; } //enable the edit button. var editButtonName = 'edit_template'; if (fieldToSetValue == 'create_case_template_id') { editButtonName = 'create_case_edit_template'; } // if var field1=document.getElementById(editButtonName); field1.style.visibility="visible"; var applyListToTemplateField = 'template_id'; if (fieldToSetValue == 'template_id') { applyListToTemplateField = 'create_case_template_id'; } // if var field=document.getElementById(applyListToTemplateField); if (bfound == 1) { for (var i=0; i < field.options.length; i++) { if (field.options[i].value == template_id) { field.options[i].text = template_name; } // if } // for } else { var newElement=document.createElement('option'); newElement.text=template_name; newElement.value=template_id; field.options.add(newElement); } // else } function open_email_template_form(fieldToSet) { fieldToSetValue = fieldToSet; URL="index.php?module=EmailTemplates&action=EditView&inboundEmail=true&show_js=1"; windowName = 'email_template'; windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1'; win = window.open(URL, windowName, windowFeatures); if(window.focus) { // put the focus on the popup if the browser supports the focus() method win.focus(); } } function edit_email_template_form(templateField) { fieldToSetValue = templateField; var field=document.getElementById(templateField); URL="index.php?module=EmailTemplates&action=EditView&inboundEmail=true&show_js=1"; if (field.options[field.selectedIndex].value != 'undefined') { URL+="&record="+field.options[field.selectedIndex].value; } windowName = 'email_template'; windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1'; win = window.open(URL, windowName, windowFeatures); if(window.focus) { // put the focus on the popup if the browser supports the focus() method win.focus(); } } function refresh_group_folder_list(groupFolder_id, groupFolder_name) { var field=document.getElementById('group_folder_id'); var bfound=0; for (var i=0; i < field.options.length; i++) { if (field.options[i].value == groupFolder_id) { if (field.options[i].selected==false) { field.options[i].selected=true; } field.options[i].text = groupFolder_name; bfound=1; } } //add item to selection list. if (bfound == 0) { var newElement=document.createElement('option'); newElement.text=groupFolder_name; newElement.value=groupFolder_id; field.options.add(newElement); newElement.selected=true; } //enable the edit button. var field1=document.getElementById('edit_group'); field1.style.visibility="visible"; showCreateCaseRow(); showHideLeaveMessagesOnMailServer(); } function show_edit_group_folder_link(field) { var field1=document.getElementById('edit_group'); if (field.selectedIndex == 0) { } else { field1.style.visibility="visible"; } showCreateCaseRow(); showHideLeaveMessagesOnMailServer(); } function showHideLeaveMessagesOnMailServer() { var field=document.getElementById('group_folder_id'); var leaveMessagesOnMailServerRow = document.getElementById('leaveMessagesOnMailServerRow'); if (field.selectedIndex == 0) { leaveMessagesOnMailServerRow.style.display="none"; } else { leaveMessagesOnMailServerRow.style.display=''; } } // fn function showWarningsIfChaningAutoImport() { var isAutoImportOn = document.getElementById('is_auto_import').checked; var isCreateCase = document.getElementById('is_create_case').checked var record = document.forms['EditView'].record.value; //Alert if changing for an existing record only. if(record != '') alert(warningForAutoChange); //If the user has create case enabled then auto import must be on. if( !isAutoImportOn && isCreateCase) { document.getElementById('is_auto_import').checked = true; alert(warningForAutoChangeWithCreateCase); } } toggle_email_provider(false); toggle_monitored_folder(document.getElementById('protocol')); setPortDefault(); possibleActionChange(); var warningForAutoChange = '{MOD.LBL_WARNING_CHANGING_AUTO_IMPORT}'; var warningForAutoChangeWithCreateCase = '{MOD.LBL_WARNING_CHANGING_AUTO_IMPORT_WITH_CREATE_CASE}'; if(window.addEventListener){ window.addEventListener("load", function() { SUGAR.util.setEmailPasswordDisplay('email_password', {HAS_PASSWORD},'EditView'); }, false); }else{ window.attachEvent("onload", function() { SUGAR.util.setEmailPasswordDisplay('email_password', {HAS_PASSWORD},'EditView'); }); } </script> {JAVASCRIPT} <!-- END: main -->