--- loncom/xml/lonxml.pm 2003/03/25 22:51:48 1.241
+++ loncom/xml/lonxml.pm 2003/04/11 16:03:26 1.248
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.241 2003/03/25 22:51:48 albertel Exp $
+# $Id: lonxml.pm,v 1.248 2003/04/11 16:03:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -196,6 +196,13 @@ sub xmlend {
my $message=$contrib{$idx.':message'};
$message=~s/\n/\
/g;
$message=&Apache::lontexconvert::msgtexconverted($message);
+ if ($contrib{$idx.':attachmenturl'}) {
+ my ($fname,$ft)
+ =($contrib{$idx.':attachmenturl'}=~/\/(\w+)\.(\w+)$/);
+ $message.='
Attachment: '.$fname.'.'.$ft.'';
+ }
if ($message) {
if ($hidden) {
$message=''.$message.'';
@@ -248,7 +255,7 @@ sub xmlend {
}
if ($discussiononly) {
$discussion.=(<
+
ENDDISCUSS
$discussion.=&Apache::lonfeedback::generate_preview_button();
@@ -370,8 +380,11 @@ sub printtokenheader {
sub fontsettings() {
my $headerstring='';
if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) {
- $headerstring.=
- '';
+ $headerstring.=
+ '';
+ } elsif (!$ENV{'browser.mathml'}) {
+ $headerstring.=
+ '';
}
return $headerstring;
}
@@ -391,6 +404,7 @@ sub xmlparse {
&Apache::inputtags::initialize_inputtags();
&Apache::outputtags::initialize_outputtags();
&Apache::edit::initialize_edit();
+
#
# do we have a course style file?
#
@@ -464,7 +478,7 @@ sub latex_special_symbols {
$current_token=~s/\\ /\\char92 /g;
$current_token=~s/\^/\\char94 /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/\\char92 /\\texttt{\\char92}/g;
@@ -516,10 +530,10 @@ sub inner_xmlparse {
while ($token->[1] ne $$stack['-1'] && ($#$stack > -1)) {
my $lasttag=$$stack[-1];
if ($token->[1] =~ /^$lasttag$/i) {
- &Apache::lonxml::warning('Using tag </'.$token->[1].'> as end tag to <'.$$stack[-1].'>');
+ &Apache::lonxml::warning('Using tag </'.$token->[1].'> on line '.$token->[3].' as end tag to <'.$$stack[-1].'>');
last;
} else {
- &Apache::lonxml::warning('Found tag </'.$token->[1].'> when looking for </'.$$stack[-1].'> in file');
+ &Apache::lonxml::warning('Found tag </'.$token->[1].'> on line '.$token->[3].' when looking for </'.$$stack[-1].'> in file');
&end_tag($stack,$parstack,$token);
}
}
@@ -887,18 +901,23 @@ sub get_all_text_unbalanced {
}
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;
}
sub init_counter {
if (defined($ENV{'form.counter'})) {
$Apache::lonxml::counter=$ENV{'form.counter'};
+ $Apache::lonxml::counter_changed=0;
} else {
$Apache::lonxml::counter=1;
- &store_counter();
+ $Apache::lonxml::counter_changed=1;
}
- $Apache::lonxml::counter_changed=0;
}
sub store_counter {
@@ -1380,7 +1399,7 @@ sub description {
# calls to lonnet functions for this setup.
# - looks for form.grade_ parameters
sub whichuser {
- my ($symb,$courseid,$domain,$name);
+ my ($symb,$courseid,$domain,$name,$publicuser);
if (defined($ENV{'form.grade_symb'})) {
my $tmp_courseid=$ENV{'form.grade_courseid'};
my $allowed=&Apache::lonnet::allowed('mgr',$tmp_courseid);
@@ -1391,12 +1410,18 @@ sub whichuser {
$name=$ENV{'form.grade_username'};
}
} else {
- $symb=&Apache::lonnet::symbread();
- $courseid=$ENV{'request.course.id'};
- $domain=$ENV{'user.domain'};
- $name=$ENV{'user.name'};
+ $symb=&Apache::lonnet::symbread();
+ $courseid=$ENV{'request.course.id'};
+ $domain=$ENV{'user.domain'};
+ $name=$ENV{'user.name'};
+ if ($name eq 'public' && $domain eq 'public') {
+ if (!defined($ENV{'form.username'})) {
+ $ENV{'form.username'}.=time.rand(10000000);
+ }
+ $name.=$ENV{'form.username'};
+ }
}
- return ($symb,$courseid,$domain,$name);
+ return ($symb,$courseid,$domain,$name,$publicuser);
}
1;