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

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 29 Nov 2006 05:54:34 -0000


raeburn		Wed Nov 29 00:54:34 2006 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  bug 5018.  Username,domain separator in additional recipients changed from @ to : to support usernames containing @, and also to reduce likelihood of someone entering an e-mail address here.  Also change format expected in uploaded file when generating messages from a file.  Maybe add client side javascript to validate additional recipients entry?    
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.42 loncom/interface/lonmsgdisplay.pm:1.43
--- loncom/interface/lonmsgdisplay.pm:1.42	Thu Nov 23 11:40:17 2006
+++ loncom/interface/lonmsgdisplay.pm	Wed Nov 29 00:54:34 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.42 2006/11/23 16:40:17 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.43 2006/11/29 05:54:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1039,7 +1039,7 @@
     my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
     if ($broadcast ne 'upload') {
        $r->print(<<"ENDCOMP");
-<tr><td>$lt{'ad'}<br /><tt>username\@domain,username\@domain, ...
+<tr><td>$lt{'ad'}<br /><tt>username:domain,username:domain, ...
 </tt></td><td>
 <input type="text" size="50" name="additionalrec" /></td></tr>
 <tr><td>$lt{'sb'}:</td><td><input type="text" size="50" name="subject" value="$dissub" />
@@ -1077,14 +1077,14 @@
 <p>
 The file format for the uploaded portion of the message is:
 <pre>
-username1\@domain1: text
-username2\@domain2: text
-username3\@domain1: text
+username1:domain1: text
+username2:domain2: text
+username3:domain1: text
 </pre>
 </p>
 <p>
 The messages will be assembled from all lines with the respective 
-<tt>username\@domain</tt>, and appended to the general message text.</p>
+<tt>username:domain</tt>, and appended to the general message text.</p>
 <p>
 <input type="file" name="upfile" size="40" /></p><p>
 $dispcrit
@@ -1906,9 +1906,10 @@
 	    }
 	} elsif ($env{'form.sendmode'} eq 'upload') {
 	    foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) {
-		my ($rec,$txt)=split(/\s*\:\s*/,$line);
+                my ($rec,$txt) = ($line =~ /^([^:]+:[^:]+):(.*)$/);
 		if ($txt) {
-		    $rec=~s/\@/\:/;
+                    $rec =~ s/^\s+//;
+                    $rec =~ ~s/\s+$//;
 		    $toaddr{$rec}.=$txt."\n";
 		}
 	    }
@@ -1919,7 +1920,7 @@
 	}
 	if ($env{'form.additionalrec'}) {
 	    foreach my $rec (split(/\,/,$env{'form.additionalrec'})) {
-		my ($auname,$audom)=split(/\@/,$rec);
+		my ($auname,$audom)=split(/:/,$rec);
 		if (($auname ne "") && ($audom ne "")) {
 		    $toaddr{$auname.':'.$audom}='';
 		}