--- loncom/interface/loncreateuser.pm 2021/12/13 20:53:06 1.406.2.20
+++ loncom/interface/loncreateuser.pm 2023/01/22 17:14:57 1.406.2.20.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.406.2.20 2021/12/13 20:53:06 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.406.2.20.2.3 2023/01/22 17:14:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -244,6 +244,7 @@ sub build_tools_display {
'aboutme' => "Personal Information Page",
'webdav' => "WebDAV access to Authoring Spaces (if SSL and author/co-author)",
'portfolio' => "Personal User Portfolio",
+ 'timezone' => "Can set Time Zone",
'avai' => "Available",
'cusa' => "availability",
'chse' => "Change setting",
@@ -255,6 +256,7 @@ sub build_tools_display {
'textbook' => 'Can request creation of textbook courses',
'requestauthor' => 'Can request author space',
);
+ $isadv = &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
if ($context eq 'requestcourses') {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
'requestcourses.official','requestcourses.unofficial',
@@ -267,7 +269,6 @@ sub build_tools_display {
$colspan = ' colspan="2"';
%domconfig =
&Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain);
- $isadv = &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
} elsif ($context eq 'requestauthor') {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
'requestauthor');
@@ -281,17 +282,18 @@ sub build_tools_display {
} else {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
'tools.aboutme','tools.portfolio','tools.blog',
- 'tools.webdav');
- @usertools = ('aboutme','blog','webdav','portfolio');
+ 'tools.webdav','tools.timezone');
+ @usertools = ('aboutme','blog','webdav','portfolio','timezone');
}
foreach my $item (@usertools) {
my ($custom_access,$curr_access,$cust_on,$cust_off,$tool_on,$tool_off,
$currdisp,$custdisp,$custradio);
$cust_off = 'checked="checked" ';
$tool_on = 'checked="checked" ';
- $curr_access =
+ $curr_access =
&Apache::lonnet::usertools_access($ccuname,$ccdomain,$item,undef,
- $context);
+ $context,\%userenv,'',
+ {'is_adv' => $isadv});
if ($context eq 'requestauthor') {
if ($userenv{$context} ne '') {
$cust_on = ' checked="checked" ';
@@ -1592,7 +1594,7 @@ ENDNOTOOLSPRIV
if ($newuser) {
$r->print(' onclick="auth_check()" \>'."\n");
} else {
- $r->print('onclick="this.form.submit()" \>'."\n");
+ $r->print(' onclick="this.form.submit()" \>'."\n");
}
} else {
$r->print(''.
@@ -2493,8 +2495,8 @@ sub personal_data_display {
}
$rowcount ++;
$output .= &Apache::lonhtmlcommon::row_closure(1);
- my $upassone = '';
- my $upasstwo = '';
+ my $upassone = '';
+ my $upasstwo = '';
$output .= &Apache::lonhtmlcommon::row_title(&mt('Password').'*',
'LC_pick_box_title',
'LC_oddrow_value')."\n".
@@ -2849,7 +2851,7 @@ sub update_user_data {
my (%alerts,%rulematch,%inst_results,%curr_rules);
my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
- my @usertools = ('aboutme','blog','webdav','portfolio');
+ my @usertools = ('aboutme','blog','webdav','portfolio','timezone');
my @requestcourses = ('official','unofficial','community','textbook');
my @requestauthor = ('requestauthor');
my ($othertitle,$usertypes,$types) =
@@ -3025,7 +3027,8 @@ sub update_user_data {
my %userenv = &Apache::lonnet::get
('environment',['firstname','middlename','lastname','generation',
'id','permanentemail','portfolioquota','authorquota','inststatus',
- 'tools.aboutme','tools.blog','tools.webdav','tools.portfolio',
+ 'tools.aboutme','tools.blog','tools.webdav',
+ 'tools.portfolio','tools.timezone',
'requestcourses.official','requestcourses.unofficial',
'requestcourses.community','requestcourses.textbook',
'reqcrsotherdom.official','reqcrsotherdom.unofficial',
@@ -3358,6 +3361,10 @@ sub update_user_data {
&Apache::lonnet::appenv(\%newenvhash);
}
}
+ if ($changed{'aboutme'}) {
+ &Apache::loncommon::devalidate_aboutme_cache($env{'form.ccuname'},
+ $env{'form.ccdomain'});
+ }
}
}
if (keys(%namechanged) > 0) {
@@ -3527,6 +3534,7 @@ sub display_userinfo {
'webdav' => 'WebDAV Availability',
'aboutme' => 'Personal Information Page Availability',
'portfolio' => 'Portfolio Availability',
+ 'timezone' => 'Can set own Time Zone',
'official' => 'Can Request Official Courses',
'unofficial' => 'Can Request Unofficial Courses',
'community' => 'Can Request Communities',
@@ -5290,7 +5298,8 @@ sub handler {
''.&mt('You do not have permission to view change logs').'');
}
} elsif ($env{'form.action'} eq 'helpdesk') {
- if (($permission->{'owner'}) || ($permission->{'co-owner'})) {
+ if (($permission->{'owner'} || $permission->{'co-owner'}) &&
+ ($permission->{'cusr'} || $permission->{'view'})) {
if ($env{'form.state'} eq 'process') {
if ($permission->{'owner'}) {
&update_helpdeskaccess($r,$permission,$brcrum);
@@ -5717,7 +5726,8 @@ sub print_main_menu {
icon => 'helpdesk-access.png',
#help => 'Course_Helpdesk_Access',
url => '/adm/createuser?action=helpdesk',
- permission => ($permission->{'owner'} || $permission->{'co-owner'}),
+ permission => (($permission->{'owner'} || $permission->{'co-owner'}) &&
+ ($permission->{'view'} || $permission->{'cusr'})),
linktitle => 'Helpdesk access options',
},
{