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

raeburn raeburn at source.lon-capa.org
Thu Feb 13 12:47:31 EST 2014


raeburn		Thu Feb 13 17:47:31 2014 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/interface	printout.pl 
  Log:
  - For 2.10
    - Backport 1.154, 1.157
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.146.4.2 loncom/interface/printout.pl:1.146.4.3
--- loncom/interface/printout.pl:1.146.4.2	Fri Mar  4 16:53:06 2011
+++ loncom/interface/printout.pl	Thu Feb 13 17:47:30 2014
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
 #
-# $Id: printout.pl,v 1.146.4.2 2011/03/04 16:53:06 raeburn Exp $
+# $Id: printout.pl,v 1.146.4.3 2014/02/13 17:47:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -127,8 +127,8 @@
 
 	    # Todo: Convert badurl into a url from file path:
 
-	    my $subject  = "Error [$badurl] Print failed for $user".'@'.$domain;
-	    my $message .= "Print failed to render LaTeX for $user".'@'."$domain\n";
+	    my $subject  = "Error [$badurl] Print failed for $user".':'.$domain;
+	    my $message .= "Print failed to render LaTeX for $user".':'."$domain\n";
 	    $message    .= "  User was attempting to print: \n";
 	    foreach my $resource (split(/:/,$resources)) {
 		$message    .= "       $resource\n";
@@ -308,14 +308,23 @@
   my $name;
   my $name_range='';
 
-  # $name       -> Either user's full name or username at domain
-  # $name_range -> Either user's last name or usrname.
+  # $name       -> Either user's full name or username:domain
+  # $name_range -> Either user's last name or username.
 
   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=$tempo_array[0].':'.$tempo_array[1];
       $name_range = $tempo_array[0];
   }
 
@@ -323,7 +332,7 @@
   # user is getting printed.
   #
 
-  if (($name ne "") && ($name ne '@') ) { # Could be printing codes...
+  if (($name ne "") && ($name ne ':') ) { # Could be printing codes...
       $link_text='<b>'.$name.'</b>';
       $status_statement.=$name;
   }
@@ -336,13 +345,23 @@
       @tempo_array=split(/:/,$stud_info[-1]);
       if ($tempo_array[3]) {
 	  $name=$tempo_array[3];
-	  my ($lastname) = split(/,/, $name,2);
-	  $name_range .= "-".$lastname;
+          $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=$tempo_array[0].':'.$tempo_array[1];
 	  $name_range .= '-'.$tempo_array[0];
       }
-      if (($name ne "") && ($name ne '@')) {
+      if (($name ne "") && ($name ne ':')) {
 	  $link_text.=' - <b>'.$name.'</b>';
 	  $status_statement.=' -  '.$name;
   




More information about the LON-CAPA-cvs mailing list