--- loncom/xml/lonxml.pm 2003/09/27 04:15:26 1.266.2.2 +++ loncom/xml/lonxml.pm 2003/08/06 17:00:30 1.269 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.266.2.2 2003/09/27 04:15:26 albertel Exp $ +# $Id: lonxml.pm,v 1.269 2003/08/06 17:00:30 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -158,9 +158,6 @@ $Apache::lonxml::usestyle=1; $Apache::lonxml::style_values=''; $Apache::lonxml::style_end_values=''; -#array of ssi calls that need to occur after we are done parsing -@Apache::lonxml::ssi_info=(); - sub xmlbegin { my $output=''; if ($ENV{'browser.mathml'}) { @@ -454,7 +451,6 @@ sub xmlparse { if ($ENV{'request.uri'}) { &writeallows($ENV{'request.uri'}); } - &do_registered_ssi(); if ($Apache::lonxml::counter_changed) { &store_counter() } return $finaloutput; } @@ -496,6 +492,7 @@ sub latex_special_symbols { $current_token=~s/(>|<)/\$$1\$/g; #more or less if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space + if ($current_token eq '%.') {$current_token = '\%.';} #persent at the end of statement } return $current_token; } @@ -703,7 +700,6 @@ sub setup_globals { &init_counter(); @Apache::lonxml::pwd=(); @Apache::lonxml::extlinks=(); - @Apache::lonxml::ssi_info=(); if ($target eq 'meta') { $Apache::lonxml::redirection = 0; $Apache::lonxml::metamode = 1; @@ -1054,7 +1050,7 @@ sub parstring { my $val=$token->[2]->{$_}; $val =~ s/([\%\@\\\"\'])/\\$1/g; #if ($val =~ m/^[\%\@]/) { $val="\\".$val; } - $temp .= "my \$$_=\"$val\";" + $temp .= "my \$$_=\"$val\";"; } } return $temp; @@ -1077,19 +1073,6 @@ sub writeallows { &Apache::lonnet::appenv(%httpref); } -sub register_ssi { - my ($url,%form)=@_; - push (@Apache::lonxml::ssi_info,{'url'=>$url,'form'=>\%form}); - return ''; -} - -sub do_registered_ssi { - foreach my $info (@Apache::lonxml::ssi_info) { - my %form=%{ $info->{'form'}}; - my $url=$info->{'url'}; - &Apache::lonnet::ssi($url,%form); - } -} # # Afterburner handles anchors, highlights and links # @@ -1410,7 +1393,7 @@ sub register_insert { my $line = $data[$i]; if ( $line =~ /^\#/ || $line =~ /^\s*\n/) { next; } if ( $line =~ /TABLE/ ) { last; } - my ($tag,$descrip,$color,$function,$show) = split(/,/, $line); + my ($tag,$descrip,$color,$function,$show,$helpfile,$helpdesc) = split(/,/, $line); if ($tag) { $insertlist{"$tagnum.tag"} = $tag; $insertlist{"$tagnum.description"} = $descrip; @@ -1418,6 +1401,8 @@ sub register_insert { $insertlist{"$tagnum.function"} = $function; if (!defined($show)) { $show='yes'; } $insertlist{"$tagnum.show"}= $show; + $insertlist{"$tagnum.helpfile"} = $helpfile; + $insertlist{"$tagnum.helpdesc"} = $helpdesc; $insertlist{"$tag.num"}=$tagnum; $tagnum++; } @@ -1452,6 +1437,20 @@ sub description { return $insertlist{$tagnum.'.description'}; } +# Returns a list containing the help file, and the description +sub helpinfo { + my ($token)=@_; + my $tagnum; + my $tag=$token->[1]; + foreach my $namespace (reverse @Apache::lonxml::namespace) { + my $testtag=$namespace.'::'.$tag; + $tagnum=$insertlist{"$testtag.num"}; + if (defined($tagnum)) { last; } + } + if (!defined ($tagnum)) { $tagnum=$Apache::lonxml::insertlist{"$tag.num"}; } + return ($insertlist{$tagnum.'.helpfile'}, $insertlist{$tagnum.'.helpdesc'}); +} + # ----------------------------------------------------------------- whichuser # returns a list of $symb, $courseid, $domain, $name that is correct for # calls to lonnet functions for this setup.