--- loncom/interface/lonprintout.pm 2003/04/22 19:54:39 1.131 +++ loncom/interface/lonprintout.pm 2003/05/01 17:19:25 1.139 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.131 2003/04/22 19:54:39 bowersj2 Exp $ +# $Id: lonprintout.pm,v 1.139 2003/05/01 17:19:25 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1378,6 +1378,7 @@ sub printHelper { my $isProblem = '$res->is_problem();'; my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; my $isNotMap = '!$res->is_map();'; + my $symb = '$res->symb();'; my $helperFragment = < Select problems to print: @@ -1386,6 +1387,7 @@ sub printHelper { return $isProblemOrMap return $isProblem $map + return $symb @@ -1395,6 +1397,7 @@ sub printHelper { FINAL return $isNotMap; $map + return $symb HELPERFRAGMENT @@ -1405,10 +1408,23 @@ HELPERFRAGMENT # If the user is priviledged, allow them to print all # problems in the course, optionally for selected students if (($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) and ($helper->{VARS}->{'postdata'}=~/\/res\//)) { - push @{$printChoices}, ['All problems in course (may take a lot of time)', 'all_problems', 'FINAL']; + push @{$printChoices}, ['All problems in course (may take a lot of time)', 'all_problems', 'ALL_PROBLEMS']; push @{$printChoices}, ["Problems from $sequenceTitle for selected students", 'problems_for_students', 'CHOOSE_STUDENTS']; + my $isProblem = '$res->is_problem();'; + my $isProblemOrMap = '$res->is_problem() || $res->is_map()'; + my $symb = '$res->symb();'; &Apache::lonxml::xmlparse($r, 'helper', < + Select problems to print: + + FINAL + return $isProblemOrMap + return $isProblem + return $symb + + + Select the students you wish to print the problems for: @@ -1421,17 +1437,22 @@ CHOOSE_STUDENTS push @{$printChoices}, ["Problems from $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; my $f = '$filename'; - &Apache::lonxml::xmlparse($r, 'helper', < Select problems you wish to print from $subdir - + FINAL - $subdir - return $f =~ + return '$subdir'; +CHOOSE_FROM_SUBDIR + + $xmlfrag .= <<'CHOOSE_FROM_SUBDIR'; + return $filename =~ m/^[^\.]+\.(problem|exam|quiz|assess|survey|form|library)$/; + CHOOSE_FROM_SUBDIR + &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag); } # Generate the first state, to select which resources get printed. @@ -1441,6 +1462,7 @@ CHOOSE_FROM_SUBDIR Apache::lonhelper::message->new(); $paramHash = Apache::lonhelper::getParamHash(); $paramHash->{'variable'} = 'PRINT_TYPE'; + $helper->declareVar('PRINT_TYPE'); $paramHash->{CHOICES} = $printChoices; Apache::lonhelper::choices->new(); Apache::lonprintout::page_format_state->new("FORMAT"); @@ -1508,7 +1530,11 @@ my @paperSize = ("Letter [8 1/2x11 in]", sub new { my $self = Apache::lonhelper::element->new(); + shift; + $self->{'variable'} = shift; + my $helper = Apache::lonhelper::getHelper(); + $helper->declareVar($self->{'variable'}); bless($self); return $self; } @@ -1566,6 +1592,17 @@ STATEHTML return $result; } +sub postprocess { + my $self = shift; + + my $var = $self->{'variable'}; + my $helper = Apache::lonhelper->getHelper(); + $helper->{VARS}->{$var} = + $ENV{"form.$var.layout"} . '|' . $ENV{"form.$var.cols"} . '|' . + $ENV{"form.$var.paper"}; + return 1; +} + 1; __END__