Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.89 and 1.94

version 1.89, 2004/09/10 17:58:01 version 1.94, 2004/10/21 11:18:06
Line 131  sub select_recent { Line 131  sub select_recent {
  ">\n<option value=''>--- ".&mt('Recent')." ---</option>";   ">\n<option value=''>--- ".&mt('Recent')." ---</option>";
     foreach (sort keys %recent) {      foreach (sort keys %recent) {
  unless ($_=~/^error\:/) {   unless ($_=~/^error\:/) {
     $return.="\n<option value='$_'>".      my $escaped = &Apache::loncommon::escape_url($_);
       $return.="\n<option value='$escaped'>".
  &Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]).   &Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]).
  '</option>';   '</option>';
  }   }
Line 525  sub javascript_nothing { Line 526  sub javascript_nothing {
     return $nothing;      return $nothing;
 }  }
   
   ##############################################
   ##############################################
   sub javascript_docopen {
       # safari does not understand document.open() and loads "text/html"
       my $nothing = "''";
       my $user_browser;
       my $user_os;
       $user_browser = $ENV{'browser.type'} if (exists($ENV{'browser.type'}));
       $user_os      = $ENV{'browser.os'}   if (exists($ENV{'browser.os'}));
       if (! defined($user_browser) || ! defined($user_os)) {
           (undef,$user_browser,undef,undef,undef,$user_os) = 
                              &Apache::loncommon::decode_user_agent();
       }
       if ($user_browser eq 'safari' && $user_os =~ 'mac') {
           $nothing = "document.clear()";
       } else {
    $nothing = "document.open('text/html','replace')";
       }
       return $nothing;
   }
   
   
 ##############################################  ##############################################
 ##############################################  ##############################################
Line 783  sub Increment_PrgWin { Line 805  sub Increment_PrgWin {
     my $sec = $time_est % 60;      my $sec = $time_est % 60;
     #       # 
     my $str;      my $str;
     if ($min == 1 && $sec > 1) {      if ($min == 0 && $sec > 1) {
         $str = '[_2] seconds';          $str = '[_2] seconds';
       } elsif ($min == 1 && $sec > 1) {
           $str = '1 minute [_2] seconds';
     } elsif ($min == 1 && $sec < 2) {      } elsif ($min == 1 && $sec < 2) {
         $str = '1 minute';          $str = '1 minute';
     } elsif ($min < 10 && $sec > 1) {      } elsif ($min < 10 && $sec > 1) {
Line 864  sub crumbs { Line 888  sub crumbs {
     unless ($path eq $uri) { $path.='/'; }      unless ($path eq $uri) { $path.='/'; }
     my $linkpath=$path;      my $linkpath=$path;
     if ($form) {      if ($form) {
  $linkpath="javascript:$form.action='$path';$form.submit();";   my $escaped_path = &Apache::loncommon::escape_single($path);
    $linkpath="javascript:$form.action='$escaped_path';$form.submit();";
     }      }
     $output.='<a href="'.$linkpath.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/';      my $escaped_linkpath = &Apache::loncommon::escape_single($linkpath);
       my $escaped_target   = &Apache::loncommon::escape_single($target);
       $output.='<a href="'.$escaped_linkpath.'"'.($target?' target="'.$escaped_target.'"':'').'>'.$_.'</a>/';
  }   }
     } else {      } else {
  $output.=$uri;   $output.=$uri;
Line 881  sub spellheader { Line 908  sub spellheader {
     my $nothing = &javascript_nothing();      my $nothing = &javascript_nothing();
     return (<<ENDCHECK);      return (<<ENDCHECK);
 <script type="text/javascript">   <script type="text/javascript"> 
 // BEGIN LON-CAPA Internal  //<!-- BEGIN LON-CAPA Internal
 var checkwin;  var checkwin;
   
 function spellcheckerwindow() {  function spellcheckerwindow() {
Line 889  function spellcheckerwindow() { Line 916  function spellcheckerwindow() {
     checkwin.document.writeln('<html><body bgcolor="#DDDDDD"><form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form></body></html>');      checkwin.document.writeln('<html><body bgcolor="#DDDDDD"><form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form></body></html>');
     checkwin.document.close();      checkwin.document.close();
 }  }
 // END LON-CAPA Internal  // END LON-CAPA Internal -->
 </script>  </script>
 ENDCHECK  ENDCHECK
 }  }
Line 953  sub disablelink { Line 980  sub disablelink {
     if (defined($#fields)) {      if (defined($#fields)) {
  unless ($#fields>=0) { return ''; }   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>';      return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl=','<>&"').&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
 }  }
   
 sub enablelink {  sub enablelink {
Line 961  sub enablelink { Line 988  sub enablelink {
     if (defined($#fields)) {      if (defined($#fields)) {
  unless ($#fields>=0) { return ''; }   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>';      return '<a href="'.&HTML::Entities::encode('/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

Removed from v.1.89  
changed lines
  Added in v.1.94


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