Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.243 and 1.253

version 1.243, 2009/11/14 18:54:17 version 1.253, 2009/12/03 02:13:28
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 111  sub dragmath_button { Line 127  sub dragmath_button {
     }      }
     my $buttontext=&mt('Edit Math');      my $buttontext=&mt('Edit Math');
     return <<ENDDRAGMATH;      return <<ENDDRAGMATH;
                 <input type="button" value="$buttontext", onclick="javascript:mathedit('$textarea',document)" />$help_text                  <input type="button" value="$buttontext" onclick="javascript:mathedit('$textarea',document)" />$help_text
 ENDDRAGMATH  ENDDRAGMATH
 }  }
   
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 1473  returns: nothing Line 1490  returns: nothing
         push @{$tools{$category}}, $html;          push @{$tools{$category}}, $html;
     }      }
   
       sub clear_breadcrumb_tools {
           undef(%tools);
       }
   
     sub add_tools {      sub add_tools {
         my ($links) = @_;          my ($links) = @_;
         return unless defined %tools;          return unless defined %tools;
Line 1487  returns: nothing Line 1508  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 1867  sub course_custom_roles { Line 1888  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>';
 }  }
   
 ##############################################  ##############################################
Line 2343  Returns: HTML code with function list st Line 2363  Returns: HTML code with function list st
 sub start_funclist {  sub start_funclist {
     my($legendtext)=@_;      my($legendtext)=@_;
     $legendtext=&mt('Functions') if !$legendtext;      $legendtext=&mt('Functions') if !$legendtext;
     return "<fieldset>\n<legend>$legendtext</legend>\n"      return '<ul class="LC_funclist"><li style="font-weight:bold; margin-left:0.8em;">'.$legendtext.'</li>'."\n";
           .'<ul class="LC_funclist">'."\n";  
 }  }
   
   
Line 2402  Returns: HTML code with function list en Line 2421  Returns: HTML code with function list en
 ##############################################  ##############################################
   
 sub end_funclist {  sub end_funclist {
     my($r)=@_;      return "</ul>\n";
     return "</ul>\n</fieldset>\n";  
 }  }
   
 1;  1;

Removed from v.1.243  
changed lines
  Added in v.1.253


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