--- loncom/interface/lonprintout.pm 2006/07/18 18:19:51 1.464
+++ loncom/interface/lonprintout.pm 2006/07/24 22:13:58 1.467
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.464 2006/07/18 18:19:51 albertel Exp $
+# $Id: lonprintout.pm,v 1.467 2006/07/24 22:13:58 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2064,7 +2064,7 @@ sub init_perm {
$perm{'pav'}=&Apache::lonnet::allowed('pav',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
}
- $perm{'pfo'}=&Apache::lonnet::allowed('pav',$env{'request.course.id'});
+ $perm{'pfo'}=&Apache::lonnet::allowed('pfo',$env{'request.course.id'});
if (!$perm{'pfo'}) {
$perm{'pfo'}=&Apache::lonnet::allowed('pfo',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
@@ -2241,10 +2241,15 @@ sub printHelper {
$helper->declareVar('SEQUENCE');
+ # If we're in a sequence...
+ my $start_new_option;
+ if ($perm{'pav'}) {
+ $start_new_option =
+ "before selected').
+ "' variable='FINISHPAGE' />";
+ }
- # If we're in a sequence...
- my $startnew=&mt('Start new page
before selected');
if (($helper->{'VARS'}->{'construction'} ne '1') &&
$helper->{VARS}->{'postdata'} &&
@@ -2253,6 +2258,7 @@ sub printHelper {
push @{$printChoices}, [&mt('Selected Problems in folder [_1]',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence
push @{$printChoices}, [&mt('Selected Resources in folder [_1]',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
+
my $helperFragment = <
return $isProblem;
$map
return $symbFilter;
-
+ $start_new_option
@@ -2272,7 +2278,7 @@ sub printHelper {
return $isNotMap;
$map
return $symbFilter;
-
+ $start_new_option
HELPERFRAGMENT
@@ -2295,7 +2301,7 @@ HELPERFRAGMENT
return $isProblemOrMap;
return $isNotMap;
return $symbFilter;
-
+ $start_new_option
@@ -2304,7 +2310,7 @@ HELPERFRAGMENT
PAGESIZE
return $isNotMap;
return $symbFilter;
-
+ $start_new_option
ALL_PROBLEMS
@@ -2332,7 +2338,7 @@ ALL_PROBLEMS
return $isProblem;
$map
return $symbFilter;
-
+ $start_new_option
@@ -2496,7 +2502,7 @@ CHOOSE_ANON1
return $isNotMap;
$map
return $symbFilter;
-
+ $start_new_option
@@ -2637,10 +2643,10 @@ CHOOSE_FROM_SUBDIR
PAGESIZE
- return $isProblem
+ return $isNotMap
return '$escapedSequenceName';
return $symbFilter;
-
+ $start_new_option
CHOOSE_FROM_ANY_SEQUENCE
@@ -2969,6 +2975,7 @@ sub new {
$self->{NEXTSTATE} = shift;
bless($self);
+
return $self;
}
@@ -2978,6 +2985,8 @@ sub render {
my $result = '';
my $var = $self->{'variable'};
+
+
if (defined $self->{ERROR_MSG}) {
$result .= '
' . $self->{ERROR_MSG} . '
';
}
@@ -3067,6 +3076,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;
}