--- loncom/interface/lonpreferences.pm 2020/02/09 04:43:20 1.236 +++ loncom/interface/lonpreferences.pm 2022/08/19 18:56:41 1.240 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.236 2020/02/09 04:43:20 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.240 2022/08/19 18:56:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -627,7 +627,7 @@ sub icon_options { } sub icon_previews { - my %icon_text = ( + my %icon_text = &Apache::lonlocal::texthash ( annotate => 'Notes', wishlist => 'Stored Links', catalog => 'Info', @@ -636,12 +636,12 @@ sub icon_previews { printout => 'Print', ); my %inlinetools = ( - printout => "s&8&3&prt.png&$icon_text{'printout'}&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document", - wishlist => "s&9&1&wishlist-link.png&$icon_text{'wishlist'}&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository", - evaluate => "s&8&1&eval.png&$icon_text{'evaluate'}&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource", - feedback => "s&8&2&fdbk.png&$icon_text{'feedback'}&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource", - annotate => "s&9&3&anot.png&$icon_text{'annotate'}&tations[_1]&annotate()&Make notes and annotations about this resource", - catalog => "s&6&3&catalog.png&$icon_text{'catalog'}&info[_1]&catalog_info()&Show Metadata", + printout => "s&8&3&prt.png&$icon_text{'printout'}&printout[_1]&gopost('/adm/printout',currentURL)&".&mt('Prepare a printable document'), + wishlist => "s&9&1&wishlist-link.png&$icon_text{'wishlist'}&wishlistlink[_2]&set_wishlistlink()&".&mt('Save a link for this resource in your personal Stored Links repository'), + evaluate => "s&8&1&eval.png&$icon_text{'evaluate'}&this[_1]&gopost('/adm/evaluate',currentURL,1)&".&mt('Provide my evaluation of this resource'), + feedback => "s&8&2&fdbk.png&$icon_text{'feedback'}&discuss[_1]&gopost('/adm/feedback',currentURL,1)&".&mt('Provide feedback messages or contribute to the course discussion about this resource'), + annotate => "s&9&3&anot.png&$icon_text{'annotate'}&tations[_1]&annotate()&".&mt('Make notes and annotations about this resource'), + catalog => "s&6&3&catalog.png&$icon_text{'catalog'}&info[_1]&catalog_info()&".&mt('Show Metadata'), ); my @toolsorder = qw(annotate wishlist evaluate feedback printout catalog); return (\%inlinetools,\@toolsorder); @@ -1265,7 +1265,8 @@ sub passwordchanger { # This function is a bit of a mess.... # Passwords are encrypted using londes.js (DES encryption) $errormessage = ($errormessage || ''); - my ($user,$domain,$currentpass); + my ($user,$domain,$currentpass,$clientip); + $clientip = &Apache::lonnet::get_requestor_ip($r); &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changepass', text => 'Change Password'}); @@ -1280,7 +1281,7 @@ sub passwordchanger { $caller = 'preferences'; } my ($blocked,$blocktext) = - &Apache::loncommon::blocking_status('passwd'); + &Apache::loncommon::blocking_status('passwd',$clientip); if ($blocked) { $r->print('

'.$blocktext.'

'); return; @@ -1302,7 +1303,7 @@ sub passwordchanger { $domain = $data{'domain'}; $currentpass = $data{'temppasswd'}; my ($blocked,$blocktext) = - &Apache::loncommon::blocking_status('passwd',$user,$domain); + &Apache::loncommon::blocking_status('passwd',$clientip,$user,$domain); if ($blocked) { $r->print('

'.$blocktext.'

'); return; @@ -1623,7 +1624,7 @@ sub server_form { sub verify_and_change_password { my ($r,$caller,$mailtoken,$timelimit,$extrafields,$ended) = @_; - my ($user,$domain,$homeserver); + my ($user,$domain,$homeserver,$clientip); if ($caller eq 'reset_by_email') { $user = $env{'form.uname'}; $domain = $env{'form.udom'}; @@ -1646,8 +1647,9 @@ sub verify_and_change_password { $domain = $env{'user.domain'}; $homeserver = $env{'user.home'}; } + $clientip = &Apache::lonnet::get_requestor_ip($r); my ($blocked,$blocktext) = - &Apache::loncommon::blocking_status('passwd',$user,$domain); + &Apache::loncommon::blocking_status('passwd',$clientip,$user,$domain); if ($blocked) { $r->print('

'.$blocktext.'

'); if ($caller eq 'reset_by_email') { @@ -2127,13 +2129,9 @@ sub change_authoring_settings { sub lockednameschanger { my $r = shift; - &Apache::lonhtmlcommon::add_breadcrumb( - { href => '/adm/preferences?action=changelockednames', - text => 'Automatic name changes'}); - $r->print(Apache::loncommon::start_page('Automatic name changes')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Allow/disallow name updates')); my %userenv = &Apache::lonnet::get('environment',['lockedname']); my $lockedname=''; + my $ended; if (&can_toggle_namelocking()) { if ($userenv{'lockedname'}) { $lockedname = ' checked="checked"'; @@ -2151,6 +2149,11 @@ sub lockednameschanger { } } if (keys(%updateable)) { + &Apache::lonhtmlcommon::add_breadcrumb( + { href => '/adm/preferences?action=changelockednames', + text => 'Automatic name changes'}); + $r->print(Apache::loncommon::start_page('Automatic name changes')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Allow/disallow name updates')); my %longnames = &Apache::lonlocal::texthash ( firstname => 'First Name', middlename => 'Middle Name', @@ -2177,11 +2180,14 @@ ENDSCREEN } else { my $message = &mt('Based on your institutional affiliation no name information is automatically updated for your LON-CAPA account.'); &print_main_menu($r,$message); + $ended = 1; } } else { my $message = &mt('You are not permitted to set a user preference for automatic name updates for your LON-CAPA account.'); &print_main_menu($r,$message); + $ended = 1; } + return $ended; } sub verify_and_change_lockednames { @@ -2522,7 +2528,7 @@ sub handler { &print_main_menu($r); $ended = 1; } elsif ($env{'form.action'} eq 'changelockednames') { - &lockednameschanger($r); + $ended = &lockednameschanger($r); } elsif ($env{'form.action'} eq 'verify_and_change_lockednames') { &verify_and_change_lockednames($r); $ended = 1;