version 1.391, 2021/11/22 23:40:59
|
version 1.393, 2021/11/28 18:43:37
|
Line 6129 sub lti_options {
|
Line 6129 sub lti_options {
|
my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield,$callback); |
my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield,$callback); |
$checked{'mapuser'}{'sourcedid'} = ' checked="checked"'; |
$checked{'mapuser'}{'sourcedid'} = ' checked="checked"'; |
$checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"'; |
$checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"'; |
$checked{'makecrs'}{'N'} = ' checked="checked"'; |
$checked{'storecrs'}{'Y'} = ' checked="checked"'; |
|
$checked{'makecrs'}{'N'} = ' checked="checked"'; |
$checked{'mapcrstype'} = {}; |
$checked{'mapcrstype'} = {}; |
$checked{'makeuser'} = {}; |
$checked{'makeuser'} = {}; |
$checked{'selfenroll'} = {}; |
$checked{'selfenroll'} = {}; |
Line 6187 sub lti_options {
|
Line 6188 sub lti_options {
|
$checked{'mapcrstype'}{$type} = ' checked="checked"'; |
$checked{'mapcrstype'}{$type} = ' checked="checked"'; |
} |
} |
} |
} |
|
if (!$current->{'storecrs'}) { |
|
$checked{'storecrs'}{'N'} = $checked{'storecrs'}{'Y'}; |
|
$checked{'storecrs'}{'Y'} = ''; |
|
} |
if ($current->{'makecrs'}) { |
if ($current->{'makecrs'}) { |
$checked{'makecrs'}{'Y'} = ' checked="checked"'; |
$checked{'makecrs'}{'Y'} = ' checked="checked"'; |
} |
} |
Line 6294 sub lti_options {
|
Line 6299 sub lti_options {
|
my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"'; |
my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"'; |
my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"'; |
my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"'; |
my $output = '<fieldset class="ltioption_usr_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Logout options').'</legend>'. |
my $output = '<fieldset class="ltioption_usr_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Logout options').'</legend>'. |
'<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('Callback on logout').': '. |
'<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('Callback to logout LON-CAPA on log out from Consumer').': '. |
'<label><input type="radio" name="lti_callback_'.$num.'" value="0"'. |
'<label><input type="radio" name="lti_callback_'.$num.'" value="0"'. |
$checked{'callback'}{'N'}.$onclickcallback.' />'.&mt('No').'</label>'.(' 'x2). |
$checked{'callback'}{'N'}.$onclickcallback.' />'.&mt('No').'</label>'.(' 'x2). |
'<label><input type="radio" name="lti_callback_'.$num.'" value="1"'. |
'<label><input type="radio" name="lti_callback_'.$num.'" value="1"'. |
Line 6382 sub lti_options {
|
Line 6387 sub lti_options {
|
$checked{'mapcrstype'}{$type}.' />'.$coursetypetitles{$type}.'</label>'. |
$checked{'mapcrstype'}{$type}.' />'.$coursetypetitles{$type}.'</label>'. |
(' 'x2); |
(' 'x2); |
} |
} |
$output .= '</span></fieldset>'. |
$output .= '</span><br /><br />'. |
|
'<span class="LC_nobreak">'.&mt('Store mapping of course identifier to LON-CAPA CourseID').': '. |
|
'<label><input type="radio" name="lti_storecrs_'.$num.'" value="0"'. |
|
$checked{'storecrs'}{'N'}.' />'.&mt('No').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="lti_storecrs_'.$num.'" value="1"'. |
|
$checked{'storecrs'}{'Y'}.' />'.&mt('Yes').'</label></span>'. |
|
'</fieldset>'. |
'<fieldset class="ltioption_crs_'.$num.'" style="display:'.$crssty.'"><legend>'.&mt('Mapping course roles').'</legend><table><tr>'; |
'<fieldset class="ltioption_crs_'.$num.'" style="display:'.$crssty.'"><legend>'.&mt('Mapping course roles').'</legend><table><tr>'; |
foreach my $ltirole (@lticourseroles) { |
foreach my $ltirole (@lticourseroles) { |
my ($selected,$selectnone); |
my ($selected,$selectnone); |
Line 7780 sub print_wafproxy {
|
Line 7791 sub print_wafproxy {
|
'<tr'.$css_class.' id="wafproxyrow_'.$dom.'"'.$wafstyle.'>'. |
'<tr'.$css_class.' id="wafproxyrow_'.$dom.'"'.$wafstyle.'>'. |
'<td class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br /><br />'. |
'<td class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br /><br />'. |
'<div id="wafproxyranges_'.$dom.'">'.&mt('Format for comma separated IP ranges').':<br />'. |
'<div id="wafproxyranges_'.$dom.'">'.&mt('Format for comma separated IP ranges').':<br />'. |
&mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'</div></td>'. |
&mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'<br />'. |
|
&mt('Range(s) stored in CIDR notation').'</div></td>'. |
'<td class="LC_left_item"><table>'. |
'<td class="LC_left_item"><table>'. |
'<tr>'. |
'<tr>'. |
'<td valign="top">'.$lt{'remoteip'}.': '. |
'<td valign="top">'.$lt{'remoteip'}.': '. |
Line 14775 sub modify_lti {
|
Line 14787 sub modify_lti {
|
my @courseroles = ('cc','in','ta','ep','st'); |
my @courseroles = ('cc','in','ta','ep','st'); |
my @ltiroles = qw(Learner Instructor ContentDeveloper TeachingAssistant Mentor Member Manager Administrator); |
my @ltiroles = qw(Learner Instructor ContentDeveloper TeachingAssistant Mentor Member Manager Administrator); |
my @lticourseroles = qw(Instructor TeachingAssistant Mentor Learner); |
my @lticourseroles = qw(Instructor TeachingAssistant Mentor Learner); |
my @coursetypes = ('official','unofficial','community','textbook','placement'); |
my @coursetypes = ('official','unofficial','community','textbook','placement','lti'); |
my %coursetypetitles = &Apache::lonlocal::texthash ( |
my %coursetypetitles = &Apache::lonlocal::texthash ( |
official => 'Official', |
official => 'Official', |
unofficial => 'Unofficial', |
unofficial => 'Unofficial', |
community => 'Community', |
community => 'Community', |
textbook => 'Textbook', |
textbook => 'Textbook', |
placement => 'Placement Test', |
placement => 'Placement Test', |
|
lti => 'LTI Provider', |
); |
); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %lt = <i_names(); |
my %lt = <i_names(); |
Line 14939 sub modify_lti {
|
Line 14952 sub modify_lti {
|
} |
} |
} |
} |
$confhash{$itemid}{'mapcrstype'} = \@crstypes; |
$confhash{$itemid}{'mapcrstype'} = \@crstypes; |
|
if ($env{'form.lti_storecrs_'.$idx}) { |
|
$confhash{$itemid}{'storecrs'} = 1; |
|
} |
if ($env{'form.lti_makecrs_'.$idx}) { |
if ($env{'form.lti_makecrs_'.$idx}) { |
$confhash{$itemid}{'makecrs'} = 1; |
$confhash{$itemid}{'makecrs'} = 1; |
} |
} |
Line 14983 sub modify_lti {
|
Line 14999 sub modify_lti {
|
} |
} |
unless (($idx eq 'add') || ($changes{$itemid})) { |
unless (($idx eq 'add') || ($changes{$itemid})) { |
if ($confhash{$itemid}{'crsinc'}) { |
if ($confhash{$itemid}{'crsinc'}) { |
foreach my $field ('mapcrs','makecrs','section','passback','roster') { |
foreach my $field ('mapcrs','storecrs','makecrs','section','passback','roster') { |
if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) { |
if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) { |
$changes{$itemid} = 1; |
$changes{$itemid} = 1; |
} |
} |
Line 15145 sub modify_lti {
|
Line 15161 sub modify_lti {
|
if ($confhash{$itemid}{'callback'}) { |
if ($confhash{$itemid}{'callback'}) { |
$resulttext .= '<li>'.&mt('Callback setting').': '.$confhash{$itemid}{'callback'}.'</li>'; |
$resulttext .= '<li>'.&mt('Callback setting').': '.$confhash{$itemid}{'callback'}.'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'.&mt('No callback to logout LON-CAPA session when user logs out of Comsumer').'</li>'; |
$resulttext .= '<li>'.&mt('Callback to logout LON-CAPA on log out from Consumer').'</li>'; |
} |
} |
if ($confhash{$itemid}{'mapuser'}) { |
if ($confhash{$itemid}{'mapuser'}) { |
my $shownmapuser; |
my $shownmapuser; |
Line 15234 sub modify_lti {
|
Line 15250 sub modify_lti {
|
$resulttext .= '<li>'.&mt('No mapping to LON-CAPA courses').'</li>'; |
$resulttext .= '<li>'.&mt('No mapping to LON-CAPA courses').'</li>'; |
} |
} |
} |
} |
|
if ($confhash{$itemid}{'storecrs'}) { |
|
$resulttext .= '<li>'.&mt('Store mapping of course identifier to LON-CAPA CourseID').': '.$confhash{$itemid}{'storecrs'}.'</li>'; |
|
} |
if ($confhash{$itemid}{'makecrs'}) { |
if ($confhash{$itemid}{'makecrs'}) { |
$resulttext .= '<li>'.&mt('Instructor may create course (if absent).').'</li>'; |
$resulttext .= '<li>'.&mt('Instructor may create course (if absent).').'</li>'; |
} else { |
} else { |
Line 20491 sub modify_wafproxy {
|
Line 20510 sub modify_wafproxy {
|
$possible =~ s/[\r\n]+/\s/g; |
$possible =~ s/[\r\n]+/\s/g; |
$possible =~ s/\s*-\s*/-/g; |
$possible =~ s/\s*-\s*/-/g; |
$possible =~ s/\s+/,/g; |
$possible =~ s/\s+/,/g; |
|
$possible =~ s/,+/,/g; |
} |
} |
$count = 0; |
$count = 0; |
if ($possible ne '') { |
if ($possible ne '') { |
foreach my $poss (split(/\,/,$possible)) { |
foreach my $poss (split(/\,/,$possible)) { |
$count ++; |
$count ++; |
if (&validate_ip_pattern($poss)) { |
$poss = &validate_ip_pattern($poss); |
|
if ($poss ne '') { |
push(@ok,$poss); |
push(@ok,$poss); |
} |
} |
} |
} |
if (@ok) { |
|
$wafproxy{$item} = join(',',@ok); |
|
} |
|
my $diff = $count - scalar(@ok); |
my $diff = $count - scalar(@ok); |
if ($diff) { |
if ($diff) { |
push(@warnings,'<li>'. |
push(@warnings,'<li>'. |
Line 20510 sub modify_wafproxy {
|
Line 20528 sub modify_wafproxy {
|
$diff,$warn{$item}). |
$diff,$warn{$item}). |
'</li>'); |
'</li>'); |
} |
} |
|
if (@ok) { |
|
my @cidr_list; |
|
foreach my $item (@ok) { |
|
@cidr_list = &Net::CIDR::cidradd($item,@cidr_list); |
|
} |
|
$wafproxy{$item} = join(',',@cidr_list); |
|
} |
} |
} |
} |
} |
if ($wafproxy{$item} ne $currvalue{$item}) { |
if ($wafproxy{$item} ne $currvalue{$item}) { |
Line 20701 sub validate_ip_pattern {
|
Line 20726 sub validate_ip_pattern {
|
if ($pattern =~ /^([^-]+)\-([^-]+)$/) { |
if ($pattern =~ /^([^-]+)\-([^-]+)$/) { |
my ($start,$end) = ($1,$2); |
my ($start,$end) = ($1,$2); |
if ((&Net::CIDR::cidrvalidate($start)) && (&Net::CIDR::cidrvalidate($end))) { |
if ((&Net::CIDR::cidrvalidate($start)) && (&Net::CIDR::cidrvalidate($end))) { |
return 1; |
if (($start !~ m{/}) && ($end !~ m{/})) { |
|
return $start.'-'.$end; |
|
} |
|
} |
|
} elsif ($pattern ne '') { |
|
$pattern = &Net::CIDR::cidrvalidate($pattern); |
|
if ($pattern ne '') { |
|
return $pattern; |
} |
} |
} elsif (&Net::CIDR::cidrvalidate($pattern)) { |
|
return 1; |
|
} |
} |
return |
return; |
} |
} |
|
|
sub modify_usersessions { |
sub modify_usersessions { |