Diff for /loncom/xml/lonxml.pm between versions 1.244 and 1.252

version 1.244, 2003/04/03 21:58:09 version 1.252, 2003/05/16 18:34:56
Line 380  sub printtokenheader { Line 380  sub printtokenheader {
 sub fontsettings() {  sub fontsettings() {
     my $headerstring='';      my $headerstring='';
     if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) {       if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { 
          $headerstring.=   $headerstring.=
              '<meta Content-Type="text/html; charset=x-mac-roman">';      '<meta Content-Type="text/html; charset=x-mac-roman">';
       } elsif (!$ENV{'browser.mathml'}) {
    $headerstring.=
       '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
     }      }
     return $headerstring;      return $headerstring;
 }  }
Line 475  sub latex_special_symbols { Line 478  sub latex_special_symbols {
  $current_token=~s/\\ /\\char92 /g;   $current_token=~s/\\ /\\char92 /g;
  $current_token=~s/\^/\\char94 /g;   $current_token=~s/\^/\\char94 /g;
  $current_token=~s/\~/\\char126 /g;   $current_token=~s/\~/\\char126 /g;
  $current_token=~s/(&[^a-z\#])/\\$1/g;   $current_token=~s/(&[^A-Za-z\#])/\\$1/g;
  $current_token=~s/([^&])\#/$1\\#/g;   $current_token=~s/([^&])\#/$1\\#/g;
  $current_token=~s/(\$|_|{|})/\\$1/g;   $current_token=~s/(\$|_|{|})/\\$1/g;
  $current_token=~s/\\char92 /\\texttt{\\char92}/g;   $current_token=~s/\\char92 /\\texttt{\\char92}/g;
Line 557  sub inner_xmlparse { Line 560  sub inner_xmlparse {
  }   }
       }        }
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {        if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
  if ($target eq 'tex') {    #Style file definitions should be correct
     $result=&latex_special_symbols($result,$stack,$parstack);    if ($target eq 'tex' && ($Apache::lonxml::usestyle)) {
  }        $result=&latex_special_symbols($result,$stack,$parstack);
     }
       }        }
   
       # Encode any high ASCII characters        # Encode any high ASCII characters
Line 718  sub init_safespace { Line 722  sub init_safespace {
   $safeeval->permit("sort");    $safeeval->permit("sort");
   $safeeval->deny(":base_io");    $safeeval->deny(":base_io");
   $safehole->wrap(\&Apache::scripttag::xmlparse,$safeeval,'&xmlparse');    $safehole->wrap(\&Apache::scripttag::xmlparse,$safeeval,'&xmlparse');
     $safehole->wrap(\&Apache::outputtags::multipart,$safeeval,'&multipart');
   $safehole->wrap(\&Apache::lonnet::EXT,$safeeval,'&EXT');    $safehole->wrap(\&Apache::lonnet::EXT,$safeeval,'&EXT');
       
   $safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin');    $safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin');
Line 799  sub init_safespace { Line 804  sub init_safespace {
   my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();    my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
   $rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name);    $rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name);
   $safeinit .= ';$external::randomseed='.$rndseed.';';    $safeinit .= ';$external::randomseed='.$rndseed.';';
     &Apache::lonxml::debug("Setting rndseed to $rndseed");
   &Apache::run::run($safeinit,$safeeval);    &Apache::run::run($safeinit,$safeeval);
 }  }
   
Line 898  sub get_all_text_unbalanced { Line 904  sub get_all_text_unbalanced {
 }  }
   
 sub increment_counter {  sub increment_counter {
     $Apache::lonxml::counter++;      my ($increment) = @_;
       if (defined($increment) && $increment gt 0) {
    $Apache::lonxml::counter+=$increment;
       } else {
    $Apache::lonxml::counter++;
       }
     $Apache::lonxml::counter_changed=1;      $Apache::lonxml::counter_changed=1;
 }  }
   
 sub init_counter {  sub init_counter {
     if (defined($ENV{'form.counter'})) {      if (defined($ENV{'form.counter'})) {
  $Apache::lonxml::counter=$ENV{'form.counter'};   $Apache::lonxml::counter=$ENV{'form.counter'};
    $Apache::lonxml::counter_changed=0;
     } else {      } else {
  $Apache::lonxml::counter=1;   $Apache::lonxml::counter=1;
  &store_counter();   $Apache::lonxml::counter_changed=1;
     }      }
     $Apache::lonxml::counter_changed=0;  
 }  }
   
 sub store_counter {  sub store_counter {
Line 1241  ENDNOTFOUND Line 1252  ENDNOTFOUND
   
   writeallows($request->uri);    writeallows($request->uri);
   
     # If we're editing, show the filename of the resource in the frame's main
     # title
     if ($ENV{'form.editmode'}) {
         my $filename = $request->uri;
         # Everything after the last /
         $filename = substr($filename, rindex($filename, '/') + 1);
         $result = substr($result, 0, rindex($result, '</html>'));
         $result .= "<script>top.document.title = '$filename - LON-CAPA Construction Space';</script>";
         $result .= "\n</html>\n";
     }
   
   
   $request->print($result);    $request->print($result);
   
   return OK;    return OK;
Line 1391  sub description { Line 1414  sub description {
 # calls to lonnet functions for this setup.  # calls to lonnet functions for this setup.
 # - looks for form.grade_ parameters  # - looks for form.grade_ parameters
 sub whichuser {  sub whichuser {
   my ($symb,$courseid,$domain,$name);    my ($symb,$courseid,$domain,$name,$publicuser);
   if (defined($ENV{'form.grade_symb'})) {    if (defined($ENV{'form.grade_symb'})) {
     my $tmp_courseid=$ENV{'form.grade_courseid'};      my $tmp_courseid=$ENV{'form.grade_courseid'};
     my $allowed=&Apache::lonnet::allowed('mgr',$tmp_courseid);      my $allowed=&Apache::lonnet::allowed('mgr',$tmp_courseid);
Line 1413  sub whichuser { Line 1436  sub whichuser {
   $name.=$ENV{'form.username'};    $name.=$ENV{'form.username'};
       }        }
   }    }
   return ($symb,$courseid,$domain,$name);    return ($symb,$courseid,$domain,$name,$publicuser);
 }  }
   
 1;  1;

Removed from v.1.244  
changed lines
  Added in v.1.252


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