[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Mon, 28 Aug 2006 11:11:52 -0000
foxr Mon Aug 28 07:11:52 2006 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Fix a few issues with which print selectsion are available in which
roles/states.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.482 loncom/interface/lonprintout.pm:1.483
--- loncom/interface/lonprintout.pm:1.482 Tue Aug 22 10:44:39 2006
+++ loncom/interface/lonprintout.pm Mon Aug 28 07:11:49 2006
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.482 2006/08/22 14:44:39 albertel Exp $
+# $Id: lonprintout.pm,v 1.483 2006/08/28 11:11:49 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2126,6 +2126,7 @@
$helper->declareVar('FINISHPAGE');
$helper->declareVar('PRINT_TYPE');
$helper->declareVar("showallfoils");
+ $helper->declareVar("STUDENTS");
# The page breaks can get loaded initially from the course environment:
# But we only do this in the initial state so that they are allowed to change.
@@ -2137,6 +2138,8 @@
{'pagebreaks' => 'scalar',
'lastprinttype' => 'scalar'});
+ # This will persistently load in the data we want from the
+ # very first screen.
if($helper->{VARS}->{PRINT_TYPE} eq $env{'form.lastprinttype'}) {
if (!defined ($env{"form.CURRENT_STATE"})) {
@@ -2151,9 +2154,7 @@
}
-
- # This will persistently load in the data we want from the
- # very first screen.
+
# Detect whether we're coming from construction space
if ($env{'form.postdata'}=~/^(?:http:\/\/[^\/]+\/|\/|)\~([^\/]+)\/(.*)$/) {
$helper->{VARS}->{'filename'} = "~$1/$2";
@@ -2191,6 +2192,7 @@
my $symb = $helper->{VARS}->{'symb'};
my ($map, $id, $url);
my $subdir;
+ my $is_published=0; # True when printing from resource space.
# Get the resource name from construction space
if ($helper->{VARS}->{'construction'}) {
@@ -2205,6 +2207,7 @@
&Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
} else {
$url = $helper->{VARS}->{'postdata'};
+ $is_published=1; # From resource space.
}
$url = &Apache::lonnet::clutter($url);
@@ -2267,7 +2270,7 @@
"' variable='FINISHPAGE' />";
}
- if (($helper->{'VARS'}->{'construction'} ne '1') &&
+ if (($helper->{'VARS'}->{'construction'} ne '1' ) &&
$helper->{VARS}->{'postdata'} &&
$helper->{VARS}->{'assignment'}) {
@@ -2305,7 +2308,7 @@
# If the user has pfo (print for otheres) allow them to print all
# problems and resources in the entier course, optionally for selected students
- if ($perm{'pfo'} &&
+ if ($perm{'pfo'} && !$is_published &&
($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) {
push @{$printChoices}, ['Selected <b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS'];
@@ -2333,7 +2336,7 @@
ALL_PROBLEMS
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>selected students</b>",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS'];
+ push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>selected people</b>",$sequenceTitle), 'problems_for_students', 'CHOOSE_STUDENTS'];
push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>CODEd assignments</b>",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1'];
}
@@ -2508,7 +2511,7 @@
if ($helper->{VARS}->{'assignment'}) {
- push @{$printChoices}, [&mt("Selected <b>Resources</b> from folder <b><i>[_1]</i></b> for <b>selected students</b>",$sequenceTitle), 'resources_for_students', 'CHOOSE_STUDENTS1'];
+ push @{$printChoices}, [&mt("Selected <b>Resources</b> from folder <b><i>[_1]</i></b> for <b>selected people</b>",$sequenceTitle), 'resources_for_students', 'CHOOSE_STUDENTS1'];
push @{$printChoices}, [&mt("Selected <b>Resources</b> from folder <b><i>[_1]</i></b> for <b>CODEd assignments</b>",$sequenceTitle), 'resources_for_anon', 'CHOOSE_ANON2'];
}
@@ -2618,14 +2621,15 @@
}
# FIXME: That RE should come from a library somewhere.
- if ($perm{'pav'}
+ 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 $pretty_dir = &Apache::lonnet::hreflocation($subdir);
@@ -2652,7 +2656,7 @@
# 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 <b>Resources</b> from <b>selected folder</b> in course",
'select_sequences', 'CHOOSE_SEQUENCE'];
my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};