--- loncom/interface/lonmodifycourse.pm 2017/04/08 14:58:11 1.92
+++ loncom/interface/lonmodifycourse.pm 2023/06/05 02:22:29 1.100
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# handler for DC-only modifiable course settings
#
-# $Id: lonmodifycourse.pm,v 1.92 2017/04/08 14:58:11 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.100 2023/06/05 02:22:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,9 @@ use Apache::lonpickcourse;
use lib '/home/httpd/lib/perl';
use LONCAPA qw(:DEFAULT :match);
+my $registered_cleanup;
+my $modified_dom;
+
sub get_dc_settable {
my ($type,$cdom) = @_;
if ($type eq 'Community') {
@@ -49,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;
}
}
@@ -101,6 +108,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'} = '';
@@ -126,7 +134,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)) {
@@ -422,6 +430,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 = (
@@ -429,6 +439,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') {
@@ -467,6 +479,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);
@@ -548,6 +562,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 => '',
+ },
]
},
);
@@ -578,7 +608,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 = '';
@@ -676,9 +708,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 {
@@ -899,15 +956,7 @@ ENDDOCUMENT
sub domain_postsubtimeout {
my ($cdom,$type,$settings) = @_;
return unless (ref($settings) eq 'HASH');
- my $lctype = lc($type);
- unless (($type eq 'Community') || ($type eq 'Placement')) {
- $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;
@@ -923,6 +972,22 @@ sub domain_postsubtimeout {
return $postsubtimeout;
}
+sub get_lctype {
+ my ($type,$settings) = @_;
+ my $lctype = lc($type);
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
+ $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);
@@ -1033,6 +1098,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';
@@ -1107,7 +1173,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').
@@ -1117,7 +1184,7 @@ sub print_course_modification_page {
if (($crstype eq 'Course') && (&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());
}
@@ -1127,8 +1194,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".
+ '