--- loncom/interface/domainprefs.pm 2024/02/25 06:15:54 1.160.6.118.2.19
+++ loncom/interface/domainprefs.pm 2024/02/27 16:47:14 1.160.6.118.2.20
@@ -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.19 2024/02/25 06:15:54 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.118.2.20 2024/02/27 16:47:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -95,8 +95,7 @@ about default quota sizes for portfolio
institutional affiliation in the domain (e.g., Faculty, Staff, Student etc.),
but is now also used to manage availability of user tools:
i.e., blogs, aboutme page, and portfolios, and the course request tool,
-used by course owners to request creation of a course, and to display/store
-default quota sizes for Authoring Spaces.
+used by course owners to request creation of a course.
Outputs: 1
@@ -222,7 +221,7 @@ sub handler {
'coursedefaults','usersessions','loadbalancing',
'requestauthor','selfenrollment','inststatus',
'passwords','ltitools','toolsec','lti','ltisec',
- 'wafproxy','ipaccess'],$dom);
+ 'wafproxy','ipaccess','authordefaults'],$dom);
my %encconfig =
&Apache::lonnet::get_dom('encconfig',['ltitools','lti','linkprot'],$dom,undef,1);
my ($checked_is_home,$is_home);
@@ -292,7 +291,7 @@ sub handler {
'contacts','usercreation','selfcreation','usermodification',
'scantron','requestcourses','requestauthor','coursecategories',
'serverstatuses','helpsettings','coursedefaults',
- 'ltitools','selfenrollment','usersessions','lti');
+ 'authordefaults','ltitools','selfenrollment','usersessions','lti');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -368,11 +367,11 @@ sub handler {
modify => \&modify_passwords,
},
'quotas' =>
- { text => 'Blogs, personal pages/timezones, webDAV/quotas, portfolio',
+ { text => 'Blogs, personal pages/timezones, portfolio/quotas',
help => 'Domain_Configuration_Quotas',
header => [{col1 => 'User affiliation',
col2 => 'Available tools',
- col3 => 'Quotas, MB; (Authoring requires role)',}],
+ col3 => 'Portfolio quota (MB)',}],
print => \&print_quotas,
modify => \&modify_quotas,
},
@@ -612,6 +611,16 @@ sub handler {
print => \&print_ipaccess,
modify => \&modify_ipaccess,
},
+ 'authordefaults' =>
+ {text => 'Authoring Space defaults',
+ help => 'Domain_Configuration_Author_Defaults',
+ header => [{col1 => 'Defaults which can be overridden by Author',
+ col2 => 'Settings',},
+ {col1 => 'Defaults which can be overridden by a Dom. Coord.',
+ col2 => 'Settings',},],
+ print => \&print_authordefaults,
+ modify => \&modify_authordefaults,
+ },
);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
@@ -809,6 +818,8 @@ sub process_changes {
$output = &modify_wafproxy($dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'ipaccess') {
$output = &modify_ipaccess($dom,$lastactref,%domconfig);
+ } elsif ($action eq 'authordefaults') {
+ $output = &modify_authordefaults($dom,$lastactref,%domconfig);
}
return $output;
}
@@ -854,6 +865,8 @@ sub print_config_box {
$output .= &saml_javascript();
} elsif ($action eq 'ipaccess') {
$output .= &ipaccess_javascript($settings);
+ } elsif ($action eq 'authordefaults') {
+ $output .= &authordefaults_javascript();
}
$output .=
'
@@ -895,7 +908,7 @@ sub print_config_box {
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') ||
($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'directorysrch') ||
($action eq 'helpsettings') || ($action eq 'contacts') || ($action eq 'wafproxy') ||
- ($action eq 'lti') || ($action eq 'ltitools')) {
+ ($action eq 'lti') || ($action eq 'ltitools') || ($action eq 'authordefaults')) {
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);
} elsif ($action eq 'passwords') {
$output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal);
@@ -1005,7 +1018,7 @@ sub print_config_box {
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
($action eq 'directorysrch') || ($action eq 'helpsettings') ||
- ($action eq 'wafproxy')) {
+ ($action eq 'wafproxy') || ($action eq 'authordefaults')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'scantron') {
$output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);
@@ -2277,7 +2290,7 @@ sub print_quotas {
} else {
$context = $action;
}
- my ($datatable,$defaultquota,$authorquota,@usertools,@options,%validations);
+ my ($datatable,$defaultquota,@usertools,@options,%validations);
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
my $typecount = 0;
my ($css_class,%titles);
@@ -2291,12 +2304,12 @@ sub print_quotas {
@options = ('norequest','approval','automatic');
%titles = &authorrequest_titles();
} else {
- @usertools = ('aboutme','blog','webdav','portfolio','timezone');
+ @usertools = ('aboutme','blog','portfolio','timezone');
%titles = &tool_titles();
}
if (ref($types) eq 'ARRAY') {
foreach my $type (@{$types}) {
- my ($currdefquota,$currauthorquota);
+ my $currdefquota;
unless (($context eq 'requestcourses') ||
($context eq 'requestauthor')) {
if (ref($settings) eq 'HASH') {
@@ -2305,9 +2318,6 @@ sub print_quotas {
} else {
$currdefquota = $settings->{$type};
}
- if (ref($settings->{authorquota}) eq 'HASH') {
- $currauthorquota = $settings->{authorquota}->{$type};
- }
}
}
if (defined($usertypes->{$type})) {
@@ -2425,13 +2435,9 @@ sub print_quotas {
($context eq 'requestauthor')) {
$datatable .=
''.
- ''.&mt('Portfolio').': '.
+ ''.
''.(' ' x 2).
- ''.&mt('Authoring').': '.
- ' | ';
}
$datatable .= '';
@@ -2440,16 +2446,12 @@ sub print_quotas {
}
unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
$defaultquota = '20';
- $authorquota = '500';
if (ref($settings) eq 'HASH') {
if (ref($settings->{'defaultquota'}) eq 'HASH') {
$defaultquota = $settings->{'defaultquota'}->{'default'};
} elsif (defined($settings->{'default'})) {
$defaultquota = $settings->{'default'};
}
- if (ref($settings->{'authorquota'}) eq 'HASH') {
- $authorquota = $settings->{'authorquota'}->{'default'};
- }
}
}
$typecount ++;
@@ -2561,12 +2563,9 @@ sub print_quotas {
$datatable .= '';
unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
$datatable .= ''.
- ''.&mt('Portfolio').': '.
+ ''.
''.(' ' x2).
- ''.&mt('Authoring').': '.
- ' | ';
+ $defaultquota.'" size="5" />';
}
$datatable .= '';
$typecount ++;
@@ -3726,6 +3725,39 @@ $jstext
ENDSCRIPT
}
+sub authordefaults_javascript {
+ my %alert = &Apache::lonlocal::texthash (
+ reqd => 'Warning: at least one editor needs to be available.',
+ rest => 'Unchecking this editor disallowed while others unchecked.',
+ );
+ &js_escape(\%alert);
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
@@ -5998,7 +6030,7 @@ sub print_coursedefaults {
my $itemcount = 1;
my %choices = &Apache::lonlocal::texthash (
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)',
@@ -6376,6 +6408,214 @@ sub print_coursedefaults {
return $datatable;
}
+sub print_authordefaults {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable,%checkedon,%checkedoff);
+ my $itemcount = 1;
+ my %titles = &authordefaults_titles();
+ if ($position eq 'top') {
+ my %defaultchecked = (
+ 'nocodemirror' => 'off',
+ 'domcoordacc' => 'on',
+ );
+ my @toggles = ('nocodemirror','domcoordacc');
+ ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%titles,$itemcount);
+ my %staticdefaults = (
+ 'copyright' => 'default',
+ 'sourceavail' => 'closed',
+ );
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my %currrights;
+ foreach my $item ('copyright','sourceavail') {
+ $currrights{$item} = $staticdefaults{$item};
+ if (ref($settings) eq 'HASH') {
+ if (exists($settings->{$item})) {
+ $currrights{$item} = $settings->{$item};
+ }
+ }
+ }
+ $datatable .= ''.
+ ''.$titles{'copyright'}.
+ ' | '.
+ &selectbox('copyright',$currrights{'copyright'},'',
+ \&Apache::loncommon::copyrightdescription,
+ (grep !/^priv|custom$/,(&Apache::loncommon::copyrightids))).
+ ' |
'."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$titles{'sourceavail'}.
+ ' | '.
+ &selectbox('sourceavail',$currrights{'sourceavail'},'',
+ \&Apache::loncommon::source_copyrightdescription,
+ (&Apache::loncommon::source_copyrightids)).
+ ' |
'."\n";
+ } else {
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ my $curreditors;
+ my %staticdefaults = (
+ editors => ['edit','xml'],
+ authorquota => 500,
+ webdav => 0,
+ );
+ my $curreditors = $staticdefaults{'editors'};
+ if ((ref($settings) eq 'HASH') &&
+ (ref($settings->{'editors'}) eq 'ARRAY')) {
+ $curreditors = $settings->{'editors'};
+ } else {
+ $curreditors = $staticdefaults{'editors'};
+ }
+ my @editors = ('edit','xml','daxe');
+ $datatable = ''."\n".
+ ''.$titles{'editors'}.' | '."\n".
+ ''."\n".
+ '';
+ foreach my $editor (@editors) {
+ my $checked;
+ if (grep(/^\Q$editor\E$/,@{$curreditors})) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= ''."\n".' | '."\n".'
'."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ my @insttypes;
+ if (ref($types) eq 'ARRAY') {
+ @insttypes = @{$types};
+ }
+ my $typecount = 0;
+ my %domconf = &Apache::lonnet::get_dom('configuration',['quotas'],$dom);
+ my @items = ('webdav','authorquota');
+ my %quotas;
+ if (ref($domconf{'quotas'}) eq 'HASH') {
+ %quotas = %{$domconf{'quotas'}};
+ foreach my $item (@items) {
+ if (ref($quotas{$item}) eq 'HASH') {
+ foreach my $type (@insttypes,'default') {
+ if ($item eq 'authorquota') {
+ if ($quotas{$item}{$type} !~ /^\d+$/) {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ } elsif ($item eq 'webdav') {
+ if ($quotas{$item}{$type} !~ /^(0|1)$/) {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ }
+ }
+ } else {
+ foreach my $type (@insttypes,'default') {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ }
+ }
+ } else {
+ foreach my $item (@items) {
+ foreach my $type (@insttypes,'default') {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ }
+ }
+ if (ref($usertypes) eq 'HASH') {
+ my $numinrow = 4;
+ my $onclick = '';
+ $datatable .= &insttypes_row(\%quotas,$types,$usertypes,$dom,
+ $numinrow,$othertitle,'authorquota',
+ \$itemcount,$onclick);
+ $itemcount ++;
+ $datatable .= &insttypes_row(\%quotas,$types,$usertypes,$dom,
+ $numinrow,$othertitle,'webdav',
+ \$itemcount);
+ $itemcount ++;
+ }
+ my $checkedno = ' checked="checked"';
+ my ($checkedon,$checkedoff);
+ if (ref($quotas{'webdav'}) eq 'HASH') {
+ if ($quotas{'webdav'}{'_LC_adv'} =~ /^0|1$/) {
+ if ($quotas{'webdav'}{'_LC_adv'}) {
+ $checkedon = $checkedno;
+ } else {
+ $checkedoff = $checkedno;
+ }
+ undef($checkedno);
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$titles{'webdav_LC_adv'}.' '.
+ $titles{'webdav_LC_adv_over'}.
+ ' | '.
+ '';
+ foreach my $option ('none','off','on') {
+ my ($text,$val,$checked);
+ if ($option eq 'none') {
+ $text = $titles{'none'};
+ $val = '';
+ $checked = $checkedno;
+ } elsif ($option eq 'off') {
+ $text = $titles{'overoff'};
+ $val = 0;
+ $checked = $checkedoff;
+ } elsif ($option eq 'on') {
+ $text = $titles{'overon'};
+ $val = 1;
+ $checked = $checkedon;
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= ' |
';
+ $itemcount ++;
+ }
+ $$rowtotal += $itemcount;
+ return $datatable;
+}
+
+sub authordefaults_titles {
+ return &Apache::lonlocal::texthash(
+ copyright => 'Copyright/Distribution',
+ sourceavail => ' Source Available',
+ editors => 'Available Editors',
+ webdav => 'WebDAV',
+ authorquota => 'Authoring Space quotas (MB)',
+ nocodemirror => 'Deactivate CodeMirror for EditXML editor',
+ domcoordacc => 'Dom. Coords. can enter Authoring Spaces in domain',
+ edit => 'Standard editor (Edit)',
+ xml => 'Text editor (EditXML)',
+ daxe => 'Daxe editor (Daxe)',
+ webdav_LC_adv => 'WebDAV access for LON-CAPA "advanced" users',
+ webdav_LC_adv_over => '(overrides access based on affiliation, if set)',
+ none => 'No override set',
+ overon => 'Override -- webDAV on',
+ overoff => 'Override -- webDAV off',
+ );
+}
+
+sub selectbox {
+ my ($name,$value,$readonly,$functionref,@idlist)=@_;
+ my $selout = '';
+ return $selout;
+}
+
sub print_selfenrollment {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable);
@@ -8253,7 +8493,6 @@ sub tool_titles {
my %titles = &Apache::lonlocal::texthash (
aboutme => 'Personal web page',
blog => 'Blog',
- webdav => 'WebDAV',
portfolio => 'Portfolio',
timezone => 'Can set time zone',
official => 'Official courses (with institutional codes)',
@@ -10602,15 +10841,19 @@ sub insttypes_row {
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context,$rowtotal,$onclick,
$customcss,$rowstyle) = @_;
my %lt = &Apache::lonlocal::texthash (
- cansearch => 'Users allowed to search',
+ cansearch => 'Users allowed to search',
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)',
- lockablenames => 'User preference to lock name',
- selfassign => 'Self-reportable affiliations',
- overrides => "Override domain's helpdesk settings based on requester's affiliation",
+ lockablenames => 'User preference to lock name',
+ selfassign => 'Self-reportable affiliations',
+ overrides => "Override domain's helpdesk settings based on requester's affiliation",
+ webdav => 'WebDAV access available',
+ authorquota => 'Authoring Space quota (MB)',
);
- my $showdom;
+ my ($showdom,$defaultquota);
if ($context eq 'cansearch') {
$showdom = ' ('.$dom.')';
+ } elsif ($context eq 'authorquota') {
+ $defaultquota = 500;
}
my $class = 'LC_left_item';
if ($context eq 'statustocreate') {
@@ -10647,25 +10890,44 @@ sub insttypes_row {
}
$output .= '';
}
- my $check = ' ';
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{$context}) eq 'ARRAY') {
- if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) {
- $check = ' checked="checked" ';
- }
- } elsif (ref($settings->{$context}) eq 'HASH') {
- if (ref($settings->{$context}->{$types->[$i]}) eq 'HASH') {
+ if ($context eq 'authorquota') {
+ my $currquota;
+ if ($settings->{$context}->{$types->[$i]} =~ /^\d+$/) {
+ $currquota = $settings->{$context}->{$types->[$i]};
+ } else {
+ $currquota = $defaultquota;
+ }
+ $output .= ''."\n".
+ ' | ';
+ } else {
+ my $check = ' ';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$context}) eq 'ARRAY') {
+ if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) {
+ $check = ' checked="checked" ';
+ }
+ } elsif (ref($settings->{$context}) eq 'HASH') {
+ if (ref($settings->{$context}->{$types->[$i]}) eq 'HASH') {
+ $check = ' checked="checked" ';
+ } elsif ($context eq 'webdav') {
+ if ($settings->{$context}->{$types->[$i]}) {
+ $check = ' checked="checked" ';
+ }
+ }
+ } elsif ($context eq 'statustocreate') {
$check = ' checked="checked" ';
}
- } elsif ($context eq 'statustocreate') {
- $check = ' checked="checked" ';
}
+ $output .= ''.
+ ' | ';
}
- $output .= ''.
- ' | ';
}
}
$rem = @{$types}%($numinrow);
@@ -10687,20 +10949,41 @@ sub insttypes_row {
} else {
$output .= '';
}
- my $defcheck = ' ';
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{$context}) eq 'ARRAY') {
- if (grep(/^default$/,@{$settings->{$context}})) {
+ if ($context eq 'authorquota') {
+ my $currquota = 500;
+ if ((ref($settings) eq 'HASH') && (ref($settings->{$context}) eq 'HASH')) {
+ if ($settings->{$context}{'default'} =~ /^\d+$/) {
+ $currquota = $settings->{$context}{'default'};
+ }
+ }
+ $output .= '';
+ } else {
+ my $defcheck = ' ';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$context}) eq 'ARRAY') {
+ if (grep(/^default$/,@{$settings->{$context}})) {
+ $defcheck = ' checked="checked" ';
+ }
+ } elsif (ref($settings->{$context}) eq 'HASH') {
+ if (ref($settings->{$context}->{'default'}) eq 'HASH') {
+ $defcheck = ' checked="checked" ';
+ } elsif ($context eq 'webdav') {
+ if ($settings->{$context}->{'default'}) {
+ $defcheck = ' checked="checked" ';
+ }
+ }
+ } elsif ($context eq 'statustocreate') {
$defcheck = ' checked="checked" ';
}
- } elsif ($context eq 'statustocreate') {
- $defcheck = ' checked="checked" ';
}
+ $output .= '';
}
- $output .= '';
}
$output .= ' |
';
return $output;
@@ -11714,6 +11997,239 @@ sub get_ipaccess_id {
return ($id,$error);
}
+sub modify_authordefaults {
+ my ($dom,$lastactref,%domconfig) = @_;
+#
+# Retrieve current domain configuration for webDAV and Authoring Space quotas from $domconfig{'quotas'}.
+#
+ my (%curr_quotas,%save_quotas,%confhash,%changes,%newvalues);
+ if (ref($domconfig{'quotas'}) eq 'HASH') {
+ foreach my $key (keys(%{$domconfig{'quotas'}})) {
+ if ($key =~ /^webdav|authorquota$/) {
+ $curr_quotas{$key} = $domconfig{'quotas'}{$key};
+ } else {
+ $save_quotas{$key} = $domconfig{'quotas'}{$key};
+ }
+ }
+ }
+ my %staticdefaults = (
+ 'copyright' => 'default',
+ 'sourceavail' => 'closed',
+ 'nocodemirror' => 'off',
+ 'domcoordacc' => 'on',
+ 'editors' => ['edit','xml'].
+ 'authorquota' => 500,
+ 'webdav' => 0,
+ );
+ my %titles = &authordefaults_titles();
+ foreach my $item ('nocodemirror','domcoordacc') {
+ if ($env{'form.'.$item} =~ /^(0|1)$/) {
+ $confhash{$item} = $env{'form.'.$item};
+ }
+ }
+ if ($env{'form.copyright'} =~ /^(default|domain|public)$/) {
+ $confhash{'copyright'} = $1;
+ }
+ if ($env{'form.sourceavail'} =~ /^(closed|open)$/) {
+ $confhash{'sourceavail'} = $1;
+ }
+ my @posseditors = &Apache::loncommon::get_env_multiple('form.author_editors');
+ my @okeditors = ('edit','xml','daxe');
+ my @editors;
+ foreach my $item (@posseditors) {
+ if (grep(/^\Q$item\E$/,@okeditors)) {
+ push(@editors,$item);
+ }
+ }
+ $confhash{'editors'} = \@editors;
+
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ my @insttypes;
+ if (ref($types) eq 'ARRAY') {
+ @insttypes = @{$types};
+ }
+ my @webdavon = &Apache::loncommon::get_env_multiple('form.webdav');
+ my %webdav;
+ map { $webdav{$_} = 1; } @webdavon;
+ foreach my $type (@insttypes,'default') {
+ my $possquota = $env{'form.authorquota_'.$type};
+ if ($possquota =~ /^\d+$/) {
+ $save_quotas{'authorquota'}{$type} = $possquota;
+ }
+ if ($webdav{$type}) {
+ $save_quotas{'webdav'}{$type} = 1;
+ } else {
+ $save_quotas{'webdav'}{$type} = 0;
+ }
+ }
+ if ($env{'form.webdav_LC_adv'} =~ /^(0|1)$/) {
+ $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};
+ }
+ if (ref($domconfig{'authordefaults'}) eq 'HASH') {
+ foreach my $item ('nocodemirror','domcoordacc','copyright','sourceavail') {
+ if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {
+ $changes{$item} = 1;
+ }
+ }
+ if (ref($domconfig{'authordefaults'}{'editors'}) eq 'ARRAY') {
+ my @diffs =
+ &Apache::loncommon::compare_arrays($confhash{'editors'},
+ $domconfig{'authordefaults'}{'editors'});
+ unless (@diffs == 0) {
+ $changes{'editors'} = 1;
+ }
+ } else {
+ my @diffs =
+ &Apache::loncommon::compare_arrays($confhash{'editors'},
+ $staticdefaults{'editors'});
+ unless (@diffs == 0) {
+ $changes{'editors'} = 1;
+ }
+ }
+ } else {
+ my @offon = ('off','on');
+ foreach my $item ('nocodemirror','domcoordacc') {
+ if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {
+ $changes{$item} = 1;
+ }
+ }
+ foreach my $item ('copyright','sourceavail') {
+ if ($confhash{$item} ne $staticdefaults{$item}) {
+ $changes{$item} = 1;
+ }
+ }
+ }
+ foreach my $key ('authorquota','webdav') {
+ if (ref($curr_quotas{$key}) eq 'HASH') {
+ foreach my $type (@insttypes,'default') {
+ if (exists($save_quotas{$key}{$type})) {
+ if ($save_quotas{$key}{$type} ne $curr_quotas{$key}{$type}) {
+ $changes{$key}{$type} = 1;
+ }
+ } elsif (exists($curr_quotas{$key}{$type})) {
+ $save_quotas{$key}{$type} = $curr_quotas{$key}{$type};
+ } else {
+ $save_quotas{$key}{$type} = $staticdefaults{$key};
+ }
+ }
+ } else {
+ foreach my $type (@insttypes,'default') {
+ if (exists($save_quotas{$key}{$type})) {
+ unless ($save_quotas{$key}{$type} eq $staticdefaults{$key}) {
+ $changes{$key}{$type} = 1;
+ }
+ } else {
+ $save_quotas{$key}{$type} = $staticdefaults{$key};
+ }
+ }
+ }
+ }
+ if (ref($curr_quotas{'webdav'}) eq 'HASH') {
+ if (exists($save_quotas{'webdav'}{'_LC_adv'})) {
+ if ($save_quotas{'webdav'}{'_LC_adv'} ne $curr_quotas{'webdav'}{'_LC_adv'}) {
+ $changes{'webdav_LC_adv'} = 1;
+ }
+ } elsif (exists($curr_quotas{'webdav'}{'_LC_adv'})) {
+ $changes{'webdav_LC_adv'} = 1;
+ }
+ } elsif (exists($save_quotas{'webdav'}{'_LC_adv'})) {
+ $changes{'webdav_LC_adv'} = 1;
+ }
+ my %confighash = (
+ quotas => \%save_quotas,
+ authordefaults => \%confhash,
+ );
+ my $putresult = &Apache::lonnet::put_dom('configuration',\%confighash,
+ $dom);
+ my $resulttext;
+ if ($putresult eq 'ok') {
+ if (keys(%changes)) {
+ my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
+ if ((exists($changes{'authorquota'})) || (exists($changes{'webdav'})) ||
+ ($changes{'webdav_LC_adv'})) {
+ if ((exists($changes{'authorquota'})) && (ref($save_quotas{'authorquota'}) eq 'HASH')) {
+ $domdefaults{'authorquota'} = $save_quotas{'authorquota'};
+ }
+ if (((exists($changes{'webdav'})) || ($changes{'webdav_LC_adv'})) &&
+ (ref($save_quotas{'webdav'}) eq 'HASH')) {
+ $domdefaults{'webdav'} = $save_quotas{'webdav'};
+ }
+ }
+ $resulttext = &mt('Changes made:').'';
+ my $authoroverride;
+ foreach my $key ('nocodemirror','domcoordacc','copyright','sourceavail') {
+ if (exists($changes{$key})) {
+ $domdefaults{$key} = $confhash{$key};
+ my $shown;
+ unless ($authoroverride) {
+ $resulttext .= '- '.&mt('Defaults which can be overridden by Author').'
';
+ $authoroverride = 1;
+ }
+ if (($key eq 'nocodemirror') || ($key eq 'domcoordacc')) {
+ $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
+ } elsif ($key eq 'copyright') {
+ $shown = &Apache::loncommon::copyrightdescription($confhash{$key});
+ } elsif ($key eq 'sourceavail') {
+ $shown = &Apache::loncommon::source_copyrightdescription($confhash{$key});
+ }
+ $resulttext .= '- '.&mt('[_1] set to: [_2]',$titles{$key},$shown).'
';
+ }
+ }
+ if ($authoroverride) {
+ $resulttext .= '
';
+ }
+ my $domcoordoverride;
+ foreach my $key ('editors','authorquota','webdav','webdav_LC_adv') {
+ if (exists($changes{$key})) {
+ my $shown;
+ unless ($domcoordoverride) {
+ $resulttext .= '- '.&mt('Defaults which can be overridden by a Domain Coodinator').'
';
+ $domcoordoverride = 1;
+ }
+ if ($key eq 'editors') {
+ if (ref($confhash{'editors'}) eq 'ARRAY') {
+ $domdefaults{'editors'} = join(',',@{$confhash{'editors'}});
+ if (@{$confhash{'editors'}}) {
+ $shown = join(', ', map { $titles{$_} } @{$confhash{'editors'}});
+ } else {
+ $shown = &mt('None');
+ }
+ }
+ } elsif ($key eq 'authorquota') {
+ foreach my $type (@insttypes) {
+ $shown .= $usertypes->{$type}.' -- '.$save_quotas{$key}{$type}.', ';
+ }
+ $shown .= $othertitle.' -- '.$save_quotas{$key}{'default'};
+ } elsif ($key eq 'webdav') {
+ foreach my $type (@insttypes) {
+ $shown .= $usertypes->{$type}.' -- '. ($save_quotas{$key}{$type} ? &mt('Yes') : &mt('No')).', ';
+ }
+ $shown .= $othertitle.' -- '. ($save_quotas{$key}{'default'} ? &mt('Yes') : &mt('No'));
+ } elsif ($key eq 'webdav_LC_adv') {
+ if (exists($save_quotas{'webdav'}{'_LC_adv'})) {
+ $shown = ($save_quotas{'webdav'}{'_LC_adv'} ? $titles{'overon'} : $titles{'overoff'});
+ } else {
+ $shown = $titles{'none'};
+ }
+ }
+ $resulttext .= '- '.&mt('[_1] set to: [_2]',$titles{$key},$shown).'
';
+ }
+ }
+ if ($domcoordoverride) {
+ $resulttext .= '
';
+ }
+ my $cachetime = 24*60*60;
+ &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
+ if (ref($lastactref) eq 'HASH') {
+ $lastactref->{'domdefaults'} = 1;
+ }
+ } else {
+ $resulttext = &mt('No changes made to Authoring Space defaults');
+ }
+ }
+ return $resulttext;
+}
+
sub modify_rolecolors {
my ($r,$dom,$confname,$roles,$lastactref,%domconfig) = @_;
my ($resulttext,%rolehash);
@@ -12267,7 +12783,7 @@ sub modify_quotas {
$author_ok,$switchserver,$errors,$validationitemsref,$validationnamesref,
$validationfieldsref);
if ($action eq 'quotas') {
- $context = 'tools';
+ $context = 'tools';
} else {
$context = $action;
}
@@ -12287,7 +12803,7 @@ sub modify_quotas {
@usertools = ('author');
%titles = &authorrequest_titles();
} else {
- @usertools = ('aboutme','blog','webdav','portfolio','timezone');
+ @usertools = ('aboutme','blog','portfolio','timezone');
%titles = &tool_titles();
}
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
@@ -12310,8 +12826,6 @@ sub modify_quotas {
} else {
if ($key =~ /^form\.quota_(.+)$/) {
$confhash{'defaultquota'}{$1} = $env{$key};
- } elsif ($key =~ /^form\.authorquota_(.+)$/) {
- $confhash{'authorquota'}{$1} = $env{$key};
} elsif ($key =~ /^form\.\Q$context\E_(.+)$/) {
@{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key);
}
@@ -12605,7 +13119,6 @@ sub modify_quotas {
}
} else {
$confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'};
- $confhash{'authorquota'}{'default'} = $env{'form.authorquota'};
}
foreach my $item (@usertools) {
foreach my $type (@{$types},'default','_LC_adv') {
@@ -12694,15 +13207,10 @@ sub modify_quotas {
}
}
if (ref($domconfig{'quotas'}{'authorquota'}) eq 'HASH') {
- foreach my $key (keys(%{$domconfig{'quotas'}{'authorquota'}})) {
- if (exists($confhash{'authorquota'}{$key})) {
- if ($confhash{'authorquota'}{$key} ne $domconfig{'quotas'}{'authorquota'}{$key}) {
- $changes{'authorquota'}{$key} = 1;
- }
- } else {
- $confhash{'authorquota'}{$key} = $domconfig{'quotas'}{'authorquota'}{$key};
- }
- }
+ $confhash{'authorquota'} = $domconfig{'quotas'}{'authorquota'};
+ }
+ if (ref($domconfig{'quotas'}{'webdav'}) eq 'HASH') {
+ $confhash{'webdav'} = $domconfig{'quotas'}{'webdav'};
}
}
if (ref($confhash{'defaultquota'}) eq 'HASH') {
@@ -12722,21 +13230,6 @@ sub modify_quotas {
}
}
}
- if (ref($confhash{'authorquota'}) eq 'HASH') {
- foreach my $key (keys(%{$confhash{'authorquota'}})) {
- if (ref($domconfig{'quotas'}) eq 'HASH') {
- if (ref($domconfig{'quotas'}{'authorquota'}) eq 'HASH') {
- if (!exists($domconfig{'quotas'}{'authorquota'}{$key})) {
- $changes{'authorquota'}{$key} = 1;
- }
- } else {
- $changes{'authorquota'}{$key} = 1;
- }
- } else {
- $changes{'authorquota'}{$key} = 1;
- }
- }
- }
}
if ($context eq 'requestauthor') {
@@ -12776,19 +13269,6 @@ sub modify_quotas {
}
}
$resulttext .= '
';
- }
- if (ref($changes{'authorquota'}) eq 'HASH') {
- $resulttext .= ''.&mt('Authoring Space default quotas').'';
- foreach my $type (@{$types},'default') {
- if (defined($changes{'authorquota'}{$type})) {
- my $typetitle = $usertypes->{$type};
- if ($type eq 'default') {
- $typetitle = $othertitle;
- }
- $resulttext .= '- '.&mt('[_1] set to [_2] MB',$typetitle,$confhash{'authorquota'}{$type}).'
';
- }
- }
- $resulttext .= '
';
}
}
my %newenv;