--- loncom/interface/lonhelper.pm 2005/07/12 16:03:12 1.111
+++ loncom/interface/lonhelper.pm 2005/10/17 18:20:59 1.123
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.111 2005/07/12 16:03:12 albertel Exp $
+# $Id: lonhelper.pm,v 1.123 2005/10/17 18:20:59 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1188,7 +1188,8 @@ sub render {
if ($self->{'multichoice'}) {
$result .= <
SCRIPT
}
@@ -1436,7 +1438,7 @@ sub render {
$choiceLabel = eval($choiceLabel);
$choiceLabel = &$choiceLabel($helper, $self);
}
- $result .= ">" . &mtn($choiceLabel) . "\n";
+ $result .= ">" . &mtn($choiceLabel) . "\n";
}
$result .= "\n";
@@ -1534,6 +1536,7 @@ sub start_date {
$paramHash->{'variable'} = $token->[2]{'variable'};
$helper->declareVar($paramHash->{'variable'});
$paramHash->{'hoursminutes'} = $token->[2]{'hoursminutes'};
+ $paramHash->{'anytime'} = $token->[2]{'anytime'};
}
sub end_date {
@@ -1552,9 +1555,22 @@ sub render {
my $var = $self->{'variable'};
my $date;
-
+
+ my $time=time;
+ my ($anytime,$onclick);
+
+ if (defined($self->{DEFAULT_VALUE})) {
+ my $valueFunc = eval($self->{DEFAULT_VALUE});
+ die('Error in default value code for variable ' .
+ $self->{'variable'} . ', Perl said: ' . $@) if $@;
+ $time = &$valueFunc($helper, $self);
+ if (lc($time) eq 'anytime') { $time=time; $anytime=1; }
+ }
+ if ($anytime) {
+ $onclick = "onclick=\"javascript:updateCheck(this.form,'${var}anytime',false)\"";
+ }
# Default date: The current hour.
- $date = localtime();
+ $date = localtime($time);
$date->min(0);
if (defined $self->{ERROR_MSG}) {
@@ -1563,7 +1579,7 @@ sub render {
# Month
my $i;
- $result .= "