--- loncom/interface/lonhtmlcommon.pm 2009/11/10 13:58:55 1.242 +++ loncom/interface/lonhtmlcommon.pm 2009/11/25 13:25:44 1.250 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.242 2009/11/10 13:58:55 droeschl Exp $ +# $Id: lonhtmlcommon.pm,v 1.250 2009/11/25 13:25:44 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,6 +62,16 @@ use Apache::lonlocal; use Apache::lonnet; use LONCAPA; + +sub coursepreflink { + my ($text,$category)=@_; + if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { + return ''.$text.''; + } else { + return ''; + } +} + ############################################## ############################################## @@ -111,7 +121,7 @@ sub dragmath_button { } my $buttontext=&mt('Edit Math'); return <$help_text + $help_text ENDDRAGMATH } @@ -1128,7 +1138,7 @@ sub crumbs { my $output=''; unless ($noformat) { $output.='
'; } $output.=''.$prefix.'/'; - if (($env{'user.adv'}) | ($env{'user.author'})) { + if (($env{'user.adv'}) || ($env{'user.author'})) { my $path=$prefix.'/'; foreach my $dir (split('/',$uri)) { if (! $dir) { next; } @@ -1473,6 +1483,10 @@ returns: nothing push @{$tools{$category}}, $html; } + sub clear_breadcrumb_tools { + undef(%tools); + } + sub add_tools { my ($links) = @_; return unless defined %tools; @@ -1487,7 +1501,7 @@ returns: nothing $item =~ s///; $html .= "
  • $item
  • "; } - $html .= ''; + $html .= ''; if ($category eq 'A') { $html .= "
  • $$links
  • "; } } $$links = $html.''; @@ -1599,7 +1613,7 @@ END } sub row_title { - my ($title,$css_title_class,$css_value_class) = @_; + my ($title,$css_title_class,$css_value_class, $css_value_furtherAttributes) = @_; $row_count[0]++; my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row'; $css_title_class ||= 'LC_pick_box_title'; @@ -1611,7 +1625,7 @@ sub row_title { $title .= ':'; } my $output = <<"ENDONE"; - + $title @@ -1867,22 +1881,21 @@ sub course_custom_roles { # topic_bar # -# Generates a div containing an (optional) numbered (static) image followed by a +# Generates a div containing an (optional) number with a white background 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. +# 1. number to display. +# If input for number is empty only the title will be displayed. # 2. title text to display. # Outputs - a scalar containing html mark-up for the div. sub topic_bar { - my ($imgnum,$title) = @_; - my $imgtag; - if ($imgnum =~ /^[1-9]$/) { - $imgtag = ''.&mt('Step [_1]',$imgnum).' '; + my ($num,$title) = @_; + my $number = ''; + if ($num ne '') { + $number = ''.$num.''; } - return '
    '.$imgtag.$title.'
    '; + return '
    '.$number.$title.'
    '; } ############################################## @@ -2343,8 +2356,7 @@ Returns: HTML code with function list st sub start_funclist { my($legendtext)=@_; $legendtext=&mt('Functions') if !$legendtext; - return "
    \n$legendtext\n" - .'
      '."\n"; + return '
      • '.$legendtext.'
      • '."\n"; } @@ -2402,8 +2414,7 @@ Returns: HTML code with function list en ############################################## sub end_funclist { - my($r)=@_; - return "
      \n
    \n"; + return "\n"; } 1;