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