[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm loncoursegroups.pm lonmodifycourse.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sat Jul 29 16:33:26 EDT 2023


raeburn		Sat Jul 29 20:33:26 2023 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm lonmodifycourse.pm 
                     	loncoursegroups.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Domain configuration for default cumulative quota for all group portfolio 
    spaces in course can be overridden for a specific course by a Domain 
    Coordinator.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.427 loncom/interface/domainprefs.pm:1.428
--- loncom/interface/domainprefs.pm:1.427	Tue Jun 20 14:03:52 2023
+++ loncom/interface/domainprefs.pm	Sat Jul 29 20:33:25 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.427 2023/06/20 14:03:52 raeburn Exp $
+# $Id: domainprefs.pm,v 1.428 2023/07/29 20:33:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6789,6 +6789,7 @@
     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',
         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)',
@@ -6805,6 +6806,7 @@
     my %staticdefaults = (
                            anonsurvey_threshold => 10,
                            uploadquota          => 500,
+                           coursequota          => 20,
                            postsubmit           => 60,
                            mysqltables          => 172800,
                            domexttool           => 1,
@@ -6922,7 +6924,8 @@
         $itemcount ++;
     } else {
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
-        my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql);
+        my ($currdefresponder,%defcredits,%curruploadquota,%currcoursequota,
+            %deftimeout,%currmysql);
         my $currusecredits = 0;
         my $postsubmitclient = 1;
         my $ltiauth = 0;
@@ -6959,6 +6962,11 @@
                     $curruploadquota{$type} = $settings->{'uploadquota'}{$type};
                 }
             }
+            if (ref($settings->{'coursequota'}) eq 'HASH') {
+                foreach my $type (keys(%{$settings->{'coursequota'}})) {
+                    $currcoursequota{$type} = $settings->{'coursequota'}{$type};
+                }
+            }
             if (ref($settings->{'coursecredits'}) eq 'HASH') {
                 foreach my $type (@types) {
                     next if ($type eq 'community');
@@ -7018,6 +7026,9 @@
             if ($curruploadquota{$type} eq '') {
                 $curruploadquota{$type} = $staticdefaults{'uploadquota'};
             }
+            if ($currcoursequota{$type} eq '') {
+                $currcoursequota{$type} = $staticdefaults{'coursequota'};
+            }
         }
         $datatable .=
                 '<tr'.$css_class.'><td><span class="LC_nobreak">'.
@@ -7041,6 +7052,19 @@
         }
         $datatable .= '</tr></table></td></tr>'."\n";
         $itemcount ++;
+        $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+        $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
+                      $choices{'coursequota'}.
+                      '</span></td>'.
+                      '<td style="text-align: right" class="LC_right_item">'.
+                      '<table><tr>';
+        foreach my $type (@types) {
+            $datatable .= '<td style="text-align: center">'.&mt($type).'<br />'.
+                           '<input type="text" name="coursequota_'.$type.'"'.
+                           ' value="'.$currcoursequota{$type}.'" size="5" /></td>';
+        }
+        $datatable .= '</tr></table></td></tr>'."\n";
+        $itemcount ++;
         my $onclick = "toggleDisplay(this.form,'credits');";
         my $display = 'none';
         if ($currusecredits) {
@@ -20491,12 +20515,15 @@
     my @toggles = ('canuse_pdfforms','uselcmath','usejsme','inline_chem','ltiauth');
     my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
                    'uploadquota_community','uploadquota_textbook','uploadquota_placement',
-                   'mysqltables_official','mysqltables_unofficial','mysqltables_community',
-                   'mysqltables_textbook','mysqltables_placement');
+                   'coursequota_official','coursequota_unofficial','coursequota_community',
+                   'coursequota_textbook','coursequota_placement','mysqltables_official',
+                   'mysqltables_unofficial','mysqltables_community','mysqltables_textbook',
+                   'mysqltables_placement');
     my @types = ('official','unofficial','community','textbook','placement');
     my %staticdefaults = (
                            anonsurvey_threshold => 10,
                            uploadquota          => 500,
+                           coursequota          => 20,
                            postsubmit           => 60,
                            mysqltables          => 172800,
                            domexttool           => 1,
@@ -20544,7 +20571,7 @@
                 }
                 $defaultshash{'coursedefaults'}{$item} = $newdef;
             } else {
-                my ($setting,$type) = ($item =~ /^(uploadquota|mysqltables)_(\w+)$/);
+                my ($setting,$type) = ($item =~ /^(uploadquota|coursequota|mysqltables)_(\w+)$/);
                 if (ref($domconfig{'coursedefaults'}{$setting}) eq 'HASH') {
                     $currdef = $domconfig{'coursedefaults'}{$setting}{$type};
                 }
@@ -20556,7 +20583,7 @@
                     unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) {
                         $changes{$item} = 1;
                     }
-                } elsif ($item =~ /^(uploadquota|mysqltables)_/) {
+                } elsif ($item =~ /^(uploadquota|coursequota|mysqltables)_/) {
                     my $setting = $1;
                     unless (($currdef eq '') && ($newdef == $staticdefaults{$setting})) {
                         $changes{$setting} = 1;
@@ -20742,7 +20769,7 @@
                 ($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||
                 ($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'}) ||
                 ($changes{'inline_chem'}) || ($changes{'ltiauth'}) || ($changes{'domexttool'}) ||
-                ($changes{'exttool'}) ) {
+                ($changes{'exttool'}) || ($changes{'coursequota'})) {
                 foreach my $item ('canuse_pdfforms','uselcmath','usejsme','inline_chem','texengine',
                                   'ltiauth') {
                     if ($changes{$item}) {
@@ -20775,6 +20802,13 @@
                         }
                     }
                 }
+                if ($changes{'coursequota'}) {
+                    if (ref($defaultshash{'coursedefaults'}{'coursequota'}) eq 'HASH') {
+                        foreach my $type (@types) {
+                            $domdefaults{$type.'coursequota'}=$defaultshash{'coursedefaults'}{'coursequota'}{$type};
+                        }
+                    }
+                }
                 if ($changes{'canclone'}) {
                     if (ref($defaultshash{'coursedefaults'}{'canclone'}) eq 'HASH') {
                         if (ref($defaultshash{'coursedefaults'}{'canclone'}{'instcode'}) eq 'ARRAY') {
@@ -20853,6 +20887,19 @@
                     } else {
                         $resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>';
                     }
+                } elsif ($item eq 'coursequota') {
+                    if (ref($defaultshash{'coursedefaults'}{'coursequota'}) eq 'HASH') {
+                        $resulttext .= '<li>'.&mt('Default cumulative quota for all group portfolio spaces in course set as follows:').'<ul>'.
+                                       '<li>'.&mt('Official courses: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'coursequota'}{'official'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Unofficial courses: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'coursequota'}{'unofficial'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Textbook courses: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'coursequota'}{'textbook'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Placement tests: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'coursequota'}{'placement'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Communities: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'coursequota'}{'community'}.'</b>').'</li>'.
+                                       '</ul>'.
+                                       '</li>';
+                    } else {
+                        $resulttext .= '<li>'.&mt('Default cumulative quota for all group portfolio spaces in course remains default: [_1] MB',$staticdefaults{'coursequota'}).'</li>';
+                    }
                 } elsif ($item eq 'mysqltables') {
                     if (ref($defaultshash{'coursedefaults'}{'mysqltables'}) eq 'HASH') {
                         $resulttext .= '<li>'.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver').'<ul>'.
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.100 loncom/interface/lonmodifycourse.pm:1.101
--- loncom/interface/lonmodifycourse.pm:1.100	Mon Jun  5 02:22:29 2023
+++ loncom/interface/lonmodifycourse.pm	Sat Jul 29 20:33:25 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # handler for DC-only modifiable course settings
 #
-# $Id: lonmodifycourse.pm,v 1.100 2023/06/05 02:22:29 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.101 2023/07/29 20:33:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -795,15 +795,20 @@
                                         $cdom,$cnum);
     my $coursequota = $settings{'internal.coursequota'};
     my $uploadquota = $settings{'internal.uploadquota'};
-    if ($coursequota eq '') {
-        $coursequota = $staticdefaults{'coursequota'};
-    }
-    if ($uploadquota eq '') {
+    if (($uploadquota eq '') || ($coursequota eq '')) {
         my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
         my $quotatype = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$type,\%settings);
-        $uploadquota = $domdefs{$quotatype.'quota'};
         if ($uploadquota eq '') {
-            $uploadquota = $staticdefaults{'uploadquota'};
+            $uploadquota = $domdefs{$quotatype.'quota'};
+            if ($uploadquota eq '') {
+                $uploadquota = $staticdefaults{'uploadquota'};
+            }
+        }
+        if ($coursequota eq '') {
+            $coursequota = $domdefs{$quotatype.'coursequota'};
+            if ($coursequota eq '') {
+                $coursequota = $staticdefaults{'coursequota'};
+            }
         }
     }
     &print_header($r,$type);
@@ -2732,9 +2737,10 @@
         $js .= <<"ENDSCRIPT";
 
 function verify_quota() {
-    var newquota = document.setquota.coursequota.value; 
+    var newcoursequota = document.setquota.coursequota.value;
+    var newuploadquota = document.setquota.uploadquota.value;
     var num_reg = $regexp;
-    if (num_reg.test(newquota)) {
+    if ((num_reg.test(newcoursequota)) && (num_reg.test(newuploadquota))) {
         changePage(document.setquota,'processquota');
     } else {
         alert("$invalid\\n$alert");
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.131 loncom/interface/loncoursegroups.pm:1.132
--- loncom/interface/loncoursegroups.pm:1.131	Tue Sep  8 23:54:40 2020
+++ loncom/interface/loncoursegroups.pm	Sat Jul 29 20:33:25 2023
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.131 2020/09/08 23:54:40 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.132 2023/07/29 20:33:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,6 +36,7 @@
 use Apache::lonnavmaps();
 use Apache::longroup();
 use Apache::portfolio();
+use Apache::lonuserutils();
 use Apache::Constants qw(:common :http);
 use HTML::Entities;
 use LONCAPA::map();
@@ -1818,7 +1819,24 @@
     my ($crsquota,$freespace,$maxposs); 
     $crsquota = $env{'course.'.$env{'request.course.id'}.'.internal.coursequota'};
     if ($crsquota eq '') {
-        $crsquota = 20;
+        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        my $crstype = &Apache::loncommon::course_type();
+        my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
+        my %coursehash = (
+            'internal.coursecode' => $env{'course.'.$env{'request.course.id'}.'.internal.coursecode'},
+            'internal.textbook'   => $env{'course.'.$env{'request.course.id'}.'.internal.textbook'},
+        );
+        my %staticdefaults = (
+                           coursequota   => 20,
+        );
+        my $quotatype = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$crstype,\%coursehash);
+        if ($crsquota eq '') {
+            $crsquota = $domdefs{$quotatype.'coursequota'};
+            if ($crsquota eq '') {
+                $crsquota = $staticdefaults{'coursequota'};
+            }
+        }
     }
     $freespace = $crsquota - &Apache::longroup::sum_quotas();
     if ($action eq 'create') {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1513 loncom/lonnet/perl/lonnet.pm:1.1514
--- loncom/lonnet/perl/lonnet.pm:1.1513	Thu Jul 20 12:47:09 2023
+++ loncom/lonnet/perl/lonnet.pm	Sat Jul 29 20:33:26 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1513 2023/07/20 12:47:09 raeburn Exp $
+# $Id: lonnet.pm,v 1.1514 2023/07/29 20:33:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2823,6 +2823,9 @@
             if (ref($domconfig{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
                 $domdefaults{$type.'quota'} = $domconfig{'coursedefaults'}{'uploadquota'}{$type};
             }
+            if (ref($domconfig{'coursedefaults'}{'coursequota'}) eq 'HASH') {
+                $domdefaults{$type.'coursequota'} = $domconfig{'coursedefaults'}{'coursequota'}{$type};
+            }
             if ($domdefaults{'postsubmit'} eq 'on') {
                 if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') {
                     $domdefaults{$type.'postsubtimeout'} = 


More information about the LON-CAPA-cvs mailing list