--- loncom/xml/lonxml.pm 2003/03/29 22:50:22 1.242 +++ loncom/xml/lonxml.pm 2003/04/07 22:28:08 1.247 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.242 2003/03/29 22:50:22 www Exp $ +# $Id: lonxml.pm,v 1.247 2003/04/07 22:28:08 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.=(< +

@@ -394,6 +401,7 @@ sub xmlparse { &Apache::inputtags::initialize_inputtags(); &Apache::outputtags::initialize_outputtags(); &Apache::edit::initialize_edit(); + # # do we have a course style file? # @@ -467,7 +475,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; @@ -519,10 +527,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); } } @@ -890,18 +898,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 { @@ -1383,7 +1396,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); @@ -1394,12 +1407,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;