Diff for /loncom/interface/lonhelper.pm between versions 1.158 and 1.159

version 1.158, 2006/08/01 15:12:32 version 1.159, 2006/12/12 20:41:08
Line 1023  sub postprocess { Line 1023  sub postprocess {
 }  }
 1;  1;
   
   package Apache::lonhelper::helpicon;
   
   =pod
   
   =head1 Elements
   
   =head2 Element: helpiconX<helpicon, helper element>
   
   Helpicon elements add a help icon at the current location.
   Example:
   
      <helpicon file="Help">
        General Help
      </helpicon>
   
   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: <helpicon file="Help" /> 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;  package Apache::lonhelper::skip;
   
 =pod  =pod

Removed from v.1.158  
changed lines
  Added in v.1.159


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>