[LON-CAPA-cvs] cvs: loncom /interface printout.pl

raeburn raeburn at source.lon-capa.org
Thu Feb 6 16:28:09 EST 2014


raeburn		Thu Feb  6 21:28:09 2014 EDT

  Modified files:              
    /loncom/interface	printout.pl 
  Log:
  - Names of course personnel need spaces between first name and last name
    replacing with underscore and/or removing when used in name range. 
    (Name range is used as part of filename for .tex and .log files).
    - Avoids printout.pl terminating when attempting to write to log file(s)
      when generating printouts for non-students, if single assignment per PDF
      or specified number of assignments per PDF.
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.156 loncom/interface/printout.pl:1.157
--- loncom/interface/printout.pl:1.156	Wed Aug 14 00:26:29 2013
+++ loncom/interface/printout.pl	Thu Feb  6 21:28:09 2014
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
 #
-# $Id: printout.pl,v 1.156 2013/08/14 00:26:29 raeburn Exp $
+# $Id: printout.pl,v 1.157 2014/02/06 21:28:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -313,7 +313,16 @@
 
   if ($tempo_array[3]) {
       $name=$tempo_array[3];
-      ($name_range) = split(/,/,$name, 2);
+      $name =~ s{^\s+|\s+$}{}g;
+      if ($name =~ /,/) { 
+          ($name_range) = split(/,/,$name, 2);
+      } elsif ($name =~ /\s/) {
+          $name_range = $name;
+          $name_range =~ s/\s+/_/;
+      } else {
+          $name_range = $name;  
+      }
+      $name_range =~ s/[^\w\:\-]+//g;
   } else {
       $name=$tempo_array[0].':'.$tempo_array[1];
       $name_range = $tempo_array[0];
@@ -336,8 +345,18 @@
       @tempo_array=split(/:/,$stud_info[-1]);
       if ($tempo_array[3]) {
 	  $name=$tempo_array[3];
-	  my ($lastname) = split(/,/, $name,2);
+          $name =~ s{^\s+|\s+$}{}g;
+          my $lastname;
+          if ($name =~ /,/) {
+	      ($lastname) = split(/,/, $name,2);
+          } elsif ($name =~ /\s/) {
+              $lastname = $name;
+              $lastname =~ s/\s+/_/;
+          } else {
+              $lastname = $name;
+          }
 	  $name_range .= "-".$lastname;
+          $name_range =~ s/[^\w\:\-]+//g;
       } else {
 	  $name=$tempo_array[0].':'.$tempo_array[1];
 	  $name_range .= '-'.$tempo_array[0];




More information about the LON-CAPA-cvs mailing list