--- loncom/interface/domainprefs.pm 2024/03/03 02:21:32 1.160.6.118.2.21
+++ loncom/interface/domainprefs.pm 2024/08/17 22:53:46 1.160.6.118.2.22
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.118.2.21 2024/03/03 02:21:32 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.118.2.22 2024/08/17 22:53:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6043,6 +6043,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)',
+ crseditors => 'Available editors for web pages and/or problems created in a course/community',
);
my %staticdefaults = (
anonsurvey_threshold => 10,
@@ -6052,6 +6053,7 @@ sub print_coursedefaults {
mysqltables => 172800,
domexttool => 1,
exttool => 0,
+ crseditors => ['edit','xml'],
);
if ($position eq 'top') {
%defaultchecked = (
@@ -6171,6 +6173,7 @@ sub print_coursedefaults {
my $ltiauth = 0;
my %domexttool;
my %exttool;
+ my %crseditors;
my @types = ('official','unofficial','community','textbook');
if (ref($settings) eq 'HASH') {
if ($settings->{'ltiauth'}) {
@@ -6196,6 +6199,15 @@ sub print_coursedefaults {
}
}
}
+ if (ref($settings->{'crseditors'}) eq 'ARRAY') {
+ foreach my $editor (@{$settings->{'crseditors'}}) {
+ $crseditors{$editor} = ' checked="checked"';
+ }
+ } else {
+ foreach my $editor (@{$staticdefaults{'crseditors'}}) {
+ $crseditors{$editor} = ' checked="checked"';
+ }
+ }
$currdefresponder = $settings->{'anonsurvey_threshold'};
if (ref($settings->{'uploadquota'}) eq 'HASH') {
foreach my $type (keys(%{$settings->{'uploadquota'}})) {
@@ -6256,6 +6268,9 @@ sub print_coursedefaults {
$domexttool{$type} = ' checked="checked"';
}
}
+ foreach my $editor (@{$staticdefaults{'crseditors'}}) {
+ $crseditors{$editor} = ' checked="checked"';
+ }
}
if (!$currdefresponder) {
$currdefresponder = $staticdefaults{'anonsurvey_threshold'};
@@ -6383,9 +6398,9 @@ sub print_coursedefaults {
foreach my $type (@types) {
$datatable .= '
'.
''.
- ''.
- &mt($type).' | '."\n";
+ &mt($type).''."\n";
}
$datatable .= ''."\n";
$itemcount ++;
@@ -6398,9 +6413,26 @@ sub print_coursedefaults {
foreach my $type (@types) {
$datatable .= ''.
''.
- ''.
- &mt($type).' | '."\n";
+ &mt($type).''."\n";
+ }
+ $datatable .= ''."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= ''.
+ $choices{'crseditors'}.
+ ' | '.
+ ''.
+ ' |
'."\n";
}
@@ -6408,6 +6440,14 @@ sub print_coursedefaults {
return $datatable;
}
+sub crseditor_titles {
+ return &Apache::lonlocal::texthash(
+ edit => 'Standard editor (Edit)',
+ xml => 'Text editor (EditXML)',
+ daxe => 'Daxe editor (Daxe)',
+ );
+}
+
sub print_authordefaults {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable,%checkedon,%checkedoff);
@@ -6575,6 +6615,15 @@ sub print_authordefaults {
}
$datatable .= '';
$itemcount ++;
+ my %defchecked = (
+ 'archive' => 'off',
+ );
+ my @toggles = ('archive');
+ (my $archive,$itemcount) = &radiobutton_prefs($settings,['archive'],
+ {'archive' => 'off'},
+ \%titles,$itemcount);
+ $datatable .= $archive."\n";
+ $itemcount ++;
}
$$rowtotal += $itemcount;
return $datatable;
@@ -6598,6 +6647,7 @@ sub authordefaults_titles {
none => 'No override set',
overon => 'Override -- webDAV on',
overoff => 'Override -- webDAV off',
+ archive => 'Authors can download tar.gz file of Authoring Space',
);
}
@@ -12020,12 +12070,13 @@ sub modify_authordefaults {
'nocodemirror' => 'off',
'daxecollapse' => 'off',
'domcoordacc' => 'on',
- 'editors' => ['edit','xml'].
+ 'editors' => ['edit','xml'],
'authorquota' => 500,
'webdav' => 0,
+ 'archive' => 'off',
);
my %titles = &authordefaults_titles();
- foreach my $item ('nocodemirror','daxecollapse','domcoordacc') {
+ foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
if ($env{'form.'.$item} =~ /^(0|1)$/) {
$confhash{$item} = $env{'form.'.$item};
}
@@ -12069,7 +12120,7 @@ sub modify_authordefaults {
$save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};
}
if (ref($domconfig{'authordefaults'}) eq 'HASH') {
- foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail') {
+ foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail','archive') {
if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {
$changes{$item} = 1;
}
@@ -12091,7 +12142,7 @@ sub modify_authordefaults {
}
} else {
my @offon = ('off','on');
- foreach my $item ('nocodemirror','daxecollapse','domcoordacc') {
+ foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {
$changes{$item} = 1;
}
@@ -12101,6 +12152,12 @@ sub modify_authordefaults {
$changes{$item} = 1;
}
}
+ my @diffs =
+ &Apache::loncommon::compare_arrays($confhash{'editors'},
+ $staticdefaults{'editors'});
+ unless (@diffs == 0) {
+ $changes{'editors'} = 1;
+ }
}
foreach my $key ('authorquota','webdav') {
if (ref($curr_quotas{$key}) eq 'HASH') {
@@ -12182,7 +12239,7 @@ sub modify_authordefaults {
$resulttext .= '';
}
my $domcoordoverride;
- foreach my $key ('editors','authorquota','webdav','webdav_LC_adv') {
+ foreach my $key ('editors','authorquota','webdav','webdav_LC_adv','archive') {
if (exists($changes{$key})) {
my $shown;
unless ($domcoordoverride) {
@@ -12214,6 +12271,9 @@ sub modify_authordefaults {
} else {
$shown = $titles{'none'};
}
+ } elsif ($key eq 'archive') {
+ $domdefaults{$key} = $confhash{$key};
+ $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
}
$resulttext .= ''.&mt('[_1] set to: [_2]',$titles{$key},$shown).'';
}
@@ -12221,6 +12281,7 @@ sub modify_authordefaults {
if ($domcoordoverride) {
$resulttext .= '';
}
+ $resulttext .= '';
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
if (ref($lastactref) eq 'HASH') {
@@ -13424,6 +13485,7 @@ sub modify_quotas {
$resulttext .= ''.&mt('Validated course requests identified as processed by: [_1]',
''.$changes{'validation'}{'dc'}.'').'';
}
+ resulttext .= '';
}
}
}
@@ -19009,12 +19071,17 @@ sub modify_coursedefaults {
postsubmit => 60,
mysqltables => 172800,
domexttool => 1,
+ crseditors => ['edit','xml'],
);
my %texoptions = (
MathJax => 'MathJax',
mimetex => &mt('Convert to Images'),
tth => &mt('TeX to HTML'),
);
+
+ my @editors = ('edit','xml','daxe');
+ my %editornames = &crseditor_titles();
+
$defaultshash{'coursedefaults'} = {};
if (ref($domconfig{'coursedefaults'}) ne 'HASH') {
@@ -19200,9 +19267,10 @@ sub modify_coursedefaults {
$changes{'postsubmit'} = 1;
}
}
- my (%newdomexttool,%newexttool,%olddomexttool,%oldexttool);
+ my (%newdomexttool,%newexttool,%olddomexttool,%oldexttool,%posscrseditors);
map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool');
map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');
+ map { $posscrseditors{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crseditors');
if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
%olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}};
} else {
@@ -19225,6 +19293,27 @@ sub modify_coursedefaults {
}
}
}
+ my @newcrseditors = ();
+ foreach my $editor (@editors) {
+ if ($posscrseditors{$editor}) {
+ push(@newcrseditors,$editor);
+ }
+ }
+ if (ref($domconfig{'coursedefaults'}{'crseditors'}) eq 'ARRAY') {
+ my @diffs =
+ &Apache::loncommon::compare_arrays($domconfig{'coursedefaults'}{'crseditors'},
+ \@newcrseditors);
+ if (@diffs) {
+ $changes{'crseditors'} = 1;
+ }
+ } else {
+ my @diffs =
+ &Apache::loncommon::compare_arrays($staticdefaults{'crseditors'},
+ \@newcrseditors);
+ unless (@diffs == 0) {
+ $changes{'crseditors'} = 1;
+ }
+ }
foreach my $type (@types) {
unless ($newdomexttool{$type}) {
$newdomexttool{$type} = 0;
@@ -19241,6 +19330,7 @@ sub modify_coursedefaults {
}
$defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool;
$defaultshash{'coursedefaults'}{'exttool'} = \%newexttool;
+ $defaultshash{'coursedefaults'}{'crseditors'} = \@newcrseditors;
}
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
$dom);
@@ -19316,6 +19406,11 @@ sub modify_coursedefaults {
}
}
}
+ if ($changes{'crseditors'}) {
+ if (ref($defaultshash{'coursedefaults'}{'crseditors'}) eq 'ARRAY') {
+ $domdefaults{'crseditors'}=join(',',@{$defaultshash{'coursedefaults'}{'crseditors'}});
+ }
+ }
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
if (ref($lastactref) eq 'HASH') {
@@ -19483,6 +19578,16 @@ sub modify_coursedefaults {
} else {
$resulttext .= ''.&mt('External Tools can not be defined in any course types, by default').'';
}
+ } elsif ($item eq 'crseditors') {
+ if (ref($defaultshash{'coursedefaults'}{$item}) eq 'ARRAY') {
+ my $shown;
+ if (@{$defaultshash{'coursedefaults'}{$item}}) {
+ $shown = join(', ', map { $editornames{$_} } @{$defaultshash{'coursedefaults'}{$item}});
+ } else {
+ $shown = &mt('None');
+ }
+ $resulttext .= ''.&mt('Available editors for course/community resources: [_1]',$shown).'';
+ }
}
}
$resulttext .= '';