--- loncom/interface/domainprefs.pm 2018/12/08 15:03:25 1.344 +++ loncom/interface/domainprefs.pm 2018/12/26 20:10:24 1.345 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.344 2018/12/08 15:03:25 raeburn Exp $ +# $Id: domainprefs.pm,v 1.345 2018/12/26 20:10:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2836,7 +2836,31 @@ sub lti_toggle_js { // {$item}) eq 'HASH') { $key = $settings->{$item}->{'key'}; $secret = $settings->{$item}->{'secret'}; $lifetime = $settings->{$item}->{'lifetime'}; $consumer = $settings->{$item}->{'consumer'}; + $requser = $settings->{$item}->{'requser'}; $current = $settings->{$item}; } + my $onclickrequser = ' onclick="toggleLTI(this.form,'."'requser','$i'".');"'; + my %checkedrequser = ( + yes => ' checked="checked"', + no => '', + ); + if (!$requser) { + $checkedrequser{'no'} = $checkedrequser{'yes'}; + $checkedrequser{'yes'} = ''; + } my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; $datatable .= '' .' '. + ': '. (' 'x2). ''.$lt{'version'}.': '. (' 'x2). ''.$lt{'lifetime'}.':'. + 'value="'.$lifetime.'" size="3" />'. + (' 'x2). + ''.$lt{'requser'}.':'. + ' '."\n". + ''."\n". '

'. ''.$lt{'key'}. ': '. @@ -4829,12 +4867,16 @@ sub print_lti { ''. '
'.&mt('Required settings').''. ''.$lt{'consumer'}. - ': '."\n". + ': '."\n". (' 'x2). ''.$lt{'version'}.': '."\n". (' 'x2). - ''.$lt{'lifetime'}.': '."\n". + ''.$lt{'lifetime'}.': '."\n". + (' 'x2). + ''.$lt{'requser'}.':'. + ' '."\n". + ''."\n". '

'. ''.$lt{'key'}.': '."\n". (' 'x2). @@ -4853,15 +4895,16 @@ sub lti_names { 'url' => 'URL', 'key' => 'Key', 'lifetime' => 'Nonce lifetime (s)', - 'consumer' => 'LTI Consumer', + 'consumer' => 'Consumer', 'secret' => 'Secret', + 'requser' => "User's identity sent", 'email' => 'Email address', 'sourcedid' => 'User ID', 'other' => 'Other', 'passback' => 'Can return grades to Consumer:', 'roster' => 'Can retrieve roster from Consumer:', 'topmenu' => 'Display LON-CAPA page header', - 'inlinemenu'=> 'Display LON-CAPA inline menu', + 'inlinemenu'=> 'Display LON-CAPA inline menu', ); return %lt; } @@ -4887,6 +4930,7 @@ sub lti_options { my $crssecfieldsty = 'none'; my $secsrcfieldsty = 'none'; my $passbacksty = 'none'; + my $optionsty = 'block'; my $lcauthparm; my $lcauthparmstyle = 'display:none'; my $lcauthparmtext; @@ -4895,6 +4939,9 @@ sub lti_options { my %menutitles = <imenu_titles(); if (ref($current) eq 'HASH') { + if (!$current->{'requser'}) { + $optionsty = 'none'; + } if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) { $checked{'mapuser'}{'sourcedid'} = ''; if ($current->{'mapuser'} eq 'lis_person_contact_email_primary') { @@ -4920,7 +4967,7 @@ sub lti_options { $checked{'mapcrstype'}{$type} = ' checked="checked"'; } } - if ($current->{'makecrs'}) { + if ($current->{'makecrs'}) { $checked{'makecrs'}{'Y'} = ' checked="checked"'; } if (ref($current->{'makeuser'}) eq 'ARRAY') { @@ -5017,7 +5064,7 @@ sub lti_options { my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"'; my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"'; my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"'; - my $output = '
'.&mt('Mapping users').''. + my $output = '
'.&mt('Mapping users').''. '
'.&mt('LON-CAPA username').': '; foreach my $option ('sourcedid','email','other') { $output .= '
'. - '
'.&mt('Mapping course roles').''; + '
'.&mt('Mapping course roles').'
'; foreach my $ltirole (@lticourseroles) { my ($selected,$selectnone); if ($rolemaps{$ltirole} eq '') { @@ -5052,13 +5099,13 @@ sub lti_options { $output .= ''; } $output .= '
'. - '
'.&mt('Roles which may create user accounts').''; + '
'.&mt('Roles which may create user accounts').''; foreach my $ltirole (@ltiroles) { $output .= '  '; } $output .= '
'. - '
'.&mt('New user accounts created for LTI users').''. + '
'.&mt('New user accounts created for LTI users').''. ''. &modifiable_userdata_row('lti','instdata_'.$num,$current,$numinrow,$itemcount). '
'. @@ -5081,7 +5128,7 @@ sub lti_options { ''.$lcauthparmtext.''. ''. '
'. - '
'.&mt('Mapping courses').''. + '
'.&mt('Mapping courses').''. '
'. &mt('Unique course identifier').': '; foreach my $option ('course_offering_sourcedid','context_id','other') { @@ -5099,20 +5146,20 @@ sub lti_options { (' 'x2); } $output .= '
'. - '
'.&mt('Creating courses').''. + '
'.&mt('Creating courses').''. ''.&mt('Course created (if absent) on Instructor access').': '. ''.(' 'x2). ''. '
'. - '
'.&mt('Roles which may self-enroll').''; + '
'.&mt('Roles which may self-enroll').''; foreach my $lticrsrole (@lticourseroles) { $output .= '  '; } $output .= '
'. - '
'.&mt('Course options').''. + '
'.&mt('Course options').''. '
'.&mt('Assign users to sections').': '. ''.(' 'x2). @@ -5164,7 +5211,7 @@ sub lti_options { &mt('Outcomes Service (1.1)').''.(' 'x2). '
'. - '
'.&mt('Course defaults (Course Coordinator can override)').''. + '
'.&mt('Course defaults (Course Coordinator can override)').''. '
'.$lt{'topmenu'}.': '. ''.(' 'x2). @@ -11776,7 +11823,7 @@ sub modify_lti { if ($position ne '') { $allpos[$position] = $itemid; } - foreach my $item ('consumer','key','secret','lifetime') { + foreach my $item ('consumer','key','secret','lifetime','requser') { my $formitem = 'form.lti_'.$item.'_'.$idx; $env{$formitem} =~ s/(`)/'/g; if ($item eq 'lifetime') { @@ -11798,177 +11845,179 @@ sub modify_lti { if ($env{'form.lti_version_'.$idx} eq 'LTI-1p0') { $confhash{$itemid}{'version'} = $env{'form.lti_version_'.$idx}; } - if ($env{'form.lti_mapuser_'.$idx} eq 'sourcedid') { - $confhash{$itemid}{'mapuser'} = 'lis_person_sourcedid'; - } elsif ($env{'form.lti_mapuser_'.$idx} eq 'email') { - $confhash{$itemid}{'mapuser'} = 'lis_person_contact_email_primary'; - } elsif ($env{'form.lti_mapuser_'.$idx} eq 'other') { - my $mapuser = $env{'form.lti_customuser_'.$idx}; - $mapuser =~ s/(`)/'/g; - $mapuser =~ s/^\s+|\s+$//g; - $confhash{$itemid}{'mapuser'} = $mapuser; - } - foreach my $ltirole (@lticourseroles) { - my $possrole = $env{'form.lti_maprole_'.$ltirole.'_'.$idx}; - if (grep(/^\Q$possrole\E$/,@courseroles)) { - $confhash{$itemid}{'maproles'}{$ltirole} = $possrole; + if ($confhash{$itemid}{'requser'}) { + if ($env{'form.lti_mapuser_'.$idx} eq 'sourcedid') { + $confhash{$itemid}{'mapuser'} = 'lis_person_sourcedid'; + } elsif ($env{'form.lti_mapuser_'.$idx} eq 'email') { + $confhash{$itemid}{'mapuser'} = 'lis_person_contact_email_primary'; + } elsif ($env{'form.lti_mapuser_'.$idx} eq 'other') { + my $mapuser = $env{'form.lti_customuser_'.$idx}; + $mapuser =~ s/(`)/'/g; + $mapuser =~ s/^\s+|\s+$//g; + $confhash{$itemid}{'mapuser'} = $mapuser; } - } - my @possmakeuser = &Apache::loncommon::get_env_multiple('form.lti_makeuser_'.$idx); - my @makeuser; - foreach my $ltirole (sort(@possmakeuser)) { - if ($posslti{$ltirole}) { - push(@makeuser,$ltirole); + foreach my $ltirole (@lticourseroles) { + my $possrole = $env{'form.lti_maprole_'.$ltirole.'_'.$idx}; + if (grep(/^\Q$possrole\E$/,@courseroles)) { + $confhash{$itemid}{'maproles'}{$ltirole} = $possrole; + } } - } - $confhash{$itemid}{'makeuser'} = \@makeuser; - if (@makeuser) { - my $lcauth = $env{'form.lti_lcauth_'.$idx}; - if ($lcauth =~ /^(internal|krb4|krb5|localauth)$/) { - $confhash{$itemid}{'lcauth'} = $lcauth; - if ($lcauth ne 'internal') { - my $lcauthparm = $env{'form.lti_lcauthparm_'.$idx}; - $lcauthparm =~ s/^(\s+|\s+)$//g; - $lcauthparm =~ s/`//g; - if ($lcauthparm ne '') { - $confhash{$itemid}{'lcauthparm'} = $lcauthparm; - } + my @possmakeuser = &Apache::loncommon::get_env_multiple('form.lti_makeuser_'.$idx); + my @makeuser; + foreach my $ltirole (sort(@possmakeuser)) { + if ($posslti{$ltirole}) { + push(@makeuser,$ltirole); } - } else { - $confhash{$itemid}{'lcauth'} = 'lti'; } - } - my @possinstdata = &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx); - if (@possinstdata) { - foreach my $field (@possinstdata) { - if (exists($fieldtitles{$field})) { - push(@{$confhash{$itemid}{'instdata'}}); + $confhash{$itemid}{'makeuser'} = \@makeuser; + if (@makeuser) { + my $lcauth = $env{'form.lti_lcauth_'.$idx}; + if ($lcauth =~ /^(internal|krb4|krb5|localauth)$/) { + $confhash{$itemid}{'lcauth'} = $lcauth; + if ($lcauth ne 'internal') { + my $lcauthparm = $env{'form.lti_lcauthparm_'.$idx}; + $lcauthparm =~ s/^(\s+|\s+)$//g; + $lcauthparm =~ s/`//g; + if ($lcauthparm ne '') { + $confhash{$itemid}{'lcauthparm'} = $lcauthparm; + } + } + } else { + $confhash{$itemid}{'lcauth'} = 'lti'; } } - } - if (($env{'form.lti_mapcrs_'.$idx} eq 'course_offering_sourcedid') || - ($env{'form.lti_mapcrs_'.$idx} eq 'context_id')) { - $confhash{$itemid}{'mapcrs'} = $env{'form.lti_mapcrs_'.$idx}; - } elsif ($env{'form.lti_mapcrs_'.$idx} eq 'other') { - my $mapcrs = $env{'form.lti_mapcrsfield_'.$idx}; - $mapcrs =~ s/(`)/'/g; - $mapcrs =~ s/^\s+|\s+$//g; - $confhash{$itemid}{'mapcrs'} = $mapcrs; - } - my @posstypes = &Apache::loncommon::get_env_multiple('form.lti_mapcrstype_'.$idx); - my @crstypes; - foreach my $type (sort(@posstypes)) { - if ($posscrstype{$type}) { - push(@crstypes,$type); + my @possinstdata = &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx); + if (@possinstdata) { + foreach my $field (@possinstdata) { + if (exists($fieldtitles{$field})) { + push(@{$confhash{$itemid}{'instdata'}}); + } + } } - } - $confhash{$itemid}{'mapcrstype'} = \@crstypes; - if ($env{'form.lti_makecrs_'.$idx}) { - $confhash{$itemid}{'makecrs'} = 1; - } - my @possenroll = &Apache::loncommon::get_env_multiple('form.lti_selfenroll_'.$idx); - my @selfenroll; - foreach my $type (sort(@possenroll)) { - if ($posslticrs{$type}) { - push(@selfenroll,$type); + if (($env{'form.lti_mapcrs_'.$idx} eq 'course_offering_sourcedid') || + ($env{'form.lti_mapcrs_'.$idx} eq 'context_id')) { + $confhash{$itemid}{'mapcrs'} = $env{'form.lti_mapcrs_'.$idx}; + } elsif ($env{'form.lti_mapcrs_'.$idx} eq 'other') { + my $mapcrs = $env{'form.lti_mapcrsfield_'.$idx}; + $mapcrs =~ s/(`)/'/g; + $mapcrs =~ s/^\s+|\s+$//g; + $confhash{$itemid}{'mapcrs'} = $mapcrs; } - } - $confhash{$itemid}{'selfenroll'} = \@selfenroll; - if ($env{'form.lti_crssec_'.$idx}) { - if ($env{'form.lti_crssecsrc_'.$idx} eq 'course_section_sourcedid') { - $confhash{$itemid}{'section'} = $env{'form.lti_crssecsrc_'.$idx}; - } elsif ($env{'form.lti_crssecsrc_'.$idx} eq 'other') { - my $section = $env{'form.lti_customsection_'.$idx}; - $section =~ s/(`)/'/g; - $section =~ s/^\s+|\s+$//g; - if ($section ne '') { - $confhash{$itemid}{'section'} = $section; + my @posstypes = &Apache::loncommon::get_env_multiple('form.lti_mapcrstype_'.$idx); + my @crstypes; + foreach my $type (sort(@posstypes)) { + if ($posscrstype{$type}) { + push(@crstypes,$type); } } - } - foreach my $field ('passback','roster','topmenu','inlinemenu') { - if ($env{'form.lti_'.$field.'_'.$idx}) { - $confhash{$itemid}{$field} = 1; + $confhash{$itemid}{'mapcrstype'} = \@crstypes; + if ($env{'form.lti_makecrs_'.$idx}) { + $confhash{$itemid}{'makecrs'} = 1; } - } - if ($env{'form.lti_passback_'.$idx}) { - if ($env{'form.lti_passbackformat_'.$idx} eq '1.0') { - $confhash{$itemid}{'passbackformat'} = '1.0'; - } else { - $confhash{$itemid}{'passbackformat'} = '1.1'; + my @possenroll = &Apache::loncommon::get_env_multiple('form.lti_selfenroll_'.$idx); + my @selfenroll; + foreach my $type (sort(@possenroll)) { + if ($posslticrs{$type}) { + push(@selfenroll,$type); + } } - } - if ($env{'form.lti_topmenu_'.$idx} || $env{'form.lti_inlinemenu_'.$idx}) { - $confhash{$itemid}{lcmenu} = []; - my @possmenu = &Apache::loncommon::get_env_multiple('form.lti_menuitem_'.$idx); - foreach my $field (@possmenu) { - if (exists($menutitles{$field})) { - if ($field eq 'grades') { - next unless ($env{'form.lti_inlinemenu_'.$idx}); + $confhash{$itemid}{'selfenroll'} = \@selfenroll; + if ($env{'form.lti_crssec_'.$idx}) { + if ($env{'form.lti_crssecsrc_'.$idx} eq 'course_section_sourcedid') { + $confhash{$itemid}{'section'} = $env{'form.lti_crssecsrc_'.$idx}; + } elsif ($env{'form.lti_crssecsrc_'.$idx} eq 'other') { + my $section = $env{'form.lti_customsection_'.$idx}; + $section =~ s/(`)/'/g; + $section =~ s/^\s+|\s+$//g; + if ($section ne '') { + $confhash{$itemid}{'section'} = $section; } - push(@{$confhash{$itemid}{lcmenu}},$field); } } - } - unless (($idx eq 'add') || ($changes{$itemid})) { - foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu') { - if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) { - $changes{$itemid} = 1; + foreach my $field ('passback','roster','topmenu','inlinemenu') { + if ($env{'form.lti_'.$field.'_'.$idx}) { + $confhash{$itemid}{$field} = 1; } } - unless ($changes{$itemid}) { - if ($domconfig{$action}{$itemid}{'passback'} eq $confhash{$itemid}{'passback'}) { - if ($domconfig{$action}{$itemid}{'passbackformat'} ne $confhash{$itemid}{'passbackformat'}) { - $changes{$itemid} = 1; + if ($env{'form.lti_passback_'.$idx}) { + if ($env{'form.lti_passbackformat_'.$idx} eq '1.0') { + $confhash{$itemid}{'passbackformat'} = '1.0'; + } else { + $confhash{$itemid}{'passbackformat'} = '1.1'; + } + } + if ($env{'form.lti_topmenu_'.$idx} || $env{'form.lti_inlinemenu_'.$idx}) { + $confhash{$itemid}{lcmenu} = []; + my @possmenu = &Apache::loncommon::get_env_multiple('form.lti_menuitem_'.$idx); + foreach my $field (@possmenu) { + if (exists($menutitles{$field})) { + if ($field eq 'grades') { + next unless ($env{'form.lti_inlinemenu_'.$idx}); + } + push(@{$confhash{$itemid}{lcmenu}},$field); } } } - foreach my $field ('makeuser','mapcrstype','selfenroll','instdata','lcmenu') { + unless (($idx eq 'add') || ($changes{$itemid})) { + foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu') { + if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) { + $changes{$itemid} = 1; + } + } unless ($changes{$itemid}) { - if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') { - if (ref($confhash{$itemid}{$field}) eq 'ARRAY') { - my @diffs = &Apache::loncommon::compare_arrays($domconfig{$action}{$itemid}{$field}, - $confhash{$itemid}{$field}); - if (@diffs) { - $changes{$itemid} = 1; - } - } elsif (@{$domconfig{$action}{$itemid}{$field}} > 0) { + if ($domconfig{$action}{$itemid}{'passback'} eq $confhash{$itemid}{'passback'}) { + if ($domconfig{$action}{$itemid}{'passbackformat'} ne $confhash{$itemid}{'passbackformat'}) { $changes{$itemid} = 1; } - } elsif (ref($confhash{$itemid}{$field}) eq 'ARRAY') { - if (@{$confhash{$itemid}{$field}} > 0) { - $changes{$itemid} = 1; - } - } + } } - } - unless ($changes{$itemid}) { - if (ref($domconfig{$action}{$itemid}{'maproles'}) eq 'HASH') { - if (ref($confhash{$itemid}{'maproles'}) eq 'HASH') { - foreach my $ltirole (keys(%{$domconfig{$action}{$itemid}{'maproles'}})) { - if ($domconfig{$action}{$itemid}{'maproles'}{$ltirole} ne - $confhash{$itemid}{'maproles'}{$ltirole}) { + foreach my $field ('makeuser','mapcrstype','selfenroll','instdata','lcmenu') { + unless ($changes{$itemid}) { + if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') { + if (ref($confhash{$itemid}{$field}) eq 'ARRAY') { + my @diffs = &Apache::loncommon::compare_arrays($domconfig{$action}{$itemid}{$field}, + $confhash{$itemid}{$field}); + if (@diffs) { + $changes{$itemid} = 1; + } + } elsif (@{$domconfig{$action}{$itemid}{$field}} > 0) { + $changes{$itemid} = 1; + } + } elsif (ref($confhash{$itemid}{$field}) eq 'ARRAY') { + if (@{$confhash{$itemid}{$field}} > 0) { $changes{$itemid} = 1; - last; } } - unless ($changes{$itemid}) { - foreach my $ltirole (keys(%{$confhash{$itemid}{'maproles'}})) { - if ($confhash{$itemid}{'maproles'}{$ltirole} ne - $domconfig{$action}{$itemid}{'maproles'}{$ltirole}) { + } + } + unless ($changes{$itemid}) { + if (ref($domconfig{$action}{$itemid}{'maproles'}) eq 'HASH') { + if (ref($confhash{$itemid}{'maproles'}) eq 'HASH') { + foreach my $ltirole (keys(%{$domconfig{$action}{$itemid}{'maproles'}})) { + if ($domconfig{$action}{$itemid}{'maproles'}{$ltirole} ne + $confhash{$itemid}{'maproles'}{$ltirole}) { $changes{$itemid} = 1; last; } } - } - } elsif (keys(%{$domconfig{$action}{$itemid}{'maproles'}}) > 0) { - $changes{$itemid} = 1; - } - } elsif (ref($confhash{$itemid}{'maproles'}) eq 'HASH') { - unless ($changes{$itemid}) { - if (keys(%{$confhash{$itemid}{'maproles'}}) > 0) { + unless ($changes{$itemid}) { + foreach my $ltirole (keys(%{$confhash{$itemid}{'maproles'}})) { + if ($confhash{$itemid}{'maproles'}{$ltirole} ne + $domconfig{$action}{$itemid}{'maproles'}{$ltirole}) { + $changes{$itemid} = 1; + last; + } + } + } + } elsif (keys(%{$domconfig{$action}{$itemid}{'maproles'}}) > 0) { $changes{$itemid} = 1; } + } elsif (ref($confhash{$itemid}{'maproles'}) eq 'HASH') { + unless ($changes{$itemid}) { + if (keys(%{$confhash{$itemid}{'maproles'}}) > 0) { + $changes{$itemid} = 1; + } + } } } } @@ -12041,122 +12090,124 @@ sub modify_lti { my $num = length($encconfig{$itemid}{'secret'}); $resulttext .= ('*'x$num).''; } - if ($confhash{$itemid}{'mapuser'}) { - my $shownmapuser; - if ($confhash{$itemid}{'mapuser'} eq 'lis_person_sourcedid') { - $shownmapuser = $lt{'sourcedid'}.' (lis_person_sourcedid)'; - } elsif ($confhash{$itemid}{'mapuser'} eq 'lis_person_contact_email_primary') { - $shownmapuser = $lt{'email'}.' (lis_person_contact_email_primary)'; - } else { - $shownmapuser = &mt('Other').' ('.$confhash{$itemid}{'mapuser'}.')'; - } - $resulttext .= '
  • '.&mt('LON-CAPA username').': '.$shownmapuser.'
  • '; - } - if (ref($confhash{$itemid}{'maproles'}) eq 'HASH') { - my $rolemaps; - foreach my $role (@ltiroles) { - if ($confhash{$itemid}{'maproles'}{$role}) { - $rolemaps .= (' 'x2).$role.'='. - &Apache::lonnet::plaintext($confhash{$itemid}{'maproles'}{$role}, - 'Course').','; + if ($confhash{$itemid}{'requser'}) { + if ($confhash{$itemid}{'mapuser'}) { + my $shownmapuser; + if ($confhash{$itemid}{'mapuser'} eq 'lis_person_sourcedid') { + $shownmapuser = $lt{'sourcedid'}.' (lis_person_sourcedid)'; + } elsif ($confhash{$itemid}{'mapuser'} eq 'lis_person_contact_email_primary') { + $shownmapuser = $lt{'email'}.' (lis_person_contact_email_primary)'; + } else { + $shownmapuser = &mt('Other').' ('.$confhash{$itemid}{'mapuser'}.')'; } + $resulttext .= '
  • '.&mt('LON-CAPA username').': '.$shownmapuser.'
  • '; } - if ($rolemaps) { - $rolemaps =~ s/,$//; - $resulttext .= '
  • '.&mt('Role mapping:').$rolemaps.'
  • '; - } - } - if (ref($confhash{$itemid}{'makeuser'}) eq 'ARRAY') { - if (@{$confhash{$itemid}{'makeuser'}} > 0) { - $resulttext .= '
  • '.&mt('Following roles may create user accounts: [_1]', - join(', ',@{$confhash{$itemid}{'makeuser'}})).'
    '; - if ($confhash{$itemid}{'lcauth'} eq 'lti') { - $resulttext .= &mt('New users will only be able to authenticate via LTI').'
  • '; - } else { - $resulttext .= &mt('New users will be assigned LON-CAPA authentication: [_1]', - $confhash{$itemid}{'lcauth'}); - if ($confhash{$itemid}{'lcauth'} eq 'internal') { - $resulttext .= '; '.&mt('a randomly generated password will be created'); - } elsif ($confhash{$itemid}{'lcauth'} eq 'localauth') { - if ($confhash{$itemid}{'lcauthparm'} ne '') { - $resulttext .= ' '.&mt('with argument: [_1]',$confhash{$itemid}{'lcauthparm'}); - } + if (ref($confhash{$itemid}{'maproles'}) eq 'HASH') { + my $rolemaps; + foreach my $role (@ltiroles) { + if ($confhash{$itemid}{'maproles'}{$role}) { + $rolemaps .= (' 'x2).$role.'='. + &Apache::lonnet::plaintext($confhash{$itemid}{'maproles'}{$role}, + 'Course').','; + } + } + if ($rolemaps) { + $rolemaps =~ s/,$//; + $resulttext .= '
  • '.&mt('Role mapping:').$rolemaps.'
  • '; + } + } + if (ref($confhash{$itemid}{'makeuser'}) eq 'ARRAY') { + if (@{$confhash{$itemid}{'makeuser'}} > 0) { + $resulttext .= '
  • '.&mt('Following roles may create user accounts: [_1]', + join(', ',@{$confhash{$itemid}{'makeuser'}})).'
    '; + if ($confhash{$itemid}{'lcauth'} eq 'lti') { + $resulttext .= &mt('New users will only be able to authenticate via LTI').'
  • '; } else { - $resulttext .= '; '.&mt('Kerberos domain: [_1]',$confhash{$itemid}{'lcauthparm'}); + $resulttext .= &mt('New users will be assigned LON-CAPA authentication: [_1]', + $confhash{$itemid}{'lcauth'}); + if ($confhash{$itemid}{'lcauth'} eq 'internal') { + $resulttext .= '; '.&mt('a randomly generated password will be created'); + } elsif ($confhash{$itemid}{'lcauth'} eq 'localauth') { + if ($confhash{$itemid}{'lcauthparm'} ne '') { + $resulttext .= ' '.&mt('with argument: [_1]',$confhash{$itemid}{'lcauthparm'}); + } + } else { + $resulttext .= '; '.&mt('Kerberos domain: [_1]',$confhash{$itemid}{'lcauthparm'}); + } } + $resulttext .= ''; + } else { + $resulttext .= '
  • '.&mt('User account creation not permitted.').'
  • '; } - $resulttext .= ''; - } else { - $resulttext .= '
  • '.&mt('User account creation not permitted.').'
  • '; } - } - if (ref($confhash{$itemid}{'instdata'}) eq 'ARRAY') { - if (@{$confhash{$itemid}{'instdata'}} > 0) { - $resulttext .= '
  • '.&mt('Institutional data will be used when creating a new user for: [_1]', - join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'
  • '; - } else { - $resulttext .= '
  • '.&mt('No institutional data used when creating a new user.').'
  • '; + if (ref($confhash{$itemid}{'instdata'}) eq 'ARRAY') { + if (@{$confhash{$itemid}{'instdata'}} > 0) { + $resulttext .= '
  • '.&mt('Institutional data will be used when creating a new user for: [_1]', + join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'
  • '; + } else { + $resulttext .= '
  • '.&mt('No institutional data used when creating a new user.').'
  • '; + } } - } - if ($confhash{$itemid}{'mapcrs'}) { - $resulttext .= '
  • '.&mt('Unique course identifier').': '.$confhash{$itemid}{'mapcrs'}.'
  • '; - } - if (ref($confhash{$itemid}{'mapcrstype'}) eq 'ARRAY') { - if (@{$confhash{$itemid}{'mapcrstype'}} > 0) { - $resulttext .= '
  • '.&mt('Mapping for the following LON-CAPA course types: [_1]', - join(', ',map { $coursetypetitles{$_}; } @coursetypes)). - '
  • '; - } else { - $resulttext .= '
  • '.&mt('No mapping to LON-CAPA courses').'
  • '; + if ($confhash{$itemid}{'mapcrs'}) { + $resulttext .= '
  • '.&mt('Unique course identifier').': '.$confhash{$itemid}{'mapcrs'}.'
  • '; } - } - if ($confhash{$itemid}{'makecrs'}) { - $resulttext .= '
  • '.&mt('Instructor may create course (if absent).').'
  • '; - } else { - $resulttext .= '
  • '.&mt('Instructor may not create course (if absent).').'
  • '; - } - if (ref($confhash{$itemid}{'selfenroll'}) eq 'ARRAY') { - if (@{$confhash{$itemid}{'selfenroll'}} > 0) { - $resulttext .= '
  • '.&mt('Self-enrollment for following roles: [_1]', - join(', ',@{$confhash{$itemid}{'selfenroll'}})). - '
  • '; + if (ref($confhash{$itemid}{'mapcrstype'}) eq 'ARRAY') { + if (@{$confhash{$itemid}{'mapcrstype'}} > 0) { + $resulttext .= '
  • '.&mt('Mapping for the following LON-CAPA course types: [_1]', + join(', ',map { $coursetypetitles{$_}; } @coursetypes)). + '
  • '; + } else { + $resulttext .= '
  • '.&mt('No mapping to LON-CAPA courses').'
  • '; + } + } + if ($confhash{$itemid}{'makecrs'}) { + $resulttext .= '
  • '.&mt('Instructor may create course (if absent).').'
  • '; } else { - $resulttext .= '
  • '.&mt('Self-enrollment not permitted').'
  • '; + $resulttext .= '
  • '.&mt('Instructor may not create course (if absent).').'
  • '; } - } - if ($confhash{$itemid}{'section'}) { - if ($confhash{$itemid}{'section'} eq 'course_section_sourcedid') { - $resulttext .= '
  • '.&mt('User section from standard field:'). - ' (course_section_sourcedid)'.'
  • '; + if (ref($confhash{$itemid}{'selfenroll'}) eq 'ARRAY') { + if (@{$confhash{$itemid}{'selfenroll'}} > 0) { + $resulttext .= '
  • '.&mt('Self-enrollment for following roles: [_1]', + join(', ',@{$confhash{$itemid}{'selfenroll'}})). + '
  • '; + } else { + $resulttext .= '
  • '.&mt('Self-enrollment not permitted').'
  • '; + } + } + if ($confhash{$itemid}{'section'}) { + if ($confhash{$itemid}{'section'} eq 'course_section_sourcedid') { + $resulttext .= '
  • '.&mt('User section from standard field:'). + ' (course_section_sourcedid)'.'
  • '; + } else { + $resulttext .= '
  • '.&mt('User section from:').' '. + $confhash{$itemid}{'section'}.'
  • '; + } } else { - $resulttext .= '
  • '.&mt('User section from:').' '. - $confhash{$itemid}{'section'}.'
  • '; + $resulttext .= '
  • '.&mt('No section assignment').'
  • '; } - } else { - $resulttext .= '
  • '.&mt('No section assignment').'
  • '; - } - foreach my $item ('passback','roster','topmenu','inlinemenu') { - $resulttext .= '
  • '.$lt{$item}.': '; - if ($confhash{$itemid}{$item}) { - $resulttext .= &mt('Yes'); - if ($item eq 'passback') { - if ($confhash{$itemid}{'passbackformat'} eq '1.0') { - $resulttext .= ' ('.&mt('Outcomes Extension (1.0)').')'; - } elsif ($confhash{$itemid}{'passbackformat'} eq '1.1') { - $resulttext .= ' ('.&mt('Outcomes Service (1.1)').')'; + foreach my $item ('passback','roster','topmenu','inlinemenu') { + $resulttext .= '
  • '.$lt{$item}.': '; + if ($confhash{$itemid}{$item}) { + $resulttext .= &mt('Yes'); + if ($item eq 'passback') { + if ($confhash{$itemid}{'passbackformat'} eq '1.0') { + $resulttext .= ' ('.&mt('Outcomes Extension (1.0)').')'; + } elsif ($confhash{$itemid}{'passbackformat'} eq '1.1') { + $resulttext .= ' ('.&mt('Outcomes Service (1.1)').')'; + } } + } else { + $resulttext .= &mt('No'); } - } else { - $resulttext .= &mt('No'); + $resulttext .= '
  • '; } - $resulttext .= ''; - } - if (ref($confhash{$itemid}{'lcmenu'}) eq 'ARRAY') { - if (@{$confhash{$itemid}{'lcmenu'}} > 0) { - $resulttext .= '
  • '.&mt('Menu items:').' '. - join(', ', map { $menutitles{$_}; } (@{$confhash{$itemid}{'lcmenu'}})).'
  • '; - } else { - $resulttext .= '
  • '.&mt('No menu items displayed in header or online menu').'
  • '; + if (ref($confhash{$itemid}{'lcmenu'}) eq 'ARRAY') { + if (@{$confhash{$itemid}{'lcmenu'}} > 0) { + $resulttext .= '
  • '.&mt('Menu items:').' '. + join(', ', map { $menutitles{$_}; } (@{$confhash{$itemid}{'lcmenu'}})).'
  • '; + } else { + $resulttext .= '
  • '.&mt('No menu items displayed in header or online menu').'
  • '; + } } } $resulttext .= '';