--- loncom/interface/lonparmset.pm 2005/06/18 14:39:24 1.228
+++ loncom/interface/lonparmset.pm 2005/06/28 15:56:35 1.236
@@ -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.236 2005/06/28 15:56:35 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 ('','','','','');
+ }
+}
+
##################################################
##################################################
#
@@ -510,11 +524,12 @@ sub plink {
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]};
}
}
-
-
+ my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/);
+ my ($hour,$min,$sec,$val)=&preset_defaults($parmname);
+ unless (defined($winvalue)) { $winvalue=$val; }
return
''.
+ .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
&valout($value,$type).'';
}
@@ -614,7 +629,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 +904,12 @@ ENDSCRIPT
$r->print("\n');
@@ -923,7 +941,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('