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

version 1.75, 2004/06/05 14:46:12 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 {
     if (&htmlareablocked()) { return ''; }      if (&htmlareablocked()) { return ''; }
       unless (&htmlareabrowser()) { return ''; }
     my $lang='en';      my $lang='en';
     if (&mt('htmlarea_lang') ne 'htmlarea_lang') {      if (&mt('htmlarea_lang') ne 'htmlarea_lang') {
  $lang=&mt('htmlarea_lang');   $lang=&mt('htmlarea_lang');
Line 886  ENDHEADERS Line 889  ENDHEADERS
   
 sub htmlareaaddbuttons {  sub htmlareaaddbuttons {
     if (&htmlareablocked()) { return ''; }      if (&htmlareablocked()) { return ''; }
       unless (&htmlareabrowser()) { return ''; }
     return (<<ENDADDBUTTON);      return (<<ENDADDBUTTON);
     var config=new HTMLArea.Config();      var config=new HTMLArea.Config();
     config.registerButton('ed_math','LaTeX Inline',      config.registerButton('ed_math','LaTeX Inline',
Line 904  sub htmlareaaddbuttons { Line 908  sub htmlareaaddbuttons {
     config.toolbar.push(['ed_math','ed_math_eqn']);      config.toolbar.push(['ed_math','ed_math_eqn']);
 ENDADDBUTTON  ENDADDBUTTON
 }  }
 # ---------------------------------------------------------- Script to activate  
   
 sub htmlareaactive {  # ----------------------------------------------------------------- Preferences
     if (&htmlareablocked()) { return ''; }  
     my $addbuttons=&htmlareaaddbuttons();  sub disablelink {
     return (<<ENDSCRIPT);      my @fields=@_;
 <script type="text/javascript" defer="1">      if (defined($#fields)) {
     $addbuttons   unless ($#fields>=0) { return ''; }
     HTMLArea.replaceAll(config);      }
 </script>      return '<a href="/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl='.&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
 ENDSCRIPT  }
   
   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  # ----------------------------------------- Script to activate only some fields
   
 sub htmlareaselectactive {  sub htmlareaselectactive {
     my @fields=@_;      my @fields=@_;
     if (&htmlareablocked()) { return ''; }      unless (&htmlareabrowser()) { return ''; }
       if (&htmlareablocked()) { return '<br />'.&enablelink(@fields); }
     my $output='<script type="text/javascript" defer="1">'.      my $output='<script type="text/javascript" defer="1">'.
  &htmlareaaddbuttons();   &htmlareaaddbuttons();
     foreach(@fields) {      foreach(@fields) {
  $output.="\nHTMLArea.replace('$_',config);";   $output.="\nHTMLArea.replace('$_',config);";
     }      }
     $output.="\nwindow.status='Activated Editfields';\n</script>";      $output.="\nwindow.status='Activated Editfields';\n</script><br />".
    &disablelink(@fields);
     return $output;      return $output;
 }  }
   
 # --------------------------------------------------------------------- Blocked  # --------------------------------------------------------------------- Blocked
   
 sub htmlareablocked {  sub htmlareablocked {
     unless (&htmlareabrowser()) { return 1; }      unless ($ENV{'environment.wysiwygeditor'} eq 'on') { return 1; }
     return 0;      return 0;
 }  }
   
Line 1048  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.75  
changed lines
  Added in v.1.79


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