--- loncom/interface/lonhtmlcommon.pm 2009/11/19 10:25:02 1.246 +++ loncom/interface/lonhtmlcommon.pm 2009/11/30 06:32:26 1.251 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.246 2009/11/19 10:25:02 bisitz Exp $ +# $Id: lonhtmlcommon.pm,v 1.251 2009/11/30 06:32:26 raeburn 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 ''; + } +} + ############################################## ############################################## @@ -222,6 +232,9 @@ sub select_recent { unless ($value =~/^error\:/) { my $escaped = &Apache::loncommon::escape_url($value); &Apache::loncommon::inhibit_menu_check(\$escaped); + if ($area eq 'residx') { + next if ((!&Apache::lonnet::allowed('bre',$value)) && (!&Apache::lonnet::allowed('bro',$value))); + } $return.="\n'; @@ -1128,7 +1141,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; } @@ -1491,7 +1504,7 @@ returns: nothing $item =~ s///; $html .= "
  • $item
  • "; } - $html .= ''; + $html .= ''; if ($category eq 'A') { $html .= "
  • $$links
  • "; } } $$links = $html.''; @@ -1871,22 +1884,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.'
    '; } ##############################################