--- loncom/interface/loncreateuser.pm 2017/01/02 19:44:06 1.428 +++ loncom/interface/loncreateuser.pm 2017/01/28 03:48:44 1.432 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.428 2017/01/02 19:44:06 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.432 2017/01/28 03:48:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -860,7 +860,7 @@ ENDBLOCK $output = '

'.$userpicker.'

'; } if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs') && - (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') && + (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))))) { my $defdom=$env{'request.role.domain'}; my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); @@ -1435,7 +1435,7 @@ ENDAUTH $r->print('
'); $r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context, $inst_results{$ccuname.':'.$ccdomain})); - if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) || + if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) || (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) { $r->print('

'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'

'. &Apache::loncommon::start_data_table()); @@ -1455,7 +1455,7 @@ ENDAUTH if ((!$isauthor) && ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) || (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) && - ($env{'request.role.domain'} eq $ccdomain)) { + ($env{'request.role.domain'} eq $ccdomain)) { $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain); } $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname); @@ -1526,7 +1526,7 @@ ENDNOTOOLSPRIV } elsif (($context eq 'course') && ((&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) || ($env{'request.course.sec'} && &Apache::lonnet::allowed('vcl',$env{'request.course.id'}.'/'.$env{'request.course.sec'})))) { - $statuses = ['active']; + $statuses = ['active']; } if ($env{'form.action'} ne 'singlestudent') { &display_existing_roles($r,$ccuname,$ccdomain,\%inccourses,$context, @@ -1760,7 +1760,7 @@ sub display_existing_roles { if ($active) { next unless($showall || $showactive); } else { - next unless($showall || $showexpired); + next unless($showall || $showexpired); } # Is this a custom role? Get role owner and title. my ($croleudom,$croleuname,$croletitle)= @@ -1905,7 +1905,7 @@ sub display_existing_roles { } else { $row.=' '; } - $row.= ''; + $row.= ''; } my $plaintext=''; if (!$croletitle) { @@ -4384,7 +4384,6 @@ sub custom_role_editor { ); my $args = { bread_crumbs => $brcrum, bread_crumbs_component => 'User Management'}; - $r->print(&Apache::loncommon::start_page('Custom Role Editor', $head_script,$args). $body_top); @@ -5025,7 +5024,7 @@ sub handler { } elsif ($env{'form.state'} eq 'done') { $r->print('

'.&mt('Enrollment request processing').'

'."\n"); $r->print(&Apache::loncoursequeueadmin::update_request_queue($context, - $cdom,$cnum,$coursedesc)); + $cdom,$cnum,$coursedesc)); } } else { $r->print(&header(undef,{'no_nav_bar' => 1}). @@ -5045,7 +5044,7 @@ sub handler { &update_helpdeskaccess($r,$permission,$brcrum); } else { &print_helpdeskaccess_display($r,$permission,$brcrum); - } + } } else { &print_helpdeskaccess_display($r,$permission,$brcrum); } @@ -5306,9 +5305,8 @@ sub print_main_menu { ); if ($linkcontext eq 'domain') { unless ($permission->{'cusr'}) { - $links{'domain'}{'singleuser'} = 'View a User'; + $links{'domain'}{'singleuser'} = 'View a User'; $linktitles{'domain'}{'singleuser'} = 'View information about a user in the domain'; - } } elsif ($linkcontext eq 'course') { unless ($permission->{'cusr'}) { @@ -6062,7 +6060,7 @@ ENDSCRIPT } elsif ($item eq 'approval') { my ($currnotified,$currapproval,%appchecked); my %selfdescs = &Apache::lonuserutils::selfenroll_default_descs(); - if (ref($currsettings) eq 'HASH') { + if (ref($currsettings) eq 'HASH') { $currnotified = $currsettings->{'selfenroll_notifylist'}; $currapproval = $currsettings->{'selfenroll_approval'}; } @@ -6596,7 +6594,7 @@ ENDSCRIPT } } if (($context eq 'course') && ($viewablesec ne '')) { - next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec); + next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec); } $count ++; next if ($count < $minshown); @@ -6686,20 +6684,25 @@ sub print_useraccesslogs_display { # set breadcrumbs my %breadcrumb_text = &singleuser_breadcrumb('','domain',$udom); - push (@{$brcrum}, - {href => "javascript:backPage($form)", - text => $breadcrumb_text{'search'}}); - my (@prevphases,$prevphasestr); - if ($env{'form.prevphases'}) { - @prevphases = split(/,/,$env{'form.prevphases'}); - $prevphasestr = $env{'form.prevphases'}; - } - if (($env{'form.phase'} eq 'userpicked') || (grep(/^userpicked$/,@prevphases))) { - push(@{$brcrum}, - {href => "javascript:backPage($form,'get_user_info','select')", - text => $breadcrumb_text{'userpicked'}}); - if ($env{'form.phase'} eq 'userpicked') { - $prevphasestr = 'userpicked'; + my $prevphasestr; + if ($env{'form.popup'}) { + $brcrum = []; + } else { + push (@{$brcrum}, + {href => "javascript:backPage($form)", + text => $breadcrumb_text{'search'}}); + my @prevphases; + if ($env{'form.prevphases'}) { + @prevphases = split(/,/,$env{'form.prevphases'}); + $prevphasestr = $env{'form.prevphases'}; + } + if (($env{'form.phase'} eq 'userpicked') || (grep(/^userpicked$/,@prevphases))) { + push(@{$brcrum}, + {href => "javascript:backPage($form,'get_user_info','select')", + text => $breadcrumb_text{'userpicked'}}); + if ($env{'form.phase'} eq 'userpicked') { + $prevphasestr = 'userpicked'; + } } } push(@{$brcrum}, @@ -6711,6 +6714,7 @@ sub print_useraccesslogs_display { bread_crumbs_component => 'User Management'}; if ($env{'form.popup'}) { $args->{'no_nav_bar'} = 1; + $args->{'bread_crumbs_nomenu'} = 1; } # set javascript @@ -6736,8 +6740,12 @@ ENDSCRIPT unless ($permission->{'activity'}) { $r->print('

' .&mt('You do not have rights to display user access logs.') - .'

' - .&earlyout_accesslog_form($formname,$prevphasestr,$udom)); + .'

'); + if ($env{'form.popup'}) { + $r->print('

'.&mt('Close window').'

'); + } else { + $r->print(&earlyout_accesslog_form($formname,$prevphasestr,$udom)); + } return; } @@ -6803,8 +6811,10 @@ ENDSCRIPT my ($nav_script,$nav_links); # table header - my $tableheader = - &Apache::loncommon::start_data_table_header_row() + my $tableheader = '

'. + &mt('User access logs for: [_1]', + &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom)).'

' + .&Apache::loncommon::start_data_table_header_row() .' ' .''.&mt('When').'' .''.&mt('HostID').'' @@ -7003,7 +7013,7 @@ sub activity_display_filter { # Update Display button $output .= '

' .'' - .'

'; + .'


'; return $output; } @@ -7201,14 +7211,14 @@ sub print_helpdeskaccess_display { my ($numstatustypes,@jsarray); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($cdom); if (ref($types) eq 'ARRAY') { - if (@{$types} > 0) { + if (@{$types} > 0) { $numstatustypes = scalar(@{$types}); push(@accesstypes,'status'); @jsarray = ('bystatus'); } } my %customroles = &get_domain_customroles($cdom,$confname); - my %domhelpdesk = &Apache::lonnet::get_active_domroles($cdom,['dh']); + my %domhelpdesk = &Apache::lonnet::get_active_domroles($cdom,['dh','da']); if (keys(%domhelpdesk)) { push(@accesstypes,('inc','exc')); push(@jsarray,('notinc','notexc')); @@ -7251,7 +7261,7 @@ sub print_helpdeskaccess_display { $elements{$role.'_staff_inc'} = 'checkbox'; $elements{$role.'_staff_exc'} = 'checkbox'; } - $elements{$role.'_override'} = 'checkbox'; + $elements{$role.'_override'} = 'checkbox'; if (ref($settings{$role}) eq 'HASH') { if ($settings{$role}{'access'} ne '') { my $curraccess = $settings{$role}{'access'}; @@ -7315,7 +7325,7 @@ function switchRoleTab(caller,role) { } } return false; -} +} function helpdeskAccess(role) { var curraccess = null; @@ -7329,11 +7339,11 @@ function helpdeskAccess(role) { var shown = Array(); var hidden = Array(); if (curraccess == 'none') { - hidden = Array ('$hiddenstr'); + hidden = Array ('$hiddenstr'); } else { if (curraccess == 'status') { - shown = Array ('bystatus','privs'); - hidden = Array ('notinc','notexc'); + shown = Array ('bystatus','privs'); + hidden = Array ('notinc','notexc'); } else { if (curraccess == 'exc') { shown = Array ('notexc','privs'); @@ -7352,7 +7362,7 @@ function helpdeskAccess(role) { if (hidden.length > 0) { for (var i=0; i 'All', 'none' => 'None', 'status' => 'Determined based on institutional status', - 'inc' => 'Include all, but exclude specific personnel', + 'inc' => 'Include all, but exclude specific personnel', 'exc' => 'Exclude all, but include specific personnel', 'hel' => 'Helpdesk', 'rpr' => 'Role privileges', @@ -7445,8 +7455,8 @@ ENDJS my @roles_by_num = (); foreach my $item (sort {$a <=> $b } (keys(%ordered))) { push(@roles_by_num,$ordered{$item}); - } - $r->print('

'.$lt{'tfh'}.': '.join(', ',map { $description{$_}; } @roles_by_num).'.'); + } + $r->print('

'.$lt{'tfh'}.': '.join(', ',map { $description{$_}; } @roles_by_num).'.'); if ($permission->{'owner'}) { $r->print('
'.$lt{'aco'}.'

'); $r->print(''. @@ -7468,7 +7478,7 @@ ENDJS my $id; if ($count == 0) { $id=' id="LC_current_minitab"'; - $visibility{$role} = ' style="display:block"'; + $visibility{$role} = ' style="display:block"'; } else { $visibility{$role} = ' style="display:none"'; } @@ -7488,11 +7498,11 @@ ENDJS priv => 'block', ); my (%selected,$overridden,$incrscheck,$indomcheck,$indomvis,$incrsvis); - if (ref($settings{$role}) eq 'HASH') { + if (ref($settings{$role}) eq 'HASH') { if ($settings{$role}{'access'} ne '') { $indomvis = ' style="display:none"'; $incrsvis = ' style="display:block"'; - $incrscheck = ' checked="checked"'; + $incrscheck = ' checked="checked"'; if ($settings{$role}{'access'} ne 'all') { $usecheck{$settings{$role}{'access'}} = $usecheck{'all'}; delete($usecheck{'all'}); @@ -7519,7 +7529,7 @@ ENDJS } } else { $indomcheck = ' checked="checked"'; - $indomvis = ' style="display:block"'; + $indomvis = ' style="display:block"'; $incrsvis = ' style="display:none"'; } $r->print('

'. @@ -7572,6 +7582,9 @@ ENDJS &role_priv_table($role,$permission,$crstype,\%full,\%levels,\%levelscurrent,$overridden{$role}). '
'); } + if ($permission->{'owner'}) { + $r->print('

'); + } } else { $r->print(&mt('Helpdesk roles have not yet been created in this domain.')); } @@ -7590,7 +7603,8 @@ sub domain_adhoc_access { my $access = $domcurrent->{$role}{'access'}; if (($access eq '') || (!grep(/^\Q$access\E$/,@{$accesstypes}))) { $access = 'all'; - $domusage{$role} = &mt('Any user in domain with active [_1] role',&Apache::lonnet::plaintext('dh')); + $domusage{$role} = &mt('Any user in domain with active [_1] or [_2] role',&Apache::lonnet::plaintext('dh'), + &Apache::lonnet::plaintext('da')); } elsif ($access eq 'status') { if (ref($domcurrent->{$role}{$access}) eq 'ARRAY') { my @shown; @@ -7606,8 +7620,8 @@ sub domain_adhoc_access { } if (@shown) { my $shownstatus = join(' '.&mt('or').' ',@shown); - $domusage{$role} = &mt('Any user in domain with active [_1] role, and institutional status: [_2]', - &Apache::lonnet::plaintext('dh'),$shownstatus); + $domusage{$role} = &mt('Any user in domain with active [_1] or [_2] role, and institutional status: [_3]', + &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da'),$shownstatus); } else { $domusage{$role} = &mt('No one in the domain'); } @@ -7621,10 +7635,11 @@ sub domain_adhoc_access { } my $showninc = join(', ',@dominc); if ($showninc ne '') { - $domusage{$role} = &mt('Include any user in domain with active [_1] role, except: [_2]', - &Apache::lonnet::plaintext('dh'),$showninc); + $domusage{$role} = &mt('Include any user in domain with active [_1] or [_2] role, except: [_3]', + &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da'),$showninc); } else { - $domusage{$role} = &mt('Any user in domain with active [_1] role',&Apache::lonnet::plaintext('dh')); + $domusage{$role} = &mt('Any user in domain with active [_1] or [_2] role', + &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da')); } } } elsif ($access eq 'exc') { @@ -7637,18 +7652,20 @@ sub domain_adhoc_access { } my $shownexc = join(', ',@domexc); if ($shownexc ne '') { - $domusage{$role} = &mt('Only the following in the domain with active [_1] role: [_2]', - &Apache::lonnet::plaintext('dh'),$shownexc); + $domusage{$role} = &mt('Only the following in the domain with active [_1] or [_2] role: [_3]', + &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da'),$shownexc); } else { $domusage{$role} = &mt('No one in the domain'); } } elsif ($access eq 'none') { $domusage{$role} = &mt('No one in the domain'); } elsif ($access eq 'all') { - $domusage{$role} = &mt('Any user in domain with active [_1] role',&Apache::lonnet::plaintext('dh')); + $domusage{$role} = &mt('Any user in domain with active [_1] or [_2] role', + &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da')); } } else { - $domusage{$role} = &mt('Any user in domain with active [_1] role',&Apache::lonnet::plaintext('dh')); + $domusage{$role} = &mt('Any user in domain with active [_1] or [_2] role', + &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da')); } } return %domusage; @@ -7716,13 +7733,13 @@ sub role_priv_table { $checked = ' checked="checked"'; } $customstatus = ''.$lt{'dis'}.''; - $ineffect = $customstatus; + $ineffect = $customstatus; } elsif ((!$levelscurrent->{'course'}{$priv}) && ($on{$priv})) { if ($permission->{'owner'}) { - $checked = ' checked="checked"'; + $checked = ' checked="checked"'; } $customstatus = ''.$lt{'ena'}.''; - $ineffect = $customstatus; + $ineffect = $customstatus; } if ($permission->{'owner'}) { $output .= ''; @@ -7737,7 +7754,7 @@ sub role_priv_table { } sub get_adhocrole_settings { - my ($cid,$accesstypes,$types,$customroles,$settings,$overridden) = @_; + my ($cid,$accesstypes,$types,$customroles,$settings,$overridden) = @_; return unless ((ref($accesstypes) eq 'ARRAY') && (ref($customroles) eq 'HASH') && (ref($settings) eq 'HASH') && (ref($overridden) eq 'HASH')); foreach my $role (split(/,/,$env{'course.'.$cid.'.internal.adhocaccess'})) { @@ -7839,7 +7856,7 @@ sub update_helpdeskaccess { my (%settings,%overridden); &get_adhocrole_settings($env{'request.course.id'},\@accesstypes, $types,\%customroles,\%settings,\%overridden); - my %domhelpdesk = &Apache::lonnet::get_active_domroles($cdom,['dh']); + my %domhelpdesk = &Apache::lonnet::get_active_domroles($cdom,['dh','da']); my (%changed,%storehash,@todelete); if (keys(%customroles)) { @@ -7866,7 +7883,7 @@ sub update_helpdeskaccess { push(@incrs,$role); unless ($current{'access'} eq $access) { $changed{$role}{'access'} = 1; - $storehash{'internal.adhoc.'.$role} = $access; + $storehash{'internal.adhoc.'.$role} = $access; } if ($access eq 'status') { my @statuses = &Apache::loncommon::get_env_multiple('form.'.$role.'_status'); @@ -7902,7 +7919,7 @@ sub update_helpdeskaccess { my @currstaff; foreach my $person (sort(@personnel)) { if ($domhelpdesk{$person}) { - push(@stored,$person); + push(@stored,$person); } } if (ref($current{$access}) eq 'ARRAY') { @@ -7948,7 +7965,7 @@ sub update_helpdeskaccess { &Apache::lonuserutils::custom_role_privs($customroles{$role},\%full,\%levels,\%levelscurrent); my (@updatedon,@updatedoff,@override); @override = &Apache::loncommon::get_env_multiple('form.'.$role.'_override'); - if (@override) { + if (@override) { foreach my $priv (sort(keys(%full))) { next unless ($levels{'course'}{$priv}); if (grep(/^\Q$priv\E$/,@override)) { @@ -7961,7 +7978,7 @@ sub update_helpdeskaccess { } } if (@updatedon) { - $newsettings{$role}{'on'} = join('
  • ', map { &Apache::lonnet::plaintext($_,$crstype) } (@updatedon)); + $newsettings{$role}{'on'} = join('
  • ', map { &Apache::lonnet::plaintext($_,$crstype) } (@updatedon)); } if (@updatedoff) { $newsettings{$role}{'off'} = join('
  • ', map { &Apache::lonnet::plaintext($_,$crstype) } (@updatedoff)); @@ -8069,13 +8086,13 @@ sub update_helpdeskaccess { push(@roles_by_num,$ordered{$item}); } %domusage = &domain_adhoc_access(\%changed,\%domcurrent,\@accesstypes,$usertypes,$othertitle); - $r->print(&mt('Helpdesk access settings have been changed as follows').'
    '); + $r->print(&mt('Helpdesk access settings have been changed as follows').'
    '); $r->print('
      '); foreach my $role (@roles_by_num) { next unless (ref($changed{$role}) eq 'HASH'); $r->print('
    • '.&mt('Ad hoc role').': '.$description{$role}.''. '
        '); - if ($changed{$role}{'access'} || $changed{$role}{'status'} || $changed{$role}{'inc'} || $changed{$role}{'exc'}) { + if ($changed{$role}{'access'} || $changed{$role}{'status'} || $changed{$role}{'inc'} || $changed{$role}{'exc'}) { $r->print('
      • '); if ($env{'form.'.$role.'_incrs'}) { if ($newsettings{$role}{'access'} eq 'all') { @@ -8085,7 +8102,7 @@ sub update_helpdeskaccess { } elsif ($newsettings{$role}{'access'} eq 'status') { if ($newsettings{$role}{'status'}) { my ($access,$rest) = split(/=/,$storehash{'internal.adhoc.'.$role}); - if (split(/,/,$rest) > 1) { + if (split(/,/,$rest) > 1) { $r->print(&mt('Helpdesk staff can use this role if their institutional type is one of: [_1].', $newsettings{$role}{'status'})); } else { @@ -8120,15 +8137,15 @@ sub update_helpdeskaccess { $r->print('
      • '.&mt('Privileges which are available by default for this ad hoc role, but are disabled for this specific '.lc($crstype).':'). '
        • '.$newsettings{$role}{'off'}.'
      • '); } else { - $r->print('
      • '.&mt('All privileges available by default for this ad hoc role are enabled.').'
      • '); + $r->print('
      • '.&mt('All privileges available by default for this ad hoc role are enabled.').'
      • '); } } - if ($changed{$role}{'on'}) { + if ($changed{$role}{'on'}) { if ($newsettings{$role}{'on'}) { $r->print('
      • '.&mt('Privileges which are not available by default for this ad hoc role, but are enabled for this specific '.lc($crstype).':'). '
        • '.$newsettings{$role}{'on'}.'
      • '); } else { - $r->print('
      • '.&mt('None of the privileges unavailable by default for this ad hoc role are enabled.').'
      • '); + $r->print('
      • '.&mt('None of the privileges unavailable by default for this ad hoc role are enabled.').'
      • '); } } } @@ -8137,7 +8154,7 @@ sub update_helpdeskaccess { $r->print('
      '); } } else { - $r->print(&mt('No changes made to helpdesk access settings.')); + $r->print(&mt('No changes made to helpdesk access settings.')); } } return; @@ -8616,7 +8633,6 @@ sub build_search_response { ,' ' ,'') .'
      '; - } } }