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

raeburn raeburn at source.lon-capa.org
Wed May 1 11:18:58 EDT 2024


raeburn		Wed May  1 15:18:58 2024 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm loncreateuser.pm 
  Log:
  - Bug 6990: Ability to download tarball of Authoring Space's files/directories.
    Add option to domain's Authoring Space defaults, and capability to override
    for individual author(s).
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.439 loncom/interface/domainprefs.pm:1.440
--- loncom/interface/domainprefs.pm:1.439	Wed Apr 17 01:02:47 2024
+++ loncom/interface/domainprefs.pm	Wed May  1 15:18:58 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.439 2024/04/17 01:02:47 raeburn Exp $
+# $Id: domainprefs.pm,v 1.440 2024/05/01 15:18:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7523,6 +7523,15 @@
         }
         $datatable .= '</td></tr>';
         $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;
@@ -7546,6 +7555,7 @@
                none => 'No override set',
                overon => 'Override -- webDAV on',
                overoff => 'Override -- webDAV off',
+               archive => 'Authors can download tar.gz file of Authoring Space',
     );
 }
 
@@ -13428,9 +13438,10 @@
                            '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};
         }
@@ -13474,7 +13485,7 @@
         $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;
              }
@@ -13496,7 +13507,7 @@
         }
     } 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; 
             }
@@ -13593,7 +13604,7 @@
                 $resulttext .= '</ul></li>';
             }
             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) {
@@ -13625,6 +13636,8 @@
                         } else {
                             $shown = $titles{'none'};
                         }
+                    } elsif ($key eq 'archive') {
+                        $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
                     }
                     $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';
                 }
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.476 loncom/interface/loncreateuser.pm:1.477
--- loncom/interface/loncreateuser.pm:1.476	Thu Feb 29 16:28:35 2024
+++ loncom/interface/loncreateuser.pm	Wed May  1 15:18:58 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.476 2024/02/29 16:28:35 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.477 2024/05/01 15:18:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -285,6 +285,7 @@
                    'webdav'     => "WebDAV access to Authoring Spaces (https)",
                    'editors'    => "Available Editors",
                    'managers'   => "Co-authors who can add/revoke roles",
+                   'archive'    => "Managers can download tar.gz file of Authoring Space", 
                    'portfolio'  => "Personal User Portfolio",
                    'portaccess' => "Portfolio Shareable",
                    'timezone'   => "Can set Time Zone",
@@ -330,8 +331,8 @@
             &Apache::lonnet::get_dom('configuration',['quotas','authordefaults'],$ccdomain);
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,'tools.webdav',
                                                     'authoreditors','authormanagers',
-                                                    'domcoord.author');
-        @usertools = ('webdav','editors','managers');
+                                                    'authorarchive','domcoord.author');
+        @usertools = ('webdav','editors','managers','archive');
         $colspan = ' colspan="2"';
     } else {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
@@ -345,7 +346,7 @@
             $currdisp,$custdisp,$custradio,$onclick,$customsty,$editorsty);
         $cust_off = 'checked="checked" ';
         $tool_on = 'checked="checked" ';
-        unless (($context eq 'authordefaults') && ($item ne 'webdav')) {
+        unless (($context eq 'authordefaults') || ($item eq 'webdav')) {
             $curr_access =
                 &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item,undef,
                                                   $context,\%userenv,'',
@@ -357,7 +358,7 @@
                 $cust_off = '';
             }
         } elsif ($context eq 'authordefaults') {
-            if ($item eq 'editors') {
+            if (($item eq 'editors') || ($item eq 'archive')) {
                 if ($userenv{'author'.$item} ne '') {
                     $cust_on = ' checked="checked" ';
                     $cust_off = '';
@@ -3235,7 +3236,7 @@
     my @usertools = ('aboutme','blog','portfolio','portaccess','timezone');
     my @requestcourses = ('official','unofficial','community','textbook','placement','lti');
     my @requestauthor = ('requestauthor');
-    my @authordefaults = ('webdav','editors');
+    my @authordefaults = ('webdav','editors','archive');
     my ($othertitle,$usertypes,$types) = 
         &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
     my %canmodify_status =
@@ -3367,6 +3368,12 @@
                     $changed{'webdav'} = &tool_admin('webdav',$newcustom{'webdav'},
                                                   \%changeHash,'authordefaults');
                 }
+                if ($env{'for.customarchive'} == 1) {
+                    $newcustom{'archive'} = $env{'form.authordefaults_archive'};
+                    $changed{'archive'} = &tool_admin('archive',$newcustom{'archive'},
+                                                  \%changeHash,'authordefaults');
+
+                }
             }
             if ($canmodify_status{'inststatus'}) {
                 if (exists($env{'form.inststatus'})) {
@@ -3434,7 +3441,7 @@
              'id','permanentemail','portfolioquota','authorquota','inststatus',
              'tools.aboutme','tools.blog','tools.webdav',
              'tools.portfolio','tools.timezone','tools.portaccess',
-             'authormanagers','authoreditors','requestauthor',
+             'authormanagers','authoreditors','authorarchive','requestauthor',
              'requestcourses.official','requestcourses.unofficial',
              'requestcourses.community','requestcourses.textbook',
              'requestcourses.placement','requestcourses.lti',
@@ -4072,6 +4079,7 @@
          'chto'           => 'Changed To:',
          'editors'        => "Available Editors in Authoring Space",
          'managers'       => "Co-authors who can add/revoke roles",
+         'archive'        => "Managers can download tar.gz file of Authoring Space",
          'edit'           => 'Standard editor (Edit)',
          'xml'            => 'Text editor (EditXML)',
          'daxe'           => 'Daxe editor (Daxe)',
@@ -4105,7 +4113,7 @@
                     if ($entry eq 'requestauthor') {
                         @items = ($entry);
                     } elsif ($entry eq 'authordefaults') {
-                        @items = ('webdav','managers','editors');
+                        @items = ('webdav','managers','editors','archive');
                     } else {
                         @items = @{$requestcourses};
                     }
@@ -4356,6 +4364,9 @@
             } elsif ($tool eq 'webdav') {
                 $envkey = 'tools.webdav';
                 $newval = $env{'form.'.$context.'_'.$tool};
+            } elsif ($tool eq 'archive') {
+                $envkey = 'authorarchive';
+                $newval = $env{'form.'.$context.'_'.$tool};
             }
         } else {
             $newval = $env{'form.'.$context.'_'.$tool};
@@ -4387,7 +4398,7 @@
                 } elsif ($tool eq 'editors') {
                     $oldaccesstext->{$tool} = &mt('can use: [_1]',
                                                   join(', ', map { $tooldesc{$_} } split(/,/,$userenv->{$envkey})));
-                } elsif ($tool eq 'webdav') {
+                } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                     if ($userenv->{$envkey}) {
                         $oldaccesstext->{$tool} = &mt("availability set to 'on'");
                     } else {
@@ -4433,7 +4444,7 @@
                                     $managers =~ s/,/, /g;
                                     $newaccesstext->{$tool} = $managers;
                                 }
-                            } elsif ($tool eq 'webdav') {
+                            } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                                 if ($newval) {
                                     $newaccesstext->{$tool} = &mt("availability set to 'on'");
                                 } else {
@@ -4473,7 +4484,7 @@
                                     $managers =~ s/,/, /g;
                                     $newaccesstext->{$tool} = $managers;
                                 }
-                            } elsif ($tool eq 'webdav') {
+                            } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                                 if ($userenv->{$envkey}) {
                                     $newaccesstext->{$tool} = &mt("availability set to 'on'");
                                 } else {
@@ -4522,7 +4533,7 @@
                                 $managers =~ s/,/, /g;
                                 $newaccesstext->{$tool} = $managers;
                             }
-                        } elsif ($tool eq 'webdav') {
+                        } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                             if ($userenv->{$envkey}) {
                                 $newaccesstext->{$tool} = &mt("availability set to 'on'");
                             } else {
@@ -4570,7 +4581,7 @@
                         } elsif ($tool eq 'editors') {
                             $newaccesstext->{$tool} = &mt('can use: [_1]',
                                                           join(', ', map { $tooldesc{$_} } split(/,/,$newval)));
-                        } elsif ($tool eq 'webdav') {
+                        } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                             if ($newval) {
                                 $newaccesstext->{$tool} = &mt("availability set to 'on'");
                             } else {
@@ -5234,7 +5245,7 @@
             $toolchanged = 1;
             if ($tool eq 'requestauthor') {
                 $changeHash->{$context} = $settool;
-            } elsif (($tool eq 'managers') || ($tool eq 'editors')) {
+            } elsif (($tool eq 'managers') || ($tool eq 'editors') || ($tool eq 'archive')) {
                 $changeHash->{'author'.$tool} = $settool;
             } elsif ($tool eq 'webdav') {
                 $changeHash->{'tools.'.$tool} = $settool;


More information about the LON-CAPA-cvs mailing list