--- loncom/interface/loncommon.pm 2002/07/22 14:25:40 1.47 +++ loncom/interface/loncommon.pm 2002/08/01 16:48:21 1.48 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.47 2002/07/22 14:25:40 bowersj2 Exp $ +# $Id: loncommon.pm,v 1.48 2002/08/01 16:48:21 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -439,10 +439,12 @@ END =pod -=item help_open_topic($topic, $stayOnPage, $width, $height) +=item help_open_topic($topic, $text, $stayOnPage, $width, $height) Returns a string corresponding to an HTML link to the given help $topic, where $topic corresponds to the name of a .tex file in /home/httpd/html/adm/help/tex, with underscores replaced by spaces. +$text will optionally be linked to the same topic, allowing you to link text in addition to the graphic. If you do not want to link text, but wish to specify one of the later parameters, pass an empty string. + $stayOnPage is a value that will be interpreted as a boolean. If true, the link will not open a new window. If false, the link will open a new window using Javascript. (Default is false.) $width and $height are optional numerical parameters that will override the width and height of the popped up window, which may be useful for certain help topics with big pictures included. @@ -450,33 +452,37 @@ $width and $height are optional numerica =cut sub help_open_topic { - my ($topic, $stayOnPage, $width, $height) = @_; + my ($topic, $text, $stayOnPage, $width, $height) = @_; + $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); $width = 350 if (not defined $width); $height = 400 if (not defined $height); my $filename = $topic; $filename =~ s/ /_/g; - my $template; + my $template = ""; + my $link; if (!$stayOnPage) { - $template = <<"ENDTEMPLATE"; -(Help: $topic) -ENDTEMPLATE + $link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height'))"; } else { - $template = <<"ENDTEMPLATE"; -(Help: $topic) -ENDTEMPLATE + $link = "/adm/help/${filename}.hlp"; + } + + # Add the text + if ($text ne "") + { + $template .= "$text "; } + # Add the graphic + $template .= <<"ENDTEMPLATE"; +(Help: $topic) +ENDTEMPLATE + return $template; }