]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Users/DetailView.php
Release 6.1.4
[Github/sugarcrm.git] / modules / Users / DetailView.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38 /*********************************************************************************
39
40  * Description:  TODO: To be written.
41  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42  * All Rights Reserved.
43  * Contributor(s): ______________________________________..
44  ********************************************************************************/
45
46
47 require_once('include/DetailView/DetailView.php');
48 require_once('include/export_utils.php');
49 require_once('include/timezone/timezones.php');
50
51
52
53 global $current_user;
54 global $theme;
55 global $app_strings;
56 global $mod_strings;
57 global $timezones;
58 if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'],'Users')
59       && ($_REQUEST['record'] != $current_user->id)) sugar_die("Unauthorized access to administration.");
60
61 $focus = new User();
62
63 $detailView = new DetailView();
64 $offset=0;
65 if (isset($_REQUEST['offset']) || !empty($_REQUEST['record'])) {
66         $result = $detailView->processSugarBean("USER", $focus, $offset);
67         
68         if($result == null) {
69             sugar_die($app_strings['ERROR_NO_RECORD']);
70         }
71         $focus=$result;
72 } else {
73         header("Location: index.php?module=Users&action=index");
74 }
75
76 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
77         $focus->id = "";
78 }
79 if(isset($_REQUEST['reset_preferences'])){
80         $focus->resetPreferences();
81 }
82 if(isset($_REQUEST['reset_homepage'])){
83     $focus->resetPreferences('Home');
84     if($focus->id == $current_user->id) {
85         $_COOKIE[$current_user->id . '_activePage'] = '0';
86         setcookie($current_user->id . '_activePage','0',3000);
87     }
88 }
89
90 $params = array();
91 $params[] = "<span class='pointer'>&raquo;</span>".$locale->getLocaleFormattedName($focus->first_name,$focus->last_name);
92 echo getClassicModuleTitle("Users", $params, true);
93
94 global $app_list_strings;
95
96 $GLOBALS['log']->info("User detail view");
97
98 $sugar_smarty = new Sugar_Smarty();
99 $sugar_smarty->assign("MOD", $mod_strings);
100 $sugar_smarty->assign("APP", $app_strings);
101 $sugar_smarty->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
102 $sugar_smarty->assign("ID", $focus->id);
103 $sugar_smarty->assign("USER_NAME", $focus->user_name);
104 $sugar_smarty->assign("FULL_NAME", $focus->full_name);
105 if(!empty($GLOBALS['sugar_config']['authenticationClass'])){
106                 $authclass =  $GLOBALS['sugar_config']['authenticationClass'];
107 }else if(!empty($GLOBALS['system_config']->settings['system_ldap_enabled'])){
108                 $authclass =  'LDAPAuthenticate';
109 }
110 if(is_admin($GLOBALS['current_user']) && !empty($authclass)){
111 $str = '<tr><td valign="top" scope="row">';
112 $str .= $authclass . ':';
113 $str .= '</td><td><input type="checkbox" disabled ';
114 if(!empty($focus->external_auth_only))$str .= ' CHECKED ';
115 $str .='/></td><td>'.  $mod_strings['LBL_EXTERNAL_AUTH_ONLY'] . ' ' . $authclass. '</td></tr>';
116 $sugar_smarty->assign('EXTERNAL_AUTH', $str);
117 }
118
119 $edit_self = $current_user->id == $focus->id;
120 if($edit_self) {
121         $sugar_smarty->assign('EDIT_SELF','1');
122 }
123
124 ///////////////////////////////////////////////////////////////////////////////
125 ////    TO SUPPORT LEGACY XTEMPLATES
126 $sugar_smarty->assign('FIRST_NAME', $focus->first_name);
127 $sugar_smarty->assign('LAST_NAME', $focus->last_name);
128 ////    END SUPPORT LEGACY XTEMPLATES
129 ///////////////////////////////////////////////////////////////////////////////
130
131 $status = '';
132 if(!empty($focus->status)) {
133   // jc:#12261 - while not apparent, replaced the explicit reference to the
134   // app_strings['user_status_dom'] element with a call to the ultility translate
135   // function to retrieved the mapped value for User::status
136   $status = translate('user_status_dom', '', $focus->status);
137 }
138 $sugar_smarty->assign("STATUS", $status);
139 $detailView->processListNavigation($sugar_smarty, "USER", $offset);
140 $reminder_time = $focus->getPreference('reminder_time');
141
142 if(empty($reminder_time)){
143         $reminder_time = -1;
144 }
145 if($reminder_time != -1){
146         $sugar_smarty->assign("REMINDER_CHECKED", 'checked');
147         $sugar_smarty->assign("REMINDER_TIME", translate('reminder_time_options', '', $reminder_time));
148 }
149 // Display the good usertype
150 $user_type_label=$mod_strings['LBL_REGULAR_USER'];
151 $usertype='RegularUser';
152
153 if((is_admin($current_user) || $_REQUEST['record'] == $current_user->id || is_admin_for_module($current_user,'Users')) && $focus->is_admin == '1'){
154         $user_type_label=$mod_strings['LBL_ADMIN_USER'];
155         $usertype='Administrator';
156 }
157
158
159 $sugar_smarty->assign('IS_GROUP_OR_PORTAL','0');
160 if(!empty($focus->is_group) && $focus->is_group == 1){
161         $user_type_label=$mod_strings['LBL_GROUP_USER'];
162         $usertype='GroupUser';
163     $sugar_smarty->assign('IS_GROUP_OR_PORTAL','1');
164 }
165
166 $sugar_smarty->assign("USER_TYPE", $usertype);
167 $sugar_smarty->assign("USER_TYPE_LABEL", $user_type_label);
168
169
170
171
172
173 // adding custom fields:
174 $xtpl = $sugar_smarty;
175 require_once('modules/DynamicFields/templates/Files/DetailView.php');
176 $errors = "";
177 $msgGood = false;
178 if (isset($_REQUEST['pwd_set']) && $_REQUEST['pwd_set']!= 0){
179         if ($_REQUEST['pwd_set']=='4'){
180                 require_once('modules/Users/password_utils.php');
181                 $errors.=canSendPassword();
182         }
183         else {
184                 $errors.=$mod_strings['LBL_NEW_USER_PASSWORD_'.$_REQUEST['pwd_set']];   
185                 $msgGood = true;
186         }
187 }else{
188         //IF FOCUS USER IS LOCKOUT
189         if($focus->getPreference('lockout')=='1')
190                 $errors.=$mod_strings['ERR_USER_IS_LOCKED_OUT'];
191 }
192 $sugar_smarty->assign("ERRORS", $errors);
193 $sugar_smarty->assign("ERROR_MESSAGE", $msgGood ? $mod_strings['LBL_PASSWORD_SENT'] : $mod_strings['LBL_CANNOT_SEND_PASSWORD']);
194 $buttons = "";
195 if ((is_admin($current_user) || $_REQUEST['record'] == $current_user->id
196      )
197         && !empty($sugar_config['default_user_name'])
198                 && $sugar_config['default_user_name'] == $focus->user_name
199                 && isset($sugar_config['lock_default_user_name'])
200                 && $sugar_config['lock_default_user_name']) {
201         $buttons .= "<input id='edit_button' title='".$app_strings['LBL_EDIT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_EDIT_BUTTON_KEY']."' class='button primary' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.return_id.value='$focus->id'; this.form.action.value='EditView'\" type='submit' name='Edit' value='".$app_strings['LBL_EDIT_BUTTON_LABEL']."'>  ";
202 }
203 elseif (is_admin($current_user)|| (is_admin_for_module($GLOBALS['current_user'],'Users')&& !$focus->is_admin)
204      || $_REQUEST['record'] == $current_user->id) {
205         $buttons .= "<input id='edit_button' title='".$app_strings['LBL_EDIT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_EDIT_BUTTON_KEY']."' class='button primary' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.return_id.value='$focus->id'; this.form.action.value='EditView'\" type='submit' name='Edit' value='".$app_strings['LBL_EDIT_BUTTON_LABEL']."'>  ";
206         if ((is_admin($current_user)|| is_admin_for_module($GLOBALS['current_user'],'Users')
207         )
208         ){
209                 if (!$current_user->is_group){
210                         $buttons .= "<input title='".$app_strings['LBL_DUPLICATE_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_DUPLICATE_BUTTON_KEY']."' class='button' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value=true; this.form.action.value='EditView'\" type='submit' name='Duplicate' value='".$app_strings['LBL_DUPLICATE_BUTTON_LABEL']."'>  ";
211
212                 if($focus->id != $current_user->id) {
213                     $buttons .="<input type='button' class='button' onclick='confirmDelete();' value='".$app_strings['LBL_DELETE_BUTTON_LABEL']."' /> ";
214                 }
215
216                         if (!$focus->portal_only && !$focus->is_group && !$focus->external_auth_only 
217                         && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){
218                                 $buttons .= "<input title='".$mod_strings['LBL_GENERATE_PASSWORD_BUTTON_TITLE']."' accessKey='".$mod_strings['LBL_GENERATE_PASSWORD_BUTTON_KEY']."' class='button' LANGUAGE=javascript onclick='generatepwd(\"".$focus->id."\");' type='button' name='password' value='".$mod_strings['LBL_GENERATE_PASSWORD_BUTTON_LABEL']."'>  ";
219                         }
220                 }
221         }
222 }
223
224 if(isset($_SERVER['QUERY_STRING'])) $the_query_string = $_SERVER['QUERY_STRING'];
225 else $the_query_string = '';
226
227 if (!$current_user->is_group){
228     if ($focus->id == $current_user->id) {
229         $reset_pref_warning = $mod_strings['LBL_RESET_PREFERENCES_WARNING'];
230         $reset_home_warning = $mod_strings['LBL_RESET_HOMEPAGE_WARNING'];
231     }
232     else {
233         $reset_pref_warning = $mod_strings['LBL_RESET_PREFERENCES_WARNING_USER'];
234         $reset_home_warning = $mod_strings['LBL_RESET_HOMEPAGE_WARNING_USER'];
235     }
236         $buttons .="<input type='button' class='button' onclick='if(confirm(\"{$reset_pref_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$the_query_string."&reset_preferences=true\";' value='".$mod_strings['LBL_RESET_PREFERENCES']."' />";
237         $buttons .="&nbsp;<input type='button' class='button' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$the_query_string."&reset_homepage=true\";' value='".$mod_strings['LBL_RESET_HOMEPAGE']."' />";
238  
239 }
240 if (isset($buttons)) $sugar_smarty->assign("BUTTONS", $buttons);
241
242 require_once("include/templates/TemplateGroupChooser.php");
243 require_once("modules/MySettings/TabController.php");
244 $chooser = new TemplateGroupChooser();
245 $controller = new TabController();
246
247 //if(is_admin($current_user) || $controller->get_users_can_edit())
248 if(is_admin($current_user)||is_admin_for_module($GLOBALS['current_user'],'Users'))
249 {
250         $chooser->display_third_tabs = true;
251         $chooser->args['third_name'] = 'remove_tabs';
252         $chooser->args['third_label'] =  $mod_strings['LBL_REMOVED_TABS'];
253 }
254 elseif(!$controller->get_users_can_edit())
255 {
256         $chooser->display_hide_tabs = false;
257 }
258 else
259 {
260         $chooser->display_hide_tabs = true;
261 }
262
263 $chooser->args['id'] = 'edit_tabs';
264 $chooser->args['values_array'] = $controller->get_tabs($focus);
265 $chooser->args['left_name'] = 'display_tabs';
266 $chooser->args['right_name'] = 'hide_tabs';
267 $chooser->args['left_label'] =  $mod_strings['LBL_DISPLAY_TABS'];
268 $chooser->args['right_label'] =  $mod_strings['LBL_HIDE_TABS'];
269 $chooser->args['title'] =  $mod_strings['LBL_EDIT_TABS'];
270 $chooser->args['disable'] = true;
271
272 foreach ($chooser->args['values_array'][0] as $key=>$value)
273 {
274 $chooser->args['values_array'][0][$key] = $app_list_strings['moduleList'][$key];
275 }
276 foreach ($chooser->args['values_array'][1] as $key=>$value)
277 {
278 $chooser->args['values_array'][1][$key] = $app_list_strings['moduleList'][$key];
279 }
280
281
282 $sugar_smarty->assign("TAB_CHOOSER", $chooser->display());
283 $sugar_smarty->assign("CHOOSE_WHICH", $mod_strings['LBL_CHOOSE_WHICH']);
284
285
286
287 if ($focus->receive_notifications) $sugar_smarty->assign("RECEIVE_NOTIFICATIONS", "checked");
288 if($focus->getPreference('mailmerge_on') == 'on') {
289 $sugar_smarty->assign("MAILMERGE_ON", "checked");
290 }
291 $sugar_smarty->assign("SETTINGS_URL", $sugar_config['site_url']);
292
293
294 $sugar_smarty->assign("EXPORT_DELIMITER", $focus->getPreference('export_delimiter'));
295 $sugar_smarty->assign('EXPORT_CHARSET', $locale->getExportCharset('', $focus));
296 $sugar_smarty->assign('USE_REAL_NAMES', $focus->getPreference('use_real_names'));
297
298
299 global $timedate;
300 $sugar_smarty->assign("DATEFORMAT", $sugar_config['date_formats'][$timedate->get_date_format()]);
301 $sugar_smarty->assign("TIMEFORMAT", $sugar_config['time_formats'][$timedate->get_time_format()]);
302
303 $userTZ = $focus->getPreference('timezone');
304 if(!empty($userTZ) && isset($timezones[$userTZ])) {
305         $value = $timezones[$userTZ];
306 }
307 if(!empty($value['dstOffset'])) {
308         $dst = " (+DST)";
309 } else {
310         $dst = "";
311 }
312 $gmtOffset = ($value['gmtOffset'] / 60);
313 if(!strstr($gmtOffset,'-')) {
314         $gmtOffset = "+".$gmtOffset;
315 }
316
317 $sugar_smarty->assign("TIMEZONE", $userTZ. str_replace('_',' '," (GMT".$gmtOffset.") ".$dst) );
318 $datef = $focus->getPreference('datef');
319 $timef = $focus->getPreference('timef');
320
321 if(!empty($datef))
322 $sugar_smarty->assign("DATEFORMAT", $sugar_config['date_formats'][$datef]);
323 if(!empty($timef))
324 $sugar_smarty->assign("TIMEFORMAT", $sugar_config['time_formats'][$timef]);
325
326 $num_grp_sep = $focus->getPreference('num_grp_sep');
327 $dec_sep = $focus->getPreference('dec_sep');
328 $sugar_smarty->assign("NUM_GRP_SEP", (empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep));
329 $sugar_smarty->assign("DEC_SEP", (empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep));
330
331
332
333 $currency  = new Currency();
334 if($focus->getPreference('currency') ) {
335         $currency->retrieve($focus->getPreference('currency'));
336         $sugar_smarty->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol );
337 } else {
338         $sugar_smarty->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
339 }
340 $sugar_smarty->assign('CURRENCY_SIG_DIGITS', $locale->getPrecedentPreference('default_currency_significant_digits', $focus));
341
342 $sugar_smarty->assign('NAME_FORMAT', $focus->getLocaleFormatDesc());
343
344
345 $sugar_smarty->assign("DESCRIPTION", nl2br(url2html($focus->description)));
346 $sugar_smarty->assign("TITLE", $focus->title);
347 $sugar_smarty->assign("DEPARTMENT", $focus->department);
348 $sugar_smarty->assign("REPORTS_TO_ID", $focus->reports_to_id);
349 $sugar_smarty->assign("REPORTS_TO_NAME", $focus->reports_to_name);
350 $sugar_smarty->assign("PHONE_HOME", $focus->phone_home);
351 $sugar_smarty->assign("PHONE_MOBILE", $focus->phone_mobile);
352 $sugar_smarty->assign("PHONE_WORK", $focus->phone_work);
353 $sugar_smarty->assign("PHONE_OTHER", $focus->phone_other);
354 $sugar_smarty->assign("PHONE_FAX", $focus->phone_fax);
355 if (!empty($focus->employee_status)) {
356         $sugar_smarty->assign("EMPLOYEE_STATUS", $app_list_strings['employee_status_dom'][$focus->employee_status]);
357 }
358 $sugar_smarty->assign("MESSENGER_ID", $focus->messenger_id);
359 $sugar_smarty->assign("MESSENGER_TYPE", $focus->messenger_type);
360 $sugar_smarty->assign("ADDRESS_STREET", $focus->address_street);
361 $sugar_smarty->assign("ADDRESS_CITY", $focus->address_city);
362 $sugar_smarty->assign("ADDRESS_STATE", $focus->address_state);
363 $sugar_smarty->assign("ADDRESS_POSTALCODE", $focus->address_postalcode);
364 $sugar_smarty->assign("ADDRESS_COUNTRY", $focus->address_country);
365 $sugar_smarty->assign("EMAIL_ADDRESSES", $focus->emailAddress->getEmailAddressWidgetDetailView($focus));
366 $sugar_smarty->assign("CALENDAR_PUBLISH_KEY", $focus->getPreference('calendar_publish_key' ));
367 if (! empty($current_user->email1))
368 {
369     $publish_url = $sugar_config['site_url'].'/vcal_server.php';
370     $token = "/";
371     //determine if the web server is running IIS
372     //if so then change the publish url
373     if(isset($_SERVER) && !empty($_SERVER['SERVER_SOFTWARE'])){
374         $position = strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'iis');
375         if($position !== false){
376             $token = '?parms=';
377         }
378     }
379
380     $publish_url .= $token.'type=vfb&email='.$focus->email1.'&source=outlook&key='.$focus->getPreference('calendar_publish_key' );
381     $sugar_smarty->assign("CALENDAR_PUBLISH_URL", $publish_url);
382     $sugar_smarty->assign("CALENDAR_SEARCH_URL", $sugar_config['site_url'].'/vcal_server.php/type=vfb&email=%NAME%@%SERVER%');
383 }
384 else
385 {
386   $sugar_smarty->assign("CALENDAR_PUBLISH_URL", $sugar_config['site_url'].'/vcal_server.php/type=vfb&user_name='.$focus->user_name.'&source=outlook&key='.$focus->getPreference('calendar_publish_key' ));
387   $sugar_smarty->assign("CALENDAR_SEARCH_URL", $sugar_config['site_url'].'/vcal_server.php/type=vfb&email=%NAME%@%SERVER%');
388 }
389
390 // Grouped tabs?
391 $useGroupTabs = $current_user->getPreference('navigation_paradigm');
392 if ( ! isset($useGroupTabs) ) {
393     if ( ! isset($GLOBALS['sugar_config']['default_navigation_paradigm']) ) {
394         $GLOBALS['sugar_config']['default_navigation_paradigm'] = 'gm';
395     }
396     $useGroupTabs = $GLOBALS['sugar_config']['default_navigation_paradigm'];
397 }
398 $sugar_smarty->assign("USE_GROUP_TABS",($useGroupTabs=='gm')?'checked':'');
399
400 $user_max_tabs = intval($focus->getPreference('max_tabs'));
401 if(isset($user_max_tabs) && $user_max_tabs > 0)
402     $sugar_smarty->assign("MAX_TAB", $user_max_tabs);
403 elseif(isset($max_tabs) && $max_tabs > 0)
404     $sugar_smarty->assign("MAX_TAB", $max_tabs);
405 else
406     $sugar_smarty->assign("MAX_TAB", $GLOBALS['sugar_config']['default_max_tabs']);
407
408 $user_subpanel_tabs = $focus->getPreference('subpanel_tabs');
409 if(isset($user_subpanel_tabs)) {
410     $sugar_smarty->assign("SUBPANEL_TABS", $user_subpanel_tabs?'checked':'');
411 } else {
412     $sugar_smarty->assign("SUBPANEL_TABS", $GLOBALS['sugar_config']['default_subpanel_tabs']?'checked':'');
413 }
414
415 // Email Options
416
417 $sugar_smarty->assign("EMAIL_OPTIONS", $focus->emailAddress->getEmailAddressWidgetDetailView($focus));
418 $email_link_type = $focus->getPreference('email_link_type');
419 if ( !empty($email_link_type) )
420     $sugar_smarty->assign('EMAIL_LINK_TYPE',$app_list_strings['dom_email_link_type'][$focus->getPreference('email_link_type')]);
421 if ( $focus->getPreference('email_link_type') == 'sugar' )
422     $sugar_smarty->assign('SHOW_SMTP_SETTINGS',true);
423
424 //Handle outbound email templates
425 $oe = new OutboundEmail();
426 $userOverrideOE = $oe->getUsersMailerForSystemOverride($focus->id);
427 $mail_smtpuser = "";
428 $mail_smtpserver = "";
429
430 if($userOverrideOE == null)
431 {
432     $systemOE = $oe->getSystemMailerSettings();
433     $mail_smtpdisplay = $systemOE->mail_smtpdisplay;
434     $mail_smtpserver = $systemOE->mail_smtpserver;
435     $mail_smtptype = $systemOE->mail_smtptype;
436     if( $oe->isAllowUserAccessToSystemDefaultOutbound() )
437         $mail_smtpuser = $systemOE->mail_smtpuser;
438 }
439 else 
440 {
441     $mail_smtpdisplay = $userOverrideOE->mail_smtpdisplay;
442     $mail_smtpuser = $userOverrideOE->mail_smtpuser;
443     $mail_smtpserver = $userOverrideOE->mail_smtpserver;
444     $mail_smtptype = $userOverrideOE->mail_smtptype;
445 }
446 $sugar_smarty->assign("MAIL_SMTPUSER", $mail_smtpuser);
447 $sugar_smarty->assign("MAIL_SMTPDISPLAY", $mail_smtpdisplay);
448
449
450 $show_roles = (!($focus->is_group=='1' || $focus->portal_only=='1'));
451 $sugar_smarty->assign('SHOW_ROLES', $show_roles);
452
453 // User Holidays subpanel on the advanced tab
454 global $modules_exempt_from_availability_check;
455 $modules_exempt_from_availability_check=array('Holidays'=>'Holidays',);
456 $locked = false;
457 if(!empty($GLOBALS['sugar_config']['lock_subpanels'])){
458         $locked = true;
459 }
460 $GLOBALS['sugar_config']['lock_subpanels'] = true;
461
462 $GLOBALS['sugar_config']['lock_subpanels'] = $locked;
463
464 $sugar_smarty->display('modules/Users/DetailView.tpl');
465
466 // Roles Grid and Roles subpanel should not be displayed for group and portal users
467 if($show_roles){
468     echo "<div>";
469     require_once('modules/ACLRoles/DetailUserRole.php');
470     echo "</div></div>";
471 }
472
473
474 echo "</td></tr>\n";
475
476
477 $savedSearch = new SavedSearch();
478 $json = getJSONobj();
479 $savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('Users')));
480 $str = "<script>
481 YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
482 </script>";
483 echo $str;
484 echo "<script type='text/javascript'>user_status_display('$usertype') </script>";
485
486 $confirmDeleteJS = "
487 <script type='text/javascript'>
488
489 function confirmDelete() {
490     var handleYes = function() {
491         window.location=\"".$_SERVER['PHP_SELF'] ."?module=Users&action=delete&record={$focus->id}\";
492     };
493
494     var handleNo = function() {
495         confirmDeletePopup.hide();
496         return false;
497      };
498     var user_portal_group = '{$usertype}';
499     var confirm_text = SUGAR.language.get('Users', 'LBL_DELETE_USER_CONFIRM');
500     if(user_portal_group == 'GroupUser'){
501         confirm_text = SUGAR.language.get('Users', 'LBL_DELETE_GROUP_CONFIRM');
502     }
503     
504     var confirmDeletePopup = new YAHOO.widget.SimpleDialog(\"Confirm \", {
505                 width: \"400px\",
506                 draggable: true,
507                 constraintoviewport: true,
508                 modal: true,
509                 fixedcenter: true,
510                 text: confirm_text,
511                 bodyStyle: \"padding:5px\",
512                 buttons: [{
513                         text: SUGAR.language.get('Users', 'LBL_OK'),
514                         handler: handleYes,
515                         isDefault:true
516                 }, {
517                         text: SUGAR.language.get('Users', 'LBL_CANCEL'),
518                         handler: handleNo
519                 }]
520      });
521     confirmDeletePopup.setHeader(SUGAR.language.get('Users', 'LBL_DELETE_USER'));
522     confirmDeletePopup.render(document.body);
523 }
524 </script>";
525 echo $confirmDeleteJS;
526 ?>