/********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ SUGAR.inboundEmail = { }; Rot13 = { map: null, convert: function(a) { Rot13.init(); var s = ""; for (i=0; i < a.length; i++) { var b = a.charAt(i); s += ((b>='A' && b<='Z') || (b>='a' && b<='z') ? Rot13.map[b] : b); } return s; }, init: function() { if (Rot13.map != null) return; var map = new Array(); var s = "abcdefghijklmnopqrstuvwxyz"; for (i=0; i 0) { fragment1 = word.substr(0, word.indexOf('&')); fragment2 = word.substr(word.indexOf('&') + 1, word.length); newWord = fragment1 + '::amp::' + fragment2; words[i] = newWord; word = newWord; // setting it locally to pass on to next IF fragment1 = ''; fragment2 = ''; } if(word.indexOf('+') > 0) { fragment1 = word.substr(0, word.indexOf('+')); fragment2 = word.substr(word.indexOf('+') + 1, word.length); newWord = fragment1 + '::plus::' + fragment2; words[i] = newWord; word = newWord; // setting it locally to pass on to next IF fragment1 = ''; fragment2 = ''; } if(word.indexOf('%') > 0) { fragment1 = word.substr(0, word.indexOf('%')); fragment2 = word.substr(word.indexOf('%') + 1, word.length); newWord = fragment1 + '::percent::' + fragment2; words[i] = newWord; word = newWord; // setting it locally to pass on to next IF fragment1 = ''; fragment2 = ''; } } // for return words; } // fn function ie_test_open_popup_with_submit(module_name, action, pageTarget, width, height, mail_server, protocol, port, login, password, mailbox, ssl, personal, formName) { if (!formName) formName = "testSettingsView"; var words = getEncryptedPassword(login, password, mailbox); var isPersonal = (personal) ? 'true' : 'false'; if (!isDataValid(formName, true)) { return; } ie_id = document.getElementById(formName).ie_id.value; // launch the popup URL = 'index.php?' + 'module=' + module_name + '&to_pdf=1' + '&action=' + action + '&target=' + pageTarget + '&target1=' + pageTarget + '&server_url=' + mail_server + '&email_user=' + words[0] + '&protocol=' + protocol + '&port=' + port + '&email_password=' + words[1] + '&mailbox=' + words[2] + '&ssl=' + ssl + '&ie_id=' + ie_id + '&personal=' + isPersonal; var SI = SUGAR.inboundEmail; if (!SI.testDlg) { SI.testDlg = new YAHOO.widget.SimpleDialog("testSettingsDiv", { width: width + "px", draggable: true, dragOnly: true, close: true, constraintoviewport: true, modal: true, loadingText: SUGAR.language.get("app_strings", "LBL_EMAIL_LOADING") }); SI.testDlg._updateContent = function (o) { var w = this.cfg.config.width.value + "px"; this.setBody(o.responseText); if (this.evalJS) SUGAR.util.evalScript(o.responseText); if (!SUGAR.isIE) this.body.style.width = w } } var title = SUGAR.language.get('Emails', 'LBL_TEST_SETTINGS'); if (typeof(title) == "undefined" || title == "undefined") title = SUGAR.language.get('InboundEmail', 'LBL_TEST_SETTINGS'); SI.testDlg.setHeader(title); SI.testDlg.setBody(SUGAR.language.get("app_strings", "LBL_EMAIL_LOADING")); SI.testDlg.render(document.body); var Connect = YAHOO.util.Connect; if (Connect.url) URL = Connect.url + "&" + url; Connect.asyncRequest("GET", URL, {success:SI.testDlg._updateContent, failure:SI.testDlg.hide, scope:SI.testDlg}); SI.testDlg.show(); } function isDataValid(formName, validateMonitoredFolder) { var formObject = document.getElementById(formName); var errors = new Array(); var out = new String(); if(trim(formObject.server_url.value) == "") { errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_SERVER')); } if(trim(formObject.email_user.value) == "") { errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_USER')); } if(trim(formObject.email_password.value) == "" && trim(formObject.ie_id.value) == "") { errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_PASSWORD')); } if(formObject.protocol.protocol == "") { errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_PROTOCOL')); } if (formObject.protocol.value == 'imap' && validateMonitoredFolder) { if (trim(formObject.mailbox.value) == "") { errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_MONITORED_FOLDER')); } // if } if(formObject.port.value == "") { errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_PORT')); } if(errors.length > 0) { out = SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_DESC'); for(i=0; i