[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
raeburn
raeburn at source.lon-capa.org
Wed Oct 3 13:57:57 EDT 2018
raeburn Wed Oct 3 17:57:57 2018 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
- Handle case where /adm/printout is called outside context of a resource.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.663 loncom/interface/lonprintout.pm:1.664
--- loncom/interface/lonprintout.pm:1.663 Tue Oct 2 18:55:45 2018
+++ loncom/interface/lonprintout.pm Wed Oct 3 17:57:56 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.663 2018/10/02 18:55:45 raeburn Exp $
+# $Id: lonprintout.pm,v 1.664 2018/10/03 17:57:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4708,6 +4708,21 @@
CHOOSE_FROM_ANY_SEQUENCE
}
+ my $numchoices = 0;
+ if (ref($printChoices) eq 'ARRAY') {
+ $numchoices = @{$printChoices};
+ }
+ # Early out if nothing to print
+ if (!$numchoices) {
+ $r->print(&Apache::loncommon::start_page('Printing Helper').
+ '<h2>'.&mt('Unable to determine print context').'</h2>'.
+ '<p>'.&mt('Please display a resource, and then click the "Print" button/icon').'</p>');
+ my $prtspool=$r->dir_config('lonPrtDir');
+ my $footer = &recently_generated($prtspool);
+ $r->print($footer.&Apache::loncommon::end_page());
+ return OK;
+ }
+
# Generate the first state, to select which resources get printed.
Apache::lonhelper::state->new("START", "Select Printing Options:");
if (!$res_printable) {
More information about the LON-CAPA-cvs
mailing list