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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 25 Jul 2007 19:15:29 -0000


albertel		Wed Jul 25 15:15:29 2007 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - BUG#5328, really fix the application of a style file in print helper
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.503 loncom/interface/lonprintout.pm:1.504
--- loncom/interface/lonprintout.pm:1.503	Mon Jul 23 18:16:31 2007
+++ loncom/interface/lonprintout.pm	Wed Jul 25 15:15:29 2007
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.503 2007/07/23 22:16:31 albertel Exp $
+# $Id: lonprintout.pm,v 1.504 2007/07/25 19:15:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1371,6 +1371,14 @@
     if ($helper->{'VARS'}->{'showallfoils'} eq "1") { 
 	$form{'showallfoils'} = $helper->{'VARS'}->{'showallfoils'};
     }
+    
+    if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
+	&Apache::lonnet::appenv('construct.style' =>
+				$helper->{'VARS'}->{'style_file'});
+    } elsif ($env{'construct.style'}) {
+	&Apache::lonnet::delenv('construct\\.style');
+    }
+
 
     if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
       #-- single document - problem, page, html, xml, ...
@@ -1394,9 +1402,6 @@
 	    if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
 		my %moreenv;
 		$moreenv{'request.filename'}=$cleanURL;
-		if ($helper->{'VARS'}->{'style_file'}=~/\w/) {
-		    $moreenv{'construct.style'}=$helper->{'VARS'}->{'style_file'};
-		}
                 if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';}
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 		$form{'suppress_tries'}=$parmhash{'suppress_tries'};
@@ -1445,7 +1450,7 @@
 			$texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';
 			my $URLpath=$cleanURL;
 			$URLpath=~s/~([^\/]+)/public_html\/$1\/$1/;
-			$texversion.=&path_to_problem ($URLpath,$LaTeXwidth);
+			$texversion.=&path_to_problem($URLpath,$LaTeXwidth);
 		    }
 		    $texversion.='\vskip 1 mm '.$answer.'\end{document}';
 		}
@@ -2945,7 +2950,11 @@
 	     <message></td></tr><tr><td align="right">
              <label for="style_file">$stylefiletext</label>:
              </td><td></message>
-             <message><input type="text" size="40" name="style_file" value="$stylevalue"  />&nbsp; <a href="javascript:openbrowser('helpform','style_file','sty')">Select style file</a> </td><tr><td></message>
+             <string variable="style_file" size="40">
+		<defaultvalue>
+	            return $env{'construct.style'};
+	        </defaultvalue>
+             </string><message>&nbsp; <a href="javascript:openbrowser('helpform','style_file_forminput','sty')">Select style file</a> </td><tr><td></message>
 	     <choices allowempty="1" multichoice="true" variable="showallfoils">
                 <choice computer="1">Show all foils?</choice>
              </choices>