[LON-CAPA-cvs] cvs: loncom /interface lonhelp.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 17 Jul 2007 22:07:52 -0000


albertel		Tue Jul 17 18:07:52 2007 EDT

  Modified files:              
    /loncom/interface	lonhelp.pm 
  Log:
  - BUG#5320, wasn't initing tth (through start_page) befroe using it indisplaying help so incorrect entities were being emitted
  - clean out uneeded serverrrot variable
  
  
Index: loncom/interface/lonhelp.pm
diff -u loncom/interface/lonhelp.pm:1.35 loncom/interface/lonhelp.pm:1.36
--- loncom/interface/lonhelp.pm:1.35	Tue Apr 17 11:45:03 2007
+++ loncom/interface/lonhelp.pm	Tue Jul 17 18:07:52 2007
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonhelp.pm,v 1.35 2007/04/17 15:45:03 www Exp $
+# $Id: lonhelp.pm,v 1.36 2007/07/17 22:07:52 albertel Exp $
 #
 # .tex help system web server handler
 #
@@ -60,14 +60,8 @@
     my ($r,$text) = @_;
     my $bugs=&Apache::loncommon::help_open_bug('Documentation','Report a documentation bug');
     my $morehelp;#=&Apache::loncommon::help_open_menu(undef,undef,1,undef,undef,undef,undef,'Help and Assistance Menu');
-    my $start_page=
-	&Apache::loncommon::start_page('LON-CAPA Help',undef,
-				       {'only_body' => 1,});
-    my $end_page=
-	&Apache::loncommon::end_page();
     my $header=&mt('LON-CAPA Help');
     $r->print(<<HEADER);
-    $start_page
     <h3 style="font: sans-serif"><img align="right" alt="help logo"
     src="/adm/help/gif/lonhelpheader.gif"/>$header</h3><hr />
     <!-- BEGIN -->
@@ -92,7 +86,6 @@
 
     $r->print(<<ENDBODY);
     <!-- END -->
-    $end_page
 ENDBODY
 
 }
@@ -100,7 +93,7 @@
 # Render takes a tex fragment, transforms it for TtH, and returns the
 # HTML equivalent
 sub render {
-    my ($tex, $docroot, $serverroot) = @_;
+    my ($tex, $docroot) = @_;
     tie (my %fragmentLabels, 'GDBM_File', $docroot . '/adm/help/fragmentLabels.gdbm', 0, 0);
 
     # This tells TtH what to do with captions, labels, and other
@@ -197,10 +190,12 @@
      my $r = shift;
 
      my $docroot = $r->dir_config('lonDocRoot');
-     my $serverroot = $ENV{'HTTP_HOST'};
 
      &Apache::lonlocal::get_language_handle($r);
      &Apache::loncommon::content_type($r,"text/html");
+     my $start_page=
+	 &Apache::loncommon::start_page('LON-CAPA Help',undef,
+					{'only_body' => 1,});
      my $text='';
      if ($env{'form.searchterm'}=~/\w/) {
 	 ($text,my $matches)=&listmatches($docroot,$env{'form.searchterm'},&Apache::lonlocal::current_language().'/');
@@ -243,11 +238,14 @@
 	     $tex .= join('', <$file>);
 	 }
 
-	 $text = &render($tex, $docroot, $serverroot);
+	 $text = &render($tex, $docroot);
      }
 
      $r->send_http_header;
+     $r->print($start_page);
      &servetext($r,$text);
+     $r->print(&Apache::loncommon::end_page());
+
      return OK;
 }