2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Description: Contains a variety of utility functions used to display UI
41 * components such as form headers and footers. Intended to be modified on a per
43 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
44 * All Rights Reserved.
45 * Contributor(s): ______________________________________..
46 ********************************************************************************/
49 * Create javascript to validate the data entered into a record.
50 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
51 * All Rights Reserved.
52 * Contributor(s): ______________________________________..
54 function user_get_validate_record_js () {
58 $lbl_email = $mod_strings['LBL_EMAIL'];
59 $lbl_last_name = $mod_strings['LBL_LIST_LAST_NAME'];
60 $lbl_password = $mod_strings['LBL_LIST_PASSWORD'];
61 $lbl_user_name = $mod_strings['LBL_LIST_USER_NAME'];
62 $err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS'];
63 $err_invalid_required_fields = $app_strings['ERR_INVALID_REQUIRED_FIELDS'];
64 //$err_invalid_email_address = $app_strings['ERR_INVALID_EMAIL_ADDRESS'];
65 $err_self_reporting = $app_strings['ERR_SELF_REPORTING'];
66 $err_password_mismatch = $mod_strings['ERR_PASSWORD_MISMATCH'];
67 $err_password_missing = $mod_strings['ERR_INVALID_PASSWORD'];
71 <script type="text/javascript" language="Javascript">
72 function verify_data(form)
74 // handles any errors in the email widget
75 var isError = !check_form("EditView");
77 if (trim(form.last_name.value) == "") {
78 add_error_style('EditView',form.last_name.name,
79 '{$app_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['LBL_LIST_NAME']}' );
82 if (trim(form.sugar_user_name.value) == "") {
83 add_error_style('EditView',form.sugar_user_name.name,
84 '{$app_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['LBL_USER_NAME']}' );
88 if (document.getElementById("required_password").value=='1'
89 && document.getElementById("new_password").value == "") {
90 add_error_style('EditView',form.new_password.name,
91 '{$app_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['LBL_NEW_PASSWORD']}' );
95 if (isError == true) {
99 if (document.EditView.return_id.value != '' && (document.EditView.return_id.value == form.reports_to_id.value)) {
100 alert('$err_self_reporting');
104 if (document.EditView.dec_sep.value != '' && (document.EditView.dec_sep.value == "'")) {
105 alert("{$app_strings['ERR_NO_SINGLE_QUOTE']} {$mod_strings['LBL_DECIMAL_SEP']}");
109 if (document.EditView.num_grp_sep.value != '' && (document.EditView.num_grp_sep.value == "'")) {
110 alert("{$app_strings['ERR_NO_SINGLE_QUOTE']} {$mod_strings['LBL_NUMBER_GROUPING_SEP']}");
114 if (document.EditView.num_grp_sep.value == document.EditView.dec_sep.value) {
115 alert("{$app_strings['ERR_DECIMAL_SEP_EQ_THOUSANDS_SEP']}");
118 if( document.getElementById("portal_only") && document.getElementById("portal_only")=='1' &&
119 typeof(document.getElementById("new_password")) != "undefined" && typeof(document.getElementById("new_password").value) != "undefined") {
120 if(document.getElementById("new_password").value != '' || document.getElementById("confirm_pwd").value != '') {
121 if(document.getElementById("new_password").value != document.getElementById("confirm_pwd").value) {
122 alert('$err_password_mismatch');
137 function user_get_chooser_js()
141 <script type="text/javascript" language="Javascript">
142 <!-- to hide script contents from old browsers
144 function set_chooser()
149 var display_tabs_def = '';
150 var hide_tabs_def = '';
151 var remove_tabs_def = '';
153 var display_td = document.getElementById('display_tabs_td');
154 var hide_td = document.getElementById('hide_tabs_td');
155 var remove_td = document.getElementById('remove_tabs_td');
157 var display_ref = display_td.getElementsByTagName('select')[0];
159 for(i=0; i < display_ref.options.length ;i++)
161 display_tabs_def += "display_tabs[]="+display_ref.options[i].value+"&";
166 var hide_ref = hide_td.getElementsByTagName('select')[0];
168 for(i=0; i < hide_ref.options.length ;i++)
170 hide_tabs_def += "hide_tabs[]="+hide_ref.options[i].value+"&";
174 if(remove_td != null)
176 var remove_ref = remove_td.getElementsByTagName('select')[0];
178 for(i=0; i < remove_ref.options.length ;i++)
180 remove_tabs_def += "remove_tabs[]="+remove_ref.options[i].value+"&";
185 document.EditView.display_tabs_def.value = display_tabs_def;
186 document.EditView.hide_tabs_def.value = hide_tabs_def;
187 document.EditView.remove_tabs_def.value = remove_tabs_def;
192 // end hiding contents from old browsers -->
199 function user_get_confsettings_js() {
203 $lbl_last_name = $mod_strings['LBL_MAIL_FROMADDRESS'];
204 $err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS'];
208 <script type="text/javascript" language="Javascript">
209 <!-- to hide script contents from old browsers
211 function add_checks(f) {
215 // end hiding contents from old browsers -->