[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 18 Apr 2006 20:45:40 -0000
albertel Tue Apr 18 16:45:40 2006 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
- .html resources -> start/end_paged
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.326 loncom/xml/londefdef.pm:1.327
--- loncom/xml/londefdef.pm:1.326 Tue Apr 11 14:42:43 2006
+++ loncom/xml/londefdef.pm Tue Apr 18 16:45:40 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.326 2006/04/11 18:42:43 albertel Exp $
+# $Id: londefdef.pm,v 1.327 2006/04/18 20:45:40 albertel Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -79,6 +79,8 @@
@Apache::londefdef::DT=(0);
@Apache::londefdef::seenDT=(0);
$Apache::londefdef::list_index=0;
+ undef($Apache::londefdef::head);
+ undef($Apache::londefdef::title);
}
#======================= TAG SUBROUTINES =====================
@@ -178,10 +180,9 @@
sub start_html {
my ($target,$token) = @_;
my $currentstring = '';
- my $options=$env{'course.'.$env{'request.course.id'}.'.tthoptions'};
&Apache::lontexconvert::init_tth();
if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) {
- $currentstring = &Apache::lonxml::xmlbegin();
+ # start_body() takes care of emitting the <html>
} elsif ($target eq 'tex') {
$currentstring .= '\documentclass[letterpaper,twoside]{article}';
if (($env{'form.latex_type'}=~'batchmode') ||
@@ -212,7 +213,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = '</html>';
+ # end_body takes care of the </html>
}
return $currentstring;
}
@@ -222,7 +223,7 @@
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[4].&Apache::lonxml::fontsettings();
+ &Apache::lonxml::startredirection();
}
return $currentstring;
}
@@ -232,8 +233,10 @@
my $currentstring = '';
if (($target eq 'web' && $env{'request.state'} eq 'published') ||
($target eq 'webgrade' && $env{'request.state'} eq 'published')) {
- $currentstring = &Apache::lonmenu::registerurl(undef,$target).
- $token->[2];
+ # in case there is a </head> but no <head>
+ if ($Apache::lonxml::redirection) {
+ $Apache::londefdef::head = &Apache::lonxml::endredirection();
+ }
}
return $currentstring;
}
@@ -365,10 +368,11 @@
#-- <title> tag (end tag required)
sub start_title {
- my ($target,$token) = @_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[4];
+ $Apache::londefdef::title =
+ &Apache::lonxml::get_all_text('/title',$parser,$style);
} elsif ($target eq 'tex') {
$currentstring .= '\keephidden{Title of the document: '
}
@@ -383,7 +387,7 @@
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[2];
+ # start_title takes care of swallowing the title
} elsif ($target eq 'tex') {
$currentstring .= '}';
}
@@ -518,71 +522,24 @@
&Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems.");
return '';
}
- if (!$Apache::lonxml::registered &&
- $env{'request.state'} eq 'published') {
- $currentstring.='<head>'.
- &Apache::lonmenu::registerurl(undef,$target).'</head>';
- }
-# Accessibility
- if ($env{'browser.imagesuppress'} eq 'on') {
- delete($token->[2]->{'background'});
- }
- if ($env{'browser.fontenhance'} eq 'on') {
- my $style='';
- foreach my $key (keys(%{$token->[2]})) {
- if ($key =~ /^style$/i) {
- $style.=$token->[2]->{$key}.';';
- delete($token->[2]->{$key});
- }
- }
- $token->[2]->{'style'}=$style.'; font-size: x-large;';
- }
- if ($env{'browser.blackwhite'} eq 'on') {
- delete($token->[2]->{'font'});
- delete($token->[2]->{'link'});
- delete($token->[2]->{'alink'});
- delete($token->[2]->{'vlink'});
- delete($token->[2]->{'bgcolor'});
- delete($token->[2]->{'background'});
- }
-# Overload loads
- my $onLoad='';
- foreach my $key (keys(%{$token->[2]})) {
- if ($key =~ /^onload$/i) {
- $onLoad.=$token->[2]->{$key}.';';
- delete($token->[2]->{$key});
- }
- }
- $token->[2]->{'onload'}=&Apache::lonmenu::loadevents().';'.$onLoad;
- my $onUnload='';
- foreach my $key (keys(%{$token->[2]})) {
- if ($key =~ /^onunload$/i) {
- $onUnload.=$token->[2]->{$key}.';';
- delete($token->[2]->{$key});
- }
- }
- $token->[2]->{'onunload'}=&Apache::lonmenu::unloadevents().
- ';'.$onUnload;
- $currentstring .= '<'.$token->[1];
- foreach (keys %{$token->[2]}) {
- $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
+ if (&is_inside_of($tagstack, "head")) {
+ &end_head(@_);
}
- $currentstring.='>';
- $currentstring.=&Apache::lontexconvert::init_math_support();
+ $currentstring =
+ &Apache::loncommon::start_page($Apache::londefdef::title,
+ $Apache::londefdef::head,
+ {'add_entries' => $token->[2],
+ 'no_title' => 1,
+ 'force_register' => 1});
+
if ($env{'request.state'} ne 'published') {
- if ($env{'environment.remote'} eq 'off') {
- $currentstring.=
- &Apache::lonmenu::constspaceform().
- &Apache::lonmenu::menubuttons(1,'web',1);
- }
$currentstring.=(<<EDITBUTTON);
<form method="post">
<input type="submit" name="editmode" accesskey="e" value="Edit" />
</form>
+<br />
EDITBUTTON
- } else {
- $currentstring.=&Apache::lonmenu::menubuttons(undef,$target,1);
}
$currentstring.=&Apache::lonxml::message_location();
} elsif ($target eq 'tex') {
@@ -595,7 +552,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
my $currentstring = &end_p(); # Close off unclosed <p>
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring .= &Apache::lonxml::xmlend($target,$parser);
+ $currentstring .= &Apache::loncommon::end_page({'discussion' => 1});
} elsif ($target eq 'tex') {
$currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}';
}