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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 29 May 2007 15:58:41 -0000


raeburn		Tue May 29 11:58:41 2007 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Don't set an autoenroll mail recipient if either one of the username or domain are blank.
  - Default to a blank domain, if no domain configurations prviously set.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.16 loncom/interface/domainprefs.pm:1.17
--- loncom/interface/domainprefs.pm:1.16	Sun May 27 17:21:26 2007
+++ loncom/interface/domainprefs.pm	Tue May 29 11:58:41 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.16 2007/05/27 21:21:26 raeburn Exp $
+# $Id: domainprefs.pm,v 1.17 2007/05/29 15:58:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -746,9 +746,8 @@
 
 sub print_autoenroll {
     my ($dom,$settings) = @_;
-    my $defdom = $dom;
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),
-    my ($runon,$runoff);
+    my ($defdom,$runon,$runoff);
     if (ref($settings) eq 'HASH') {
         if (exists($settings->{'run'})) {
             if ($settings->{'run'} eq '0') {
@@ -1577,10 +1576,17 @@
     my %title = ( run => 'Auto-enrollment active',
                   sender => 'Sender for notification messages');
     my @offon = ('off','on');
+    my $sender_uname = $env{'form.sender_uname'};
+    my $sender_domain = $env{'form.sender_domain'};
+    if ($sender_domain eq '') {
+        $sender_uname = '';
+    } elsif ($sender_uname eq '') {
+        $sender_domain = '';
+    }
     my %autoenrollhash =  (
                        autoenroll => { run => $env{'form.autoenroll_run'},
-                                       sender_uname => $env{'form.sender_uname'},
-                                       sender_domain => $env{'form.sender_domain'},
+                                       sender_uname => $sender_uname,
+                                       sender_domain => $sender_domain,
 
                                 }
                      );
@@ -1596,18 +1602,10 @@
                 $changes{'run'} = 1;
             }
         }
-        if (exists($currautoenroll{sender_uname})) {
-            if ($currautoenroll{'sender_uname'} ne $env{'form.sender_uname'}) {
-                $changes{'sender'} = 1;
-            }
-        } else {
+        if ($currautoenroll{'sender_uname'} ne $sender_uname) {
             $changes{'sender'} = 1;
         }
-        if (exists($currautoenroll{sender_domain})) {
-            if ($currautoenroll{'sender_domain'} ne $env{'form.sender_domain'}) {
-                $changes{'sender'} = 1;
-            }
-        } else {
+        if ($currautoenroll{'sender_domain'} ne $sender_domain) {
             $changes{'sender'} = 1;
         }
         if (keys(%changes) > 0) {
@@ -1616,7 +1614,11 @@
                 $resulttext .= '<li>'.&mt("$title{'run'} set to $offon[$env{'form.autoenroll_run'}]").'</li>';
             }
             if ($changes{'sender'}) {
-                $resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$env{'form.sender_uname'}.':'.$env{'form.sender_domain'}).'</li>';
+                if ($sender_uname eq '' || $sender_domain eq '') {
+                    $resulttext .= '<li>'.&mt("$title{'sender'} set to default (course owner).").'</li>';
+                } else {
+                    $resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$sender_uname.':'.$sender_domain).'</li>';
+                }
             }
             $resulttext .= '</ul>';
         } else {