-
$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
@@ -2621,7 +2751,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'};
@@ -2644,10 +2774,10 @@ CHOOSE_FROM_SUBDIR
PAGESIZE
- return $isProblem
+ return $isNotMapreturn '$escapedSequenceName';return $symbFilter;
-
+ $start_new_option
CHOOSE_FROM_ANY_SEQUENCE
@@ -2973,10 +3103,10 @@ sub new {
# $helper->{VARS} to figure out whether the columns are one or two
$self->{'formatvar'} = shift;
- # The state to transition to after selection, or after discovering
- # the cols are not set to 1
+
$self->{NEXTSTATE} = shift;
bless($self);
+
return $self;
}
@@ -2986,67 +3116,142 @@ sub render {
my $result = '';
my $var = $self->{'variable'};
+
+
if (defined $self->{ERROR_MSG}) {
- $result .= ' ' . $self->{ERROR_MSG} . ' ';
+ $result .= ' ' . $self->{ERROR_MSG} . ' ';
}
- my $width = 18;
my $format = $helper->{VARS}->{$self->{'formatvar'}};
- if (substr($format, 2, 1) ne '1') {
- $width = 9;
+
+ # Use format to get sensible defaults for the margins:
+
+
+ my ($laystyle, $cols, $papersize) = split(/\|/, $format);
+ ($papersize) = split(/ /, $papersize);
+
+
+ if ($laystyle eq 'L') {
+ $laystyle = 'album';
+ } else {
+ $laystyle = 'book';
}
+
+ my %size;
+ ($size{'width_and_units'},
+ $size{'height_and_units'},
+ $size{'margin_and_units'})=
+ &Apache::lonprintout::page_format($papersize, $laystyle, $cols);
+
+ foreach my $dimension ('width','height','margin') {
+ ($size{$dimension},$size{$dimension.'_unit'}) =
+ split(/ +/, $size{$dimension.'_and_units'},2);
+
+ foreach my $unit ('cm','in') {
+ $size{$dimension.'_options'} .= '