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