[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Mon Nov 24 23:32:13 EST 2014
raeburn Tue Nov 25 04:32:13 2014 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Course Editor
- When modifying randompick or randomorder for a single item - check if
setting was changed in &update_paameter(), and include contentchg flag
in call to storemap() if there was a change.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.587 loncom/interface/londocs.pm:1.588
--- loncom/interface/londocs.pm:1.587 Fri Oct 24 00:20:09 2014
+++ loncom/interface/londocs.pm Tue Nov 25 04:32:13 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.587 2014/10/24 00:20:09 raeburn Exp $
+# $Id: londocs.pm,v 1.588 2014/11/25 04:32:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2603,26 +2603,44 @@
}
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;
}
}
-
sub handle_edit_cmd {
my ($coursenum,$coursedom) =@_;
if ($env{'form.cmd'} eq '') {
@@ -2714,7 +2732,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