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

raeburn raeburn@source.lon-capa.org
Wed, 14 Apr 2010 04:27:20 -0000


raeburn		Wed Apr 14 04:27:20 2010 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Domain Configuration can include one or more Bcc recipients for helpdesk email.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.133 loncom/interface/domainprefs.pm:1.134
--- loncom/interface/domainprefs.pm:1.133	Mon Mar 22 17:23:34 2010
+++ loncom/interface/domainprefs.pm	Wed Apr 14 04:27:20 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.133 2010/03/22 17:23:34 raeburn Exp $
+# $Id: domainprefs.pm,v 1.134 2010/04/14 04:27:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -988,7 +988,7 @@
     my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,
         $images,$bgs,$links,$alt_text,$rowtotal,$logintext,$loginheader) = @_;
     my $css_class = $itemcount%2?' class="LC_odd_row"':'';
-    my $datatable = '<tr>'.
+    my $datatable = '<tr'.$css_class.'>'.
         '<td>'.$choices->{'font'}.'</td>';
     if (!$is_custom->{'font'}) {
         $datatable .=  '<td>'.&mt('Default in use:').'&nbsp;<span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>';
@@ -2014,12 +2014,13 @@
     my ($dom,$settings,$rowtotal) = @_;
     my $datatable;
     my @contacts = ('adminemail','supportemail');
-    my (%checked,%to,%otheremails);
+    my (%checked,%to,%otheremails,%bccemails);
     my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
                     'requestsmail');
     foreach my $type (@mailings) {
         $otheremails{$type} = '';
     }
+    $bccemails{'helpdeskmail'} = '';
     if (ref($settings) eq 'HASH') {
         foreach my $item (@contacts) {
             if (exists($settings->{$item})) {
@@ -2035,6 +2036,9 @@
                         }
                     }
                     $otheremails{$type} = $settings->{$type}{'others'};
+                    if ($type eq 'helpdeskmail') {
+                        $bccemails{$type} = $settings->{$type}{'bcc'};
+                    }
                 }
             } elsif ($type eq 'lonstatusmail') {
                 $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
@@ -2078,8 +2082,13 @@
         }
         $datatable .= '</span><br />'.&mt('Others').':&nbsp;&nbsp;'.
                       '<input type="text" name="'.$type.'_others" '.
-                      'value="'.$otheremails{$type}.'"  />'.
-                      '</td></tr>'."\n";
+                      'value="'.$otheremails{$type}.'"  />';
+        if ($type eq 'helpdeskmail') {
+            $datatable .= '<br />'.&mt('Bcc').':'.('&nbsp;'x6).
+                          '<input type="text" name="'.$type.'_bcc" '.
+                          'value="'.$bccemails{$type}.'"  />';
+        }
+        $datatable .= '</td></tr>'."\n";
     }
     $$rowtotal += $rownum;
     return $datatable;
@@ -5186,7 +5195,7 @@
             $currsetting{$key} = $domconfig{'contacts'}{$key};
         }
     }
-    my (%others,%to);
+    my (%others,%to,%bcc);
     my @contacts = ('supportemail','adminemail');
     my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail',
                     'requestsmail');
@@ -5202,6 +5211,10 @@
         }  
         $others{$type} = $env{'form.'.$type.'_others'};
         $contacts_hash{contacts}{$type}{'others'} = $others{$type};
+        if ($type eq 'helpdeskmail') {
+            $bcc{$type} = $env{'form.'.$type.'_bcc'};
+            $contacts_hash{contacts}{$type}{'bcc'} = $bcc{$type};
+        }
     }
     foreach my $item (@contacts) {
         $to{$item} = $env{'form.'.$item};
@@ -5226,6 +5239,11 @@
             if ($others{$type} ne $currsetting{$type}{'others'}) {
                 push(@{$changes{$type}},'others');
             }
+            if ($type eq 'helpdeskmail') {   
+                if ($bcc{$type} ne $currsetting{$type}{'bcc'}) {
+                    push(@{$changes{$type}},'bcc'); 
+                }
+            }
         }
     } else {
         my %default;
@@ -5248,7 +5266,12 @@
             }
             if ($others{$type} ne '') {
                 push(@{$changes{$type}},'others');
-            } 
+            }
+            if ($type eq 'helpdeskmail') {
+                if ($bcc{$type} ne '') {
+                    push(@{$changes{$type}},'bcc');
+                }
+            }
         }
     }
     my $putresult = &Apache::lonnet::put_dom('configuration',\%contacts_hash,
@@ -5276,7 +5299,13 @@
                         push(@text,$others{$type});
                     }
                     $resulttext .= '<span class="LC_cusr_emph">'.
-                                   join(', ',@text).'</span></li>';
+                                   join(', ',@text).'</span>';
+                    if ($type eq 'helpdeskmail') {
+                        if ($bcc{$type} ne '') {
+                            $resulttext .= '&nbsp;'.&mt('with Bcc to').': <span class="LC_cusr_emph">'.$bcc{$type}.'</span>';
+                        }
+                    }
+                    $resulttext .= '</li>';
                 }
             }
             $resulttext .= '</ul>';