--- loncom/interface/lonprintout.pm 2018/09/02 16:36:29 1.627.2.23
+++ loncom/interface/lonprintout.pm 2018/10/02 19:25:30 1.627.2.25
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.627.2.23 2018/09/02 16:36:29 raeburn Exp $
+# $Id: lonprintout.pm,v 1.627.2.25 2018/10/02 19:25:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -157,7 +157,7 @@ sub create_incomplete_folder_selstud_hel
my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_PEOPLE_SEQ',
'Select problem(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'CHOOSE_STUDENTS_INCOMPLETE',
$map,
@@ -206,7 +206,7 @@ sub create_incomplete_course_helper {
my $resource_chooser = &generate_resource_chooser('INCOMPLETE_PROBLEMS_COURSE_RESOURCES',
'Select problem(s) to print',
- 'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1"',
+ 'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1" modallink="1"',
'RESOURCES',
'INCOMPLETE_PROBLEMS_COURSE_STUDENTS',
'',
@@ -252,7 +252,7 @@ sub create_incomplete_folder_helper {
my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_SEQ',
'Select problem(s) to print',
- 'multichoice="1", toponly ="1", addstatus="1", closeallpages="1"',
+ 'multichoice="1", toponly ="1", addstatus="1", closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -306,7 +306,8 @@ CHOOSE_STUDENTS
# this_state - State name of the chooser.
# prompt_text - Text to use to prompt user.
# resource_options - Resource tag options e.g.
-# "multichoice='1', toponly='1', addstatus='1'"
+# "multichoice='1', toponly='1', addstatus='1',
+# modallink='1'"
# that control the selection and appearance of the
# resource selector.
# variable - Name of the variable to hold the choice
@@ -4076,6 +4077,7 @@ sub printHelper {
my $subdir;
my $is_published=0; # True when printing from resource space.
my $res_printable = 1; # By default the current resource is printable.
+ my $res_error;
my $userCanPrint = ($perm{'pav'} || $perm{'pfo'});
my $res_printstartdate;
my $res_printenddate;
@@ -4097,13 +4099,22 @@ sub printHelper {
($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
$helper->{VARS}->{'postdata'} =
&Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($url));
- my $navmap = Apache::lonnavmaps::navmap->new();
- my $res = $navmap->getBySymb($symb);
- $res_printable = $res->resprintable() || $userCanPrint; #printability in course context
- ($res_printstartdate, $res_printenddate) = &get_print_dates($res);
- ($course_open, $course_close) = &course_print_dates($res);
- ($map_open, $map_close) = &map_print_dates($res);
-
+ if (!$userCanPrint) {
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ my $res = $navmap->getBySymb($symb);
+ if (ref($res)) {
+ $res_printable = $res->resprintable(); #printability in course context
+ ($res_printstartdate, $res_printenddate) = &get_print_dates($res);
+ ($course_open, $course_close) = &course_print_dates($res);
+ ($map_open, $map_close) = &map_print_dates($res);
+ } else {
+ $res_error = 1;
+ }
+ } else {
+ $res_error = 1;
+ }
+ }
} else {
# Resource space.
@@ -4219,7 +4230,7 @@ sub printHelper {
}
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' toponly='1' addstatus='1' closeallpages='1'",
+ "multichoice='1' toponly='1' addstatus='1' closeallpages='1' modallink='1'",
'RESOURCES',
'PAGESIZE',
$url,
@@ -4229,7 +4240,7 @@ sub printHelper {
$helperFragment .= &generate_resource_chooser('CHOOSE_RESOURCES_PAGE',
'Select Resource(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$url,
@@ -4294,7 +4305,7 @@ sub printHelper {
'CHOOSE_PROBLEMS_HTML'];
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS',
'Select Problem(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -4303,7 +4314,7 @@ sub printHelper {
$start_new_option);
$helperFragment .= &generate_resource_chooser('CHOOSE_PROBLEMS_HTML',
'Select Resource(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -4351,7 +4362,7 @@ ALL_PROBLEMS
&Apache::lonxml::xmlparse($r, 'helper',
&generate_resource_chooser('ALL_PROBLEMS',
'Select Problem(s) to print',
- 'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
+ 'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
'',
@@ -4360,7 +4371,7 @@ ALL_PROBLEMS
$start_new_option) .
&generate_resource_chooser('ALL_RESOURCES',
'Select Resource(s) to print',
- " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1'",
+ " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1' modallink='1'",
'RESOURCES',
'PAGESIZE',
'',
@@ -4368,7 +4379,7 @@ ALL_PROBLEMS
$start_new_option) .
&generate_resource_chooser('ALL_PROBLEMS_STUDENTS',
'Select Problem(s) to print',
- 'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
+ 'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'STUDENTS1',
'',
@@ -4412,7 +4423,7 @@ ALL_PROBLEMS
#
my $resource_selector= &generate_resource_chooser('SELECT_PROBLEMS',
'Select resources to print',
- 'multichoice="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PRINT_FORMATTING',
$map,
@@ -4423,7 +4434,7 @@ ALL_PROBLEMS
'PRINT_FORMATTING').
&generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' addstatus='1' closeallpages ='1'",
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
'RESOURCES',
'PRINT_FORMATTING',
$url,
@@ -4521,7 +4532,7 @@ ALL_PROBLEMS
$namechoice) .
&generate_resource_chooser('SELECT_PROBLEMS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' addstatus='1' closeallpages ='1'",
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
'RESOURCES',
'PRINT_FORMATTING',
$url,
@@ -4545,7 +4556,7 @@ ALL_PROBLEMS
PRINT_FORMATTING
Select resources for the assignment
+ closeallpages="1" modallink="1">
return $isNotMap;
$map
return $symbFilter;
@@ -4690,7 +4701,7 @@ CHOOSE_FROM_SUBDIR
(mark desired resources then click "next" button)
+ closeallpages="1" modallink="1">
PAGESIZE
return $isNotMap
return '$escapedSequenceName';
@@ -4704,23 +4715,27 @@ CHOOSE_FROM_ANY_SEQUENCE
# Generate the first state, to select which resources get printed.
Apache::lonhelper::state->new("START", "Select Printing Options:");
if (!$res_printable) {
- my $now = time;
- my $shownprintstart = &Apache::lonlocal::locallocaltime($res_printstartdate);
- my $shownprintend = &Apache::lonlocal::locallocaltime($res_printenddate);
my $noprintmsg;
- if (($res_printenddate) && ($res_printenddate < $now)) {
+ if ($res_error) {
+ $noprintmsg = &mt('Print availability for current resource could not be determined');
+ } else {
+ my $now = time;
+ my $shownprintstart = &Apache::lonlocal::locallocaltime($res_printstartdate);
+ my $shownprintend = &Apache::lonlocal::locallocaltime($res_printenddate);
+ if (($res_printenddate) && ($res_printenddate < $now)) {
$noprintmsg = &mt('Printing for current resource no longer available (ended: [_1])',
$shownprintend);
- } else {
- if (($res_printstartdate) && ($res_printstartdate > $now)) {
- if (($res_printenddate) && ($res_printenddate > $now) && ($res_printenddate > $res_printstartdate)) {
- $noprintmsg = &mt('Printing for current resource is only possible between [_1] and [_2]',
- $shownprintstart,$shownprintend);
- } elsif (!$res_printenddate) {
- $noprintmsg = &mt('Printing for current resource will only be possible starting [_1]',
- $shownprintstart);
- } else {
- $noprintmsg = &mt('Printing for current resource is unavailable');
+ } else {
+ if (($res_printstartdate) && ($res_printstartdate > $now)) {
+ if (($res_printenddate) && ($res_printenddate > $now) && ($res_printenddate > $res_printstartdate)) {
+ $noprintmsg = &mt('Printing for current resource is only possible between [_1] and [_2]',
+ $shownprintstart,$shownprintend);
+ } elsif (!$res_printenddate) {
+ $noprintmsg = &mt('Printing for current resource will only be possible starting [_1]',
+ $shownprintstart);
+ } else {
+ $noprintmsg = &mt('Printing for current resource is unavailable');
+ }
}
}
}