--- loncom/interface/lonmodifycourse.pm 2019/07/26 17:43:54 1.79.2.7
+++ loncom/interface/lonmodifycourse.pm 2023/09/04 20:46:02 1.79.2.9.2.4
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# handler for DC-only modifiable course settings
#
-# $Id: lonmodifycourse.pm,v 1.79.2.7 2019/07/26 17:43:54 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.79.2.9.2.4 2023/09/04 20:46:02 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -52,6 +52,10 @@ sub get_dc_settable {
if (&showcredits($cdom)) {
push(@items,'defaultcredits');
}
+ my %passwdconf = &Apache::lonnet::get_passwdconf($cdom);
+ if (($passwdconf{'crsownerchg'}) && ($type ne 'Placement')) {
+ push(@items,'nopasswdchg');
+ }
return @items;
}
}
@@ -97,6 +101,7 @@ sub get_enrollment_settings {
@items = map { 'internal.'.$_; } (@{$internals});
push(@items,@{$accessdates});
}
+ push(@items,'internal.nopasswdchg');
my %settings = &Apache::lonnet::get('environment',\@items,$cdom,$cnum);
my %enrollvar;
$enrollvar{'autharg'} = '';
@@ -122,7 +127,7 @@ sub get_enrollment_settings {
} elsif ($type eq "authtype"
|| $type eq "autharg" || $type eq "coursecode"
|| $type eq "crosslistings" || $type eq "selfenrollmgr"
- || $type eq "autodropfailsafe") {
+ || $type eq "autodropfailsafe" || $type eq 'nopasswdchg') {
$enrollvar{$type} = $settings{$item};
} elsif ($type eq 'defaultcredits') {
if (&showcredits($cdom)) {
@@ -405,6 +410,8 @@ sub print_modification_menu {
'setanon' => 'View/Modify responders threshold for anonymous survey submissions display',
'selfenroll' => 'View/Modify Self-Enrollment configuration',
'setpostsubmit' => 'View/Modify submit button behavior, post-submission',
+ 'setltiauth' => 'View/Modify re-authentication requirement for LTI launch of deep-linked item',
+ 'setexttool' => 'View/Modify External Tools permissions',
);
} else {
%linktext = (
@@ -412,6 +419,8 @@ sub print_modification_menu {
'setanon' => 'View responders threshold for anonymous survey submissions display',
'selfenroll' => 'View Self-Enrollment configuration',
'setpostsubmit' => 'View submit button behavior, post-submission',
+ 'setltiauth' => 'View re-authentication requirement for LTI launch of deep-linked item',
+ 'setexttool' => 'View External Tools permissions',
);
}
if ($type eq 'Community') {
@@ -450,6 +459,8 @@ sub print_modification_menu {
my $anon_text = &mt('Responder threshold required to display anonymous survey submissions.');
my $postsubmit_text = &mt('Override defaults for submit button behavior post-submission for this specific course.');
my $mysqltables_text = &mt('Override default for lifetime of "temporary" MySQL tables containing student performance data.');
+ my $ltiauth_text = &mt('Override default for requirement for re-authentication for LTI-limited launch of deep-linked item.');
+ my $exttool_text = &mt('Override default permissions for external tools use for this specific course.');
$linktext{'viewparms'} = 'Display current settings for automated enrollment';
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
@@ -531,6 +542,22 @@ sub print_modification_menu {
permission => $permission->{'setpostsubmit'},
linktitle => '',
},
+ {
+ linktext => $linktext{'setltiauth'},
+ icon => 'system-lock-screen.png',
+ #help => '',
+ url => &phaseurl('setltiauth'),
+ permission => $permission->{'setltiauth'},
+ linktitle => '',
+ },
+ {
+ linktext => $linktext{'setexttool'},
+ icon => 'exttool.png',
+ #help => '',
+ url => &phaseurl('setexttool'),
+ permission => $permission->{'setexttool'},
+ linktitle => '',
+ },
]
},
);
@@ -561,7 +588,9 @@ sub print_modification_menu {
'
'.$setquota_text.''."\n".
''.$setuploadquota_text.''."\n".
''.$anon_text.''."\n".
- ''.$postsubmit_text.''."\n";
+ ''.$postsubmit_text.''."\n".
+ ''.$ltiauth_text.''."\n".
+ ''.$exttool_text.''."\n";
my ($categories_link_start,$categories_link_end);
if ($permission->{'catsettings'} eq 'edit') {
$categories_link_start = '';
@@ -659,9 +688,34 @@ sub print_settings_display {
"$lt{'dcon'} | \n".
&Apache::loncommon::end_data_table_header_row()."\n";
foreach my $item (@items) {
+ my $shown = $enrollvar{$item};
+ if ($item eq 'crosslistings') {
+ my (@xlists,@lcsecs);
+ foreach my $entry (split(/,/,$enrollvar{$item})) {
+ my ($xlist,$lc_sec) = split(/:/,$entry);
+ push(@xlists,$xlist);
+ push(@lcsecs,$lc_sec);
+ }
+ if (@xlists) {
+ my $crskey = $cnum.':'.$enrollvar{'coursecode'};
+ my %reformatted =
+ &Apache::lonnet::auto_instsec_reformat($cdom,'declutter',
+ {$crskey => \@xlists});
+ if (ref($reformatted{$crskey}) eq 'ARRAY') {
+ my @show;
+ my @xlcodes = @{$reformatted{$crskey}};
+ for (my $i=0; $i<@xlcodes; $i++) {
+ push(@show,$xlcodes[$i].':'.$lcsecs[$i]);
+ }
+ if (@show) {
+ $shown = join(',',@show);
+ }
+ }
+ }
+ }
$disp_table .= &Apache::loncommon::start_data_table_row()."\n".
"$longtype{$item} | \n".
- "$enrollvar{$item} | \n";
+ "$shown | \n";
if (grep(/^\Q$item\E$/,@modifiable_params)) {
$disp_table .= ''.&mt('Yes').' | '."\n";
} else {
@@ -721,15 +775,20 @@ sub print_setquota {
$cdom,$cnum);
my $coursequota = $settings{'internal.coursequota'};
my $uploadquota = $settings{'internal.uploadquota'};
- if ($coursequota eq '') {
- $coursequota = $staticdefaults{'coursequota'};
- }
- if ($uploadquota eq '') {
+ if (($uploadquota eq '') || ($coursequota eq '')) {
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
my $quotatype = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$type,\%settings);
- $uploadquota = $domdefs{$quotatype.'quota'};
if ($uploadquota eq '') {
- $uploadquota = $staticdefaults{'uploadquota'};
+ $uploadquota = $domdefs{$quotatype.'quota'};
+ if ($uploadquota eq '') {
+ $uploadquota = $staticdefaults{'uploadquota'};
+ }
+ }
+ if ($coursequota eq '') {
+ $coursequota = $domdefs{$quotatype.'coursequota'};
+ if ($coursequota eq '') {
+ $coursequota = $staticdefaults{'coursequota'};
+ }
}
}
&print_header($r,$type);
@@ -882,15 +941,7 @@ ENDDOCUMENT
sub domain_postsubtimeout {
my ($cdom,$type,$settings) = @_;
return unless (ref($settings) eq 'HASH');
- my $lctype = lc($type);
- unless ($type eq 'Community') {
- $lctype = 'unofficial';
- if ($settings->{'internal.coursecode'}) {
- $lctype = 'official';
- } elsif ($settings->{'internal.textbook'}) {
- $lctype = 'textbook';
- }
- }
+ my $lctype = &get_lctype($type,$settings);
my %domconfig =
&Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
my $postsubtimeout = 60;
@@ -906,6 +957,22 @@ sub domain_postsubtimeout {
return $postsubtimeout;
}
+sub get_lctype {
+ my ($type,$settings) = @_;
+ my $lctype = lc($type);
+ unless ($type eq 'Community') {
+ $lctype = 'unofficial';
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'internal.coursecode'}) {
+ $lctype = 'official';
+ } elsif ($settings->{'internal.textbook'}) {
+ $lctype = 'textbook';
+ }
+ }
+ }
+ return $lctype;
+}
+
sub print_catsettings {
my ($r,$cdom,$cnum,$cdesc,$type,$readonly) = @_;
&print_header($r,$type);
@@ -1014,6 +1081,7 @@ sub print_course_modification_page {
my @specific_managebydc = split(/,/,$settings{'internal.selfenrollmgrdc'});
my @specific_managebycc = split(/,/,$settings{'internal.selfenrollmgrcc'});
my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom);
+ my %passwdconf = &Apache::lonnet::get_passwdconf($cdom);
my @default_managebydc = split(/,/,$domdefaults{$type.'selfenrolladmdc'});
if ($crstype eq 'Community') {
$ccrole = 'co';
@@ -1088,7 +1156,8 @@ sub print_course_modification_page {
if ($crstype eq 'Community') {
$r->print(&Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Community_Owner').
- ' '.&mt('Community Owner'))."\n");
+ ' '.&mt('Community Owner'))."\n".
+ $ownertable."\n".&Apache::lonhtmlcommon::row_closure());
} else {
$r->print(&Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Course_Instcode').
@@ -1098,7 +1167,7 @@ sub print_course_modification_page {
if (&showcredits($cdom)) {
$r->print(&Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Course_Credithours').
- ' '.&mt('Credits (students)'))."\n".
+ ' '.&mt('Credits (students)'))."\n".
''.
&Apache::lonhtmlcommon::row_closure());
}
@@ -1108,8 +1177,21 @@ sub print_course_modification_page {
$authenitems."\n".
&Apache::lonhtmlcommon::row_closure().
&Apache::lonhtmlcommon::row_title(
- &Apache::loncommon::help_open_topic('Modify_Course_Owner').
- ' '.&mt('Course Owner'))."\n");
+ &Apache::loncommon::help_open_topic('Modify_Course_Owner').
+ ' '.&mt('Course Owner'))."\n".
+ $ownertable."\n".&Apache::lonhtmlcommon::row_closure());
+ if (($passwdconf{'crsownerchg'}) && ($type ne 'Placement')) {
+ my $checked;
+ if ($enrollvar{'nopasswdchg'}) {
+ $checked = ' checked="checked"';
+ }
+ $r->print(&Apache::lonhtmlcommon::row_title(
+ &Apache::loncommon::help_open_topic('Modify_Course_Chgpasswd').
+ ' '.&mt('Changing passwords (internal)'))."\n".
+ '