--- loncom/interface/lonhelper.pm 2006/07/17 16:26:09 1.157 +++ loncom/interface/lonhelper.pm 2006/12/12 20:41:08 1.159 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.157 2006/07/17 16:26:09 raeburn Exp $ +# $Id: lonhelper.pm,v 1.159 2006/12/12 20:41:08 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1023,6 +1023,91 @@ sub postprocess { } 1; +package Apache::lonhelper::helpicon; + +=pod + +=head1 Elements + +=head2 Element: helpiconX + +Helpicon elements add a help icon at the current location. +Example: + + + General Help + + +In this example will generate a help icon to the Help.hlp url with a +description of 'General Help'. The description is not required and if +left out (Example: only the icon will be +added.) + +=head3 Localization + +The description text will be run through the normalize_string function +and that will be used as a call to &mt. + +=cut + +no strict; +@ISA = ("Apache::lonhelper::element"); +use strict; +use Apache::lonlocal; + +BEGIN { + &Apache::lonhelper::register('Apache::lonhelper::helpicon', + ('helpicon')); +} + +sub new { + my $ref = Apache::lonhelper::element->new(); + bless($ref); +} + +# CONSTRUCTION: Construct the message element from the XML +sub start_helpicon { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + + if ($target ne 'helper') { + return ''; + } + + $paramHash->{HELP_TEXT} = &mtn(&Apache::lonxml::get_all_text('/helpicon', + $parser)); + + $paramHash->{HELP_TEXT} =~s/^\s+//; + $paramHash->{HELP_TEXT} =~s/\s+$//; + + if (defined($token->[2]{'file'})) { + $paramHash->{HELP_FILE} = $token->[2]{'file'}; + } + return ''; +} + +sub end_helpicon { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + + if ($target ne 'helper') { + return ''; + } + Apache::lonhelper::helpicon->new(); + return ''; +} + +sub render { + my $self = shift; + + my $text; + if ( $self->{HELP_TEXT} ne '') { + $text=&mtn($text); + } + + return &Apache::loncommon::help_open_topic($self->{HELP_FILE}, + $text); +} +1; + package Apache::lonhelper::skip; =pod @@ -2430,7 +2515,7 @@ sub render { # Current personel - $result .= '

Select Currently Enrolled Students and Active Course Personnel

'; + $result .= '

'.&mt('Select Currently Enrolled Students and Active Course Personnel').'

'; $result .= &Apache::lonselstudent::render_student_list( $current_members, "helpform", "current", @@ -2442,11 +2527,11 @@ sub render { # If activeonly is not set then we can also give the expired students: # - if (!$self->{'activeonly'} && ((scalar @$expired_members) > 0)) { + if (!$self->{'activeonly'} && ((scalar(@$future_members)) > 0)) { # And future. - $result .= '

Select Future Enrolled Students and Future Course Personnel

'; + $result .= '

'.&mt('Select Future Enrolled Students and Future Course Personnel').'

'; $result .= &Apache::lonselstudent::render_student_list( $future_members, "helpform", @@ -2455,9 +2540,11 @@ sub render { $self->{'multichoice'}, $self->{'variable'}, 0); + } + if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) { # Past - $result .= '

Select Previously Enrolled Students and Inactive Course Personnel

'; + $result .= '

'.&mt('Select Previously Enrolled Students and Inactive Course Personnel').'

'; $result .= &Apache::lonselstudent::render_student_list($expired_members, "helpform", "past",