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

raeburn raeburn at source.lon-capa.org
Wed Apr 6 10:35:27 EDT 2022


raeburn		Wed Apr  6 14:35:27 2022 EDT

  Modified files:              
    /loncom/interface	courseprefs.pm 
  Log:
  - Bug 6907
   - Preserve existing settings when other changes are made to link protection
     configuration on course's homeserver.
   - Include a required hidden form element so changes can be made to link
     protection from a server that is not the course's homeserver.
   - Use appropriate upper bound to loop variable when looping over existing
     link protection items. 
  
  
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.110 loncom/interface/courseprefs.pm:1.111
--- loncom/interface/courseprefs.pm:1.110	Tue Apr  5 18:15:30 2022
+++ loncom/interface/courseprefs.pm	Wed Apr  6 14:35:27 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.110 2022/04/05 18:15:30 raeburn Exp $
+# $Id: courseprefs.pm,v 1.111 2022/04/06 14:35:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1548,7 +1548,7 @@
     if (ref($values) eq 'HASH') {
         my @todelete = &Apache::loncommon::get_env_multiple('form.linkprot_del');
         my $maxnum = $env{'form.linkprot_maxnum'};
-        for (my $i=0; $i<=$maxnum; $i++) {
+        for (my $i=0; $i<$maxnum; $i++) {
             my $itemid = $env{'form.linkprot_id_'.$i};
             $itemid =~ s/\D+//g;
             if ($itemid) {
@@ -1660,6 +1660,7 @@
                     }
                 } else {
                     $linkprot{$itemid}{'secret'} = $current{'secret'};
+                    $linkprot{$itemid}{'cipher'} = $current{'cipher'};
                 }
             } elsif ($env{$secretitem} ne '') {
                 if ($privnum && $cipher) {
@@ -5773,6 +5774,7 @@
                     } else {
                         $datatable .= '<span class="LC_nobreak">'.&mt('Secret required').' - '.$switchmessage.'</span>'."\n";
                     }
+                    $datatable .= '<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" />';
                 } else {
                     if ($values{'usable'} ne '') {
                         $datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'.




More information about the LON-CAPA-cvs mailing list