--- loncom/xml/lonxml.pm 2004/10/05 18:51:50 1.339
+++ loncom/xml/lonxml.pm 2010/10/01 14:21:55 1.494.4.5
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.339 2004/10/05 18:51:50 albertel Exp $
+# $Id: lonxml.pm,v 1.494.4.5 2010/10/01 14:21:55 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,11 +37,31 @@
# to any other parties under any circumstances.
#
+=pod
+
+=head1 NAME
+
+Apache::lonxml
+
+=head1 SYNOPSIS
+
+XML Parsing Module
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+
+=head1 SUBROUTINES
+
+=cut
+
+
package Apache::lonxml;
use vars
-qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $errorcount $warningcount @htmlareafields);
+qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $errorcount $warningcount);
use strict;
+use LONCAPA;
use HTML::LCParser();
use HTML::TreeBuilder();
use HTML::Entities();
@@ -52,6 +72,7 @@ use Math::Random();
use Opcode();
use POSIX qw(strftime);
use Time::HiRes qw( gettimeofday tv_interval );
+use Symbol();
sub register {
my ($space,@taglist) = @_;
@@ -81,16 +102,20 @@ use Apache::languagetags();
use Apache::edit();
use Apache::inputtags();
use Apache::outputtags();
-use Apache::lonnet();
+use Apache::lonnet;
use Apache::File();
use Apache::loncommon();
use Apache::lonfeedback();
use Apache::lonmsg();
use Apache::loncacc();
+use Apache::lonmaxima();
+use Apache::lonr();
use Apache::lonlocal;
-#================================================== Main subroutine: xmlparse
+#==================================== Main subroutine: xmlparse
+
#debugging control, to turn on debugging modify the correct handler
+
$Apache::lonxml::debug=0;
# keeps count of the number of warnings and errors generated in a parse
@@ -122,8 +147,8 @@ $evaluate = 1;
# stores the list of active tag namespaces
@namespace=();
-# has the dynamic menu been updated to know about this resource
-$Apache::lonxml::registered=0;
+# stores all Scrit Vars displays for later showing
+my @script_var_displays=();
# a pointer the the Apache request object
$Apache::lonxml::request='';
@@ -132,6 +157,16 @@ $Apache::lonxml::request='';
$Apache::lonxml::counter=1;
$Apache::lonxml::counter_changed=0;
+# Part counter hash. In analysis mode, the
+# problems can use this to record which parts increment the counter
+# by how much. The counter subs will maintain this hash via
+# their optional part parameters. Note that the assumption is that
+# analysis is done in one request and therefore it is not necessary to
+# save this information request-to-request.
+
+
+%Apache::lonxml::counters_per_part = ();
+
#internal check on whether to look at style defs
$Apache::lonxml::usestyle=1;
@@ -148,38 +183,42 @@ $Apache::lonxml::post_evaluate=1;
#a header message to emit in the case of any generated warning or errors
$Apache::lonxml::warnings_error_header='';
-sub xmlbegin {
- my $output='';
- @htmlareafields=();
- if ($ENV{'browser.mathml'}) {
- $output=''
- .''
- .']>'
- .'';
- } else {
- $output='';
- }
- return $output;
+# Control whether or not LaTeX symbols should be substituted for their
+# \ style equivalents...this may be turned off e.g. in an verbatim
+# environment.
+
+$Apache::lonxml::substitute_LaTeX_symbols = 1; # Starts out on.
+
+sub enable_LaTeX_substitutions {
+ $Apache::lonxml::substitute_LaTeX_symbols = 1;
+}
+sub disable_LaTeX_substitutions {
+ $Apache::lonxml::substitute_LaTeX_symbols = 0;
}
sub xmlend {
my ($target,$parser)=@_;
my $mode='xml';
my $status='OPEN';
- if ($Apache::lonhomework::parsing_a_problem) {
+ if ($Apache::lonhomework::parsing_a_problem ||
+ $Apache::lonhomework::parsing_a_task ) {
$mode='problem';
$status=$Apache::inputtags::status[-1];
}
- my $discussion=&Apache::lonfeedback::list_discussion($mode,$status);
+ my $discussion;
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['LONCAPA_INTERNAL_no_discussion']);
+ if (! exists($env{'form.LONCAPA_INTERNAL_no_discussion'}) ||
+ $env{'form.LONCAPA_INTERNAL_no_discussion'} ne 'true') {
+ $discussion=&Apache::lonfeedback::list_discussion($mode,$status);
+ }
if ($target eq 'tex') {
$discussion.='