--- loncom/interface/lonprintout.pm 2005/02/22 23:32:48 1.365 +++ loncom/interface/lonprintout.pm 2005/03/29 10:21:21 1.372 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.365 2005/02/22 23:32:48 foxr Exp $ +# $Id: lonprintout.pm,v 1.372 2005/03/29 10:21:21 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -841,13 +841,16 @@ Please stand by while processing your pr 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. - $ENV{'form.pagebreaks'} = $helper->{'VARS'}->{'FINISHPAGE'}; + $ENV{'form.pagebreaks'} = $helper->{'VARS'}->{'FINISHPAGE'}; + $ENV{'form.lastprinttype'} = $helper->{'VARS'}->{'PRINT_TYPE'}; &Apache::loncommon::store_course_settings('print', - {'pagebreaks' => 'scalar'}); + {'pagebreaks' => 'scalar', + 'lastprinttype' => 'scalar'}); my %page_breaks = &get_page_breaks($helper); @@ -875,7 +878,18 @@ ENDPART 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); @@ -1180,6 +1194,7 @@ ENDPART $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); $moreenv{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'}; $moreenv{'problem_split'} = $parmhash{'problem_stream_switch'}; + $moreenv{'suppress_tries'} = $parmhash{'suppress_tries'}; if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$moreenv{'problem_split'}='yes';} my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75'); my $student_counter=-1; @@ -1338,6 +1353,7 @@ ENDPART $result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; $result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; } + #-- writing .tex file in prtspool my $temp_file; my $identifier = &Apache::loncommon::get_cgi_id(); @@ -1582,7 +1598,14 @@ sub handler { # - + # If a figure conversion queue file exists for this user.domain + # we delete it since it can only be bad (if it were good, printout.pl + # would have deleted it the last time around. + + my $conversion_queuefile = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; + if(-e $conversion_queuefile) { + unlink $conversion_queuefile; + } &output_data($r,$helper,\%parmhash); return OK; } @@ -1637,13 +1660,27 @@ sub printHelper { $helper->declareVar('style_file'); $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: + + if((!defined($ENV{"form.CURRENT_STATE"})) || + ($ENV{'form.CURRENT_STATE'} == "START")) { + $helper->{VARS}->{FINISHPAGE} = ""; # In case they did a back e.g. + } + + &Apache::loncommon::restore_course_settings('print', - {'pagebreaks' => 'scalar'}); + {'pagebreaks' => 'scalar', + 'lastprinttype' => 'scalar'}); - $helper->{VARS}->{FINISHPAGE} = $ENV{'form.pagebreaks'}; + + if("$helper->{VARS}->{PRINT_TYPE}" eq "$ENV{'form.lastprinttype'}") { + $helper->{VARS}->{FINISHPAGE} = $ENV{'form.pagebreaks'}; + } + # This will persistently load in the data we want from the # very first screen. @@ -1751,8 +1788,8 @@ sub printHelper { $helper->declareVar('SEQUENCE'); # Useful for debugging: Dump the help vars - #$r->print(Dumper($helper->{VARS})); - #$r->print($map); +# $r->print(Dumper($helper->{VARS})); +# $r->print($map); # If we're in a sequence... if (($helper->{'VARS'}->{'construction'} ne '1') && @@ -1850,7 +1887,7 @@ RESOURCE_SELECTOR &Apache::lonxml::xmlparse($r, 'helper', < - + Select sort order Sort by section then student @@ -1926,7 +1963,7 @@ RESOURCE_SELECTOR &Apache::lonxml::xmlparse($r, 'helper', < - + Sort by section then student Sort by students across sections. @@ -2030,7 +2067,6 @@ CHOOSE_FROM_ANY_SEQUENCE Apache::lonhelper::message->new(); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'PRINT_TYPE'; - $helper->declareVar('PRINT_TYPE'); $paramHash->{CHOICES} = $printChoices; Apache::lonhelper::choices->new(); @@ -2046,8 +2082,7 @@ CHOOSE_FROM_ANY_SEQUENCE $paramHash->{CHOICES} = [ ['Without Answers', 'yes'], ['With Answers', 'no'], - ['Only Answers', 'only'], - ['As Exam Problem', 'exam'] + ['Only Answers', 'only'] ]; Apache::lonhelper::dropdown->new(); addMessage(""); @@ -2104,6 +2139,20 @@ CHOOSE_FROM_ANY_SEQUENCE ['Yes', 'yes'] ]; Apache::lonhelper::dropdown->new(); addMessage(""); + + # If advanced roles, then allow to show all foils. + + if ($ENV{'request.role.adv'}) { + addMessage(" "); + $paramHash = Apache::lonhelper::getParamHash(); + $paramHash->{'multichoice'} = "true"; + $paramHash->{'allowempty'} = "true"; + $paramHash->{'variable'} = "showallfoils"; + $paramHash->{'CHOICES'} = [ ["Show all foils", "1"] ]; + Apache::lonhelper::choices->new(); + addMessage(""); + } + } if ($helper->{'VARS'}->{'construction'}) { @@ -2118,10 +2167,15 @@ CHOOSE_FROM_ANY_SEQUENCE Use style file:   Select style file + + Show all foils? + RNDSEED &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag); $helper->{'VARS'}->{'style_file'}=$ENV{'form.style_file_value'}; - } + + } + }