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

foxr lon-capa-cvs@mail.lon-capa.org
Wed, 24 May 2006 10:49:12 -0000


foxr		Wed May 24 06:49:12 2006 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - Remove stubby stuff for .page which was also causing problems.
  - Allow 2 column printouts to choose margins.. for now symmetrical.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.437 loncom/interface/lonprintout.pm:1.438
--- loncom/interface/lonprintout.pm:1.437	Tue Apr 18 06:03:45 2006
+++ loncom/interface/lonprintout.pm	Wed May 24 06:49:04 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.437 2006/04/18 10:03:45 foxr Exp $
+# $Id: lonprintout.pm,v 1.438 2006/05/24 10:49:04 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1119,8 +1119,6 @@
 	$selectionmade = 1;
 	if ($cleanURL!~m|^/adm/|
 	    && $cleanURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
-	    if ($cleanURL =~/\.page/) {
-	    }
 	    my $rndseed=time;
 	    my $texversion='';
 	    if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
@@ -1321,12 +1319,9 @@
 	    my $texversion='';
 	    if ($urlp!~m|^/adm/|
 		&& $urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
-		if ($urlp =!/\.page/) {
-		}
 		$resources_printed .= $urlp.':';
 
 		&Apache::lonxml::remember_problem_counter();
-
 		$texversion.=&Apache::lonnet::ssi($urlp,%form);
 		if ($urlp=~/\.page$/) {
 		    ($texversion,my $number_of_columns_page) = &page_cleanup($texversion);
@@ -1675,13 +1670,14 @@
 			       $selectionmade, 
 			       $helper->{'VARS'}->{'ANSWER_TYPE'});
     }
-    #changes page's parameters for the one column output 
-    if ($numberofcolumns == 1) {
-	$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
-	$result =~ s/\\textheight\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
-	$result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
-	$result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
-    }
+    &Apache::lonnet::logthis("Resetting page e.g. height -> $helper->{'VARS'}->{'pagesize.height'}");
+    &Apache::lonnet::logthis("Before: $result \n--------------------------\n");
+    $result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
+    $result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
+    $result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
+    $result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
+
+    &Apache::lonnet::logthis("After: $result \n----------------------------------\n");
 
 #-- writing .tex file in prtspool 
     my $temp_file;
@@ -1828,8 +1824,6 @@
 	    if (&Apache::lonnet::allowed('bre',$res_url)) {
 		if ($res_url!~m|^ext/|
 		    && $res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
-		    if ($res_url =~ /\.page/) {
-		    }
 		    $printed .= $curresline.':';
 
 		    &Apache::lonxml::remember_problem_counter();    
@@ -2888,6 +2882,12 @@
         $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />';
     }
 
+    my $width = 18;
+    my $format = $helper->{VARS}->{$self->{'formatvar'}};
+    if (substr($format, 2, 1) ne '1') {
+	$width = 9;
+    }
+
     $result .= <<ELEMENTHTML;
 
 <p>How should the column be formatted?</p>
@@ -2895,7 +2895,7 @@
 <table cellpadding='3'>
   <tr>
     <td align='right'><b>Width</b>:</td>
-    <td align='left'><input type='text' name='$var.width' value='18' size='4'></td>
+    <td align='left'><input type='text' name='$var.width' value='$width' size='4'></td>
     <td align='left'>
       <select name='$var.widthunit'>
         <option>cm</option><option>in</option>
@@ -2936,9 +2936,9 @@
     my $helper = Apache::lonhelper::getHelper();
 
     my $format = $helper->{VARS}->{$self->{'formatvar'}};
-    if (substr($format, 2, 1) ne '1') {
-        $helper->changeState($self->{NEXTSTATE});
-    }
+#    if (substr($format, 2, 1) ne '1') {
+#        $helper->changeState($self->{NEXTSTATE});
+#    }
    
     return 1;
 }