[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 22 Aug 2006 14:44:40 -0000
albertel Tue Aug 22 10:44:40 2006 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
- fixes 4093
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.481 loncom/interface/lonprintout.pm:1.482
--- loncom/interface/lonprintout.pm:1.481 Tue Aug 22 10:43:49 2006
+++ loncom/interface/lonprintout.pm Tue Aug 22 10:44:39 2006
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.481 2006/08/22 14:43:49 albertel Exp $
+# $Id: lonprintout.pm,v 1.482 2006/08/22 14:44:39 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -812,6 +812,8 @@
if (!$postdata) { $postdata=$helper->{VARS}{'postdata'}; }
my $name_of_resource = &Apache::lonnet::gettitle($postdata);
my $symbolic = &Apache::lonnet::symbread($postdata);
+ return if ( $symbolic eq '');
+
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symbolic);
$map=&Apache::lonnet::clutter($map);
my $name_of_sequence = &Apache::lonnet::gettitle($map);
@@ -2159,6 +2161,9 @@
} else {
if ($env{'form.postdata'}) {
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($env{'form.postdata'});
+ if ( $helper->{VARS}->{'symb'} eq '') {
+ $helper->{VARS}->{'postdata'} = $env{'form.postdata'};
+ }
}
if ($env{'form.symb'}) {
$helper->{VARS}->{'symb'} = $env{'form.symb'};
@@ -2194,9 +2199,14 @@
$subdir = substr($helper->{VARS}->{'filename'},
0, rindex($helper->{VARS}->{'filename'}, '/') + 1);
} else {
- ($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
- $helper->{VARS}->{'postdata'} =
- &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
+ if ($symb ne '') {
+ ($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
+ $helper->{VARS}->{'postdata'} =
+ &Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
+ } else {
+ $url = $helper->{VARS}->{'postdata'};
+ }
+ $url = &Apache::lonnet::clutter($url);
if (!$resourceTitle) { # if the resource doesn't have a title, use the filename
my $postdata = $helper->{VARS}->{'postdata'};
@@ -2217,11 +2227,6 @@
# "Delete everything after the last slash."
$subdir =~ s|/[^/]+$||;
- if (not $helper->{VARS}->{'construction'}) {
- $subdir=$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$subdir;
- }
- # "Remove all duplicate slashes."
- $subdir =~ s|/+|/|g;
# What can be printed is a very dynamic decision based on
# lots of factors. So we need to dynamically build this list.
@@ -2613,12 +2618,20 @@
}
# 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 <b>Problems</b> from current subdirectory <b><i>[_1]</i></b>",$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)/)
+ )
+ ) {
- my $f = '$filename';
+ my $pretty_dir = &Apache::lonnet::hreflocation($subdir);
+ push @{$printChoices}, [&mt("Selected <b>Problems</b> from current subdirectory <b><i>[_1]</i></b>",$pretty_dir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
my $xmlfrag = <<CHOOSE_FROM_SUBDIR;
- <state name="CHOOSE_FROM_SUBDIR" title="Select File(s) from <b><small>$subdir</small></b> to print">
+ <state name="CHOOSE_FROM_SUBDIR" title="Select File(s) from <b><small>$pretty_dir</small></b> to print">
<files variable="FILES" multichoice='1'>
<nextstate>PAGESIZE</nextstate>