--- loncom/interface/loncommon.pm 2002/07/03 21:12:38 1.43 +++ loncom/interface/loncommon.pm 2002/07/05 16:12:31 1.44 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.43 2002/07/03 21:12:38 ng Exp $ +# $Id: loncommon.pm,v 1.44 2002/07/05 16:12:31 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -428,6 +428,49 @@ END ############################################################### + +=item help_open_topic($topic, $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. + +$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. + +=cut + +sub help_open_topic { + my ($topic, $stayOnPage, $width, $height) = @_; + $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; + + if (!$stayOnPage) + { + $template = <<"ENDTEMPLATE"; +(Help: $topic) +ENDTEMPLATE + } + else + { + $template = <<"ENDTEMPLATE"; +(Help: $topic) +ENDTEMPLATE + } + + return $template; + +} + =item csv_translate($text) Translate $text to allow it to be output as a 'comma seperated values'