--- loncom/interface/lonparmset.pm 2005/06/18 14:39:24 1.228 +++ loncom/interface/lonparmset.pm 2005/11/22 19:02:40 1.268.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.228 2005/06/18 14:39:24 www Exp $ +# $Id: lonparmset.pm,v 1.268.2.1 2005/11/22 19:02:40 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -260,6 +260,20 @@ sub rulescache { return $rules{$id}; } +sub preset_defaults { + my $type=shift; + if (&rulescache($type.'_action') eq 'default') { +# yes, there is something + return (&rulescache($type.'_hours'), + &rulescache($type.'_min'), + &rulescache($type.'_sec'), + &rulescache($type.'_value')); + } else { +# nothing there or something else + return ('','','','',''); + } +} + ################################################## ################################################## # @@ -302,6 +316,8 @@ sub storeparm_by_symb { # store parameter &storeparm_by_symb_inner ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); +# don't do anything if parameter was reset + unless ($nval) { return; } my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); # remember that this was set $recstack{$parm}=1; @@ -510,12 +526,13 @@ sub plink { $winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; } } - - - return + my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); + my ($hour,$min,$sec,$val)=&preset_defaults($parmname); + unless (defined($winvalue)) { $winvalue=$val; } + return '
'. ''. - &valout($value,$type).''; + .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. + &valout($value,$type).'
'; } sub startpage { @@ -614,7 +631,10 @@ sub print_row { } else { $parm=~s|\[.*\]\s||g; } - + my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); + if ($automatic) { + $parm.='
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'
'; + } $r->print(''.$parm.''); my $thismarker=$which; @@ -886,12 +906,12 @@ ENDSCRIPT $r->print("\n"); my $cnt=0; foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { - $r->print("\n'); + $r->print('>'.$$allparms{$tempkey}.''); $cnt++; if ($cnt==3) { $r->print("\n"); @@ -900,16 +920,16 @@ ENDSCRIPT } $r->print(' '); $r->print('
print("\n
-Select All
-Select Common Only +Select All
+Select Common Only
-Add Problem Dates -Add Content Dates
-Add Discussion Settings -Add Visibilities
-Add Part Parameters +Add Problem Dates +Add Content Dates
+Add Discussion Settings +Add Visibilities
+Add Part Parameters
-Unselect All +Unselect All
'); @@ -923,7 +943,9 @@ sub partmenu { $r->print('>'.&mt('All Parts').''); my %temphash=(); foreach (@{$psprt}) { $temphash{$_}=1; } - foreach my $tempkey (sort keys %{$allparts}) { + foreach my $tempkey (sort { + if ($a==$b) { return ($a cmp $b) } else { return ($a <=> $b); } + } keys(%{$allparts})) { unless ($tempkey =~ /\./) { $r->print('