--- loncom/interface/lonparmset.pm 2008/10/10 15:29:17 1.412 +++ loncom/interface/lonparmset.pm 2008/10/23 14:26:17 1.413 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.412 2008/10/10 15:29:17 bisitz Exp $ +# $Id: lonparmset.pm,v 1.413 2008/10/23 14:26:17 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -325,14 +325,31 @@ sub date_sanity_info { my $crsprefix='course.'.$env{'request.course.id'}.'.'; if ($env{$crsprefix.'default_enrollment_end_date'}) { if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) { - $result.='
'.&mt('After course enrollment end!'); + $result.='
' + .&mt('After course enrollment end!') + .'
'; } } if ($env{$crsprefix.'default_enrollment_start_date'}) { if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) { - $result.='
'.&mt('Before course enrollment start!'); + $result.='
' + .&mt('Before course enrollment start!') + .'
'; } } +# Preparation for additional warnings about dates in the past/future. +# An improved, more context sensitive version is recommended, +# e.g. warn for due and answer dates which are defined before the corresponding open date, etc. +# if ($checkdate'; +# } +# if ($checkdate>time) { +# $result.='
' +# .'('.&mt('in the future').')' +# .'
'; +# } return $result; } ################################################## @@ -551,27 +568,38 @@ sub valout { } else { if ($type eq 'date_interval') { my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); + my @timer; $year=$year-70; $mday--; if ($year) { - $result.=$year.' yrs '; +# $result.=&mt('[quant,_1,yr]',$year).' '; + push(@timer,&mt('[quant,_1,yr]',$year)); } if ($mon) { - $result.=$mon.' mths '; +# $result.=&mt('[quant,_1,mth]',$mon).' '; + push(@timer,&mt('[quant,_1,mth]',$mon)); } if ($mday) { - $result.=$mday.' days '; +# $result.=&mt('[quant,_1,day]',$mday).' '; + push(@timer,&mt('[quant,_1,day]',$mday)); } if ($hour) { - $result.=$hour.' hrs '; +# $result.=&mt('[quant,_1,hr]',$hour).' '; + push(@timer,&mt('[quant,_1,hr]',$hour)); } if ($min) { - $result.=$min.' mins '; +# $result.=&mt('[quant,_1,min]',$min).' '; + push(@timer,&mt('[quant,_1,min]',$min)); } if ($sec) { - $result.=$sec.' secs '; +# $result.=&mt('[quant,_1,sec]',$sec).' '; + push(@timer,&mt('[quant,_1,sec]',$sec)); } - $result=~s/\s+$//; +# $result=~s/\s+$//; + if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead of empty field to keep this field editable + push(@timer,&mt('[quant,_1,sec]',0)); + } + $result.=join(", ",@timer); } elsif (&isdateparm($type)) { $result = &Apache::lonlocal::locallocaltime($value). &date_sanity_info($value); @@ -2950,8 +2978,8 @@ sub listdata { $$resourcedata{$thiskey}, '',1,'',''). ''. -(($$resourcedata{$thiskey}!=0)?''. -&mt('Shift all dates based on this date').'':''). +(($$resourcedata{$thiskey}!=0)?''. +&mt('Shift all dates based on this date').'':''). &date_sanity_info($$resourcedata{$thiskey}) ); } elsif ($thistype eq 'date_interval') {