--- loncom/xml/lonxml.pm 2004/10/05 18:54:49 1.340
+++ loncom/xml/lonxml.pm 2004/10/18 19:49:58 1.345
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.340 2004/10/05 18:54:49 albertel Exp $
+# $Id: lonxml.pm,v 1.345 2004/10/18 19:49:58 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -159,7 +159,8 @@ sub xmlbegin {
.'';
} else {
- $output='';
+ $output='
+';
}
return $output;
}
@@ -287,7 +288,7 @@ sub fontsettings() {
my $headerstring='';
if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) {
$headerstring.=
- '';
+ '';
} elsif (!$ENV{'browser.mathml'} && $ENV{'browser.unicode'}) {
$headerstring.=
'';
@@ -1028,6 +1029,7 @@ sub parstring {
unless ($_=~/\W/) {
my $val=$token->[2]->{$_};
$val =~ s/([\%\@\\\"\'])/\\$1/g;
+ $val =~ s/(\$[^{a-zA-Z_])/\\$1/g;
#if ($val =~ m/^[\%\@]/) { $val="\\".$val; }
$temp .= "my \$$_=\"$val\";";
}
@@ -1287,7 +1289,7 @@ $bodytag
ENDNOTFOUND
- $filecontents='';
+ $filecontents='';
if ($ENV{'request.state'} ne 'published') {
if ($filetype eq 'sty') {
$filecontents=&createnewsty();
@@ -1298,6 +1300,10 @@ ENDNOTFOUND
}
} else {
unless ($ENV{'request.state'} eq 'published') {
+ if ($filecontents=~/BEGIN LON-CAPA Internal/) {
+ &Apache::lonxml::error(&mt('This file appears to be a rendering of a Lon-CAPA resource. If this is correct, this resource will act very oddly and incorrectly.'));
+ }
+
if ($ENV{'form.attemptclean'}) {
$filecontents=&htmlclean($filecontents,1);
}
@@ -1477,7 +1483,7 @@ sub get_param_var {
} elsif ( $args !~ /my \$\Q$param\E=\"/ ) { return undef; }
my $value=&Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'
&Apache::lonxml::debug("first run is $value");
- if ($value =~ /^[\$\@\%]\w+$/) {
+ if ($value =~ /^[\$\@\%][a-zA-Z_]\w*$/) {
&Apache::lonxml::debug("doing second");
my @result=&Apache::run::run("return $value",$safeeval,1);
if (!defined($result[0])) {
@@ -1567,6 +1573,12 @@ sub whichuser {
if (defined($ENV{'form.grade_symb'})) {
my $tmp_courseid=$ENV{'form.grade_courseid'};
my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
+ if (!$allowed &&
+ exists($ENV{'request.course.sec'}) &&
+ $ENV{'request.course.sec'} !~ /^\s*$/) {
+ $allowed=&Apache::lonnet::allowed('vgr',$ENV{'form.grade_courseid'}.
+ '/'.$ENV{'request.course.sec'});
+ }
if ($allowed) {
$symb=$ENV{'form.grade_symb'};
$courseid=$ENV{'form.grade_courseid'};