--- loncom/interface/lonhelper.pm 2005/11/22 12:49:50 1.128 +++ 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.128 2005/11/22 12:49:50 raeburn 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 <head> <title>$loncapaHelper: $helperTitle</title> + <script type="text/javascript"> +$browser_searcher_js + </script> </head> $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 .= '<font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />'; @@ -2364,6 +2374,8 @@ SCRIPT </table> <br /> 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 = '<select multiple name="chosensections" size="'.$size.'">'."\n"; + foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) { + $choice_widget .= "<option name=\"$sec\">$sec</option>\n"; + } + $choice_widget .= "<option>none</option></select>\n"; + + # Build a table without any borders to contain the section based + # selection: + + my $section_selectors =<<SECTIONSELECT; +<table border="0"> + <tr valign="top"> + <td>For Sections:</td><td>$choice_widget</td> + <td><label><input type="radio" name="personstate" value="Active" checked /> + Current Students</label></td> + <td><label><input type="radio" name="personstate" value="All" /> + All students</label></td> + <td><label><input type="radio" name="personstate" value="Expired" /> + Expired Students</label></td> + </tr> + <tr> + <td><input type="button" value="Select" onclick="checksections(true);" /></td> + <td><input type="button" value="Unselect" onclick="checksections(false);" /></td></tr> +</table> +<br /> +SECTIONSELECT + $result .= $section_selectors; + } # username, fullname, section, type for (@keys) { @@ -2476,51 +2532,8 @@ BUTTONS } $result .= "</table>\n\n"; - $result .= $buttons; - # - # 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 = '<select multiple name="chosensections" size="'.$size.'">'."\n"; - foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) { - $choice_widget .= "<option name=\"$sec\">$sec</option>\n"; - } - $choice_widget .= "<option>none</option></select>\n"; - # Build a table without any borders to contain the section based - # selection: - my $section_selectors =<<SECTIONSELECT; -<table border="0"> - <tr valign="top"> - <td>For Sections:</td><td>$choice_widget</td> - <td><label><input type="radio" name="personstate" value="Active" checked /> - Current Students</label></td> - <td><label><input type="radio" name="personstate" value="All" /> - All students</label></td> - <td><label><input type="radio" name="personstate" value="Expired" /> - Expired Students</label></td> - </tr> - <tr> - <td><input type="button" value="Select" onclick="checksections(true);" /></td> - <td><input type="button" value="Unselect" onclick="checksections(false);" /></td></tr> -</table> -<br /> -SECTIONSELECT - $result .= $section_selectors; - } return $result; }