--- loncom/interface/lonprintout.pm 2006/07/20 03:38:52 1.465 +++ loncom/interface/lonprintout.pm 2006/07/31 10:30:52 1.468 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.465 2006/07/20 03:38:52 albertel Exp $ +# $Id: lonprintout.pm,v 1.468 2006/07/31 10:30:52 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2412,7 +2412,7 @@ CHOOSE_STUDENTS push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); -
+ '.$/; } @@ -2432,9 +2432,12 @@ CHOOSE_STUDENTS $codechoice='Default'; } &Apache::lonxml::xmlparse($r, 'helper', < + SELECT_PROBLEMS -
Number of anonymous assignments to print: +

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) && @@ -2456,9 +2459,10 @@ CHOOSE_STUDENTS $codechoice -

-
- Enter a CODE to print: +
+
+

Print a Specific Code


+
Enter a CODE to print: if(!\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'} && @@ -2471,17 +2475,16 @@ CHOOSE_STUDENTS } -

+
$code_selection - - - Reprint a set of saved CODEs: +
+

Reprint a Set of Saved Codes

+ Select saved CODEs: $namechoice
-
$resource_selector CHOOSE_ANON1 @@ -2643,7 +2646,7 @@ CHOOSE_FROM_SUBDIR PAGESIZE - return $isProblem + return $isNotMap return '$escapedSequenceName'; return $symbFilter; $start_new_option @@ -2975,6 +2978,7 @@ sub new { $self->{NEXTSTATE} = shift; bless($self); + return $self; } @@ -2984,6 +2988,8 @@ sub render { my $result = ''; my $var = $self->{'variable'}; + + if (defined $self->{ERROR_MSG}) { $result .= '
' . $self->{ERROR_MSG} . '
'; } @@ -3073,6 +3079,46 @@ sub preprocess { my $helper = Apache::lonhelper::getHelper(); my $format = $helper->{VARS}->{$self->{'formatvar'}}; + + # If the user does not have 'pav' privilege, set default widths and + # on to the next state right away. + # + if (!$perm{'pav'}) { + my $var = $self->{'variable'}; + my $format = $helper->{VARS}->{$self->{'formatvar'}}; + + my ($laystyle, $cols, $papersize) = split(/\|/, $format); + ($papersize) = split(/ /, $papersize); + + + if ($laystyle eq 'L') { + $laystyle = 'album'; + } else { + $laystyle = 'book'; + } + # Figure out some good defaults for the print out and set them: + + my %size; + ($size{'width'}, + $size{'height'}, + $size{'lmargin'})= + &Apache::lonprintout::page_format($papersize, $laystyle, $cols); + + foreach my $dim ('width', 'height', 'lmargin') { + my ($value, $units) = split(/ /, $size{$dim}); + + &Apache::lonnet::logthis("$dim : $value : $units"); + + $helper->{VARS}->{"$var.".$dim} = $value; + $helper->{VARS}->{"$var.".$dim.'unit'} = $units; + + } + + + # Transition to the next state + + $helper->changeState($self->{NEXTSTATE}); + } return 1; }