--- loncom/xml/lonxml.pm 2002/09/11 13:36:50 1.195
+++ loncom/xml/lonxml.pm 2013/07/15 16:13:36 1.542
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.195 2002/09/11 13:36:50 www Exp $
+# $Id: lonxml.pm,v 1.542 2013/07/15 16:13:36 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,32 +36,32 @@
# The C source of the Code may not be distributed by the Licensee
# to any other parties under any circumstances.
#
-# last modified 06/26/00 by Alexander Sakharuk
-# 11/6 Gerd Kortemeyer
-# 6/1/1 Gerd Kortemeyer
-# 2/21,3/13 Guy
-# 3/29,5/4 Gerd Kortemeyer
-# 5/10 Scott Harrison
-# 5/26 Gerd Kortemeyer
-# 5/27 H. K. Ng
-# 6/2,6/3,6/8,6/9 Gerd Kortemeyer
-# 6/12,6/13 H. K. Ng
-# 6/16 Gerd Kortemeyer
-# 7/27 H. K. Ng
-# 8/7,8/9,8/10,8/11,8/15,8/16,8/17,8/18,8/20,8/23,8/24 Gerd Kortemeyer
-# Guy Albertelli
-# 9/26 Gerd Kortemeyer
-# Dec Guy Albertelli
-# YEAR=2002
-# 1/1 Gerd Kortemeyer
-# 1/2 Matthew Hall
-# 1/3 Gerd Kortemeyer
-#
+
+=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 $prevent_entity_encode);
+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();
@@ -70,6 +70,9 @@ use Safe::Hole();
use Math::Cephes();
use Math::Random();
use Opcode();
+use POSIX qw(strftime);
+use Time::HiRes qw( gettimeofday tv_interval );
+use Symbol();
sub register {
my ($space,@taglist) = @_;
@@ -95,15 +98,33 @@ use Apache::style();
use Apache::run();
use Apache::londefdef();
use Apache::scripttag();
+use Apache::languagetags();
use Apache::edit();
-use Apache::lonnet();
+use Apache::inputtags();
+use Apache::outputtags();
+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;
+use Apache::lonhtmlcommon();
+use Apache::functionplotresponse();
+use Apache::lonnavmaps();
+
+#==================================== 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
+$warningcount=0;
+$errorcount=0;
+
#path to the directory containing the file currently being processed
@pwd=();
@@ -129,363 +150,82 @@ $evaluate = 1;
# stores the list of active tag namespaces
@namespace=();
-# if 0 all high ASCII characters will be encoded into HTML Entities
-$prevent_entity_encode=0;
-
-# 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='';
-sub xmlbegin {
- my $output='';
- if ($ENV{'browser.mathml'}) {
- $output=''
- .''
- .']>'
- .'';
- } else {
- $output='';
- }
- return $output;
-}
-
-sub xmlend {
- my ($discussiononly,$symb)=@_;
- my $discussion='';
- if ($ENV{'request.course.id'}) {
- my $crs='/'.$ENV{'request.course.id'};
- if ($ENV{'request.course.sec'}) {
- $crs.='_'.$ENV{'request.course.sec'};
- }
- $crs=~s/\_/\//g;
- my $seeid=&Apache::lonnet::allowed('rin',$crs);
- unless ($symb) {
- $symb=&Apache::lonnet::symbread();
- }
- if ($symb) {
- my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
- if ($contrib{'version'}) {
- unless ($discussiononly) {
- $discussion.=
- '
';
- }
- my $idx;
- for ($idx=1;$idx<=$contrib{'version'};$idx++) {
- my $hidden=($contrib{'hidden'}=~/\.$idx\./);
- unless (($hidden) && (!$seeid)) {
- my $message=$contrib{$idx.':message'};
- $message=~s/\n/\ /g;
- $message=&Apache::lontexconvert::msgtexconverted($message);
- if ($message) {
- if ($hidden) {
- $message=''.$message.'';
- }
- my $sender='Anonymous';
- if ((!$contrib{$idx.':anonymous'}) || ($seeid)) {
- $sender=&Apache::loncommon::aboutmewrapper(
- $contrib{$idx.':plainname'},
- $contrib{$idx.':sendername'},
- $contrib{$idx.':senderdomain'}).' ('.
- $contrib{$idx.':sendername'}.' at '.
- $contrib{$idx.':senderdomain'}.')';
- if ($contrib{$idx.':anonymous'}) {
- $sender.=' [anonymous] '.
- $contrib{$idx.':screenname'};
- }
- if ($seeid) {
- if ($hidden) {
- $sender.=' Make Visible';
- } else {
- $sender.=' Hide';
- }
- }
- } else {
- if ($contrib{$idx.':screenname'}) {
- $sender=''.$contrib{$idx.':screenname'}.'';
- }
- }
- $discussion.='