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

raeburn raeburn at source.lon-capa.org
Sun Mar 22 14:10:45 EDT 2026


raeburn		Sun Mar 22 18:10:45 2026 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - Bug 6121. Create unique universal identifiers (uuids), as needed, when
    generating PDF with form fields.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.716 loncom/interface/lonprintout.pm:1.717
--- loncom/interface/lonprintout.pm:1.716	Thu Mar 12 13:25:47 2026
+++ loncom/interface/lonprintout.pm	Sun Mar 22 18:10:45 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.716 2026/03/12 13:25:47 raeburn Exp $
+# $Id: lonprintout.pm,v 1.717 2026/03/22 18:10:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2326,6 +2326,15 @@
 	if ($resource_src =~ /.page$/i) {
 	    my $navmap         = Apache::lonnavmaps::navmap->new();
 	    my @page_resources = $navmap->retrieveResources($resource_src);
+            my @needuuid;
+            foreach my $res (@page_resources) {
+                if (($res->symb() =~ /$LONCAPA::assess_re/) && ($pdfFormFields eq 'yes')) {
+                    push(@needuuid,$res->symb());
+                }
+            }
+            if (@needuuid) {
+                &Apache::lonnet::makeuuids(\@needuuid);
+            }
 	    $result           .= &print_page_in_course($helper, $rparmhash,
 						       $resource_src, \@page_resources);
         } elsif ($resource->ext()) {
@@ -2922,6 +2931,9 @@
 		my %moreenv;
 		$moreenv{'request.filename'}=$cleanURL;
                 if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';}
+                if (($cleanURL =~ /$LONCAPA::assess_re/) && ($pdfFormFields eq 'yes') && ($form{'problemtype'} ne 'exam')) {
+                    &Apache::lonnet::makeuuids([$helper->{'VARS'}->{'symb'}]);
+                }
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 		$form{'suppress_tries'}=$parmhash{'suppress_tries'};
 		$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -3050,6 +3062,15 @@
 
 	    my $navmap         =  Apache::lonnavmaps::navmap->new();
 	    my @page_resources =  $navmap->retrieveResources($cleanURL);
+            my @needuuid;
+            foreach my $res (@page_resources) {
+                if (($res->symb() =~ /$LONCAPA::assess_re/) && ($pdfFormFields)) {
+                    push(@needuuid,$res->symb());
+                }
+            }
+            if (@needuuid) {
+                &Apache::lonnet::makeuuids(\@needuuid);
+            }
 	    $result           .=  &print_page_in_course($helper, $rparmhash,
 							$cleanURL, \@page_resources);
 
@@ -3098,6 +3119,15 @@
 	my $flag_latex_header_remove = 'NO';
 	my $flag_page_in_sequence = 'NO';
 	my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+        my @needuuid;
+        foreach my $symb (@master_seq) {
+            if (($symb =~ /$LONCAPA::assess_re/) && ($pdfFormFields eq 'yes')) {
+                push(@needuuid,$symb);
+            }
+        }
+        if (@needuuid) {
+            &Apache::lonnet::makeuuids(\@needuuid);
+        }
 	my $prevassignment='';
 
 	&Apache::lonxml::clear_problem_counter();
@@ -3332,6 +3362,15 @@
 	     $helper->{'VARS'}->{'NUMBER_TO_PRINT'} = $#students+1;
 	 }
 	 my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+         my @needuuid;
+         foreach my $symb (@master_seq) {
+             if (($symb =~ /$LONCAPA::assess_re/) && ($pdfFormFields eq 'yes')) {
+                push(@needuuid,$symb);
+             }
+         }
+         if (@needuuid) {
+             &Apache::lonnet::makeuuids(\@needuuid);
+         }
 
          my $map;
          if ($helper->{VARS}->{'symb'}) {
@@ -3488,6 +3527,15 @@
 	     @allcodes=keys(%allcodes);
 	 }
 	 my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+         my @needuuid;
+         foreach my $symb (@master_seq) {
+             if (($symb =~ /$LONCAPA::assess_re/) && ($pdfFormFields eq 'yes')) {
+                 push(@needuuid,$symb);
+             }
+         }
+         if (@needuuid) {
+             &Apache::lonnet::makeuuids(\@needuuid);
+         }
 	 my ($type) = split(/_/,$print_type);
 	 &adjust_number_to_print($helper);
 	 my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'};




More information about the LON-CAPA-cvs mailing list