[LON-CAPA-cvs] cvs: loncom(bz2851) /interface lonprintout.pm
foxr
foxr@source.lon-capa.org
Tue, 13 Oct 2009 11:01:17 -0000
This is a MIME encoded message
--foxr1255431677
Content-Type: text/plain
foxr Tue Oct 13 11:01:17 2009 EDT
Modified files: (Branch: bz2851)
/loncom/interface lonprintout.pm
Log:
BZ2851 - Make selected CODE problems from .page work correctly.
--foxr1255431677
Content-Type: text/plain
Content-Disposition: attachment; filename="foxr-20091013110117.txt"
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.560.2.5 loncom/interface/lonprintout.pm:1.560.2.6
--- loncom/interface/lonprintout.pm:1.560.2.5 Mon Oct 12 10:59:48 2009
+++ loncom/interface/lonprintout.pm Tue Oct 13 11:01:16 2009
@@ -4,7 +4,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.560.2.5 2009/10/12 10:59:48 foxr Exp $
+# $Id: lonprintout.pm,v 1.560.2.6 2009/10/13 11:01:16 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -171,7 +171,87 @@
return $result;
}
+#
+# Generate the helper XML for a code choice helper dialog:
+#
+# Paramters:
+# $helper - Reference to the helper.
+# $state - Name of the state for the chooser.
+# $next_state - Name fo the state to follow the chooser.
+# $bubble_types - Populates the bubble sheet type dropt down.
+# $code_selections - Provides set of code choices that have been used
+# $saved_codes - Provides the list of saved codes.
+#
+# Returns;
+# The Xml of the code chooser.
+#
+sub generate_code_selector {
+ my ($helper,
+ $state,
+ $next_state,
+ $bubble_types,
+ $code_selections,
+ $saved_codes) = @_; # Unpack the parameters.
+
+ my $result = <<CHOOSE_ANON1;
+ <state name="$state" title="Specify CODEd Assignments">
+ <nextstate>$next_state</nextstate>
+ <message><h4>Fill out one of the forms below</h4></message>
+ <message><br /><hr /> <br /></message>
+ <message><h3>Generate new CODEd Assignments</h3></message>
+ <message><table><tr><td><b>Number of CODEd assignments to print:</b></td><td></message>
+ <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5">
+ <validator>
+ if (((\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'}+0) < 1) &&
+ !\$helper->{'VARS'}{'REUSE_OLD_CODES'} &&
+ !\$helper->{'VARS'}{'SINGLE_CODE'} &&
+ !\$helper->{'VARS'}{'CODE_SELECTED_FROM_LIST'}) {
+ return "You need to specify the number of assignments to print";
+ }
+ return undef;
+ </validator>
+ </string>
+ <message></td></tr><tr><td></message>
+ <message><b>Names to save the CODEs under for later:</b></message>
+ <message></td><td></message>
+ <string variable="ANON_CODE_STORAGE_NAME" maxlength="50" size="20" />
+ <message></td></tr><tr><td></message>
+ <message><b>Bubble sheet type:</b></message>
+ <message></td><td></message>
+ <dropdown variable="CODE_OPTION" multichoice="0" allowempty="0">
+ $bubble_types
+ </dropdown>
+ <message></td></tr><tr><td colspan="2"></td></tr><tr><td></message>
+ <message></td></tr><tr><td></table></message>
+ <message><br /><hr /><h3>Print a Specific CODE </h3><br /><table></message>
+ <message><tr><td><b>Enter a CODE to print:</b></td><td></message>
+ <string variable="SINGLE_CODE" size="10">
+ <validator>
+ if(!\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'} &&
+ !\$helper->{'VARS'}{'REUSE_OLD_CODES'} &&
+ !\$helper->{'VARS'}{'CODE_SELECTED_FROM_LIST'}) {
+ return &Apache::lonprintout::is_code_valid(\$helper->{'VARS'}{'SINGLE_CODE'},
+ \$helper->{'VARS'}{'CODE_OPTION'});
+ } else {
+ return undef; # Other forces control us.
+ }
+ </validator>
+ </string>
+ <message></td></tr><tr><td></message>
+ $code_selections
+ <message></td></tr></table></message>
+ <message><hr /><h3>Reprint a Set of Saved CODEs</h3><table><tr><td></message>
+ <message><b>Select saved CODEs:</b></message>
+ <message></td><td></message>
+ <dropdown variable="REUSE_OLD_CODES">
+ $saved_codes
+ </dropdown>
+ <message></td></tr></table></message>
+ </state>
+CHOOSE_ANON1
+ return $result;
+}
#-----------------------------------------------------------------------
@@ -2373,6 +2453,7 @@
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
$result .= $print_array[0].' \end{document}';
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon') ||
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon_page') ||
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon') ) {
my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
@@ -3279,7 +3360,7 @@
'problems_for_students_from_page', 'CHOOSE_TGT_STUDENTS_PAGE'];
push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from page [_3] for [_4]CODEd assignments[_5]',
'<b>', '</b>', '<b><i>'.$page_title.'</i></b>', '<b>', '</b>'),
- 'problems_for_anon', 'CHOOSE_ANON1_PAGE'];
+ 'problems_for_anon_page', 'CHOOSE_ANON1_PAGE'];
}
push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from folder [_3] for [_4]selected people[_5]',
'<b>','</b>','<b><i>'.$sequenceTitle.'</i></b>','<b>','</b>'),
@@ -3411,63 +3492,32 @@
if ($codechoice eq '') {
$codechoice='<choice computer="default">Default</choice>';
}
- &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1);
- <state name="CHOOSE_ANON1" title="Specify CODEd Assignments">
- <nextstate>SELECT_PROBLEMS</nextstate>
- <message><h4>Fill out one of the forms below</h4></message>
- <message><br /><hr /> <br /></message>
- <message><h3>Generate new CODEd Assignments</h3></message>
- <message><table><tr><td><b>Number of CODEd assignments to print:</b></td><td></message>
- <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5">
- <validator>
- if (((\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'}+0) < 1) &&
- !\$helper->{'VARS'}{'REUSE_OLD_CODES'} &&
- !\$helper->{'VARS'}{'SINGLE_CODE'} &&
- !\$helper->{'VARS'}{'CODE_SELECTED_FROM_LIST'}) {
- return "You need to specify the number of assignments to print";
- }
- return undef;
- </validator>
- </string>
- <message></td></tr><tr><td></message>
- <message><b>Names to save the CODEs under for later:</b></message>
- <message></td><td></message>
- <string variable="ANON_CODE_STORAGE_NAME" maxlength="50" size="20" />
- <message></td></tr><tr><td></message>
- <message><b>Bubble sheet type:</b></message>
- <message></td><td></message>
- <dropdown variable="CODE_OPTION" multichoice="0" allowempty="0">
- $codechoice
- </dropdown>
- <message></td></tr><tr><td colspan="2"></td></tr><tr><td></message>
- <message></td></tr><tr><td></table></message>
- <message><br /><hr /><h3>Print a Specific CODE </h3><br /><table></message>
- <message><tr><td><b>Enter a CODE to print:</b></td><td></message>
- <string variable="SINGLE_CODE" size="10">
- <validator>
- if(!\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'} &&
- !\$helper->{'VARS'}{'REUSE_OLD_CODES'} &&
- !\$helper->{'VARS'}{'CODE_SELECTED_FROM_LIST'}) {
- return &Apache::lonprintout::is_code_valid(\$helper->{'VARS'}{'SINGLE_CODE'},
- \$helper->{'VARS'}{'CODE_OPTION'});
- } else {
- return undef; # Other forces control us.
- }
- </validator>
- </string>
- <message></td></tr><tr><td></message>
- $code_selection
- <message></td></tr></table></message>
- <message><hr /><h3>Reprint a Set of Saved CODEs</h3><table><tr><td></message>
- <message><b>Select saved CODEs:</b></message>
- <message></td><td></message>
- <dropdown variable="REUSE_OLD_CODES">
- $namechoice
- </dropdown>
- <message></td></tr></table></message>
- </state>
- $resource_selector
-CHOOSE_ANON1
+ my $anon1 = &generate_code_selector($helper,
+ 'CHOOSE_ANON1',
+ 'SELECT_PROBLEMS',
+ $codechoice,
+ $code_selection,
+ $namechoice) . $resource_selector;
+
+
+ &Apache::lonxml::xmlparse($r, 'helper',$anon1);
+
+ my $anon_page = &generate_code_selector($helper,
+ 'CHOOSE_ANON1_PAGE',
+ 'SELECT_PROBLEMS_PAGE',
+ $codechoice,
+ $code_selection,
+ $namechoice) .
+ &generate_resource_chooser('SELECT_PROBLEMS_PAGE',
+ 'Select Problem(s) to print',
+ "multichoice='1' addstatus='1' closeallpages ='1'",
+ 'RESOURCES',
+ 'PRINT_FORMATTING',
+ $url,
+ $isProblem, '', $symbFilter,
+ $start_new_option);
+ &Apache::lonnet::logthis('XML for anonpage: '.$anon_page);
+ &Apache::lonxml::xmlparse($r, 'helper', $anon_page);
if ($helper->{VARS}->{'assignment'}) {
--foxr1255431677--