--- loncom/xml/lonxml.pm 2005/02/17 08:34:56 1.356
+++ loncom/xml/lonxml.pm 2005/03/17 13:56:32 1.366
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.356 2005/02/17 08:34:56 albertel Exp $
+# $Id: lonxml.pm,v 1.366 2005/03/17 13:56:32 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -154,11 +154,13 @@ sub xmlbegin {
@htmlareafields=();
if ($ENV{'browser.mathml'}) {
$output=''
- .''
- .']>'
+ #.''."\n"
+# .'] >'
+ .''
.'';
+ .'xmlns="http://www.w3.org/1999/xhtml">';
} else {
$output='';
}
@@ -176,13 +178,19 @@ sub xmlend {
$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.='\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\end{document}';
&Apache::lonxml::newparser($parser,\$discussion,'');
return '';
} else {
- return $discussion.'';
+ return $discussion.&Apache::loncommon::endbodytag();
}
}
@@ -356,8 +364,8 @@ sub xmlparse {
my @stack = ();
my @parstack = ();
- &initdepth;
-
+ &initdepth();
+ &init_alarm();
my $finaloutput = &inner_xmlparse($target,\@stack,\@parstack,\@pars,
$safeeval,\%style_for_target);
@@ -366,6 +374,9 @@ sub xmlparse {
}
&do_registered_ssi();
if ($Apache::lonxml::counter_changed) { &store_counter() }
+ if ($ENV{'form.return_only_error_and_warning_counts'}) {
+ return "$errorcount:$warningcount";
+ }
return $finaloutput;
}
@@ -790,6 +801,28 @@ sub default_homework_load {
}
}
+{
+ my $alarm_depth;
+ sub init_alarm {
+ alarm(0);
+ $alarm_depth=0;
+ }
+
+ sub start_alarm {
+ if ($alarm_depth<1) {
+ my $old=alarm($Apache::lonnet::perlvar{'lonScriptTimeout'});
+ if ($old) {
+ &Apache::lonxml::error("Cancelled an alarm of $old, this shouldn't occur.");
+ }
+ }
+ $alarm_depth++;
+ }
+
+ sub end_alarm {
+ $alarm_depth--;
+ if ($alarm_depth<1) { alarm(0); }
+ }
+}
my $metamode_was;
sub startredirection {
if (!$Apache::lonxml::redirection) {
@@ -1023,7 +1056,8 @@ sub get_all_text {
sub newparser {
my ($parser,$contentref,$dir) = @_;
push (@$parser,HTML::LCParser->new($contentref));
- $$parser['-1']->xml_mode('1');
+ $$parser[-1]->xml_mode(1);
+ $$parser[-1]->marked_sections(1);
if ( $dir eq '' ) {
push (@Apache::lonxml::pwd, $Apache::lonxml::pwd[$#Apache::lonxml::pwd]);
} else {
@@ -1218,7 +1252,7 @@ $initialize
$xml_help
$buttons
-
+
$buttons
@@ -1264,14 +1298,12 @@ sub handler {
$Apache::lonxml::debug=$ENV{'user.debug'};
- if ($ENV{'browser.mathml'}) {
- &Apache::loncommon::content_type($request,'text/xml');
- } else {
- &Apache::loncommon::content_type($request,'text/html');
- }
+ &Apache::loncommon::content_type($request,'text/html');
&Apache::loncommon::no_cache($request);
- $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
- 'lastrevisiondate'));
+ if ($ENV{'request.state'} eq 'published') {
+ $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
+ 'lastrevisiondate'));
+ }
$request->send_http_header;
return OK if $request->header_only;