version 1.560.2.2, 2009/08/25 10:57:18
|
version 1.560.2.3, 2009/09/08 10:53:15
|
Line 1
|
Line 1
|
|
# |
|
# Issues: |
|
# - Need to get the state flow for selected problems/resources for students |
|
# correct |
|
# - Need to do the CODEd stuff. |
|
# - Need to regularize and figure out for each case who puts on the latex |
|
# front matter and make sure it gets done. |
|
# |
|
# |
|
|
# The LearningOnline Network |
# The LearningOnline Network |
# Printout |
# Printout |
# |
# |
Line 111 CHOOSE_STUDENTS
|
Line 121 CHOOSE_STUDENTS
|
return $result; |
return $result; |
} |
} |
|
|
|
# Generate the text needed for a resource chooser given the top level of |
|
# the sequence/page |
|
# |
|
# Parameters: |
|
# this_state - State name of the chooser. |
|
# prompt_text - Text to use to prompt user. |
|
# resource_options - Resource tag options e.g. |
|
# "multichoice='1', toponly='1', addstatus='1'" |
|
# that control the selection and appearance of the |
|
# resource selector. |
|
# variable - Name of the variable to hold the choice |
|
# next_state - Name of the next state the helper should transition |
|
# to |
|
# top_url - Top level URL within which to make the selector. |
|
# If empty the top level sequence is shown. |
|
# filter - How to filter the resources. |
|
# value_func - <valuefunc> function. |
|
# choice_func - If not empty generates a <choicefunc> with this function. |
|
# start_new_option |
|
# - Fragment appended after valuefunc. |
|
# |
|
# |
|
sub generate_resource_chooser { |
|
my ($this_state, |
|
$prompt_text, |
|
$resource_options, |
|
$variable, |
|
$next_state, |
|
$top_url, |
|
$filter, |
|
$choice_func, |
|
$value_func, |
|
$start_new_option) = @_; |
|
|
|
|
|
my $result = <<CHOOSE_RESOURCES; |
|
<state name="$this_state" title="$prompt_text"> |
|
<resource variable="$variable" $resource_options |
|
closeallpages="1"> |
|
<nextstate>$next_state</nextstate> |
|
<filterfunc>return $filter;</filterfunc> |
|
CHOOSE_RESOURCES |
|
if ($value_func ne '') { |
|
$result .= "<choicefunc>return $choice_func;</choicefunc>"; |
|
} |
|
if ($top_url ne '') { |
|
$result .= "<mapurl>$top_url</mapurl>"; |
|
} |
|
$result .= <<CHOOSE_RESOURCES; |
|
<valuefunc>return $value_func;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
CHOOSE_RESOURCES |
|
|
|
return $result; |
|
} |
|
|
|
|
#----------------------------------------------------------------------- |
#----------------------------------------------------------------------- |
|
|
|
|
Line 3080 sub printHelper {
|
Line 3149 sub printHelper {
|
'map_resources_in_page', |
'map_resources_in_page', |
'CHOOSE_RESOURCES_PAGE']; |
'CHOOSE_RESOURCES_PAGE']; |
} |
} |
my $helperFragment = <<HELPERFRAGMENT; |
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE', |
<state name="CHOOSE_PROBLEMS_PAGE" title="Select Problem(s) to print"> |
'Select Problem(s) to print', |
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
"multichoice='1' toponly='1', addstatus='1' closeallpages='1'", |
closeallpages="1"> |
'RESOURCES', |
<nextstate>PAGESIZE</nextstate> |
'PAGESIZE', |
<filterfunc>return $isProblem;</filterfunc> |
$url, |
<mapurl>$url</mapurl> |
$isProblem, '', $symbFilter, |
<valuefunc>return $symbFilter;</valuefunc> |
$start_new_option); |
$start_new_option |
|
</resource> |
|
</state> |
$helperFragment .= &generate_resource_chooser('CHOOSE_RESOURCES_PAGE', |
|
'Select Resource(s) to print', |
|
'multichoice="1" toponly="1" addstatus="1" closeallpages="1"', |
|
'RESOURCES', |
|
'PAGESIZE', |
|
$url, |
|
$isNotMap, '', $symbFilter, |
|
$start_new_option); |
|
|
|
|
|
|
|
|
<state name="CHOOSE_RESOURCES_PAGE" title="Select Resource(s) to print"> |
|
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
|
closeallpages="1"> |
|
<nextstate>PAGESIZE</nextstate> |
|
<filterfunc>return $isNotMap;</filterfunc> |
|
<mapurl>$url</mapurl> |
|
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
HELPERFRAGMENT |
|
|
|
&Apache::lonxml::xmlparse($r, 'helper', $helperFragment); |
&Apache::lonxml::xmlparse($r, 'helper', $helperFragment); |
|
|
} |
} |
} |
} |
|
|
if (($helper->{'VARS'}->{'construction'} ne '1' ) && |
if (($helper->{'VAR'}->{'construction'} ne '1' ) && |
$helper->{VARS}->{'postdata'} && |
$helper->{VARS}->{'postdata'} && |
$helper->{VARS}->{'assignment'}) { |
$helper->{VARS}->{'assignment'}) { |
# Allow problems from sequence |
# Allow problems from sequence |
Line 3122 HELPERFRAGMENT
|
Line 3190 HELPERFRAGMENT
|
'map_problems_pages', |
'map_problems_pages', |
'CHOOSE_PROBLEMS_HTML']; |
'CHOOSE_PROBLEMS_HTML']; |
&Apache::lonnet::logthis("Map url : $map"); |
&Apache::lonnet::logthis("Map url : $map"); |
my $helperFragment = <<HELPERFRAGMENT; |
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS', |
<state name="CHOOSE_PROBLEMS" title="Select Problem(s) to print"> |
'Select Problem(s) to print', |
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
'multichoice="1" toponly="1" addstatus="1" closeallpages="1"', |
closeallpages="1"> |
'RESOURCES', |
<nextstate>PAGESIZE</nextstate> |
'PAGESIZE', |
<filterfunc>return $isProblem;</filterfunc> |
$map, |
<mapurl>$map</mapurl> |
$isProblem, '', |
<valuefunc>return $symbFilter;</valuefunc> |
$symbFilter, |
$start_new_option |
$start_new_option); |
</resource> |
$helperFragment .= &generate_resource_chooser('CHOOSE_PROBLEMS_HTML', |
</state> |
'Select Resource(s) to print', |
|
'multichoice="1" toponly="1" addstatus="1" closeallpages="1"', |
<state name="CHOOSE_PROBLEMS_HTML" title="Select Resource(s) to print"> |
'RESOURCES', |
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1" |
'PAGESIZE', |
closeallpages="1"> |
$map, |
<nextstate>PAGESIZE</nextstate> |
$isNotMap, '', |
<filterfunc>return $isNotMap;</filterfunc> |
$symbFilter, |
<mapurl>$map</mapurl> |
$start_new_option); |
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
HELPERFRAGMENT |
|
|
|
&Apache::lonxml::xmlparse($r, 'helper', $helperFragment); |
&Apache::lonxml::xmlparse($r, 'helper', $helperFragment); |
} |
} |
Line 3158 HELPERFRAGMENT
|
Line 3221 HELPERFRAGMENT
|
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES']; |
push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES']; |
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b> for <b>selected people</b>'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS']; |
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b> for <b>selected people</b>'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS']; |
&Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS); |
my $suffixXml = <<ALL_PROBLEMS; |
<state name="ALL_PROBLEMS" title="Select Problem(s) to print"> |
|
<resource variable="RESOURCES" toponly='0' multichoice="1" |
|
suppressEmptySequences='0' addstatus="1" closeallpages="1"> |
|
<nextstate>PAGESIZE</nextstate> |
|
<filterfunc>return $isProblemOrMap;</filterfunc> |
|
<choicefunc>return $isNotMap;</choicefunc> |
|
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
<state name="ALL_RESOURCES" title="Select Resource(s) to print"> |
|
<resource variable="RESOURCES" toponly='0' multichoice='1' |
|
suppressEmptySequences='0' addstatus='1' closeallpages='1'> |
|
<nextstate>PAGESIZE</nextstate> |
|
<filterfunc>return $isNotMap; </filterfunc> |
|
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
<state name="ALL_PROBLEMS_STUDENTS" title="Select Problem(s) to print"> |
|
<resource variable="RESOURCES" toponly='0' multichoice="1" |
|
suppressEmptySequences='0' addstatus="1" closeallpages="1"> |
|
<nextstate>STUDENTS1</nextstate> |
|
<filterfunc>return $isProblemOrMap;</filterfunc> |
|
<choicefunc>return $isNotMap;</choicefunc> |
|
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
<state name="STUDENTS1" title="Select People"> |
<state name="STUDENTS1" title="Select People"> |
<message><b>Select sorting order of printout</b> </message> |
<message><b>Select sorting order of printout</b> </message> |
<choices variable='student_sort'> |
<choices variable='student_sort'> |
Line 3197 HELPERFRAGMENT
|
Line 3231 HELPERFRAGMENT
|
<message><br /><hr /><br /> </message> |
<message><br /><hr /><br /> </message> |
<student multichoice='1' variable="STUDENTS" nextstate="PRINT_FORMATTING" coursepersonnel="1"/> |
<student multichoice='1' variable="STUDENTS" nextstate="PRINT_FORMATTING" coursepersonnel="1"/> |
</state> |
</state> |
|
|
ALL_PROBLEMS |
ALL_PROBLEMS |
|
&Apache::lonxml::xmlparse($r, 'helper', |
|
&generate_resource_chooser('ALL_PROBLEMS', |
|
'SelectProblem(s) to print', |
|
'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"', |
|
'RESOURCES', |
|
'PAGESIZE', |
|
'', |
|
$isProblemOrMap, $isNotMap, |
|
$symbFilter, |
|
$start_new_option) . |
|
&generate_resource_chooser('ALL_RESOURCES', |
|
'Select Resource(s) to print', |
|
" toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1'", |
|
'RESOURCES', |
|
'PAGESIZE', |
|
'', |
|
$isNotMap,,$symbFilter, |
|
$start_new_option) . |
|
&generate_resource_chooser('ALL_PROBLEMS_STUDENTS', |
|
'Select Problem(s) to print', |
|
'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"', |
|
'RESOURCES', |
|
'STUDENTS1', |
|
'', |
|
$isProblemOrMap, , $symbFilter, |
|
$start_new_option) . |
|
$suffixXml |
|
); |
|
|
if ($helper->{VARS}->{'assignment'}) { |
if ($helper->{VARS}->{'assignment'}) { |
|
|
Line 3233 ALL_PROBLEMS
|
Line 3294 ALL_PROBLEMS
|
# with one state, and use REGEXPs at inclusion time to set state names |
# with one state, and use REGEXPs at inclusion time to set state names |
# and next states for better mix and match capability |
# and next states for better mix and match capability |
# |
# |
my $resource_selector=<<RESOURCE_SELECTOR; |
my $resource_selector= &generate_resource_chooser('SELECT_PROBLEMS', |
<state name="SELECT_PROBLEMS" title="Select resources to print"> |
'Select resources to print', |
$randomly_ordered_warning |
'multichoice="1" addstatus="1" closeallpages="1"', |
|
'RESOURCES', |
<nextstate>PRINT_FORMATTING</nextstate> |
'PRINT_FORMATTING', |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
'', |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
$isProblem, , $symbFilter, |
closeallpages="1"> |
$start_new_option); |
<filterfunc>return $isProblem;</filterfunc> |
$resource_selector .= <<RESOURCE_SELECTOR; |
<mapurl>$map</mapurl> |
|
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
<state name="PRINT_FORMATTING" title="How should results be printed?"> |
<state name="PRINT_FORMATTING" title="How should results be printed?"> |
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message> |
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message> |
<choices variable="EMPTY_PAGES"> |
<choices variable="EMPTY_PAGES"> |
Line 3271 RESOURCE_SELECTOR
|
Line 3327 RESOURCE_SELECTOR
|
|
|
|
|
|
|
# &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS); |
|
# <state name="CHOOSE_STUDENTS" title="Select Students and Resources"> |
|
# <message><b>Select sorting order of printout</b> </message> |
|
# <choices variable='student_sort'> |
|
# |
|
# |
|
# <choice computer='0'>Sort by section then student</choice> |
|
# <choice computer='1'>Sort by students across sections.</choice> |
|
# </choices> |
|
# <message><br /><hr /><br /> </message> |
|
# <student multichoice='1' variable="STUDENTS" nextstate="SELECT_PROBLEMS" coursepersonnel="1"/> |
|
# </state> |
|
&Apache::lonxml::xmlparse($r, 'helper', |
&Apache::lonxml::xmlparse($r, 'helper', |
&generate_student_chooser('CHOOSE_STUDENTS', |
&generate_student_chooser('CHOOSE_STUDENTS', |
'student_sort', |
'student_sort', |
'STUDENTS', |
'STUDENTS', |
'SELECT_PROBLEMS')); |
'SELECT_PROBLEMS')); |
&Apache::lonxml::xmlparse($r, 'helper', $resource_selector); |
&Apache::lonxml::xmlparse($r, 'helper', $resource_selector); |
# $resource_selector |
|
# CHOOSE_STUDENTS |
|
|
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
Line 3416 CHOOSE_ANON1
|
Line 3459 CHOOSE_ANON1
|
$resource_selector=<<RESOURCE_SELECTOR; |
$resource_selector=<<RESOURCE_SELECTOR; |
<state name="SELECT_RESOURCES" title="Select Resources"> |
<state name="SELECT_RESOURCES" title="Select Resources"> |
$randomly_ordered_warning |
$randomly_ordered_warning |
|
|
<nextstate>PRINT_FORMATTING</nextstate> |
<nextstate>PRINT_FORMATTING</nextstate> |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
Line 3427 CHOOSE_ANON1
|
Line 3469 CHOOSE_ANON1
|
$start_new_option |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
|
|
<state name="PRINT_FORMATTING" title="Format of the print job"> |
<state name="PRINT_FORMATTING" title="Format of the print job"> |
<nextstate>NUMBER_PER_PDF</nextstate> |
<nextstate>NUMBER_PER_PDF</nextstate> |
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message> |
<message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message> |