1 /*********************************************************************************
2 * SugarCRM Community Edition is a customer relationship management program developed by
3 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Affero General Public License version 3 as published by the
7 * Free Software Foundation with the addition of the following permission added
8 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
9 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
10 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
17 * You should have received a copy of the GNU Affero General Public License along with
18 * this program; if not, see http://www.gnu.org/licenses or write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
23 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU Affero General Public License version 3.
29 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
30 * these Appropriate Legal Notices must retain the display of the "Powered by
31 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
32 * technical reasons, the Appropriate Legal Notices must display the words
33 * "Powered by SugarCRM".
34 ********************************************************************************/
38 function clearInboundSettings() {
39 var url = document.getElementById('server_url');
40 var user = document.getElementById('email_user');
41 var prot = document.getElementById('protocol');
42 var pass = document.getElementById('email_password');
43 var port = document.getElementById('port');
44 var inbox = document.getElementById('mailbox');
52 for(i=0; i<prot.options.length; i++) {
53 if(prot.options[i].value == '') {
54 prot.options[i].selected = true;
59 function checkInboundEmailSettings() {
60 var url = document.getElementById('server_url');
61 var user = document.getElementById('email_user');
62 var prot = document.getElementById('protocol');
63 var pass = document.getElementById('email_password');
64 var port = document.getElementById('port');
65 var inbox = document.getElementById('mailbox');
67 var IEAlert = SUGAR.language.get('Users', 'ERR_IE_MISSING_REQUIRED');
71 } else if(user.value != '') {
73 } else if(prot.value != '') {
75 } else if(pass.value != '') {
77 } else if(port.value != '') {
80 /* else if(inbox.value != '') {
85 if(url.value == '' || url.value == 'undefined') {
88 } else if(user.value == '' || user.value == 'undefined') {
91 } else if(prot.value == '' || prot.value == 'undefined') {
94 } else if(pass.value == '' || pass.value == 'undefined') {
97 } else if(port.value == '' || port.value == 'undefined') {
100 } else if(inbox.value == '' || inbox.value == 'undefined') {
110 function show_main() {
111 var basic = document.getElementById('basic'); basic.style.display = "";
112 var settings = document.getElementById('settings'); settings.style.display = "";
113 var info = document.getElementById('information'); info.style.display = "";
114 var address = document.getElementById('address'); address.style.display = "";
115 var calendar_options = document.getElementById('calendar_options'); calendar_options.style.display = "";
116 var edit_tabs = document.getElementById('edit_tabs'); edit_tabs.style.display = "";
118 var email_options = document.getElementById('email_options'); email_options.style.display = 'none';
119 var email_inbound = document.getElementById('email_inbound'); email_inbound.style.display = 'none';
122 function show_email() {
123 var basic = document.getElementById('basic'); basic.style.display = "none";
124 var settings = document.getElementById('settings'); settings.style.display = "none";
125 var info = document.getElementById('information'); info.style.display = "none";
126 var address = document.getElementById('address'); address.style.display = "none";
127 var calendar_options = document.getElementById('calendar_options'); calendar_options.style.display = "none";
128 var edit_tabs = document.getElementById('edit_tabs'); edit_tabs.style.display = "none";
130 var email_options = document.getElementById('email_options'); email_options.style.display = "";
131 var email_inbound = document.getElementById('email_inbound'); email_inbound.style.display = "";
135 function enable_change_password_button() {
136 var butt = document.getElementById('change_password_button');
137 if(document.EditView.record.value != "" && document.EditView.record.value != 'undefined') {
138 butt.style.display = '';
142 function refresh_signature_list(signature_id, signature_name) {
143 var field=document.getElementById('signature_id');
145 for (var i=0; i < field.options.length; i++) {
146 if (field.options[i].value == signature_id) {
147 if (field.options[i].selected==false) {
148 field.options[i].selected=true;
153 //add item to selection list.
155 var newElement=document.createElement('option');
156 newElement.text=signature_name;
157 newElement.value=signature_id;
158 field.options.add(newElement);
159 newElement.selected=true;
162 //enable the edit button.
163 var field1=document.getElementById('edit_sig');
164 field1.style.visibility="visible";
167 function setSigEditButtonVisibility() {
168 var field = document.getElementById('signature_id');
169 var editButt = document.getElementById('edit_sig');
170 if(field.value != '') {
171 editButt.style.visibility = "visible";
173 editButt.style.visibility = "hidden";
177 function open_email_signature_form(record, the_user_id) {
178 URL="index.php?module=Users&action=Popup";
180 URL += "&record="+record;
182 if(the_user_id != "") {
183 URL += "&the_user_id="+the_user_id;
185 windowName = 'email_signature';
186 windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
188 win = window.open(URL, windowName, windowFeatures);
190 // put the focus on the popup if the browser supports the focus() method
195 function setDefaultSigId(id) {
196 var checkbox = document.getElementById("signature_default");
197 var default_sig = document.getElementById("signatureDefault");
199 if(checkbox.checked) {
200 default_sig.value = id;
202 default_sig.value = "";