version 1.484.2.58, 2015/03/11 01:59:25
|
version 1.484.2.59, 2015/03/22 20:37:05
|
Line 2613 sub update_parameter {
|
Line 2613 sub update_parameter {
|
} |
} |
return $haschanges; |
return $haschanges; |
} else { |
} 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 $which = $env{'form.changeparms'}; |
my $idx = $env{'form.setparms'}; |
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}) { |
if ($env{'form.'.$which.'_'.$idx}) { |
my $value = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx} |
$newvalue = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx} |
: 'yes'; |
: 1; |
&LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $value, |
} |
$parameter_type{$which}); |
if ($oldvalue ne $newvalue) { |
&remember_parms($idx,$which,'set',$value); |
$haschanges = 1; |
} else { |
if ($newvalue) { |
&LONCAPA::map::delparameter($idx,'parameter_'.$which); |
my $storeval = 'yes'; |
|
if ($which eq 'randompick') { |
&remember_parms($idx,$which,'del'); |
$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 1; |
return $haschanges; |
} |
} |
|
return; |
} |
} |
|
|
|
|
sub handle_edit_cmd { |
sub handle_edit_cmd { |
my ($coursenum,$coursedom) =@_; |
my ($coursenum,$coursedom) =@_; |
if ($env{'form.cmd'} eq '') { |
if ($env{'form.cmd'} eq '') { |
Line 2724 sub editor {
|
Line 2743 sub editor {
|
&snapshotbefore(); |
&snapshotbefore(); |
|
|
if (&update_parameter()) { |
if (&update_parameter()) { |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,1); |
return $errtext if ($fatal); |
return $errtext if ($fatal); |
} |
} |
|
|