--- loncom/interface/domainprefs.pm 2023/11/07 11:50:56 1.431
+++ loncom/interface/domainprefs.pm 2023/12/23 02:17:38 1.432
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.431 2023/11/07 11:50:56 raeburn Exp $
+# $Id: domainprefs.pm,v 1.432 2023/12/23 02:17:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6822,7 +6822,7 @@ sub print_coursedefaults {
my %choices = &Apache::lonlocal::texthash (
canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
- coursequota => 'Default cumulative quota for all group portfolio spaces in course',
+ coursequota => 'Default cumulative quota for all group portfolio spaces in course (MB)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',
@@ -6835,6 +6835,7 @@ sub print_coursedefaults {
ltiauth => 'Student username in LTI launch of deep-linked URL can be accepted without re-authentication',
domexttool => 'External Tools defined in the domain may be used in courses/communities (by type)',
exttool => 'External Tools can be defined and configured in courses/communities (by type)',
+ crsauthor => 'Standard LON-CAPA problems can be created within a course/community (by type)',
);
my %staticdefaults = (
anonsurvey_threshold => 10,
@@ -6844,6 +6845,7 @@ sub print_coursedefaults {
mysqltables => 172800,
domexttool => 1,
exttool => 0,
+ crsauthor => 1,
);
if ($position eq 'top') {
%defaultchecked = (
@@ -6964,6 +6966,7 @@ sub print_coursedefaults {
my $ltiauth = 0;
my %domexttool;
my %exttool;
+ my %crsauthor;
my @types = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
if ($settings->{'ltiauth'}) {
@@ -6989,6 +6992,19 @@ sub print_coursedefaults {
}
}
}
+ if (ref($settings->{'crsauthor'}) eq 'HASH') {
+ foreach my $type (@types) {
+ if ($settings->{'crsauthor'}->{$type}) {
+ $crsauthor{$type} = ' checked="checked"';
+ }
+ }
+ } else {
+ foreach my $type (@types) {
+ if ($staticdefaults{'crsauthor'}) {
+ $crsauthor{$type} = ' checked="checked"';
+ }
+ }
+ }
$currdefresponder = $settings->{'anonsurvey_threshold'};
if (ref($settings->{'uploadquota'}) eq 'HASH') {
foreach my $type (keys(%{$settings->{'uploadquota'}})) {
@@ -7048,6 +7064,9 @@ sub print_coursedefaults {
if ($staticdefaults{'domexttool'}) {
$domexttool{$type} = ' checked="checked"';
}
+ if ($staticdefaults{'crsauthor'}) {
+ $crsauthor{$type} = ' checked="checked"';
+ }
}
}
if (!$currdefresponder) {
@@ -7196,6 +7215,21 @@ sub print_coursedefaults {
&mt($type).''."\n";
}
$datatable .= ''."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= '
'.
+ $choices{'crsauthor'}.
+ ' | '.
+ ''.
+ ' |
'."\n";
}
$$rowtotal += $itemcount;
return $datatable;
@@ -21009,6 +21043,7 @@ sub modify_coursedefaults {
postsubmit => 60,
mysqltables => 172800,
domexttool => 1,
+ crsauthor => 1,
);
my %texoptions = (
MathJax => 'MathJax',
@@ -21200,9 +21235,10 @@ sub modify_coursedefaults {
$changes{'postsubmit'} = 1;
}
}
- my (%newdomexttool,%newexttool,%olddomexttool,%oldexttool);
+ my (%newdomexttool,%newexttool,%newcrsauthor,%olddomexttool,%oldexttool,%oldcrsauthor);
map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool');
map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');
+ map { $newcrsauthor{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crsauthor');
if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
%olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}};
} else {
@@ -21225,6 +21261,17 @@ sub modify_coursedefaults {
}
}
}
+ if (ref($domconfig{'coursedefaults'}{'crsauthor'}) eq 'HASH') {
+ %oldcrsauthor = %{$domconfig{'coursedefaults'}{'crsauthor'}};
+ } else {
+ foreach my $type (@types) {
+ if ($staticdefaults{'crsauthor'}) {
+ $oldcrsauthor{$type} = 1;
+ } else {
+ $oldcrsauthor{$type} = 0;
+ }
+ }
+ }
foreach my $type (@types) {
unless ($newdomexttool{$type}) {
$newdomexttool{$type} = 0;
@@ -21232,15 +21279,22 @@ sub modify_coursedefaults {
unless ($newexttool{$type}) {
$newexttool{$type} = 0;
}
+ unless ($newcrsauthor{$type}) {
+ $newcrsauthor{$type} = 0;
+ }
if ($newdomexttool{$type} != $olddomexttool{$type}) {
$changes{'domexttool'} = 1;
}
if ($newexttool{$type} != $oldexttool{$type}) {
$changes{'exttool'} = 1;
}
+ if ($newcrsauthor{$type} != $oldcrsauthor{$type}) {
+ $changes{'crsauthor'} = 1;
+ }
}
$defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool;
$defaultshash{'coursedefaults'}{'exttool'} = \%newexttool;
+ $defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor;
}
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
$dom);
@@ -21251,7 +21305,7 @@ sub modify_coursedefaults {
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||
($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'}) ||
($changes{'inline_chem'}) || ($changes{'ltiauth'}) || ($changes{'domexttool'}) ||
- ($changes{'exttool'}) || ($changes{'coursequota'})) {
+ ($changes{'exttool'}) || ($changes{'coursequota'}) || ($changes{'crsauthor'})) {
foreach my $item ('canuse_pdfforms','uselcmath','usejsme','inline_chem','texengine',
'ltiauth') {
if ($changes{$item}) {
@@ -21317,6 +21371,13 @@ sub modify_coursedefaults {
}
}
}
+ if ($changes{'crsauthor'}) {
+ if (ref($defaultshash{'coursedefaults'}{'crsauthor'}) eq 'HASH') {
+ foreach my $type (@types) {
+ $domdefaults{$type.'crsauthor'}=$defaultshash{'coursedefaults'}{'crsauthor'}{$type};
+ }
+ }
+ }
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
if (ref($lastactref) eq 'HASH') {
@@ -21467,33 +21528,34 @@ sub modify_coursedefaults {
} else {
$resulttext .= ''.&mt('LTI launch of deep-linked URL will require re-authentication').'';
}
- } elsif ($item eq 'domexttool') {
- my @noyes = (&mt('no'),&mt('yes'));
- if (ref($defaultshash{'coursedefaults'}{'domexttool'}) eq 'HASH') {
- $resulttext .= ''.&mt('External Tools defined in the domain may be used as follows:').''.
- '- '.&mt('Official courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'official'}].'').'
'.
- '- '.&mt('Unofficial courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'unofficial'}].'').'
'.
- '- '.&mt('Textbook courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'textbook'}].'').'
'.
- '- '.&mt('Placement tests: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'placement'}].'').'
'.
- '- '.&mt('Communities: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'community'}].'').'
'.
- '
'.
- '';
- } else {
- $resulttext .= ''.&mt('External Tools defined in the domain may be used in all course types, by default').'';
- }
- } elsif ($item eq 'exttool') {
+ } elsif (($item eq 'domexttool') || ($item eq 'exttool') || ($item eq 'crsauthor')) {
my @noyes = (&mt('no'),&mt('yes'));
- if (ref($defaultshash{'coursedefaults'}{'exttool'}) eq 'HASH') {
- $resulttext .= ''.&mt('External Tools can be defined and configured in course containers as follows:').''.
- '- '.&mt('Official courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'official'}].'').'
'.
- '- '.&mt('Unofficial courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'unofficial'}].'').'
'.
- '- '.&mt('Textbook courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'textbook'}].'').'
'.
- '- '.&mt('Placement tests: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'placement'}].'').'
'.
- '- '.&mt('Communities: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'community'}].'').'
'.
+ my %status = (
+ domexttool => {
+ ishash => &mt('External Tools defined in the domain may be used as follows:'),
+ default => &mt('External Tools defined in the domain may be used in all course types, by default'),
+ },
+ exttool => {
+ ishash => &mt('External Tools can be defined and configured in course containers as follows:'),
+ default => &mt('External Tools can not be defined in any course types, by default'),
+ },
+ crsauthor => {
+ ishash => &mt('Standard Problems can be created within course containers as follows:'),
+ default => &mt('Standard Problems can be created within any course type, by default'),
+ },
+ );
+
+ if (ref($defaultshash{'coursedefaults'}{$item}) eq 'HASH') {
+ $resulttext .= '- '.$status{$item}{'ishash'}.'
'.
+ '- '.&mt('Official courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{$item}{'official'}].'').'
'.
+ '- '.&mt('Unofficial courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{$item}{'unofficial'}].'').'
'.
+ '- '.&mt('Textbook courses: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{$item}{'textbook'}].'').'
'.
+ '- '.&mt('Placement tests: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{$item}{'placement'}].'').'
'.
+ '- '.&mt('Communities: [_1]',''.$noyes[$defaultshash{'coursedefaults'}{$item}{'community'}].'').'
'.
'
'.
' ';
} else {
- $resulttext .= '- '.&mt('External Tools can not be defined in any course types, by default').'
';
+ $resulttext .= '- '.$status{$item}{'default'}.'
';
}
}
}