--- loncom/interface/lonhelper.pm 2005/10/17 21:14:55 1.126
+++ loncom/interface/lonhelper.pm 2006/03/02 23:56:55 1.131
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.126 2005/10/17 21:14:55 albertel Exp $
+# $Id: lonhelper.pm,v 1.131 2006/03/02 23:56:55 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -576,6 +576,7 @@ sub display {
my $html=&Apache::lonxml::xmlbegin();
my $stateTitle=&mt($state->title());
my $helperTitle = &mt($self->{TITLE});
+ my $browser_searcher_js = &Apache::loncommon::browser_and_searcher_javascript();
my $bodytag = &Apache::loncommon::bodytag($helperTitle,'','');
my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"');
my $next = HTML::Entities::encode(&mt("Next ->"), '<>&"');
@@ -586,6 +587,9 @@ sub display {
$html
$loncapaHelper: $helperTitle
+
$bodytag
HEADER
@@ -1557,6 +1561,8 @@ sub render {
my $date;
my $time=time;
+ $date = localtime($time);
+ $date->min(0);
my ($anytime,$onclick);
if (defined($self->{DEFAULT_VALUE})) {
@@ -1564,14 +1570,18 @@ sub render {
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 (lc($time) eq 'anytime') {
+ $anytime=1;
+ } else {
+ $date = localtime($time);
+ }
+ } else {
+
}
if ($anytime) {
$onclick = "onclick=\"javascript:updateCheck(this.form,'${var}anytime',false)\"";
}
# Default date: The current hour.
- $date = localtime($time);
- $date->min(0);
if (defined $self->{ERROR_MSG}) {
$result .= '' . $self->{ERROR_MSG} . '
';
@@ -2364,6 +2374,8 @@ SCRIPT
BUTTONS
+ $result .= $buttons;
+
}
if (defined $self->{ERROR_MSG}) {
@@ -2420,6 +2432,50 @@ BUTTONS
}
return $classlist->{$a}->[$fullname] cmp $classlist->{$b}->[$fullname];
} @keys;
+ #
+ # now add the fancy section choice... first enumerate the sections:
+ if ($self->{'multichoice'}) {
+ my %sections;
+ for my $key (@keys) {
+ my $section_name = $classlist->{$key}->[$section];
+ if ($section_name ne "") {
+ $sections{$section_name} = 1;
+ }
+ }
+ # The variable $choice_widget will have the html to make the choice
+ # selector.
+ my $size=5;
+ if (scalar(keys(%sections)) < 5) {
+ $size=scalar(keys(%sections));
+ }
+ my $choice_widget = '\n";
+
+ # Build a table without any borders to contain the section based
+ # selection:
+
+ my $section_selectors =<
+