--- loncom/xml/lonxml.pm 2006/03/08 21:49:26 1.398 +++ loncom/xml/lonxml.pm 2006/03/10 23:49:35 1.401 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.398 2006/03/08 21:49:26 albertel Exp $ +# $Id: lonxml.pm,v 1.401 2006/03/10 23:49:35 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -971,6 +971,16 @@ sub decreasedepth { #print "
e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n"; } +sub get_id { + my ($parstack,$safeeval)=@_; + my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); + if ($env{'request.state'} eq 'construct' && $id =~ /(\.|_)/) { + &error(&mt("IDs are not allowed to contain "_" or "."")); + } + if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; } + return $id; +} + sub get_all_text_unbalanced { #there is a copy of this in lonpublisher.pm my($tag,$pars)= @_; @@ -1028,13 +1038,13 @@ sub init_counter { sub store_counter { &Apache::lonnet::appenv(('form.counter' => $Apache::lonxml::counter)); + $Apache::lonxml::counter_changed=0; return ''; } { my $state; sub clear_problem_counter { - &Apache::lonnet::logthis(" cpc called from ".(join(':',caller(0)))); undef($state); &Apache::lonnet::delenv('form.counter'); &Apache::lonxml::init_counter(); @@ -1051,6 +1061,11 @@ sub store_counter { &Apache::lonnet::appenv(('form.counter' => $state)); } } + sub get_problem_counter { + if ($Apache::lonxml::counter_changed) { &store_counter() } + &Apache::lonnet::transfer_profile_to_env(); + return $env{'form.counter'}; + } } sub get_all_text {