--- loncom/xml/lonxml.pm 2002/10/21 17:10:35 1.206 +++ loncom/xml/lonxml.pm 2002/11/06 22:36:08 1.211 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.206 2002/10/21 17:10:35 albertel Exp $ +# $Id: lonxml.pm,v 1.211 2002/11/06 22:36:08 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -528,7 +528,7 @@ sub xmlparse { # do we have a course style file? # - if ($ENV{'request.course.id'}) { + if ($ENV{'request.course.id'} && $ENV{'request.state'} ne 'construct') { my $bodytext= $ENV{'course.'.$ENV{'request.course.id'}.'.default_xml_style'}; if ($bodytext) { @@ -841,6 +841,9 @@ sub callsub { if ($token->[0] eq 'S') { $currentstring = $token->[4]; $currentstring.=&Apache::edit::handle_insert(); + } elsif ($token->[0] eq 'E') { + $currentstring = $token->[2]; + $currentstring.=&Apache::edit::handle_insertafter($token->[1]); } else { $currentstring = $token->[2]; } @@ -858,6 +861,7 @@ sub setup_globals { $Apache::lonxml::registered = 0; $errorcount=0; $warningcount=0; + $Apache::lonxml::default_homework_loaded=0; &init_counter(); @Apache::lonxml::pwd=(); @Apache::lonxml::extlinks=(); @@ -959,6 +963,18 @@ sub init_safespace { &Apache::run::run($safeinit,$safeeval); } +sub default_homework_load { + my ($safeeval)=@_; + &Apache::lonxml::debug('Loading default_homework'); + my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm'); + if ($default == -1) { + &Apache::lonxml::error("Unable to find default_homework.lcpm"); + } else { + &Apache::run::run($default,$safeeval); + $Apache::lonxml::default_homework_loaded=1; + } +} + sub startredirection { $Apache::lonxml::redirection++; push (@Apache::lonxml::outputstack, ''); @@ -1030,7 +1046,7 @@ sub get_all_text_unbalanced { } elsif ($token->[0] eq 'E') { $result.=$token->[2]; } - if ($result =~ /(.*)$tag(.*)/) { + if ($result =~ /(.*)\Q$tag\E(.*)/s) { &Apache::lonxml::debug('Got a winner with leftovers ::'.$2); &Apache::lonxml::debug('Result is :'.$1); $result=$1; @@ -1368,10 +1384,10 @@ sub error { &Apache::lonmsg::author_res_msg($ENV{'request.filename'},join('
',@_)); #notify course if ( $ENV{'request.course.id'} ) { - my $users=$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}; + my (undef,%users)=&Apache::lonfeedback::decide_receiver(undef,0,1,1,1); my $declutter=&Apache::lonnet::declutter($ENV{'request.filename'}); - foreach my $user (split /\,/, $users) { - ($user,my $domain) = split /:/, $user; + foreach (keys %users) { + my ($user,$domain) = split(/:/, $_); &Apache::lonmsg::user_normal_msg($user,$domain, "Error [$declutter]",join('
',@_)); }