[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Tue Nov 7 06:50:56 EST 2023


raeburn		Tue Nov  7 11:50:56 2023 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Update domdefaults in memcache if authordefaults changes in domain config
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.430 loncom/interface/domainprefs.pm:1.431
--- loncom/interface/domainprefs.pm:1.430	Fri Nov  3 01:12:15 2023
+++ loncom/interface/domainprefs.pm	Tue Nov  7 11:50:56 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.430 2023/11/03 01:12:15 raeburn Exp $
+# $Id: domainprefs.pm,v 1.431 2023/11/07 11:50:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -13392,9 +13392,9 @@
     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'})) { 
-                my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
                 if ((exists($changes{'authorquota'})) && (ref($save_quotas{'authorquota'}) eq 'HASH')) {
                     $domdefaults{'authorquota'} = $save_quotas{'authorquota'};
                 }
@@ -13402,16 +13402,12 @@
                     (ref($save_quotas{'webdav'}) eq 'HASH')) {
                     $domdefaults{'webdav'} = $save_quotas{'webdav'};
                 }
-                my $cachetime = 24*60*60;
-                &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
-                if (ref($lastactref) eq 'HASH') {
-                    $lastactref->{'domdefaults'} = 1;
-                }
             }
             $resulttext = &mt('Changes made:').'<ul>';
             my $authoroverride;
             foreach my $key ('nocodemirror','domcoordacc','copyright','sourceavail') {
                 if (exists($changes{$key})) {
+                    $domdefaults{$key} = $confhash{$key};
                     my $shown;
                     unless ($authoroverride) {
                         $resulttext .= '<li>'.&mt('Defaults which can be overridden by Author').'<ul>';
@@ -13439,10 +13435,13 @@
                         $domcoordoverride = 1;
                     }
                     if ($key eq 'editors') {
-                        if (@{$confhash{'editors'}}) {
-                            $shown = join(', ', map { $titles{$_} } @{$confhash{'editors'}});
-                        } else {
-                            $shown = &mt('None');
+                        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) {
@@ -13467,6 +13466,11 @@
             if ($domcoordoverride) {
                 $resulttext .= '</ul></li>';
             }
+            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');
         }




More information about the LON-CAPA-cvs mailing list