[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Sun Mar 22 16:37:06 EDT 2015


raeburn		Sun Mar 22 20:37:06 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	londocs.pm 
  Log:
  - For 2.11
    Backport all of 1.588 except one wording change. 
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.58 loncom/interface/londocs.pm:1.484.2.59
--- loncom/interface/londocs.pm:1.484.2.58	Wed Mar 11 01:59:25 2015
+++ loncom/interface/londocs.pm	Sun Mar 22 20:37:05 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.484.2.58 2015/03/11 01:59:25 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.59 2015/03/22 20:37:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2613,26 +2613,45 @@
         }
         return $haschanges;
     } else {
-        return 0 if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/);
+        my $haschanges = 0;
+        return $haschanges if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/);
 
         my $which = $env{'form.changeparms'};
         my $idx = $env{'form.setparms'};
+        my $oldvalue = 0;
+        my $newvalue = 0;
+        my $current = (&LONCAPA::map::getparameter($idx,'parameter_'.$which))[0];
+        if ($which eq 'randompick') {
+            if ($current =~ /^(\d+)$/) {
+                $oldvalue = $1;
+            }
+        } elsif ($current =~ /^yes$/i) {
+            $oldvalue = 1;
+        }
         if ($env{'form.'.$which.'_'.$idx}) {
-	    my $value = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx}
-	                                         : 'yes';
-	    &LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $value,
-				          $parameter_type{$which});
-	    &remember_parms($idx,$which,'set',$value);
-        } else {
-	    &LONCAPA::map::delparameter($idx,'parameter_'.$which);
-
-	    &remember_parms($idx,$which,'del');
+            $newvalue = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx}
+                                                 : 1;
         }
-        return 1;
+        if ($oldvalue ne $newvalue) {
+            $haschanges = 1;
+            if ($newvalue) {
+                my $storeval = 'yes';
+                if ($which eq 'randompick') {
+                    $storeval = $newvalue;
+                }
+                &LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $storeval,
+                                              $parameter_type{$which});
+                &remember_parms($idx,$which,'set',$storeval);
+            } else {
+                &LONCAPA::map::delparameter($idx,'parameter_'.$which);
+                &remember_parms($idx,$which,'del');
+            }
+        }
+        return $haschanges;
     }
+    return;
 }
 
-
 sub handle_edit_cmd {
     my ($coursenum,$coursedom) =@_;
     if ($env{'form.cmd'} eq '') {
@@ -2724,7 +2743,7 @@
 	&snapshotbefore();
 
 	if (&update_parameter()) {
-	    ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
+	    ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,1);
 	    return $errtext if ($fatal);
 	}
 




More information about the LON-CAPA-cvs mailing list