Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.246 and 1.253.2.2

version 1.246, 2009/11/19 10:25:02 version 1.253.2.2, 2009/12/08 05:19:08
Line 62  use Apache::lonlocal; Line 62  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
 use LONCAPA;  use LONCAPA;
   
   
   sub coursepreflink {
      my ($text,$category)=@_;
      if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
         return '<a href="/adm/courseprefs?phase=display&actions='.$category.'">'.$text.'</a>';
      } else {
         return '';
      }
   }
   
   sub raw_href_to_link {
      my ($message)=@_;
      $message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/<a href="$1"><tt>$1<\/tt><\/a>$2/gi;
      return $message;
   }
   
 ##############################################  ##############################################
 ##############################################  ##############################################
   
Line 222  sub select_recent { Line 238  sub select_recent {
  unless ($value =~/^error\:/) {   unless ($value =~/^error\:/) {
     my $escaped = &Apache::loncommon::escape_url($value);      my $escaped = &Apache::loncommon::escape_url($value);
     &Apache::loncommon::inhibit_menu_check(\$escaped);      &Apache::loncommon::inhibit_menu_check(\$escaped);
               if ($area eq 'residx') {
                   next if ((!&Apache::lonnet::allowed('bre',$value)) && (!&Apache::lonnet::allowed('bro',$value)));
               }
     $return.="\n<option value='$escaped'>".      $return.="\n<option value='$escaped'>".
  &unescape((split(/\&/,$recent{$value}))[1]).   &unescape((split(/\&/,$recent{$value}))[1]).
  '</option>';   '</option>';
Line 1117  sub r_print { Line 1136  sub r_print {
 # ------------------------------------------------------- Puts directory header  # ------------------------------------------------------- Puts directory header
   
 sub crumbs {  sub crumbs {
     my ($uri,$target,$prefix,$form,$size,$noformat,$skiplast)=@_;      my ($uri,$target,$prefix,$form,$skiplast)=@_;
     if (! defined($size)) {  
         $size = '+2';  
     }  
     if ($target) {      if ($target) {
         $target = ' target="'.          $target = ' target="'.
                   &Apache::loncommon::escape_single($target).'"';                    &Apache::loncommon::escape_single($target).'"';
     }      }
     my $output='';      my $output='<span class="LC_filename">';
     unless ($noformat) { $output.='<br /><tt><b>'; }      $output.=$prefix.'/';
     $output.='<font size="'.$size.'">'.$prefix.'/';      if (($env{'user.adv'}) || ($env{'user.author'})) {
     if (($env{'user.adv'}) | ($env{'user.author'})) {          my $path=$prefix.'/';
  my $path=$prefix.'/';          foreach my $dir (split('/',$uri)) {
  foreach my $dir (split('/',$uri)) {  
             if (! $dir) { next; }              if (! $dir) { next; }
             $path .= $dir;              $path .= $dir;
     if ($path eq $uri) {              if ($path eq $uri) {
  if ($skiplast) {                  if ($skiplast) {
     $output.=$dir;                      $output.=$dir;
                     last;                      last;
  }                   } 
     } else {              } else {
  $path.='/';                   $path.='/'; 
     }                  }
             my $href_path = &HTML::Entities::encode($path,'<>&"');              my $href_path = &HTML::Entities::encode($path,'<>&"');
     &Apache::loncommon::inhibit_menu_check(\$href_path);              &Apache::loncommon::inhibit_menu_check(\$href_path);
     if ($form) {              if ($form) {
         my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';                  my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';
         $output.=qq{<a href="$href" $target>$dir</a>/};                  $output.=qq{<a href="$href"$target>$dir</a>/};
     } else {              } else {
         $output.=qq{<a href="$href_path" $target>$dir</a>/};                  $output.=qq{<a href="$href_path"$target>$dir</a>/};
     }              }
  }          }
     } else {      } else {
  foreach my $dir (split('/',$uri)) {          foreach my $dir (split('/',$uri)) {
             if (! $dir) { next; }              if (! $dir) { next; }
     $output.=$dir.'/';              $output.=$dir.'/';
  }          }
     }      }
     if ($uri !~ m|/$|) { $output=~s|/$||; }      if ($uri !~ m|/$|) { $output=~s|/$||; }
     return $output.'</font>'.($noformat?'':'</b></tt><br />');      $output.='</span>';
   
       return $output;
 }  }
   
 # --------------------- A function that generates a window for the spellchecker  # --------------------- A function that generates a window for the spellchecker
Line 1361  returns: nothing Line 1378  returns: nothing
         # The first one should be the course or a menu link          # The first one should be the course or a menu link
         if (!defined($menulink)) { $menulink=1; }          if (!defined($menulink)) { $menulink=1; }
         if ($menulink) {          if ($menulink) {
             my $description = 'Menu';              if ($menulink eq '_nomenu') {
             my $no_mt_descr = 0;                  return unless($last);
             if (exists($env{'request.course.id'}) &&   
                 $env{'request.course.id'} ne '') {  
                 $description =   
                     $env{'course.'.$env{'request.course.id'}.'.description'};  
                 $no_mt_descr = 1;  
             }  
             $menulink =  {  href   =>'/adm/menu',  
                             title  =>'Go to main menu',  
                             target =>'_top',  
                             text   =>$description,  
                             no_mt  =>$no_mt_descr, };  
             if($last) {  
                 #$last set, so we have some crumbs  
                 unshift(@Crumbs,$menulink);  
             } else {              } else {
                 #only menulink crumb present                  my $description = 'Menu';
                 $last = $menulink;                  my $no_mt_descr = 0;
                   $menulink =  {  href   =>'/adm/menu',
                                   title  =>'Go to main menu',
                                   target =>'_top',
                                   text   =>$description,
                                   no_mt  =>$no_mt_descr, };
                   if($last) {
                       #$last set, so we have some crumbs
                       unshift(@Crumbs,$menulink);
                   } else {
                       #only menulink crumb present
                       $last = $menulink;
                   }
             }              }
         }          }
         my $links = join "",           my $links = join "", 
Line 1491  returns: nothing Line 1506  returns: nothing
                 $item =~ s/<span(.*?)\/span>//;                  $item =~ s/<span(.*?)\/span>//;
                 $html .= "<li>$item</li>";                  $html .= "<li>$item</li>";
             }              }
             $html .= '</li></ul>';              $html .= '</ul></li>';
             if ($category eq 'A') { $html .= "<li>$$links</li>"; }              if ($category eq 'A') { $html .= "<li>$$links</li>"; }
         }          }
         $$links = $html.'</ul>';          $$links = $html.'</ul>';
Line 1871  sub course_custom_roles { Line 1886  sub course_custom_roles {
   
 # topic_bar  # 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  # title with a background color defined in the corresponding CSS: LC_topic_bar
 # Inputs:  # Inputs:
 # 1. number to display (corresponding static image should exist).  # 1. number to display.
 #    img tag will be included if arg is an integer in the range 1 to 9.   #    If input for number is empty only the title will be displayed. 
 # 2. title text to display.  # 2. title text to display.
 # Outputs - a scalar containing html mark-up for the div.  # Outputs - a scalar containing html mark-up for the div.
   
 sub topic_bar {  sub topic_bar {
     my ($imgnum,$title) = @_;      my ($num,$title) = @_;
     my $imgtag;      my $number = '';
     if ($imgnum =~ /^[1-9]$/) {      if ($num ne '') {
         $imgtag = '<img src="/res/adm/pages/bl_step'.$imgnum.'.gif"'.           $number = '<span>'.$num.'</span>';
                   ' alt="'.&mt('Step [_1]',$imgnum).'" /> ';  
     }      }
     return '<div class="LC_topic_bar">'.$imgtag.$title.'</div>';      return '<div class="LC_topic_bar">'.$number.$title.'</div>';
 }  }
   
 ##############################################  ##############################################

Removed from v.1.246  
changed lines
  Added in v.1.253.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>