--- loncom/xml/lonxml.pm 2000/06/23 20:40:06 1.2
+++ loncom/xml/lonxml.pm 2001/05/04 17:33:35 1.70
@@ -1,149 +1,607 @@
# The LearningOnline Network with CAPA
-# Style Parser Module
+# XML Parser Module
#
-# last modified 06/23/00 by Alexander Sakharuk
-
-package Apache::lonstyleparser;
-
+# 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
+
+package Apache::lonxml;
+use vars
+qw(@pwd @outputstack $redirection $import @extlinks $metamode);
use strict;
use HTML::TokeParser;
+use Safe;
+use Safe::Hole;
+use Opcode;
+use Apache::Constants qw(:common);
+
+
+sub xmlbegin {
+ my $output='';
+ if ($ENV{'browser.mathml'}) {
+ $output=''
+ .''
+ .']>'
+ .'';
+ } else {
+ $output='';
+ }
+ return $output;
+}
-#============================================================= style subroutine
+sub xmlend {
+ return '';
+}
-sub styleparser {
+sub fontsettings() {
+ my $headerstring='';
+ if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) {
+ $headerstring.=
+ '';
+ }
+ return $headerstring;
+}
- my ($target,$content_style_string) = @_;
+sub registerurl {
+ return (<
+ function LONCAPAreg() {
+ if (window.location.pathname!="/res/adm/pages/menu.html") {
+ menu=window.open("","LONCAPAmenu");
+ menu.currentURL=window.location.pathname;
+ menu.currentStale=0;
+ }
+ }
+
+ function LONCAPAstale() {
+ if (window.location.pathname!="/res/adm/pages/menu.html") {
+ menu=window.open("","LONCAPAmenu");
+ menu.currentStale=1;
+ }
+ }
+
+ENDSCRIPT
+}
-#------------------------------------------- target redefinition (if necessary)
-
- my @target_string = '';
- my $element;
-
- ($element,@target_string) = split ('&&',$target);
-
- map {$content_style_string =~ s/\<(.*)$_\>/\<$1$element\>/g; } @target_string;
-
- $target = $element;
-
-#-------------------------------------------- create a table for defined target
-#----------------------------------------- from the information from Style File
-
- my @value_style = ();
- my $current_key = '';
- my $current_value = '';
- my $stoken;
- my $flag;
- my $iele;
-
- my $pstyle = HTML::TokeParser->new(\$content_style_string);
-
- while ($stoken = $pstyle->get_token) {
-#----------------------------------------------------- start for tag definition
- if ($stoken->[0] eq 'S' and $stoken->[1] eq 'definetag') {
-#-------------------------------------------------------------- new key in hash
- $current_key = $stoken->[2]{name};
- $flag = 0;
-#-------------------------------------------------------------- metadata output
- if ($target eq 'meta') {
- while ($stoken = $pstyle->get_token and $stoken->[1] ne 'definetag') {
- if ($stoken->[0] eq 'S' and $stoken->[1] eq 'meta') {
- while ($stoken = $pstyle->get_token and $stoken->[1] ne 'meta') {
- $current_value .= $stoken->[1];
- }
+sub loadevents() {
+ return 'LONCAPAreg();';
+}
+
+sub unloadevents() {
+ return 'LONCAPAstale();';
+}
+
+sub register {
+ my $space;
+ my @taglist;
+ my $temptag;
+ ($space,@taglist) = @_;
+ foreach $temptag (@taglist) {
+ $Apache::lonxml::alltags{$temptag}=$space;
+ }
+}
+
+sub printalltags {
+ my $temp;
+ foreach $temp (sort keys %Apache::lonxml::alltags) {
+ &Apache::lonxml::debug("$temp -- $Apache::lonxml::alltags{$temp}");
+ }
+}
+use Apache::style;
+use Apache::run;
+use Apache::londefdef;
+use Apache::scripttag;
+use Apache::edit;
+#================================================== Main subroutine: xmlparse
+@pwd=();
+@outputstack = ();
+$redirection = 0;
+$import = 1;
+@extlinks=();
+$metamode = 0;
+
+sub xmlparse {
+
+ my ($target,$content_file_string,$safeinit,%style_for_target) = @_;
+ if ($target eq 'meta') {
+ # meta mode is a bit weird only some output is to be turned off
+ #