--- loncom/interface/lonprintout.pm 2009/09/08 10:53:15 1.560.2.3 +++ loncom/interface/lonprintout.pm 2010/12/05 19:46:04 1.568.4.4 @@ -1,17 +1,8 @@ # -# 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 # Printout # -# $Id: lonprintout.pm,v 1.560.2.3 2009/09/08 10:53:15 foxr Exp $ +# $Id: lonprintout.pm,v 1.568.4.4 2010/12/05 19:46:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -99,7 +90,6 @@ sub generate_student_chooser { $sort_choice, $variable, $next_state) = @_; - my $result = < Select sorting order of printout @@ -155,7 +145,6 @@ sub generate_resource_chooser { $value_func, $start_new_option) = @_; - my $result = < $next_state return $filter; CHOOSE_RESOURCES - if ($value_func ne '') { + if ($choice_func ne '') { $result .= "return $choice_func;"; } if ($top_url ne '') { @@ -178,7 +167,87 @@ CHOOSE_RESOURCES 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 = < + $next_state +

Fill out one of the forms below

+


+

Generate new CODEd Assignments

+
Number of CODEd assignments to print: + + + 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; + + +
+ Names to save the CODEs under for later: + + +
+ Bubble sheet type: + + + $bubble_types + +
+
+

Print a Specific CODE


+
Enter a CODE to print: + + + 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. + } + + +
+ $code_selections +
+

Reprint a Set of Saved CODEs

+ Select saved CODEs: + + + $saved_codes + +
+ +CHOOSE_ANON1 + return $result; +} #----------------------------------------------------------------------- @@ -430,8 +499,11 @@ sub printf_style_subst { sub format_page_header { my ($width, $format, $assignment, $course, $student, $section) = @_; - + + $width = &recalcto_mm($width); # Get width in mm. + my $chars_per_line = int($width/1.6); # Character/textline. + # Default format? if ($format eq '') { @@ -445,9 +517,8 @@ sub format_page_header { # but only truncate the course. # - Allow the assignment to be 2 lines (wrapped). # - my $chars_per_line = $width/2; # Character/textline. - + my $name_length = int($chars_per_line *3 /4); my $sec_length = int($chars_per_line / 5); @@ -483,7 +554,19 @@ sub format_page_header { my $testPrintout = '\\\\'.&mt('Construction Space').' \\\\'.&mt('Test-Printout '); $format =~ s/\\\\\s\\\\\s/$testPrintout/; } - + # + # We're going to trust LaTeX to break lines appropriately, but + # we'll truncate anything that's more than 3 lines worth of + # text. This is also assuming (which will probably end badly) + # nobody's going to embed LaTeX control sequences in the title + # header or rather that those control sequences won't get broken + # by the stuff below. + # + my $total_length = 3*$chars_per_line; + if (length($format) > $total_length) { + $format = substr($format, 0, $total_length); + } + return $format; @@ -1194,9 +1277,9 @@ sub page_format_transformation { if ($selectionmade eq '4') { if ($choice eq 'all_problems') { - $assignment='Problems from the Whole Course'; + $assignment=&mt('Problems from the Whole Course'); } else { - $assignment='Resources from the Whole Course'; + $assignment=&mt('Resources from the Whole Course'); } } else { $assignment=&Apache::lonxml::latex_special_symbols($assignment,'header'); @@ -1470,9 +1553,9 @@ sub print_page_in_course { # First is the overall page description. This is then followed by the # components of the page. Each of which must be printed independently. - my $the_page = shift(@page_resources); + foreach my $resource (@page_resources) { my $resource_src = $resource->src(); # Essentially the URL of the resource. $result .= $resource->title() . '\\\\'; @@ -1673,7 +1756,7 @@ sub recently_generated { # A reference to a page break hash. # # -use Data::Dumper; +# use Data::Dumper; #sub dump_helper_vars { # my ($helper) = @_; # my $helpervars = Dumper($helper->{'VARS'}); @@ -1807,7 +1890,7 @@ sub print_construction_sequence { } sub output_data { - my ($r,$helper,$rparmhash) = @_; + my ($r,$helper,$rparmhash,$is_custom) = @_; my %parmhash = %$rparmhash; $ssi_error = 0; # This will be set nonzero by failing ssi's. $resources_printed = ''; @@ -1848,6 +1931,11 @@ ENDPART {'href' => '', 'text' => 'Preparing Printout'}]; + if ($is_custom) { + $brcrum = [{'href' => '', + 'text' => 'Preparing Printout'}]; + } + my $start_page = &Apache::loncommon::start_page('Preparing Printout', $js, {'bread_crumbs' => $brcrum,}); @@ -1909,7 +1997,6 @@ ENDPART &Apache::lonnet::delenv('construct.style'); } - if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') { #-- single document - problem, page, html, xml, ... my ($currentURL,$cleanURL); @@ -2025,7 +2112,6 @@ ENDPART $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|; -# $result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); $result .= &print_construction_sequence($currentURL, $helper, %form, $LaTeXwidth); $result .= '\end{document}'; @@ -2037,7 +2123,7 @@ ENDPART $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;} $resources_printed .= $currentURL.':'; - my $texversion=&ssi_with_retries($currentURL, $ssi_retry_count, %form); + my $texversion = &ssi_with_retries($currentURL, $ssi_retry_count, %form); if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { my $annotation = &annotate($currentURL); $texversion =~ s/(\\end{document})/$annotation$1/; @@ -2070,7 +2156,6 @@ ENDPART } else { - &Apache::lonnet::logthis("Unsupported type handler"); $result.=&unsupported($currentURL,$helper->{'VARS'}->{'LATEX_TYPE'}, $helper->{'VARS'}->{'symb'}); } @@ -2091,7 +2176,6 @@ ENDPART } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_resources_in_page')) { - &Apache::lonnet::logthis("Selectionmade => 3"); $selectionmade = 3; } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') ) { @@ -2131,11 +2215,10 @@ ENDPART $result.="\\newpage\n"; } } - my ($sequence,$middle_thingy,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]); + my ($sequence,$middle_thingy,$urlp)=&Apache::lonnet::decode_symb($master_seq[$i]); $urlp=&Apache::lonnet::clutter($urlp); $form{'symb'}=$master_seq[$i]; - &Apache::lonnet::logthis("Element $i Sequence $sequence Middle $middle_thingy URLP $urlp"); my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #title of the assignment which contains this problem if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;} @@ -2143,17 +2226,14 @@ ENDPART my $texversion=''; if ($urlp!~m|^/adm/| && $urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { - &Apache::lonnet::logthis("Problem"); $resources_printed .= $urlp.':'; &Apache::lonxml::remember_problem_counter(); - &Apache::lonnet::logthis("Fetching tex for $urlp"); - my $debug = Dumper(%form); - &Apache::lonnet::logthis("Form: $debug"); - + if ($flag_latex_header_remove eq 'NO') { + $texversion.=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); # RF + $flag_latex_header_remove = 'YES'; + } $texversion.=&ssi_with_retries($urlp, $ssi_retry_count, %form); - &Apache::lonnet::logthis("texversion so far: $texversion"); if ($urlp=~/\.page$/) { - &Apache::lonnet::("Special page actions"); ($texversion,my $number_of_columns_page) = &page_cleanup($texversion); if ($number_of_columns_page > $number_of_columns) {$number_of_columns=$number_of_columns_page;} $texversion =~ s/\\end{document}\d*/\\end{document}/; @@ -2175,7 +2255,6 @@ ENDPART $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; } else { if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library)$/) { - &Apache::lonnet::logthis("problem printing"); $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); $texversion =~ s/\\begin{document}//; my $title = &Apache::lonnet::gettitle($master_seq[$i]); @@ -2221,13 +2300,12 @@ ENDPART } } $result .= $texversion; - &Apache::lonnet::logthis("About to set rem header true with $result"); $flag_latex_header_remove = 'YES'; } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;} $resources_printed .= $urlp.':'; - my $texversion=&ssi_with_retries($urlp, $ssi_retry_count, %form); + my $texversion = &ssi_with_retries($urlp, $ssi_retry_count, %form); if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { my $annotation = &annotate($urlp); $texversion =~ s/(\\end{document)/$annotation$1/; @@ -2278,6 +2356,7 @@ ENDPART } $result .= '\end{document}'; } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || + ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students_from_page') || ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') || ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){ @@ -2285,6 +2364,7 @@ ENDPART #-- prints assignments for whole class or for selected students my $type; if (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || + ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students_from_page') || ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ) { $selectionmade=5; $type='problems'; @@ -2324,7 +2404,8 @@ ENDPART my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; #loop over students - my $flag_latex_header_remove = 'NO'; + + my $flag_latex_header_remove = 'NO'; my %moreenv; $moreenv{'instructor_comments'}='hide'; $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); @@ -2372,6 +2453,7 @@ ENDPART &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'}; @@ -2727,8 +2809,7 @@ sub print_resources { # so we will just rely on prntout.pl to strip ENDOFSTUDENTSTAMP from the # postscript. Each ENDOFSTUDENTSTAMP will go on a line by itself. # - - + my $syllabus_first = 0; foreach my $curresline (@{$master_seq}) { if (defined $page_breaks{$curresline}) { if($i != 0) { @@ -2747,7 +2828,6 @@ sub print_resources { &Apache::lonxml::remember_problem_counter(); my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); - if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) { # Use a copy of the hash so we don't pervert it on future loop passes. @@ -2775,12 +2855,12 @@ sub print_resources { $rendered = $header.$body; } } - if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { my $url = &Apache::lonnet::clutter($res_url); my $annotation = &annotate($url); $rendered =~ s/(\\keephidden{ENDOFPROBLEM})/$annotation$1/; } + my $junk; if ($remove_latex_header eq 'YES') { $rendered = &latex_header_footer_remove($rendered); } else { @@ -2788,6 +2868,9 @@ sub print_resources { } $current_output .= $rendered; } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + if ($i == 1) { + $syllabus_first = 1; + } $printed .= $curresline.':'; my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { @@ -2832,8 +2915,11 @@ sub print_resources { my $header_start = ($columns_in_format == 1) ? '\lhead' : '\fancyhead[LO]'; $header_line = $header_start.'{'.$header_line.'}'; - if ($current_output=~/\\documentclass/) { + if ($current_output=~/\\documentclass/ && (!$syllabus_first)) { $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$header_line$namepostfix}\\vskip 5 mm /; + } elsif ($syllabus_first) { + + $current_output =~ s/\\\\ Last updated:/Last updated:/ } else { my $blankpages = '\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'}; @@ -2856,17 +2942,113 @@ sub handler { &init_perm(); + my ($helper,$is_custom); + if ((&Apache::loncommon::needs_gci_custom()) && + ($env{'request.role.domain'} =~ /^\w+citest$/)) { + if ($r->header_only) { + if ($env{'browser.mathml'}) { + &Apache::loncommon::content_type($r,'text/xml'); + } else { + &Apache::loncommon::content_type($r,'text/html'); + } + $r->send_http_header; + return OK; + } + # Send header, nocache + if ($env{'browser.mathml'}) { + &Apache::loncommon::content_type($r,'text/xml'); + } else { + &Apache::loncommon::content_type($r,'text/html'); + } + &Apache::loncommon::no_cache($r); + $r->send_http_header; + $r->rflush(); - - my $helper = printHelper($r); - if (!ref($helper)) { - return $helper; + my ($navmap_error,$resources,@master_seq); + my $navmap = Apache::lonnavmaps::navmap->new(); + if (!defined($navmap)) { + my $brcrum = [{'href' => '', + 'text' => 'Preparing Printout'}]; + + my $start_page = + &Apache::loncommon::start_page('Preparing Printout','', + {'bread_crumbs' => $brcrum,}); + my $endpage = &Apache::loncommon::end_page(); + + my $navmap_error = ''.&mt('An error occurred retrieving information about the course.').'
'.&mt('It is recommended that you re-select the concept test by clicking on the "Review Questions" tab and then clicking on the "Manage Tests" tab again.').'
'; + $r->print($start_page.$navmap_error.$endpage); + return OK; + } else { + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $sequence = &Apache::loncommon::get_citest_map($cdom); + my @allres; + if ($sequence) { + @allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/'.$sequence); + } + foreach my $resource (@allres) { + next if ($resource->is_map()); + my $symb = $resource->symb(); + push(@master_seq,$symb); + } + $resources = join('|||',@master_seq); + my ($sequence,$middle_thingy,$urlp) = + &Apache::lonnet::decode_symb($master_seq[0]); + + my $assignment = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); + + $helper = { + VARS => { + ANON_CODE_STORAGE_NAME => '', + ANSWER_TYPE => 'yes', + CODE_OPTION => '', + EMPTY_PAGES => '', + FINISHPAGE => '', + FORMAT => 'P|1|letter|no', + LATEX_TYPE => 'batchmode', + NUMBER_TO_PRINT_TOTAL => '', + PRINT_ANNOTATIONS => 'no', + PRINT_DISCUSSIONS => 'no', + PRINT_TYPE => 'map_problems', + RESOURCES => $resources, + REUSE_OLD_CODES => '', + SEQUENCE => '', + SINGLE_CODE => '', + SPLIT_PDFS => '', + STUDENTS => '', + TABLE_CONTENTS => 'no', + TABLE_INDEX => 'no', + assignment => $assignment, + construction => '', + curseed => '', + filename => '', + fontsize => 'normalsize', + pagesize => '', + 'pagesize.height' => '9.8', + 'pagesize.heightunit' => 'in', + 'pagesize.lmargin' => '-0.57', + 'pagesize.lmarginunit' => 'in', + 'pagesize.width' => '7.1', + 'pagesize.widthunit' => 'in', + postdata => $urlp, + probstatus => '', + showallfoils => '', + student_sort => '', + style_file => '', + symb => $master_seq[0], + } + }; + $env{'form.assignment'} = $assignment; + $is_custom = 1; + } + } else { + $helper = printHelper($r); + if (!ref($helper)) { + return $helper; + } } - %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'}); - - # If a figure conversion queue file exists for this user.domain @@ -2875,13 +3057,13 @@ sub handler { my $conversion_queuefile = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"; if(-e $conversion_queuefile) { - unlink $conversion_queuefile; + unlink $conversion_queuefile; } - - &output_data($r,$helper,\%parmhash); + + &output_data($r,$helper,\%parmhash,$is_custom); return OK; -} +} use Apache::lonhelper; @@ -3063,7 +3245,6 @@ sub printHelper { } else { $url = $helper->{VARS}->{'postdata'}; $is_published=1; # From resource space. - &Apache::lonnet::logthis("Resource url $url"); } $url = &Apache::lonnet::clutter($url); if (!$resourceTitle) { # if the resource doesn't have a title, use the filename @@ -3133,25 +3314,26 @@ sub printHelper { my $varspostdata = $helper->{VARS}->{'postdata'}; my $varsassignment = $helper->{VARS}->{'assignment'}; my $page_navmap = Apache::lonnavmaps::navmap->new(); - my @page_resources = $page_navmap->retrieveResources($url); - if(defined($page_resources[0])) { - $page_ispage = $page_resources[0]->is_page(); - $page_title = $page_resources[0]->title(); - my $resourcesymb = $page_resources[0]->symb(); - my ($pagemap, $pageid, $pageurl) = &Apache::lonnet::decode_symb($symb); - if ($page_ispage) { - push @{$printChoices}, - [&mt('Selected [_1]Problems[_2] from page [_3]', '', '', ''.$page_title.''), - 'map_problems_in_page', - 'CHOOSE_PROBLEMS_PAGE']; - push @{$printChoices}, - [&mt('Selected [_1]Resources[_2] from page [_3]', '', '', ''.$page_title.''), - 'map_resources_in_page', - 'CHOOSE_RESOURCES_PAGE']; - } + if (defined($page_navmap)) { + my @page_resources = $page_navmap->retrieveResources($url); + if(defined($page_resources[0])) { + $page_ispage = $page_resources[0]->is_page(); + $page_title = $page_resources[0]->title(); + my $resourcesymb = $page_resources[0]->symb(); + my ($pagemap, $pageid, $pageurl) = &Apache::lonnet::decode_symb($symb); + if ($page_ispage) { + push @{$printChoices}, + [&mt('Selected [_1]Problems[_2] from page [_3]', '', '', ''.$page_title.''), + 'map_problems_in_page', + 'CHOOSE_PROBLEMS_PAGE']; + push @{$printChoices}, + [&mt('Selected [_1]Resources[_2] from page [_3]', '', '', ''.$page_title.''), + 'map_resources_in_page', + 'CHOOSE_RESOURCES_PAGE']; + } my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE', 'Select Problem(s) to print', - "multichoice='1' toponly='1', addstatus='1' closeallpages='1'", + "multichoice='1' toponly='1' addstatus='1' closeallpages='1'", 'RESOURCES', 'PAGESIZE', $url, @@ -3174,7 +3356,8 @@ sub printHelper { &Apache::lonxml::xmlparse($r, 'helper', $helperFragment); - } + } + } } if (($helper->{'VAR'}->{'construction'} ne '1' ) && @@ -3189,7 +3372,6 @@ sub printHelper { push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from folder [_3]','','',''.$sequenceTitle.''), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML']; - &Apache::lonnet::logthis("Map url : $map"); my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS', 'Select Problem(s) to print', 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"', @@ -3248,7 +3430,7 @@ ALL_PROBLEMS 'RESOURCES', 'PAGESIZE', '', - $isNotMap,,$symbFilter, + $isNotMap,'',$symbFilter, $start_new_option) . &generate_resource_chooser('ALL_PROBLEMS_STUDENTS', 'Select Problem(s) to print', @@ -3256,7 +3438,7 @@ ALL_PROBLEMS 'RESOURCES', 'STUDENTS1', '', - $isProblemOrMap, , $symbFilter, + $isProblemOrMap,'' , $symbFilter, $start_new_option) . $suffixXml ); @@ -3269,10 +3451,10 @@ ALL_PROBLEMS if ($page_ispage) { push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from page [_3] for [_4]selected people[_5]', '', '', ''.$page_title.'', '', ''), - 'problems_for_students', 'CHOOSE_STUDENTS']; + 'problems_for_students_from_page', 'CHOOSE_TGT_STUDENTS_PAGE']; push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from page [_3] for [_4]CODEd assignments[_5]', '', '', ''.$page_title.'', '', ''), - 'problems_for_anon', 'CHOOSE_ANON1']; + 'problems_for_anon_page', 'CHOOSE_ANON1_PAGE']; } push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from folder [_3] for [_4]selected people[_5]', '','',''.$sequenceTitle.'','',''), @@ -3299,8 +3481,8 @@ ALL_PROBLEMS 'multichoice="1" addstatus="1" closeallpages="1"', 'RESOURCES', 'PRINT_FORMATTING', - '', - $isProblem, , $symbFilter, + $map, + $isProblem, '', $symbFilter, $start_new_option); $resource_selector .= < @@ -3322,12 +3504,25 @@ ALL_PROBLEMS RESOURCE_SELECTOR + $resource_selector .= &generate_resource_chooser('CHOOSE_STUDENTS_PAGE', + 'Select Problem(s) to print', + "multichoice='1' addstatus='1' closeallpages ='1'", + 'RESOURCES', + 'PRINT_FORMATTING', + $url, + $isProblem, '', $symbFilter, + $start_new_option); -# Generate student choosers. +# Generate student choosers. + &Apache::lonxml::xmlparse($r, 'helper', + &generate_student_chooser('CHOOSE_TGT_STUDENTS_PAGE', + 'student_sort', + 'STUDENTS', + 'CHOOSE_STUDENTS_PAGE')); &Apache::lonxml::xmlparse($r, 'helper', &generate_student_chooser('CHOOSE_STUDENTS', 'student_sort', @@ -3391,63 +3586,31 @@ RESOURCE_SELECTOR if ($codechoice eq '') { $codechoice='Default'; } - &Apache::lonxml::xmlparse($r, 'helper', < - SELECT_PROBLEMS -

Fill out one of the forms below

-


-

Generate new CODEd Assignments

-
Number of CODEd assignments to print: - - - 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; - - -
- Names to save the CODEs under for later: - - -
- Bubble sheet type: - - - $codechoice - -
-
-

Print a Specific CODE


-
Enter a CODE to print: - - - 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. - } - - -
- $code_selection -
-

Reprint a Set of Saved CODEs

- Select saved CODEs: - - - $namechoice - -
- - $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::lonxml::xmlparse($r, 'helper', $anon_page); if ($helper->{VARS}->{'assignment'}) {