--- loncom/interface/lonhtmlcommon.pm 2009/11/06 10:14:12 1.239 +++ loncom/interface/lonhtmlcommon.pm 2009/11/06 18:32:42 1.240 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.239 2009/11/06 10:14:12 amueller Exp $ +# $Id: lonhtmlcommon.pm,v 1.240 2009/11/06 18:32:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1815,25 +1815,22 @@ sub course_custom_roles { # topic_bar # -# Generates a div containing a numbered (static image) followed by a title -# with a background color defined in the corresponding CSS: LC_topic_bar -# +# Generates a div containing an (optional) numbered (static) image followed by a +# title with a background color defined in the corresponding CSS: LC_topic_bar +# Inputs: +# 1. number to display (corresponding static image should exist). +# img tag will be included if arg is an integer in the range 1 to 9. +# 2. title text to display. +# Outputs - a scalar containing html mark-up for the div. + sub topic_bar { - my ($imgnum,$title, $show_number) = @_; - my $output = undef; - if (!$show_number) { - $output = '
' - .''.&mt('Step [_1]',$imgnum).'' - .' '.$title - .'
'; - } else { - $output = '
' - .$title - .'
'; + my ($imgnum,$title) = @_; + my $imgtag; + if ($imgnum =~ /^[1-9]$/) { + $imgtag = ''.&mt('Step [_1]',$imgnum).' '; } - - return $output; + return '
'.$imgtag.$title.'
'; } ##############################################