[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonprintout.pm

raeburn raeburn at source.lon-capa.org
Tue Feb 5 20:10:09 EST 2019


raeburn		Wed Feb  6 01:10:09 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonprintout.pm 
  Log:
  - For 2.11
    Backport 1.664, 1.665, 1.667
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.627.2.25 loncom/interface/lonprintout.pm:1.627.2.26
--- loncom/interface/lonprintout.pm:1.627.2.25	Tue Oct  2 19:25:30 2018
+++ loncom/interface/lonprintout.pm	Wed Feb  6 01:10:09 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.627.2.25 2018/10/02 19:25:30 raeburn Exp $
+# $Id: lonprintout.pm,v 1.627.2.26 2019/02/06 01:10:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3228,7 +3228,7 @@
 	 $result .= $print_array[0].'  \end{document}';
      } elsif (($print_type eq 'problems_for_anon')      ||
 	      ($print_type eq 'problems_for_anon_page') ||
-	      ($print_type eq 'resources_for_anon')  ) { 
+	      ($print_type eq 'resources_for_anon')  ) {
 	 my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
 	 my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
 	 my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
@@ -3354,7 +3354,7 @@
 	 }
 	 &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
 	 $result .= $print_array[0].'  \end{document}';
-     } elsif ($print_type eq 'problems_from_directory') {      
+     } elsif ($print_type eq 'problems_from_directory') {
     #prints selected problems from the subdirectory 
 	$selectionmade = 6;
         my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'};
@@ -4065,8 +4065,10 @@
         $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
 
     }
-    $helper->{VARS}->{'symb'}=
-	&Apache::lonenc::check_encrypt($helper->{VARS}->{'symb'});
+    if ($helper->{VARS}->{'symb'} ne '') {
+        $helper->{VARS}->{'symb'}=
+	    &Apache::lonenc::check_encrypt($helper->{VARS}->{'symb'});
+    }
     my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu($helper);
     if ($sequenceTitle ne '') {$helper->{VARS}->{'assignment'}=$sequenceTitle;}
 
@@ -4712,6 +4714,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