--- loncom/interface/lonnotify.pm 2012/12/17 15:06:39 1.39
+++ loncom/interface/lonnotify.pm 2021/03/06 13:41:46 1.44
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Sending messages
#
-# $Id: lonnotify.pm,v 1.39 2012/12/17 15:06:39 raeburn Exp $
+# $Id: lonnotify.pm,v 1.44 2021/03/06 13:41:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -220,8 +220,8 @@ sub print_display_option_form {
$output .= &Apache::lonhtmlcommon::row_title(&mt('Choose sender(s)'));
my %personnel = &Apache::lonnet::get_domain_roles($cdom,\@roles);
my @domcc = ();
- foreach my $server (keys %personnel) {
- foreach my $user (sort(keys %{$personnel{$server}})) {
+ foreach my $server (keys(%personnel)) {
+ foreach my $user (sort(keys(%{$personnel{$server}}))) {
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);
unless (grep/^$uname:$udom$/,@domcc) {
my %userinfo = &Apache::lonnet::get('environment',['lastname','firstname'],$udom,$uname);
@@ -286,11 +286,11 @@ ENDSCRIPT
$output .= &Apache::loncommon::start_data_table();
if ($msgcount > 0) {
$output .= &Apache::loncommon::start_data_table_header_row().
- '
Date | '.
- 'Subject | '.
- 'Sender | '.
- 'Message | '.
- 'Recipients | '.
+ ''.&mt('Date').' | '.
+ ''.&mt('Subject').' | '.
+ ''.&mt('Sender').' | '.
+ ''.&mt('Message').' | '.
+ ''.&mt('Recipients').' | '.
&Apache::loncommon::end_data_table_header_row();
if (($env{'form.sortby'} eq 'date') || ($env{'form.sortby'} eq '') || (!defined($env{'form.sortby'})) || (($env{'form.sortby'} eq 'sender') && (@senders <= 1))) {
@@ -357,7 +357,7 @@ ENDSCRIPT
}
} else {
$output .= &Apache::loncommon::start_data_table_empty_row().
- 'No mail sent matching supplied criteria | '.
+ ''.&mt('No mail sent matching supplied criteria').' | '.
&Apache::loncommon::end_data_table_empty_row();
}
$output .= &Apache::loncommon::end_data_table();
@@ -378,7 +378,6 @@ ENDSCRIPT
sub print_selection_form {
my ($r,$formname,$cdom) = @_;
- my %coursecodes = ();
my %codes = ();
my @codetitles = ();
my %cat_titles = ();
@@ -386,9 +385,7 @@ sub print_selection_form {
my %idlist = ();
my %idnums = ();
my %idlist_titles = ();
- my $caller = 'global';
my $totcodes = 0;
- my $format_reply;
my $jscript = '';
my %lt=&Apache::lonlocal::texthash(
'buil' => 'Building valid e-mail address from username, if missing from preferences:',
@@ -399,10 +396,15 @@ sub print_selection_form {
&Apache::lonhtmlcommon::add_breadcrumb
({text=>"Select Audience"});
- $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$cdom,$totcodes);
- if ($totcodes > 0) {
- $format_reply = &Apache::lonnet::auto_instcode_format($caller,$cdom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
- if ($format_reply eq 'ok') {
+ my $instcats = &Apache::lonnet::get_dom_instcats($cdom);
+ if (ref($instcats) eq 'HASH') {
+ if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') &&
+ (ref($instcats->{'cat_titles'}) eq 'HASH') && (ref($instcats->{'cat_order'}) eq 'HASH')) {
+ %codes = %{$instcats->{'codes'}};
+ @codetitles = @{$instcats->{'codetitles'}};
+ %cat_titles = %{$instcats->{'cat_titles'}};
+ %cat_order = %{$instcats->{'cat_order'}};
+ $totcodes = scalar(keys(%codes));
my $numtypes = @codetitles;
&Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);
my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles);
@@ -410,7 +412,7 @@ sub print_selection_form {
my $allidlist = $idlist{$codetitles[0]};
$jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist);
$jscript .= $scripttext;
- $jscript .= &Apache::courseclassifier::javascript_code_selections($formname,@codetitles);
+ $jscript .= &Apache::courseclassifier::javascript_code_selections($formname,\@codetitles);
}
}
my @standardnames = &Apache::loncommon::get_standard_codeitems();
@@ -645,7 +647,7 @@ function goBack(target) {
$output .= &Apache::loncommon::end_data_table();
if (@unmatched) {
$output .= '
'.&mt('Could not determine e-mail addresses for the following users:').'';
- foreach my $username (sort @unmatched) {
+ foreach my $username (sort(@unmatched)) {
$output .= '- '.$username.'
';
}
$output .= '
';
@@ -720,7 +722,7 @@ ENDSCRIPT
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table();
} else {
- $output .= 'No mail sent - no recipients identified';
+ $output .= &mt('No mail sent - no recipients identified');
}
$output .= '
'.&mt('Send another e-mail').''."\n";
$output .= ''."\n".
@@ -786,7 +788,7 @@ sub form_elements {
previous => &mt('Previously had access'),
future => &mt('Will have future access'),
);
- %{$authtypes} = (
+ %{$authtypes} = &Apache::lonlocal::texthash (
krb4 => 'Kerberos 4',
krb5 => 'Kerberos 5',
internal => 'Internal (LON-CAPA)',