-
$resource_selector
CHOOSE_ANON2
}
# FIXME: That RE should come from a library somewhere.
- if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $perm{'pav'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {
- push @{$printChoices}, [&mt("Selected Problems from current subdirectory [_1]",$subdir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
+ if (($perm{'pav'}
+ && $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'
+ && (defined($helper->{'VARS'}->{'construction'})
+ ||
+ (&Apache::lonnet::allowed('bre',$subdir) eq 'F'
+ &&
+ $helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)
+ ))
+ && $helper->{VARS}->{'assignment'} eq ""
+ ) {
- my $f = '$filename';
+ my $pretty_dir = &Apache::lonnet::hreflocation($subdir);
+ push @{$printChoices}, [&mt("Selected Problems from current subdirectory [_1]",$pretty_dir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $xmlfrag = <
+ PAGESIZE
@@ -2620,7 +2786,7 @@ CHOOSE_FROM_SUBDIR
# Allow the user to select any sequence in the course, feed it to
# another resource selector for that sequence
- if (!$helper->{VARS}->{'construction'}) {
+ if (!$helper->{VARS}->{'construction'} && !$is_published) {
push @$printChoices, ["Selected Resources from selected folder in course",
'select_sequences', 'CHOOSE_SEQUENCE'];
my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};
@@ -2643,7 +2809,7 @@ CHOOSE_FROM_SUBDIR
PAGESIZE
- return $isProblem
+ return $isNotMapreturn '$escapedSequenceName';return $symbFilter;
$start_new_option
@@ -2667,7 +2833,10 @@ CHOOSE_FROM_ANY_SEQUENCE
if (($perm{'pav'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or
($helper->{VARS}->{'construction'} eq '1')) {
- addMessage("
Show all foils?
@@ -2975,6 +3166,7 @@ sub new {
$self->{NEXTSTATE} = shift;
bless($self);
+
return $self;
}
@@ -2984,6 +3176,8 @@ sub render {
my $result = '';
my $var = $self->{'variable'};
+
+
if (defined $self->{ERROR_MSG}) {
$result .= ' ' . $self->{ERROR_MSG} . ' ';
}
@@ -3023,9 +3217,16 @@ sub render {
}
}
- $result .= <How should each column be formatted?
@@ -3067,12 +3268,50 @@ ELEMENTHTML
return $result;
}
-# If the user didn't select 1 column, skip this state.
+
sub preprocess {
my $self = shift;
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});
+
+ $helper->{VARS}->{"$var.".$dim} = $value;
+ $helper->{VARS}->{"$var.".$dim.'unit'} = $units;
+
+ }
+
+
+ # Transition to the next state
+
+ $helper->changeState($self->{NEXTSTATE});
+ }
return 1;
}
@@ -3102,6 +3341,14 @@ sub postprocess {
}
if ($lmargin !~ /^-?[0-9]*(\.[0-9]*)?$/) {
$error .= "Invalid left margin; please type only a number. \n";
+ } else {
+ # Adjust for LaTeX 1.0 inch margin:
+
+ if ($env{"form.${var}.lmarginunit"} eq "in") {
+ $helper->{VARS}->{$var.'.lmargin'} = $lmargin - 1;
+ } else {
+ $helper->{VARS}->{$var.'.lmargin'} = $lmargin - 2.54;
+ }
}
if (!$error) {