[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 20 Jun 2007 21:06:54 -0000
albertel Wed Jun 20 17:06:54 2007 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
- email address verification code wasn't taking into account full range of what is allowed int eh email specification (multiple receivers, and receivers that target specific sections)
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.370 loncom/interface/lonparmset.pm:1.371
--- loncom/interface/lonparmset.pm:1.370 Tue Jun 19 18:35:11 2007
+++ loncom/interface/lonparmset.pm Wed Jun 20 17:06:51 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.370 2007/06/19 22:35:11 albertel Exp $
+# $Id: lonparmset.pm,v 1.371 2007/06/20 21:06:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2047,17 +2047,24 @@
#
# Deal with the emails
if ($name =~ /\.email$/) {
- my ($user,$domain) = split(/:/,$value);
- if (!defined($user) || !defined($domain)) {
- $setoutput.= '<br /> <span class="LC_error">'.
- &mt("Invalid email address specified, address must be of the form username:domain").
- '</span>';
- undef($value);
- } elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') {
- $setoutput.= '<br /> <span class="LC_error">'.
- &mt("Invalid email address specified, user [_1] is unknown.",$value).
- '</span>';
- undef($value);
+ foreach my $specifier (split(',',$value)) {
+ my ($user,$sections_or_groups)=
+ ($specifier=~/^([^\(]+)\(([^\)]+)\)/);
+ if (!$sections_or_groups) {
+ $user = $specifier;
+ }
+ my ($name,$domain) = split(':',$user);
+ if (!defined($user) || !defined($domain)) {
+ $setoutput.= '<br /> <span class="LC_error">'.
+ &mt("Invalid email address specified, address must be of the form username:domain what was specified was ([_1])",$user).
+ '</span>';
+ undef($value);
+ } elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') {
+ $setoutput.= '<br /> <span class="LC_error">'.
+ &mt("Invalid email address specified, user [_1] is unknown.",$name).
+ '</span>';
+ undef($value);
+ }
}
}
# Get existing cloners