Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.69 and 1.79

version 1.69, 2004/05/06 17:54:11 version 1.79, 2004/07/03 18:49:42
Line 841  sub r_print { Line 841  sub r_print {
 # ------------------------------------------------------- Puts directory header  # ------------------------------------------------------- Puts directory header
   
 sub crumbs {  sub crumbs {
     my ($uri,$target,$prefix,$form,$size)=@_;      my ($uri,$target,$prefix,$form,$size,$noformat)=@_;
     if (! defined($size)) {      if (! defined($size)) {
         $size = '+2';          $size = '+2';
     }      }
     my $output='<br /><tt><b><font size="'.$size.'">'.$prefix.'/';      my $output='';
       unless ($noformat) { $output.='<br /><tt><b>'; }
       $output.='<font size="'.$size.'">'.$prefix.'/';
     if ($ENV{'user.adv'}) {      if ($ENV{'user.adv'}) {
  my $path=$prefix.'/';   my $path=$prefix.'/';
  foreach (split('/',$uri)) {   foreach (split('/',$uri)) {
Line 862  sub crumbs { Line 864  sub crumbs {
  $output.=$uri;   $output.=$uri;
     }      }
     unless ($uri=~/\/$/) { $output=~s/\/$//; }      unless ($uri=~/\/$/) { $output=~s/\/$//; }
     return $output.'</font></b></tt><br />';      return $output.'</font>'.($noformat?'':'</b></tt><br />');
 }  }
   
 # ------------------------------------------------- Output headers for HTMLArea  # ------------------------------------------------- Output headers for HTMLArea
   
 sub htmlareaheaders {  sub htmlareaheaders {
     unless (&htmlareablocked()) { return ''; }      if (&htmlareablocked()) { return ''; }
       unless (&htmlareabrowser()) { return ''; }
     my $lang='en';      my $lang='en';
       if (&mt('htmlarea_lang') ne 'htmlarea_lang') {
    $lang=&mt('htmlarea_lang');
       }
     return (<<ENDHEADERS);      return (<<ENDHEADERS);
 <script type="text/javascript">  <script type="text/javascript">
     _editor_url="/htmlarea/";  _editor_url='/htmlarea/';
   _editor_lang='$lang';
 </script>  </script>
 <script type="text/javascript" src="/htmlarea/htmlarea.js"></script>  <script type="text/javascript" src="/htmlarea/htmlarea.js"></script>
 <script type="text/javascript" src="/htmlarea/lang/$lang.js"></script>  
 <script type="text/javascript" src="/htmlarea/dialog.js"></script>  
 <style type="text/css">  
 \@import url(/htmlarea/htmlarea.css);  
 </style>  
 ENDHEADERS  ENDHEADERS
 }  }
   
 # ---------------------------------------------------------- Script to activate  # ------------------------------------------------- Activate additional buttons
   
 sub htmlareaactive {  sub htmlareaaddbuttons {
     unless (&htmlareablocked()) { return ''; }      if (&htmlareablocked()) { return ''; }
     return (<<ENDSCRIPT);      unless (&htmlareabrowser()) { return ''; }
 <script type="text/javascript" defer="1">      return (<<ENDADDBUTTON);
     HTMLArea.replaceAll();      var config=new HTMLArea.Config();
 </script>      config.registerButton('ed_math','LaTeX Inline',
 ENDSCRIPT    '/htmlarea/images/ed_math.gif',false,
       function(editor,id) {
         editor.surroundHTML('<m>\$','\$</m>');
       }
     );
       config.registerButton('ed_math_eqn','LaTeX Equation',
     '/htmlarea/images/ed_math_eqn.gif',false,
       function(editor,id) {
         editor.surroundHTML(
        '<center><m>\\\\[','\\\\]</m></center>');
       }
     );
       config.toolbar.push(['ed_math','ed_math_eqn']);
   ENDADDBUTTON
   }
   
   # ----------------------------------------------------------------- Preferences
   
   sub disablelink {
       my @fields=@_;
       if (defined($#fields)) {
    unless ($#fields>=0) { return ''; }
       }
       return '<a href="/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl='.&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
   }
   
   sub enablelink {
       my @fields=@_;
       if (defined($#fields)) {
    unless ($#fields>=0) { return ''; }
       }
       return '<a href="/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl='.&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>';
   }
   
   # ----------------------------------------- Script to activate only some fields
   
   sub htmlareaselectactive {
       my @fields=@_;
       unless (&htmlareabrowser()) { return ''; }
       if (&htmlareablocked()) { return '<br />'.&enablelink(@fields); }
       my $output='<script type="text/javascript" defer="1">'.
    &htmlareaaddbuttons();
       foreach(@fields) {
    $output.="\nHTMLArea.replace('$_',config);";
       }
       $output.="\nwindow.status='Activated Editfields';\n</script><br />".
    &disablelink(@fields);
       return $output;
 }  }
   
 # --------------------------------------------------------------------- Blocked  # --------------------------------------------------------------------- Blocked
   
 sub htmlareablocked {  sub htmlareablocked {
     unless (&htmlareabrowser()) { return ''; }      unless ($ENV{'environment.wysiwygeditor'} eq 'on') { return 1; }
     return 1;      return 0;
 }  }
   
 # ---------------------------------------- Browser capable of running HTMLArea?  # ---------------------------------------- Browser capable of running HTMLArea?
Line 975  returns: nothing Line 1024  returns: nothing
         # The last breadcrumb does not have a link, so handle it separately.          # The last breadcrumb does not have a link, so handle it separately.
         my $last = pop(@Crumbs);          my $last = pop(@Crumbs);
         #          #
         # The first one should be the course, I guess.          # The first one should be the course or a menu link
  if (!defined($menulink)) { $menulink=1; }   if (!defined($menulink)) { $menulink=1; }
         if ($menulink && exists($ENV{'request.course.id'}) && $ENV{'request.course.id'} ne '') {          if ($menulink) {
             my $cid = $ENV{'request.course.id'};              my $description = 'Menu';
               if (exists($ENV{'request.course.id'}) && 
                   $ENV{'request.course.id'} ne '') {
                   $description = 
                       $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
               }
             unshift(@Crumbs,{              unshift(@Crumbs,{
                              href   =>'/adm/menu',                      href   =>'/adm/menu',
                              title  =>'Go to main menu',                      title  =>'Go to main menu',
                              target =>'_top',                      target =>'_top',
                              text   =>$ENV{'course.'.$cid.'.description'},                      text   =>$description,
                             });                  });
         }          }
         my $links .=           my $links .= 
             join('-&gt;',              join('-&gt;',
Line 1006  returns: nothing Line 1060  returns: nothing
         my $icons = '';          my $icons = '';
         $faq = $last->{'faq'} if (exists($last->{'faq'}));          $faq = $last->{'faq'} if (exists($last->{'faq'}));
         $bug = $last->{'bug'} if (exists($last->{'bug'}));          $bug = $last->{'bug'} if (exists($last->{'bug'}));
         if ($faq ne '') {  #        if ($faq ne '') {
             $icons .= &Apache::loncommon::help_open_faq($faq);  #            $icons .= &Apache::loncommon::help_open_faq($faq);
         }  #        }
         if ($bug ne '') {  #        if ($bug ne '') {
             $icons .= &Apache::loncommon::help_open_bug($bug);  #            $icons .= &Apache::loncommon::help_open_bug($bug);
         }  #        }
           $icons .= &Apache::loncommon::help_open_menu($color,$component,$component_help,$function,$faq,$bug);
         if ($icons ne '') {          if ($icons ne '') {
             $Str .= $icons.'&nbsp;';              $Str .= $icons.'&nbsp;';
         }          }

Removed from v.1.69  
changed lines
  Added in v.1.79


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