--- loncom/interface/lonprintout.pm 2010/05/10 10:21:24 1.575.2.1
+++ loncom/interface/lonprintout.pm 2010/05/11 11:10:19 1.575.2.2
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.575.2.1 2010/05/10 10:21:24 foxr Exp $
+# $Id: lonprintout.pm,v 1.575.2.2 2010/05/11 11:10:19 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -74,8 +74,23 @@ my $ssi_retry_count = 5; # Some arbit
my $font_size = 'normalsize'; # Default is normalsize...
+#
+# Useful filters that will be filled in by printHelper.
+# These are put here to support modularizing helpers into
+# less of a helper soup than it was originally:
+# These can't be filled in here as there's some conditionalization
+# involved.
+#
+
+my $isProblem;
+my $isProblemOrMap;
+my $isNotMap;
+my $isMap;
+my $symbFilter;
+
#---------------------------- Helper helpers. -------------------------
+
# Returns the text needd for a student chooser.
# that text must still be parsed by the helper xml parser.
# Parameters:
@@ -239,6 +254,42 @@ CHOOSE_ANON1
return $result;
}
+# Returns the XML for the states associated with choosing incomplete problems
+# for selected students:
+# Paramterss:
+# helper - reference to the helper.
+# map - Map within which to generate the selector.
+# base_state - The first/base state of the helper subsegment.
+#
+#
+#
+# States we will use:
+# $base_state - Selects resources.
+# $base_state.WHO - Selects the people to display.
+# $base_state.FORMAT - Selects the final print format etc.
+#
+
+sub generate_incomplete_states {
+ my ($helper, $map, $base_state) = @_;
+ my $result = '';
+
+ $result .= &generate_resource_chooser(
+ $base_state,
+ 'Select Problem(s) to print.',
+ "multichoice='1' addstatus='1'",
+ 'RESOURCES',
+ $base_state.'WHO',
+ '',
+ '$res->is_incomplete()'
+ );
+ $result .= &generate_student_chooser(
+ $base_state.'WHO',
+ 'student_sort',
+ 'STUDENTS',
+ $base_state.'FORMAT');
+ return $result;
+}
+
#-----------------------------------------------------------------------
# Fetch the contents of a resource, uninterpreted.
@@ -3642,7 +3693,11 @@ sub printHelper {
}
- # Detect whether we're coming from construction space
+ # Detect whether we're coming from construction space. If so,
+ # $helper->{VARS}->{'construction'} will be defined and true.
+ # Otherwise, if this is a post, load the helper 'postdata' var with
+ # the posted form data.
+
if (
$env{'form.postdata'} =~ /^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/ )
{
@@ -3755,15 +3810,16 @@ sub printHelper {
}
# Useful filter strings
- my $isProblem =
+ $isProblem =
'($res->is_problem()||$res->contains_problem||$res->is_practice()) ';
$isProblem .= ' && !$res->randomout()' if !$userCanSeeHidden;
- my $isProblemOrMap =
+ $isProblemOrMap =
'$res->is_problem() || $res->contains_problem() || $res->is_sequence() || $res->is_practice()';
- my $isNotMap = '!$res->is_sequence()';
+ $isNotMap = '!$res->is_sequence()';
$isNotMap .= ' && !$res->randomout()' if !$userCanSeeHidden;
- my $isMap = '$res->is_map()';
- my $symbFilter = '$res->shown_symb()';
+ $isMap = '$res->is_map()';
+ $symbFilter = '$res->shown_symb()';
+
my $urlValue = '$res->link()';
$helper->declareVar('SEQUENCE');
@@ -3949,9 +4005,22 @@ sub printHelper {
ALL_PROBLEMS
+ #
+ # Support printing incompleteproblems.:
+ #
+ push @{$printChoices},
+ [
+ &mtn('Incomplete Problems from entire course for selected people'),
+ 'incomplete_problems_students',
+ 'INCOMPLETE_PROBLEMS_STUDENTS'
+ ];
+
&Apache::lonxml::xmlparse(
$r, 'helper',
- &generate_resource_chooser(
+ &generate_incomplete_states($helper, $map,
+ 'INCOMPLETE_PROBLEMS_STUDENTS')
+
+ .&generate_resource_chooser(
'ALL_PROBLEMS',
'SelectProblem(s) to print',
'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',