Diff for /loncom/xml/londefdef.pm between versions 1.326 and 1.327

version 1.326, 2006/04/11 18:42:43 version 1.327, 2006/04/18 20:45:40
Line 79  sub initialize_londefdef { Line 79  sub initialize_londefdef {
     @Apache::londefdef::DT=(0);      @Apache::londefdef::DT=(0);
     @Apache::londefdef::seenDT=(0);      @Apache::londefdef::seenDT=(0);
     $Apache::londefdef::list_index=0;      $Apache::londefdef::list_index=0;
       undef($Apache::londefdef::head);
       undef($Apache::londefdef::title);
 }  }
   
 #======================= TAG SUBROUTINES =====================  #======================= TAG SUBROUTINES =====================
Line 178  sub end_tthoption { Line 180  sub end_tthoption {
 sub start_html {  sub start_html {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     my $options=$env{'course.'.$env{'request.course.id'}.'.tthoptions'};  
     &Apache::lontexconvert::init_tth();      &Apache::lontexconvert::init_tth();
     if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) {      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') {      } elsif ($target eq 'tex') {
  $currentstring .= '\documentclass[letterpaper,twoside]{article}';   $currentstring .= '\documentclass[letterpaper,twoside]{article}';
  if (($env{'form.latex_type'}=~'batchmode') ||   if (($env{'form.latex_type'}=~'batchmode') ||
Line 212  sub end_html { Line 213  sub end_html {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = '</html>';   # end_body takes care of the </html>
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 222  sub start_head { Line 223  sub start_head {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4].&Apache::lonxml::fontsettings();   &Apache::lonxml::startredirection();
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 232  sub end_head { Line 233  sub end_head {
     my $currentstring = '';      my $currentstring = '';
     if (($target eq 'web'      && $env{'request.state'} eq 'published') ||      if (($target eq 'web'      && $env{'request.state'} eq 'published') ||
  ($target eq 'webgrade' && $env{'request.state'} eq 'published')) {   ($target eq 'webgrade' && $env{'request.state'} eq 'published')) {
  $currentstring = &Apache::lonmenu::registerurl(undef,$target).   # in case there is a </head> but no <head>
     $token->[2];       if ($Apache::lonxml::redirection) {
       $Apache::londefdef::head = &Apache::lonxml::endredirection();
    }
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 365  sub end_form { Line 368  sub end_form {
   
 #-- <title> tag (end tag required)  #-- <title> tag (end tag required)
 sub start_title {  sub start_title {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      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') {      } elsif ($target eq 'tex') {
  $currentstring .= '\keephidden{Title of the document:  '    $currentstring .= '\keephidden{Title of the document:  ' 
     }      }
Line 383  sub end_title { Line 387  sub end_title {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       # start_title takes care of swallowing the title
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
     }        }  
Line 518  sub start_body { Line 522  sub start_body {
     &Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems.");      &Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems.");
     return '';      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];   if (&is_inside_of($tagstack, "head")) {
  foreach (keys %{$token->[2]}) {      &end_head(@_);
     $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';  
  }   }
  $currentstring.='>';   $currentstring = 
  $currentstring.=&Apache::lontexconvert::init_math_support();      &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{'request.state'} ne 'published') {
     if ($env{'environment.remote'} eq 'off') {  
  $currentstring.=   
     &Apache::lonmenu::constspaceform().  
     &Apache::lonmenu::menubuttons(1,'web',1);  
     }  
     $currentstring.=(<<EDITBUTTON);      $currentstring.=(<<EDITBUTTON);
 <form method="post">  <form method="post">
 <input type="submit" name="editmode" accesskey="e" value="Edit" />  <input type="submit" name="editmode" accesskey="e" value="Edit" />
 </form>  </form>
   <br />
 EDITBUTTON  EDITBUTTON
  } else {  
     $currentstring.=&Apache::lonmenu::menubuttons(undef,$target,1);  
  }   }
  $currentstring.=&Apache::lonxml::message_location();   $currentstring.=&Apache::lonxml::message_location();
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
Line 595  sub end_body { Line 552  sub end_body {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off unclosed <p>      my $currentstring = &end_p(); # Close off unclosed <p>
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= &Apache::lonxml::xmlend($target,$parser);   $currentstring .= &Apache::loncommon::end_page({'discussion' => 1});
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}';     $currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}';  
     }       } 

Removed from v.1.326  
changed lines
  Added in v.1.327


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>