Diff for /loncom/interface/domainprefs.pm between versions 1.160.6.84.2.3 and 1.160.6.84.2.4

version 1.160.6.84.2.3, 2017/09/16 00:26:17 version 1.160.6.84.2.4, 2017/10/15 18:51:15
Line 2658  sub print_autoupdate { Line 2658  sub print_autoupdate {
         my $locknamesettings;          my $locknamesettings;
         $datatable .= &insttypes_row($settings,$types,$usertypes,          $datatable .= &insttypes_row($settings,$types,$usertypes,
                                      $dom,$numinrow,$othertitle,                                       $dom,$numinrow,$othertitle,
                                     'lockablenames');                                      'lockablenames',$rowtotal);
         $$rowtotal ++;          $$rowtotal ++;
     } else {      } else {
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);          my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
Line 2801  sub print_directorysrch { Line 2801  sub print_directorysrch {
         if (ref($usertypes) eq 'HASH') {          if (ref($usertypes) eq 'HASH') {
             if (keys(%{$usertypes}) > 0) {              if (keys(%{$usertypes}) > 0) {
                 $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,                  $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
                                              $numinrow,$othertitle,'cansearch');                                               $numinrow,$othertitle,'cansearch',
                                                $rowtotal);
                 $cansrchrow = 1;                  $cansrchrow = 1;
             }              }
         }          }
Line 3002  sub print_contacts { Line 3003  sub print_contacts {
                           $to{$item}.'" /></td></tr>';                            $to{$item}.'" /></td></tr>';
             $rownum ++;              $rownum ++;
         }          }
     } else {      } elsif ($position eq 'bottom') {
           $css_class = $rownum%2?' class="LC_odd_row"':'';
           $datatable .= '<tr'.$css_class.'>'.
                         '<td>'.&mt('Extra helpdesk form fields:').'<br />'.
                         &mt('(e-mail, subject, and description always shown)').
                         '</td><td class="LC_left_item">';
           if ((ref($fields) eq 'ARRAY') && (ref($fieldtitles) eq 'HASH') &&
               (ref($fieldoptions) eq 'HASH') && (ref($possoptions) eq 'HASH')) {
               $datatable .= '<table><tr><th>'.&mt('Field').'</th><th>'.&mt('Status').'</th></tr>';
               foreach my $field (@{$fields}) {
                   $datatable .= '<tr><td>'.$fieldtitles->{$field};
                   if (($field eq 'screenshot') || ($field eq 'cc')) {
                       $datatable .= ' '.&mt('(logged-in users)');
                   }
                   $datatable .='</td><td>';
                   my $clickaction;
                   if ($field eq 'screenshot') {
                       $clickaction = ' onclick="screenshotSize(this);"';
                   }
                   if (ref($possoptions->{$field}) eq 'ARRAY') {
                       foreach my $option (@{$possoptions->{$field}}) {
                           my $checked;
                           if ($currfield{$field} eq $option) {
                               $checked = ' checked="checked"';
                           }
                           $datatable .= '<span class="LC_nobreak"><label>'.
                                         '<input type="radio" name="helpform_'.$field.'" '.
                                         'value="'.$option.'"'.$checked.$clickaction.' />'.$fieldoptions->{$option}.
                                         '</label></span>'.('&nbsp;'x2);
                       }
                   }
                   if ($field eq 'screenshot') {
                       my $display;
                       if ($currfield{$field} eq 'no') {
                           $display = ' style="display:none"';
                       }
                       $datatable .= '</td></tr><tr id="help_screenshotsize"'.$display.' />'.
                                     '<td>'.&mt('Maximum size for upload (MB)').'</td><td>'.
                                     '<input type="text" size="5" name="helpform_maxsize" value="'.$maxsize.'" />';
                   }
                   $datatable .= '</td></tr>';
               }
               $datatable .= '</table>';
           }
           $datatable .= '</td></tr>'."\n";
           $rownum ++;
       }
       unless ($position eq 'top') {
         foreach my $type (@mailings) {          foreach my $type (@mailings) {
             $css_class = $rownum%2?' class="LC_odd_row"':'';              $css_class = $rownum%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'>'.              $datatable .= '<tr'.$css_class.'>'.
Line 3062  sub print_contacts { Line 3110  sub print_contacts {
                                                    \%choices,$rownum);                                                     \%choices,$rownum);
         $datatable .= $reports;          $datatable .= $reports;
     } elsif ($position eq 'bottom') {      } elsif ($position eq 'bottom') {
         $css_class = $rownum%2?' class="LC_odd_row"':'';          my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
         $datatable .= '<tr'.$css_class.'>'.          my (@posstypes,%usertypeshash);
                       '<td>'.&mt('Extra helpdesk form fields:').'<br />'.          if (ref($types) eq 'ARRAY') {
                       &mt('(e-mail, subject, and description always shown)').              @posstypes = @{$types};
                       '</td><td class="LC_left_item">';          }
         if ((ref($fields) eq 'ARRAY') && (ref($fieldtitles) eq 'HASH') &&          if (@posstypes) {
             (ref($fieldoptions) eq 'HASH') && (ref($possoptions) eq 'HASH')) {              if (ref($usertypes) eq 'HASH') {
             $datatable .= '<table><tr><th>'.&mt('Field').'</th><th>'.&mt('Status').'</th></tr>';                  %usertypeshash = %{$usertypes};
             foreach my $field (@{$fields}) {              }
                 $datatable .= '<tr><td>'.$fieldtitles->{$field};              my @overridden;
                 if (($field eq 'screenshot') || ($field eq 'cc')) {              my $numinrow = 4;
                     $datatable .= ' '.&mt('(logged-in users)');              if (ref($settings) eq 'HASH') {
                 }                  if (ref($settings->{'overrides'}) eq 'HASH') {
                 $datatable .='</td><td>';                      foreach my $key (sort(keys(%{$settings->{'overrides'}}))) {
                 my $clickaction;                          if (ref($settings->{'overrides'}{$key}) eq 'HASH') {
                 if ($field eq 'screenshot') {                              push(@overridden,$key);
                     $clickaction = ' onclick="screenshotSize(this);"';                              foreach my $item (@contacts) {
                 }                                  if ($settings->{'overrides'}{$key}{$item}) {
                 if (ref($possoptions->{$field}) eq 'ARRAY') {                                      $checked{'override_'.$key}{$item} = ' checked="checked" ';
                     foreach my $option (@{$possoptions->{$field}}) {                                  }
                         my $checked;                              }
                         if ($currfield{$field} eq $option) {                              $otheremails{'override_'.$key} = $settings->{'overrides'}{$key}{'others'};
                             $checked = ' checked="checked"';                              $bccemails{'override_'.$key} = $settings->{'overrides'}{$key}{'bcc'};
                               $includeloc{'override_'.$key} = '';
                               $includestr{'override_'.$key} = '';
                               if ($settings->{'overrides'}{$key}{'include'} ne '') {
                                   ($includeloc{'override_'.$key},$includestr{'override_'.$key}) =
                                       split(/:/,$settings->{'overrides'}{$key}{'include'},2);
                                   $includestr{'override_'.$key} = &unescape($includestr{'override_'.$key});
                               }
                         }                          }
                         $datatable .= '<span class="LC_nobreak"><label>'.  
                                       '<input type="radio" name="helpform_'.$field.'" '.  
                                       'value="'.$option.'"'.$checked.$clickaction.' />'.$fieldoptions->{$option}.  
                                       '</label></span>'.('&nbsp;'x2);  
                     }                      }
                 }                  }
                 if ($field eq 'screenshot') {              }
                     my $display;              my $customclass = 'LC_helpdesk_override';
                     if ($currfield{$field} eq 'no') {              my $optionsprefix = 'LC_options_helpdesk_';
                         $display = ' style="display:none"';  
                     }              my $onclicktypes = "toggleHelpdeskRow(this.form,'overrides','$customclass','$optionsprefix');";
                     $datatable .= '</td></tr><tr id="help_screenshotsize"'.$display.' />'.  
                                   '<td>'.&mt('Maximum size for upload (MB)').'</td><td>'.              $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
                                   '<input type="text" size="5" name="helpform_maxsize" value="'.$maxsize.'" />';                                           $numinrow,$othertitle,'overrides',
                                            \$rownum,$onclicktypes,$customclass);
               $rownum ++;
               $usertypeshash{'default'} = $othertitle;
               foreach my $status (@posstypes) {
                   my $css_class;
                   if ($rownum%2) {
                       $css_class = 'LC_odd_row ';
                   }
                   $css_class .= $customclass;
                   my $rowid = $optionsprefix.$status;
                   my $hidden = 1;
                   my $currstyle = 'display:none';
                   if (grep(/^\Q$status\E$/,@overridden)) {
                       $currstyle = 'display:table-row';
                       $hidden = 0;
                   }
                   my $key = 'override_'.$status;
                   $datatable .= &overridden_helpdesk($checked{$key},$otheremails{$key},$bccemails{$key},
                                                     $includeloc{$key},$includestr{$key},$status,$rowid,
                                                     $usertypeshash{$status},$css_class,$currstyle,
                                                     \@contacts,$short_titles);
                   unless ($hidden) {
                       $rownum ++;
                 }                  }
                 $datatable .= '</td></tr>';  
             }              }
             $datatable .= '</table>';  
         }          }
         $datatable .= '</td></tr>'."\n";  
         $rownum ++;  
     }      }
     $$rowtotal += $rownum;      $$rowtotal += $rownum;
     return $datatable;      return $datatable;
 }  }
   
   sub overridden_helpdesk {
       my ($checked,$otheremails,$bccemails,$includeloc,$includestr,$type,$rowid,
           $typetitle,$css_class,$rowstyle,$contacts,$short_titles) = @_;
       my $class = 'LC_left_item';
       if ($css_class) {
           $css_class = ' class="'.$css_class.'"';
       }
       if ($rowid) {
           $rowid = ' id="'.$rowid.'"';
       }
       if ($rowstyle) {
           $rowstyle = ' style="'.$rowstyle.'"';
       }
       my ($output,$description);
       $description = &mt('Helpdesk requests from: [_1] in this domain (overrides default)',"<b>$typetitle</b>");
       $output = '<tr'.$css_class.$rowid.$rowstyle.'>'.
                 "<td>$description</td>\n".
                 '<td class="'.$class.'" colspan="2">'.
                 '<fieldset><legend>'.&mt('E-mail recipient(s)').'</legend>'.
                 '<span class="LC_nobreak">';
       if (ref($contacts) eq 'ARRAY') {
           foreach my $item (@{$contacts}) {
               my $check;
               if (ref($checked) eq 'HASH') {
                  $check = $checked->{$item};
               }
               my $title;
               if (ref($short_titles) eq 'HASH') {
                   $title = $short_titles->{$item};
               }
               $output .= '<label>'.
                          '<input type="checkbox" name="override_'.$type.'"'.$check.
                          ' value="'.$item.'" />'.$title.'</label>&nbsp;';
           }
       }
       $output .= '</span><br />'.&mt('Others').':&nbsp;&nbsp;'.
                  '<input type="text" name="override_'.$type.'_others" '.
                  'value="'.$otheremails.'"  />';
       my %locchecked;
       foreach my $loc ('s','b') {
           if ($includeloc eq $loc) {
               $locchecked{$loc} = ' checked="checked"';
               last;
           }
       }
       $output .= '<br />'.&mt('Bcc:').('&nbsp;'x6).
                  '<input type="text" name="override_'.$type.'_bcc" '.
                  'value="'.$bccemails.'"  /></fieldset>'.
                  '<fieldset><legend>'.&mt('Optional added text').'</legend>'.
                  &mt('Text automatically added to e-mail:').' '.
                  '<input type="text" name="override_'.$type.'_includestr" value="'.$includestr.'" /><br >'.
                  '<span class="LC_nobreak">'.&mt('Location:').'&nbsp;'.
                  '<label><input type="radio" name="override_'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.
                  ('&nbsp;'x2).
                  '<label><input type="radio" name="override_'.$type.'_includeloc" value="b"'.$locchecked{'b'}.' />'.&mt('in body').'</label>'.
                  '</span></fieldset>'.
                  '</td></tr>'."\n";
       return $output;
   }
   
 sub contacts_javascript {  sub contacts_javascript {
     return <<"ENDSCRIPT";      return <<"ENDSCRIPT";
   
Line 3129  function screenshotSize(field) { Line 3259  function screenshotSize(field) {
     return;      return;
 }  }
   
   function toggleHelpdeskRow(form,checkbox,target,prefix,docount) {
       if (form.elements[checkbox].length != undefined) {
           var count = 0;
           if (docount) {
               for (var i=0; i<form.elements[checkbox].length; i++) {
                   if (form.elements[checkbox][i].checked) {
                       count ++;
                   }
               }
           }
           for (var i=0; i<form.elements[checkbox].length; i++) {
               var type = form.elements[checkbox][i].value;
               if (document.getElementById(prefix+type)) {
                   if (form.elements[checkbox][i].checked) {
                       document.getElementById(prefix+type).style.display = 'table-row';
                       if (count % 2 == 1) {
                           document.getElementById(prefix+type).className = target+' LC_odd_row';
                       } else {
                           document.getElementById(prefix+type).className = target;
                       }
                       count ++;
                   } else {
                       document.getElementById(prefix+type).style.display = 'none';
                   }
               }
           }
       }
       return;
   }
   
   
 // ]]>  // ]]>
 </script>  </script>
   
Line 5219  sub contact_titles { Line 5380  sub contact_titles {
                    'adminemail'      => 'Default Server Admin E-mail address',                     'adminemail'      => 'Default Server Admin E-mail address',
                    'errormail'       => 'Error reports to be e-mailed to',                     'errormail'       => 'Error reports to be e-mailed to',
                    'packagesmail'    => 'Package update alerts to be e-mailed to',                     'packagesmail'    => 'Package update alerts to be e-mailed to',
                    'helpdeskmail'    => "Helpdesk requests for this domain's users",                     'helpdeskmail'    => "Helpdesk requests from all users in this domain",
                    'otherdomsmail'   => 'Helpdesk requests for other (unconfigured) domains',                     'otherdomsmail'   => 'Helpdesk requests from users in other (unconfigured) domains',
                    'lonstatusmail'   => 'E-mail from nightly status check (warnings/errors)',                     'lonstatusmail'   => 'E-mail from nightly status check (warnings/errors)',
                    'requestsmail'    => 'E-mail from course requests requiring approval',                     'requestsmail'    => 'E-mail from course requests requiring approval',
                    'updatesmail'     => 'E-mail from nightly check of LON-CAPA module integrity/updates',                     'updatesmail'     => 'E-mail from nightly check of LON-CAPA module integrity/updates',
Line 5489  sub print_selfcreation { Line 5650  sub print_selfcreation {
             if (keys(%{$usertypes}) > 0) {              if (keys(%{$usertypes}) > 0) {
                 $datatable .= &insttypes_row($createsettings,$types,$usertypes,                  $datatable .= &insttypes_row($createsettings,$types,$usertypes,
                                              $dom,$numinrow,$othertitle,                                               $dom,$numinrow,$othertitle,
                                              'statustocreate',$$rowtotal);                                               'statustocreate',$rowtotal);
                 $$rowtotal ++;                  $$rowtotal ++;
             }              }
         }          }
Line 7067  sub modifiable_userdata_row { Line 7228  sub modifiable_userdata_row {
 }  }
   
 sub insttypes_row {  sub insttypes_row {
     my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context,$rownum) = @_;      my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context,$rowtotal,$onclick,
           $customcss,$rowstyle) = @_;
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                       cansearch => 'Users allowed to search',                        cansearch => 'Users allowed to search',
                       statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)',                        statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)',
                       lockablenames => 'User preference to lock name',                        lockablenames => 'User preference to lock name',
                         overrides     => "Override domain's helpdesk settings based on requester's affiliation",
              );               );
     my $showdom;      my $showdom;
     if ($context eq 'cansearch') {      if ($context eq 'cansearch') {
Line 7081  sub insttypes_row { Line 7244  sub insttypes_row {
     if ($context eq 'statustocreate') {      if ($context eq 'statustocreate') {
         $class = 'LC_right_item';          $class = 'LC_right_item';
     }      }
     my $css_class = ' class="LC_odd_row"';      my $css_class;
     if ($rownum ne '') {       if ($$rowtotal%2) {
         $css_class = ($rownum%2? ' class="LC_odd_row"':'');          $css_class = 'LC_odd_row';
       }
       if ($customcss) {
           $css_class .= ' '.$customcss;
       }
       $css_class =~ s/^\s+//;
       if ($css_class) {
           $css_class = ' class="'.$css_class.'"';
       }
       if ($rowstyle) {
           $css_class .= ' style="'.$rowstyle.'"';
       }
       if ($onclick) {
           $onclick = 'onclick="'.$onclick.'" ';
     }      }
     my $output = '<tr'.$css_class.'>'.      my $output = '<tr'.$css_class.'>'.
                  '<td>'.$lt{$context}.$showdom.                   '<td>'.$lt{$context}.$showdom.
Line 7105  sub insttypes_row { Line 7281  sub insttypes_row {
                         if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) {                          if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) {
                             $check = ' checked="checked" ';                              $check = ' checked="checked" ';
                         }                          }
                       } elsif (ref($settings->{$context}) eq 'HASH') {
                           if (ref($settings->{$context}->{$types->[$i]}) eq 'HASH') {
                               $check = ' checked="checked" ';
                           }
                     } elsif ($context eq 'statustocreate') {                      } elsif ($context eq 'statustocreate') {
                         $check = ' checked="checked" ';                          $check = ' checked="checked" ';
                     }                      }
Line 7119  sub insttypes_row { Line 7299  sub insttypes_row {
         $rem = @{$types}%($numinrow);          $rem = @{$types}%($numinrow);
     }      }
     my $colsleft = $numinrow - $rem;      my $colsleft = $numinrow - $rem;
     if (($rem == 0) && (@{$types} > 0)) {      if ($context eq 'overrides') {
         $output .= '<tr>';          if ($colsleft > 1) {
     }              $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
     if ($colsleft > 1) {          } else {
         $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';              $output .= '<td class="LC_left_item">';
           }
           $output .= '&nbsp;';
     } else {      } else {
         $output .= '<td class="LC_left_item">';          if (($rem == 0) && (@{$types} > 0)) {
     }              $output .= '<tr>';
     my $defcheck = ' ';          }
     if (ref($settings) eq 'HASH') {            if ($colsleft > 1) {
         if (ref($settings->{$context}) eq 'ARRAY') {              $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
             if (grep(/^default$/,@{$settings->{$context}})) {          } else {
               $output .= '<td class="LC_left_item">';
           }
           my $defcheck = ' ';
           if (ref($settings) eq 'HASH') {  
               if (ref($settings->{$context}) eq 'ARRAY') {
                   if (grep(/^default$/,@{$settings->{$context}})) {
                       $defcheck = ' checked="checked" ';
                   }
               } elsif ($context eq 'statustocreate') {
                 $defcheck = ' checked="checked" ';                  $defcheck = ' checked="checked" ';
             }              }
         } elsif ($context eq 'statustocreate') {  
             $defcheck = ' checked="checked" ';  
         }          }
           $output .= '<span class="LC_nobreak"><label>'.
                      '<input type="checkbox" name="'.$context.'" '.
                      'value="default"'.$defcheck.'/>'.
                      $othertitle.'</label></span>';
     }      }
     $output .= '<span class="LC_nobreak"><label>'.      $output .= '</td></tr></table></td></tr>';
                '<input type="checkbox" name="'.$context.'" '.  
                'value="default"'.$defcheck.'/>'.  
                $othertitle.'</label></span></td>'.  
                '</tr></table></td></tr>';  
     return $output;      return $output;
 }  }
   
Line 10347  sub modify_contacts { Line 10536  sub modify_contacts {
                 my $value = $env{'form.helpform_'.$field};                  my $value = $env{'form.helpform_'.$field};
                 $value =~ s/^\s+|\s+$//g;                  $value =~ s/^\s+|\s+$//g;
                 if (grep(/^\Q$value\E$/,@{$possoptions->{$field}})) {                  if (grep(/^\Q$value\E$/,@{$possoptions->{$field}})) {
                     $contacts_hash{contacts}{'helpform'}{$field} = $value;                      $contacts_hash{'contacts'}{'helpform'}{$field} = $value;
                     if ($field eq 'screenshot') {                      if ($field eq 'screenshot') {
                         $env{'form.helpform_maxsize'} =~ s/^\s+|\s+$//g;                          $env{'form.helpform_maxsize'} =~ s/^\s+|\s+$//g;
                         if ($env{'form.helpform_maxsize'} =~ /^\d+\.?\d*$/) {                          if ($env{'form.helpform_maxsize'} =~ /^\d+\.?\d*$/) {
                             $contacts_hash{contacts}{'helpform'}{'maxsize'} = $env{'form.helpform_maxsize'};                              $contacts_hash{'contacts'}{'helpform'}{'maxsize'} = $env{'form.helpform_maxsize'};
                         }                          }
                     }                      }
                 }                  }
             }              }
         }          }
     }      }
       my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
       my (@statuses,%usertypeshash,@overrides);
       if ((ref($types) eq 'ARRAY') && (@{$types} > 0)) {
           @statuses = @{$types};
           if (ref($usertypes) eq 'HASH') {
               %usertypeshash = %{$usertypes};
           }
       }
       if (@statuses) {
           my @possoverrides = &Apache::loncommon::get_env_multiple('form.overrides');
           foreach my $type (@possoverrides) {
               if (($type ne '') && (grep(/^\Q$type\E$/,@statuses))) {
                   push(@overrides,$type);
               }
           }
           if (@overrides) {
               foreach my $type (@overrides) {
                   my @standard = &Apache::loncommon::get_env_multiple('form.override_'.$type);
                   foreach my $item (@contacts) {
                       if (grep(/^\Q$item\E$/,@standard)) {
                           $contacts_hash{'contacts'}{'overrides'}{$type}{$item} = 1;
                           $newsetting{'override_'.$type}{$item} = 1;
                       } else {
                           $contacts_hash{'contacts'}{'overrides'}{$type}{$item} = 0;
                           $newsetting{'override_'.$type}{$item} = 0;
                       }
                   }
                   $contacts_hash{'contacts'}{'overrides'}{$type}{'others'} = $env{'form.override_'.$type.'_others'};
                   $contacts_hash{'contacts'}{'overrides'}{$type}{'bcc'} = $env{'form.override_'.$type.'_bcc'};
                   $newsetting{'override_'.$type}{'others'} = $env{'form.override_'.$type.'_others'};
                   $newsetting{'override_'.$type}{'bcc'} = $env{'form.override_'.$type.'_bcc'};
                   if (($env{'form.override_'.$type.'_includestr'} ne '') && ($env{'form.override_'.$type.'_includeloc'} =~ /^s|b$/)) {
                       $includestr{$type} = $env{'form.override_'.$type.'_includestr'};
                       $includeloc{$type} = $env{'form.override_'.$type.'_includeloc'};
                       $contacts_hash{'contacts'}{'overrides'}{$type}{'include'} = $includeloc{$type}.':'.&escape($includestr{$type});
                       $newsetting{'override_'.$type}{'include'} = $contacts_hash{'contacts'}{'overrides'}{$type}{'include'};
                   }
               }
           }
       }
     if (keys(%currsetting) > 0) {      if (keys(%currsetting) > 0) {
         foreach my $item (@contacts) {          foreach my $item (@contacts) {
             if ($to{$item} ne $currsetting{$item}) {              if ($to{$item} ne $currsetting{$item}) {
Line 10412  sub modify_contacts { Line 10641  sub modify_contacts {
                 }                  }
             }              }
         }          }
           if (@statuses) {
               if (ref($currsetting{'overrides'}) eq 'HASH') {
                   foreach my $key (keys(%{$currsetting{'overrides'}})) {
                       if (ref($currsetting{'overrides'}{$key}) eq 'HASH') {
                           if (ref($newsetting{'override_'.$key}) eq 'HASH') {
                               foreach my $item (@contacts,'bcc','others','include') {
                                   if ($currsetting{'overrides'}{$key}{$item} ne $newsetting{'override_'.$key}{$item}) {
                                       push(@{$changes{'overrides'}},$key);
                                       last;
                                   }
                               }
                           } else {
                               push(@{$changes{'overrides'}},$key);
                           }
                       }
                   }
                   foreach my $key (@overrides) {
                       unless (exists($currsetting{'overrides'}{$key})) {
                           push(@{$changes{'overrides'}},$key);
                       }
                   }
               } else {
                   foreach my $key (@overrides) {
                       push(@{$changes{'overrides'}},$key);
                   }
               }
           }
     } else {      } else {
         my %default;          my %default;
         $default{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};          $default{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};
Line 10526  sub modify_contacts { Line 10782  sub modify_contacts {
                     $resulttext .= '</li>';                      $resulttext .= '</li>';
                 }                  }
             }              }
               if (ref($changes{'overrides'}) eq 'ARRAY') {
                   my @deletions;
                   foreach my $type (@{$changes{'overrides'}}) {
                       if ($usertypeshash{$type}) {
                           if (grep(/^\Q$type\E/,@overrides)) {
                               $resulttext .= '<li>'.&mt("Overrides based on requester's affiliation set for [_1]",
                                                         $usertypeshash{$type}).'<ul><li>';
                               if (ref($newsetting{'override_'.$type}) eq 'HASH') {
                                   my @text;
                                   foreach my $item (@contacts) {
                                       if ($newsetting{'override_'.$type}{$item}) {
                                           push(@text,$short_titles->{$item});
                                       }
                                   }
                                   if ($newsetting{'override_'.$type}{'others'} ne '') {
                                       push(@text,$newsetting{'override_'.$type}{'others'});
                                   }
   
                                   if (@text) {
                                       $resulttext .= &mt('Helpdesk e-mail sent to: [_1]',
                                                          '<span class="LC_cusr_emph">'.join(', ',@text).'</span>');
                                   }
                                   if ($newsetting{'override_'.$type}{'bcc'} ne '') {
                                       my $bcctext;
                                       if (@text) {
                                           $bcctext = '&nbsp;'.&mt('with Bcc to');
                                       } else {
                                           $bcctext = '(Bcc)';
                                       }
                                       $resulttext .= $bcctext.': <span class="LC_cusr_emph">'.$newsetting{'override_'.$type}{'bcc'}.'</span>';
                                   } elsif (!@text) {
                                        $resulttext .= &mt('Helpdesk e-mail sent to no one');
                                   }
                                   $resulttext .= '</li>';
                                   if ($newsetting{'override_'.$type}{'include'} ne '') {
                                       my ($loc,$str) = split(/:/,$newsetting{'override_'.$type}{'include'});
                                       if ($loc eq 'b') {
                                           $resulttext .= '<li>'.&mt('Text automatically added to e-mail body:').' '.&unescape($str).'</li>';
                                       } elsif ($loc eq 's') {
                                           $resulttext .= '<li>'.&mt('Text automatically added to e-mail subject:').' '.&unescape($str).'</li>';
                                       }
                                   }
                               }
                               $resulttext .= '</li></ul></li>';
                           } else {
                               push(@deletions,$usertypeshash{$type});
                           }
                       }
                   }
                   if (@deletions) {
                       $resulttext .= '<li>'.&mt("Overrides based on requester's affiliation discontinued for: [_1]",
                                                 join(', ',@deletions)).'</li>';
                   }
               }
             my @offon = ('off','on');              my @offon = ('off','on');
             if ($changes{'reporterrors'}) {              if ($changes{'reporterrors'}) {
                 $resulttext .= '<li>'.                  $resulttext .= '<li>'.
Line 10581  sub modify_contacts { Line 10891  sub modify_contacts {
                                    &mt('Max size for file uploaded to help form by logged-in user set to [_1] MB.',                                     &mt('Max size for file uploaded to help form by logged-in user set to [_1] MB.',
                                        $contacts_hash{'contacts'}{'helpform'}{'maxsize'}).                                         $contacts_hash{'contacts'}{'helpform'}{'maxsize'}).
                                    '</li>';                                     '</li>';
   
                 }                  }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
Line 11175  sub modify_selfcreation { Line 11484  sub modify_selfcreation {
         $save_usercreate{'cancreate'}{'shibenv'} = $cancreate{'shibenv'};          $save_usercreate{'cancreate'}{'shibenv'} = $cancreate{'shibenv'};
     }      }
     $save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'};      $save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'};
     $save_usercreate{'emailrule'} = \@email_rule;      $save_usercreate{'email_rule'} = \@email_rule;
   
     my %userconfig_hash = (      my %userconfig_hash = (
             usercreation     => \%save_usercreate,              usercreation     => \%save_usercreate,

Removed from v.1.160.6.84.2.3  
changed lines
  Added in v.1.160.6.84.2.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>