[LON-CAPA-cvs] cvs: rat / lonpage.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 20 Jun 2002 17:47:35 -0000


sakharuk		Thu Jun 20 13:47:35 2002 EDT

  Modified files:              
    /rat	lonpage.pm 
  Log:
  can print pages, but 1. somebody needs to define the width of minipage
  inside the table (corresponds to HTML table) 2. if the table is sufficiently
  large somebody has to split the table. Now I am trying to resolve these 
  problems.
  
  
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.39 rat/lonpage.pm:1.40
--- rat/lonpage.pm:1.39	Mon May 27 08:04:36 2002
+++ rat/lonpage.pm	Thu Jun 20 13:47:35 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.39 2002/05/27 12:04:36 www Exp $
+# $Id: lonpage.pm,v 1.40 2002/06/20 17:47:35 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -147,7 +147,7 @@
        if ($ENV{'browser.mathml'}) {
            $r->content_type('text/xml');
        } else {
-           $r->content_type('text/html');
+           $r->content_type('text/html'); 
        }
        $r->send_http_header;
        return OK;
@@ -196,6 +196,7 @@
 
 # ------------------------------------------------------------------ Page parms
 
+                  my $number_of_columns = 1;
                   my $j;
                   my $lcm=1;
                   my $contents=0;
@@ -366,8 +367,19 @@
 			  if ($nforms) {
 			      $r->print('<form method="post" action="'.
 					$requrl.'">');
-			  }		      
+			  }
+		      } else {
+			  $r->print('\documentclass[letterpaper]{article}
+                                 \newcommand{\keephidden}[1]{}           
+                                 \usepackage[dvips]{graphicx}
+                                 \usepackage{epsfig}
+                                 \usepackage{calc}
+                                 \begin{document}');
+		      }
 # ----------------------------------------------------------------- Start table
+		      if ($target eq 'tex') {
+			  $r->print('\begin{tabular}INSERT');
+		      } else {
 			  $r->print('<table cols="'.$lcm.'" border="0">');
 		      }
                       for ($i=0;$i<=$#rows;$i++) {
@@ -448,15 +460,23 @@
                               }
 			      unless ($target eq 'tex') {
 				  $r->print('</td>');
+			      } else {
+				  $number_of_columns++;
+				  $r->print(' & ');
 			      }
                           }
 			      unless ($target eq 'tex') {
 				  $r->print('</tr>');
+			      } else {
+				  $number_of_columns = 1;
+				  $r->print('REMOVE\\\\');
 			      }
 		        }
                       }
 		      unless ($target eq 'tex') {
 			  $r->print("\n</table>");
+		      } else {
+			  $r->print('\end{tabular}');
 		      }
 # ---------------------------------------------------------------- Submit, etc.
                       if ($nforms) {
@@ -464,7 +484,11 @@
 	                  '<input name="all_submit" value="Submit All" type="'.
 			  (($nforms>1)?'submit':'hidden').'"></input></form>');
                       }
-                      $r->print('</body>'.&Apache::lonxml::xmlend());
+		      unless ($target eq 'tex') {
+			  $r->print('</body>'.&Apache::lonxml::xmlend());
+		      } else {
+			  $r->print('\end{document}'.$number_of_columns);
+		      }
 # -------------------------------------------------------------------- End page
                   }                  
 # ------------------------------------------------------------- End render page