Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.73 and 1.76

version 1.73, 2004/06/03 16:42:02 version 1.76, 2004/06/08 01:32:02
Line 869  sub crumbs { Line 869  sub crumbs {
   
 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 882  _editor_lang='$lang'; Line 883  _editor_lang='$lang';
 ENDHEADERS  ENDHEADERS
 }  }
   
   # ------------------------------------------------- Activate additional buttons
   
   sub htmlareaaddbuttons {
       if (&htmlareablocked()) { return ''; }
       unless (&htmlareabrowser()) { return ''; }
       return (<<ENDADDBUTTON);
       var config=new HTMLArea.Config();
       config.registerButton('ed_math','LaTeX Inline',
     '/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 {
       return '<a href="/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl='.&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
   }
   
   sub enablelink {
       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  # ---------------------------------------------------------- Script to activate
   
 sub htmlareaactive {  sub htmlareaactive {
     if (&htmlareablocked()) { return ''; }      unless (&htmlareabrowser()) { return ''; }
       if (&htmlareablocked()) { return '<br />'.&enablelink(); }
       my $addbuttons=&htmlareaaddbuttons();
       my $disable=&disablelink();
     return (<<ENDSCRIPT);      return (<<ENDSCRIPT);
 <script type="text/javascript" defer="1">  <script type="text/javascript" defer="1">
     HTMLArea.replaceAll();      $addbuttons
 </script>      HTMLArea.replaceAll(config);
   </script><br />
   $disable
 ENDSCRIPT  ENDSCRIPT
 }  }
   
Line 897  ENDSCRIPT Line 937  ENDSCRIPT
   
 sub htmlareaselectactive {  sub htmlareaselectactive {
     my @fields=@_;      my @fields=@_;
     if (&htmlareablocked()) { return ''; }      unless (&htmlareabrowser()) { return ''; }
     my $output='<script type="text/javascript" defer="1">';      if (&htmlareablocked()) { return '<br />'.&enablelink(); }
       my $output='<script type="text/javascript" defer="1">'.
    &htmlareaaddbuttons();
     foreach(@fields) {      foreach(@fields) {
  $output.="\nHTMLArea.replace('$_');";   $output.="\nHTMLArea.replace('$_',config);";
     }      }
     $output.="\nwindow.status='Activated Editfields';\n</script>";      $output.="\nwindow.status='Activated Editfields';\n</script><br />".
    &disablelink();
     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;
 }  }
   

Removed from v.1.73  
changed lines
  Added in v.1.76


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