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

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 01 Jul 2002 20:56:20 -0000


sakharuk		Mon Jul  1 16:56:20 2002 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  start work with different page layouts
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.35 loncom/interface/lonprintout.pm:1.36
--- loncom/interface/lonprintout.pm:1.35	Mon Jul  1 11:02:54 2002
+++ loncom/interface/lonprintout.pm	Mon Jul  1 16:56:20 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.35 2002/07/01 15:02:54 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.36 2002/07/01 20:56:20 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -85,8 +85,19 @@
     $r->print(<<ENDMENUOUT3);
 <br /><hr /><br />
 <h1>And what page format do you prefer?</h1>
-<input type="radio" name="layout" value="CBI"> Two columns landscape <br />
-<input type="radio" name="layout" value="CAPA" checked>  Two columns portrait <br />
+<table>
+ <tr>
+   <td>
+     <input type="radio" name="layout" value="CBI"> Landscape <br />
+     <input type="radio" name="layout" value="CAPA" checked>  Portrait <br />
+   </td>
+   <td>&nbsp;</td>
+   <td rawspan="2">
+     Number of columns: <input type="text" size="2" name="numberofcolumns" value="2"> 
+   </td>
+ </tr>
+</table>
+</br> 
 <input type="submit" value="Submit your choice">
 </form>
 </body>
@@ -110,11 +121,13 @@
 
     my $choice = $ENV{'form.choice'};
     my $layout = $ENV{'form.layout'};
+    my $numberofcolumns = $ENV{'form.numberofcolumns'};               
     my $laystyle = 'book';
     my $result = '';
     my $number_of_columns = 1;
-
+ 
     if ($choice eq 'Standard LaTeX output for current document') {
+      #-- single document - problem, page, html, xml  
       my %moreenv;
       $moreenv{'form.grade_target'}='tex';
       $moreenv{'request.filename'}=$ENV{'form.url'};
@@ -125,24 +138,24 @@
       $result = &additional_cleanup($result);
       if ($ENV{'form.url'}=~m/\.page\s*$/) {($result,$number_of_columns) = &page_cleanup($result);}
     } elsif ($choice eq 'Standard LaTeX output for the primary sequence' or $choice eq 'Standard LaTeX output for whole primary sequence') {
-#-- where is the primary sequence containing file?
-	my %moreenv;
+      #-- minimal sequence to which the current document belongs
+        #-- where is the primary sequence containing file?
 	my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'});
 	$_ = $symbolic;
 	m/([^_]+)_/;
 	my $primary_sequence = '/res/'.$1;
-#-- open and analyses the primary sequence
+        #-- open and analyses the primary sequence
 	my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence);
 	my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file);
 	my @master_seq = &content_map($sequencefilecontents);
-#-- produce an output string
+        #-- produce an output string
 	for (my $i=0;$i<=$#master_seq;$i++) {
 	    $_ = $master_seq[$i];
 	    m/\"(.*)\"/;
             $_ = $1;
-            my $urlp = $1;
+            my $urlp = $1;		
 	    if ($choice eq 'Standard LaTeX output for the primary sequence') {
-		if (/\.(problem|exam|quiz|assess|survey|form|library)/) {
+		if ($urlp =~ m/\.(problem|exam|quiz|assess|survey|form|library)/) {
 		    my %moreenv;
 		    $moreenv{'form.grade_target'}='tex';
 		    &Apache::lonnet::appenv(%moreenv);
@@ -151,6 +164,7 @@
 		    $result .= $texversion;        
 		}
 	    } else {
+		my %moreenv;
 		$moreenv{'form.grade_target'}='tex';
 		&Apache::lonnet::appenv(%moreenv);
 		my $texversion=&Apache::lonnet::ssi($urlp);
@@ -232,7 +246,8 @@
 	
     }
 #-- corrections for the different page formats
-    if ($layout eq 'CBI') {
+    if ($layout eq 'CBI' and $numberofcolumns eq '1') {
+    } elsif ($layout eq 'CBI' and $numberofcolumns eq '2') {
 	$result =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{-40pt}\\setlength{\\evensidemargin}{-60pt}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{4\.4in}\\setlength{\\textheight}{6\.8in}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt} \\begin{document}/;
         $laystyle = 'album';
     } elsif ($layout eq 'CAPA') {