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

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 29 Mar 2005 10:21:21 -0000


foxr		Tue Mar 29 05:21:21 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Bug 2259: Support a checkbox when in  either advanced roles or when in 
  construction space that allows the user to show all options on option
  response problems.  This correlates with response.pm1 r 1.115
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.371 loncom/interface/lonprintout.pm:1.372
--- loncom/interface/lonprintout.pm:1.371	Mon Mar 28 07:14:13 2005
+++ loncom/interface/lonprintout.pm	Tue Mar 29 05:21:21 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.371 2005/03/28 12:14:13 foxr Exp $
+# $Id: lonprintout.pm,v 1.372 2005/03/29 10:21:21 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -841,6 +841,7 @@
 ENDPART
 
 
+
     # fetch the pagebreaks and store them in the course environment
     # The page breaks will be pulled into the hash %page_breaks which is
     # indexed by symb and contains 1's for each break.
@@ -877,7 +878,18 @@
     my %form;
     $form{'grade_target'} = 'tex';
     $form{'textwidth'}    = &get_textwidth($helper, $LaTeXwidth);
-    
+
+    # If form.showallfoils is set, then request all foils be shown:
+    # privilege will be enforced both by not allowing the 
+    # check box selecting this option to be presnt unless it's ok,
+    # and by lonresponse's priv. check.
+    # The if is here because lonresponse.pm only cares that
+    # showallfoils is defined, not what the value is.
+
+    if ($helper->{'VARS'}->{'showallfoils'} eq "1") { 
+	$form{'showallfoils'} = $helper->{'VARS'}->{'showallfoils'};
+    }
+
     if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
       #-- single document - problem, page, html, xml, ...
 	my ($currentURL,$cleanURL);
@@ -1649,6 +1661,7 @@
     $helper->declareVar('student_sort');
     $helper->declareVar('FINISHPAGE');
     $helper->declareVar('PRINT_TYPE');
+    $helper->declareVar("showallfoils");
 
     #  The page breaks can get loaded initially from the course environment:
 
@@ -2126,6 +2139,20 @@
 				     ['Yes', 'yes'] ];
 	    Apache::lonhelper::dropdown->new();
 	    addMessage("</td></tr>");
+
+            #  If advanced roles, then allow to show all foils.
+
+            if ($ENV{'request.role.adv'}) {
+		addMessage("<tr><td align = 'right'>  </td><td>");
+		$paramHash = Apache::lonhelper::getParamHash();
+		$paramHash->{'multichoice'} = "true";
+		$paramHash->{'allowempty'}  = "true";
+		$paramHash->{'variable'}   = "showallfoils";
+		$paramHash->{'CHOICES'} = [ ["Show all foils", "1"] ];
+		Apache::lonhelper::choices->new();
+		addMessage("</td></tr>");
+            }
+
 	}
 
 	if ($helper->{'VARS'}->{'construction'}) { 
@@ -2147,7 +2174,8 @@
             &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
 	    $helper->{'VARS'}->{'style_file'}=$ENV{'form.style_file_value'};
 	    
-	}
+	} 
+
     }