'.
+ &Apache::loncommon::end_data_table_row().
+ &Apache::loncommon::end_data_table();
+ $num ++;
+ $r->print($output);
+ $r->print(qq|
+
+
+
+
+
+|);
+
+}
+
+sub get_notifications {
+ my ($userenv) = @_;
+ my %allnot;
+ my @critnot = split(/,/,$userenv->{'critnotification'});
+ my @regnot = split(/,/,$userenv->{'notification'});
+ foreach my $item (@critnot) {
+ $allnot{$item}{crit} = 1;
+ }
+ foreach my $item (@regnot) {
+ $allnot{$item}{reg} = 1;
+ }
+ return %allnot;
}
sub verify_and_change_msgforward {
@@ -602,7 +833,7 @@ sub verify_and_change_msgforward {
if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') {
$newscreen.=$msuser.':'.$msdomain.',';
} else {
- $message.='No such user: '.$msuser.':'.$msdomain.' ';
+ $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.' ';
}
}
}
@@ -610,37 +841,85 @@ sub verify_and_change_msgforward {
if ($newscreen) {
&Apache::lonnet::put('environment',{'msgforward' => $newscreen});
&Apache::lonnet::appenv('environment.msgforward' => $newscreen);
- $message.='Set new message forwarding to '.$newscreen.' ';
+ $message .= &mt('Set message forwarding to ').'"'.$newscreen.'".'
+ .' ';
} else {
&Apache::lonnet::del('environment',['msgforward']);
&Apache::lonnet::delenv('environment\.msgforward');
- $message.='Reset message forwarding ';
+ $message.= &mt("Set message forwarding to 'off'.").' ';
}
- my $notification=$env{'form.notification'};
+ my $critnotification;
+ my $notification;
+ my $notify_with_html;
+ my $lastnotify = $env{'form.numnotify'}-1;
+ my $totaladdresses = 0;
+ for (my $i=0; $i<$env{'form.numnotify'}; $i++) {
+ if ((!defined($env{'form.del_notify_'.$i})) &&
+ ((($i==$lastnotify) && ($env{'form.add_notify_'.$lastnotify} == 1)) ||
+ ($i<$lastnotify))) {
+ if (defined($env{'form.address_'.$i})) {
+ if ($env{'form.notify_type_'.$i} eq 'all') {
+ $critnotification .= $env{'form.address_'.$i}.',';
+ $notification .= $env{'form.address_'.$i}.',';
+ } elsif ($env{'form.notify_type_'.$i} eq 'crit') {
+ $critnotification .= $env{'form.address_'.$i}.',';
+ } elsif ($env{'form.notify_type_'.$i} eq 'reg') {
+ $notification .= $env{'form.address_'.$i}.',';
+ }
+ if ($env{'form.html_'.$i} eq '1') {
+ $notify_with_html .= $env{'form.address_'.$i}.',';
+ }
+ $totaladdresses ++;
+ }
+ }
+ }
+ $critnotification =~ s/,$//;
+ $critnotification=~s/\s//gs;
+ $notification =~ s/,$//;
$notification=~s/\s//gs;
+ $notify_with_html =~ s/,$//;
+ $notify_with_html =~ s/\s//gs;
if ($notification) {
&Apache::lonnet::put('environment',{'notification' => $notification});
&Apache::lonnet::appenv('environment.notification' => $notification);
- $message.='Set message notification address to '.$notification.' ';
+ $message.=&mt('Set non-critical message notification address(es) to ').'"'.$notification.'". ';
} else {
&Apache::lonnet::del('environment',['notification']);
&Apache::lonnet::delenv('environment\.notification');
- $message.='Reset message notification ';
+ $message.=&mt("Set non-critical message notification to 'off'.").' ';
}
- my $critnotification=$env{'form.critnotification'};
- $critnotification=~s/\s//gs;
if ($critnotification) {
&Apache::lonnet::put('environment',{'critnotification' => $critnotification});
&Apache::lonnet::appenv('environment.critnotification' => $critnotification);
- $message.='Set critical message notification address to '.$critnotification;
+ $message.=&mt('Set critical message notification address(es) to ').'"'.$critnotification.'". ';
} else {
&Apache::lonnet::del('environment',['critnotification']);
&Apache::lonnet::delenv('environment\.critnotification');
- $message.='Reset critical message notification ';
+ $message.=&mt("Set critical message notification to 'off'.").' ';
}
- $r->print(< $notify_with_html});
+ &Apache::lonnet::appenv('environment.notifywithhtml' => $notify_with_html);
+ $message.=&mt('Set address(es) to receive excerpts with html retained ').'"'.$notify_with_html.'".';
+ } else {
+ &Apache::lonnet::del('environment',['notifywithhtml']);
+ &Apache::lonnet::delenv('environment\.notifywithhtml');
+ if ($totaladdresses == 1) {
+ $message.=&mt("Set notification address to receive excerpts with html stripped.");
+ } else {
+ $message.=&mt("Set all notification addresses to receive excerpts with html stripped.");
+ }
+ }
+ } else {
+ &Apache::lonnet::del('environment',['notifywithhtml']);
+ &Apache::lonnet::delenv('environment\.notifywithhtml');
+ }
+ if ($message) {
+ $message .= ' ';
+ }
+ &Apache::loncommon::flush_email_cache($user,$domain);
+ &msgforwardchanger($r,$message);
}
################################################################
@@ -738,11 +1017,11 @@ sub verify_and_change_colors {
if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) {
&Apache::lonnet::put('environment',{$entry => $color});
&Apache::lonnet::appenv('environment.'.$entry => $color);
- $message.='Set '.$colortypes{$item}.' to '.$color.' ';
+ $message.=&mt('Set '.$colortypes{$item}.' to ').'"'.$color.'". ';
} else {
&Apache::lonnet::del('environment',[$entry]);
&Apache::lonnet::delenv('environment\.'.$entry);
- $message.='Reset '.$colortypes{$item}.' ';
+ $message.=&mt('Reset '.$colortypes{$item}.'.').' ';
}
}
my $now = time;
@@ -776,7 +1055,7 @@ sub passwordchanger {
$defdom = $r->dir_config('lonDefDomain');
my %data = &Apache::lonnet::tmpget($mailtoken);
if (keys(%data) == 0) {
- $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a new request for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'));
+ $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a new request for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'));
return;
}
if (defined($data{time})) {
@@ -1028,7 +1307,7 @@ sub verify_and_change_password {
if ($caller eq 'reset_by_email') {
$tryagain_text = &mt('Please try again later.');
}
- my $unable=&mt("Unable to retrieve stored token for password decryption");
+ my $unable=&mt("Unable to retrieve saved token for password decryption");
$r->print(<$unable. $tryagain_text
@@ -1048,23 +1327,23 @@ ENDERROR
if ($currentpass ne $data{'temppasswd'}) {
&passwordchanger($r,
''.
- &mt('Could not verify current authentication').'. '.
- &mt('Please try again').'.',$caller,$mailtoken);
+ &mt('Could not verify current authentication.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
}
if ($newpass1 ne $newpass2) {
&passwordchanger($r,
''.
- &mt('The new passwords you entered do not match').'. '.
- &mt('Please try again').'.',$caller,$mailtoken);
+ &mt('The new passwords you entered do not match.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
if (length($newpass1) < 7) {
&passwordchanger($r,
''.
- &mt('Passwords must be a minimum of 7 characters long').'. '.
- &mt('Please try again').'.',$caller,$mailtoken);
+ &mt('Passwords must be a minimum of 7 characters long.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
#
@@ -1076,7 +1355,7 @@ ENDERROR
if ($badpassword) {
# I can't figure out how to enter bad characters on my browser.
my $errormessage =''.
- &mt('The password you entered contained illegal characters').'. '.
+ &mt('The password you entered contained illegal characters.').' '.
&mt('Valid characters are').(<<"ENDERROR");
: space and
@@ -1097,7 +1376,7 @@ ENDERROR
} else {
# error error: run in circles, scream and shout
$r->print("
".&mt("The password for [_1] was not changed",$user)."
".
- &mt('Please make sure your old password was entered correctly').'.');
+ &mt('Please make sure your old password was entered correctly.'));
return 1;
}
return;
@@ -1201,7 +1480,7 @@ END
$r->print(<<"END");
-
+
Note: $lt{'thde'}
@@ -1217,11 +1496,11 @@ sub verify_and_change_discussion {
if (defined($env{'form.discdisp'}) ) {
my $newdisp = $env{'form.newdisp'};
if ($newdisp eq 'unread') {
- $message .='In discussions: only new posts will be displayed. ';
+ $message .=&mt('In discussions: only new posts will be displayed.').' ';
&Apache::lonnet::put('environment',{'discdisplay' => $newdisp});
&Apache::lonnet::appenv('environment.discdisplay' => $newdisp);
} else {
- $message .= 'In discussions: all posts will be displayed. ';
+ $message .= &mt('In discussions: all posts will be displayed.').' ';
&Apache::lonnet::del('environment',['discdisplay']);
&Apache::lonnet::delenv('environment\.discdisplay');
}
@@ -1229,11 +1508,11 @@ sub verify_and_change_discussion {
if (defined($env{'form.discmark'}) ) {
my $newmark = $env{'form.newmark'};
if ($newmark eq 'ondisp') {
- $message.='In discussions: new posts will be cease to be identified as "new" after display. ';
+ $message.=&mt('In discussions: new posts will be cease to be identified as "NEW" after display.').' ';
&Apache::lonnet::put('environment',{'discmarkread' => $newmark});
&Apache::lonnet::appenv('environment.discmarkread' => $newmark);
} else {
- $message.='In discussions: posts will be identified as "new" until marked as read by the reader. ';
+ $message.=&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.').' ';
&Apache::lonnet::del('environment',['discmarkread']);
&Apache::lonnet::delenv('environment\.discmarkread');
}
@@ -1398,7 +1677,7 @@ sub handler {
breadcrumb =>
{ href => '/adm/preferences?action=changemsgforward',
text => 'Change Message Forwarding'},
- printmenu => 'yes',
+ printmenu => 'no',
subroutine => \&verify_and_change_msgforward }));
my $aboutmeaction=
'/adm/'.$env{'user.domain'}.'/'.$env{'user.name'}.'/aboutme';
@@ -1517,7 +1796,7 @@ sub handler {
}
push (@Options,({ action => 'changeicons',
- linktext => 'Change How Main Menu is Displayed',
+ linktext => 'Change How Menus are Displayed',
href => '/adm/preferences',
subroutine => \&iconchanger,
breadcrumb =>
@@ -1532,6 +1811,23 @@ sub handler {
printmenu => 'yes',
}));
+ push (@Options,({ action => 'changeclicker',
+ linktext => 'Register Response Devices ("Clickers")',
+ href => '/adm/preferences',
+ subroutine => \&clickerchanger,
+ breadcrumb =>
+ { href => '/adm/preferences?action=changeicons',
+ text => 'Register Clicker'},
+ },
+ { action => 'verify_and_change_clicker',
+ subroutine => \&verify_and_change_clicker,
+ breadcrumb =>
+ { href => '/adm/preferences?action=changeclicker',
+ text => 'Register Clicker'},
+ printmenu => 'yes',
+ }));
+
+
if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
.$env{'request.course.sec'})) {