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

raeburn raeburn at source.lon-capa.org
Tue Aug 13 15:18:44 EDT 2013


raeburn		Tue Aug 13 19:18:44 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.11
    - Backport 1.203, 1.204.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.22 loncom/interface/domainprefs.pm:1.160.6.23
--- loncom/interface/domainprefs.pm:1.160.6.22	Thu Aug  8 00:54:47 2013
+++ loncom/interface/domainprefs.pm	Tue Aug 13 19:18:43 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.160.6.22 2013/08/08 00:54:47 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.23 2013/08/13 19:18:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -511,7 +511,7 @@
     } elsif ($action eq 'contacts') {
         $output = &modify_contacts($dom,%domconfig);
     } elsif ($action eq 'defaults') {
-        $output = &modify_defaults($dom,$r);
+        $output = &modify_defaults($dom,$r,%domconfig);
     } elsif ($action eq 'scantron') {
         $output = &modify_scantron($r,$dom,$confname,%domconfig);
     } elsif ($action eq 'coursecategories') {
@@ -2290,7 +2290,7 @@
     my @contacts = ('adminemail','supportemail');
     my (%checked,%to,%otheremails,%bccemails);
     my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
-                    'requestsmail','updatesmail');
+                    'requestsmail','updatesmail','idconflictsmail');
     foreach my $type (@mailings) {
         $otheremails{$type} = '';
     }
@@ -2326,22 +2326,22 @@
         $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
         $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; 
         $checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
-        $checked{'updatesmail'}{'adminemail'} = ' checked="checked" '; 
+        $checked{'updatesmail'}{'adminemail'} = ' checked="checked" ';
+        $checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" ';
     }
     my ($titles,$short_titles) = &contact_titles();
     my $rownum = 0;
     my $css_class;
     foreach my $item (@contacts) {
-        $rownum ++;
         $css_class = $rownum%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'>'. 
                   '<td><span class="LC_nobreak">'.$titles->{$item}.
                   '</span></td><td class="LC_right_item">'.
                   '<input type="text" name="'.$item.'" value="'.
                   $to{$item}.'" /></td></tr>';
+        $rownum ++;
     }
     foreach my $type (@mailings) {
-        $rownum ++;
         $css_class = $rownum%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'>'.
                       '<td><span class="LC_nobreak">'.
@@ -2364,7 +2364,21 @@
                           'value="'.$bccemails{$type}.'"  />';
         }
         $datatable .= '</td></tr>'."\n";
+        $rownum ++;
     }
+    my %choices;
+    $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',
+                                   &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+                                   &mt('LON-CAPA core group - MSU'),600,500));
+    $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',
+                                    &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+                                    &mt('LON-CAPA core group - MSU'),600,500));
+    my @toggles = ('reporterrors','reportupdates');
+    my %defaultchecked = ('reporterrors'  => 'on',
+                          'reportupdates' => 'on');
+    (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+                                               \%choices,$rownum);
+    $datatable .= $reports;
     $$rowtotal += $rownum;
     return $datatable;
 }
@@ -3282,6 +3296,7 @@
                    'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',
                    'requestsmail' => 'E-mail from course requests requiring approval',
                    'updatesmail'  => 'E-mail from nightly check of LON-CAPA module integrity/updates',
+                   'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
                  );
     my %short_titles = &Apache::lonlocal::texthash (
                            adminemail   => 'Admin E-mail address',
@@ -4403,7 +4418,7 @@
             if (ref($cats->[$depth]{$parent}) eq 'ARRAY') {
                 my $numchildren = @{$cats->[$depth]{$parent}};
                 my $css_class = $itemcount%2?' class="LC_odd_row"':'';
-                $text .= '<td><table class="LC_datatable">';
+                $text .= '<td><table class="LC_data_table">';
                 my ($idxnum,$parent_name,$parent_item);
                 my $higher = $depth - 1;
                 if ($higher == 0) {
@@ -6653,7 +6668,8 @@
     my (%others,%to,%bcc);
     my @contacts = ('supportemail','adminemail');
     my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail',
-                    'requestsmail','updatesmail');
+                    'requestsmail','updatesmail','idconflictsmail');
+    my @toggles = ('reporterrors','reportupdates');
     foreach my $type (@mailings) {
         @{$newsetting{$type}} = 
             &Apache::loncommon::get_env_multiple('form.'.$type);
@@ -6675,6 +6691,11 @@
         $to{$item} = $env{'form.'.$item};
         $contacts_hash{'contacts'}{$item} = $to{$item};
     }
+    foreach my $item (@toggles) {
+        if ($env{'form.'.$item} =~ /^(0|1)$/) {
+            $contacts_hash{'contacts'}{$item} = $env{'form.'.$item};
+        }
+    }
     if (keys(%currsetting) > 0) {
         foreach my $item (@contacts) {
             if ($to{$item} ne $currsetting{$item}) {
@@ -6713,7 +6734,7 @@
         foreach my $item (@contacts) {
            if ($to{$item} ne $default{$item}) {
               $changes{$item} = 1;
-           } 
+           }
         }
         foreach my $type (@mailings) {
             if ((@{$newsetting{$type}} != 1) || ($newsetting{$type}[0] ne $default{$type})) {
@@ -6730,6 +6751,14 @@
             }
         }
     }
+    foreach my $item (@toggles) {
+        if (($env{'form.'.$item} == 1) && ($currsetting{$item} == 0)) {
+            $changes{$item} = 1;
+        } elsif ((!$env{'form.'.$item}) &&
+                 (($currsetting{$item} eq '') || ($currsetting{$item} == 1))) {
+            $changes{$item} = 1;
+        }
+    }
     my $putresult = &Apache::lonnet::put_dom('configuration',\%contacts_hash,
                                              $dom);
     if ($putresult eq 'ok') {
@@ -6764,6 +6793,23 @@
                     $resulttext .= '</li>';
                 }
             }
+            my @offon = ('off','on');
+            if ($changes{'reporterrors'}) {
+                $resulttext .= '<li>'.
+                               &mt('E-mail error reports to [_1] set to "'.
+                                   $offon[$env{'form.reporterrors'}].'".',
+                                   &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+                                       &mt('LON-CAPA core group - MSU'),600,500)).
+                               '</li>';
+            }
+            if ($changes{'reportupdates'}) {
+                $resulttext .= '<li>'.
+                                &mt('E-mail record of completed LON-CAPA updates to [_1] set to "'.
+                                    $offon[$env{'form.reportupdates'}].'".',
+                                    &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+                                        &mt('LON-CAPA core group - MSU'),600,500)).
+                                '</li>';
+            }
             $resulttext .= '</ul>';
         } else {
             $resulttext = &mt('No changes made to contact information');
@@ -7358,7 +7404,7 @@
 }
 
 sub modify_defaults {
-    my ($dom,$r) = @_;
+    my ($dom,$r,%domconfig) = @_;
     my ($resulttext,$mailmsgtxt,%newvalues,%changes, at errors);
     my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
     my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def','portal_def');
@@ -7444,8 +7490,17 @@
             my $cachetime = 24*60*60;
             &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
             if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_def'}) {
-                my $sysmail = $r->dir_config('lonSysEMail');
-                &Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext);
+                my $notify = 1;
+                if (ref($domconfig{'contacts'}) eq 'HASH') {
+                    if ($domconfig{'contacts'}{'reportupdates'} == 0) {
+                        $notify = 0;
+                    }
+                }
+                if ($notify) {
+                    &Apache::lonmsg::sendemail('installrecord at loncapa.org',
+                                               "LON-CAPA Domain Settings Change - $dom",
+                                               $mailmsgtext);
+                }
             }
         } else {
             $resulttext = &mt('No changes made to default authentication/language/timezone settings');


More information about the LON-CAPA-cvs mailing list