--- loncom/interface/lonpreferences.pm 2025/03/05 05:24:42 1.247 +++ loncom/interface/lonpreferences.pm 2025/03/07 02:13:40 1.248 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.247 2025/03/05 05:24:42 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.248 2025/03/07 02:13:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -103,16 +103,17 @@ sub languagechanger { { href => '/adm/preferences?action=changelanguages', text => 'Change Language'}); $r->print(Apache::loncommon::start_page('Content Display Settings')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Language')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Language'). + '
'); my %userenv = &Apache::lonnet::get('environment',['languages']); my $language=$userenv{'languages'}; $r->print( '
'."\n". ''. - '
'.&mt('Preferred language').': '. - &Apache::loncommon::select_language('language',$language,1).''."\n". - '
' + '
'."\n". + '
' ); } @@ -192,8 +193,8 @@ sub texenginechanger {

-$lt{'preftxt'}: $selectionbox -
+

@@ -275,7 +276,8 @@ sub rolesprefchanger { { href => '/adm/preferences?action=changerolespref', text => $brtext}); $r->print(Apache::loncommon::start_page('Content Display Settings')); - $r->print(Apache::lonhtmlcommon::breadcrumbs($brtitle)); + $r->print(Apache::lonhtmlcommon::breadcrumbs($brtitle). + '
'); my $hotlist_flag=$userenv{'recentroles'}; my $hotlist_n=$userenv{'recentrolesn'}; my ($checkedon,$checkedoff); @@ -294,49 +296,49 @@ sub rolesprefchanger { } # Get list of recent roles and display with checkbox in front - my $roles_check_list = ''; - my $role_key=''; + my $roles_check_list; if ($env{'environment.recentroles'}) { my %recent_roles = &Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); my %frozen_roles = &Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'}); - + my %role_text = &rolespref_get_role_text([keys(%recent_roles)]); my @sorted_roles = sort {$role_text{$a} cmp $role_text{$b}} keys(%role_text); - $roles_check_list .= - &Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_header_row(). - "".&mt('Freeze '.$role)."". - "".&mt($role)."". - &Apache::loncommon::end_data_table_header_row(). - "\n"; - my $count; - foreach $role_key (@sorted_roles) { - my $checked = ""; - my $value = $recent_roles{$role_key}; - if ($frozen_roles{$role_key}) { - $checked = ' checked="checked"'; - } - $count++; - $roles_check_list .= - &Apache::loncommon::start_data_table_row(). - ''. - "". - "". - &Apache::loncommon::end_data_table_row(). "\n"; + if (@sorted_roles) { + $roles_check_list = + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + "".&mt('Freeze '.$role)."". + "".&mt($role)."". + &Apache::loncommon::end_data_table_header_row()."\n"; + my $count = 0; + foreach my $role_key (@sorted_roles) { + my $checked = ""; + my $value = $recent_roles{$role_key}; + if ($frozen_roles{$role_key}) { + $checked = ' checked="checked"'; + } + $count++; + $roles_check_list .= + &Apache::loncommon::start_data_table_row(). + ''. + "". + "". + &Apache::loncommon::end_data_table_row(). "\n"; + } + $roles_check_list .= &Apache::loncommon::end_data_table."\n"; } - $roles_check_list .= "\n"; } my $actionurl = '/adm/preferences'; if ($env{'form.returnurl'} eq '/adm/roles') { $actionurl = '/adm/roles'; } - $r->print('

'.&mt('Recent Roles Hotlist').'

'); + $r->print('

'.&mt('Recent Roles Hotlist').'

'); unless ($checkedon) { $r->print(&mt('LON-CAPA users with several '.$lc_role.'s may wish to enable the Hotlist.').'
'); } @@ -344,7 +346,7 @@ sub rolesprefchanger {
-

'.&mt('Hotlist options').'

+

'.&mt('Hotlist options').'

'. &mt('When enabled, the Hotlist keeps track of the last N '.$lc_role.'s visited.').'
'. &mt('Those N '.$lc_role.'s are then shown in a table at the top of the '.$lc_role.'s page.').'

'. @@ -365,7 +367,7 @@ $options.'
'); if ($roles_check_list) { $r->print('
-

'.&mt('Freeze Roles').'

+

'.&mt('Freeze Roles').'

'.&mt('The table below can be used to [_1]freeze[_2] '.$lc_role.'s in the Hotlist.','','').'
'. &mt('Those '.$lc_role.'s marked frozen will not be removed from the list, even if not recently used.').'

@@ -378,7 +380,7 @@ $options.' $r->print('
-'); +
'); } sub rolespref_get_role_text { @@ -491,13 +493,11 @@ sub screennamechanger { text => 'Change Screen Name'}); $r->print(Apache::loncommon::start_page('Personal Data')); $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Screen Name')); - $r->print('

' - .&mt('Change the name that is displayed in your posts.') - .'

' - ); + $r->print('
'); + my $caption = &mt('Name displayed in posts you make').':'; $r->print('
' - .'' - .&Apache::lonhtmlcommon::start_pick_box() + .'

' + .&Apache::lonhtmlcommon::start_pick_box(undef,undef,$caption,'LC_caption_prefs') .&Apache::lonhtmlcommon::row_title(' '.&mt('(shown if you post anonymously)')) .'' .&Apache::lonhtmlcommon::row_closure() @@ -508,7 +508,7 @@ sub screennamechanger { .'' .&Apache::lonhtmlcommon::row_closure(1) .&Apache::lonhtmlcommon::end_pick_box() - .'

' + .'

' ); } @@ -556,7 +556,8 @@ sub iconchanger { { href => '/adm/preferences?action=changeicons', text => 'Change Menu Display'}); $r->print(Apache::loncommon::start_page('Page Display Settings')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Menu Display')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Menu Display'). + '
'); my $user = $env{'user.name'}; my $domain = $env{'user.domain'}; @@ -591,14 +592,19 @@ sub iconchanger { '
    '. $iconic_preview. '
'; + my $title = &mt('Use of icons and text'); $r->print(< +
$title $iconic_preview
$iconsonly_preview
+
+

- +

+
ENDSCREEN } @@ -657,7 +663,8 @@ sub clickerchanger { { href => '/adm/preferences?action=changeclicker', text => 'Register Clicker'}); $r->print(Apache::loncommon::start_page('Other')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Register Clicker')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Register Clicker'). + '
'); my $user = $env{'user.name'}; my $domain = $env{'user.domain'}; my %userenv = &Apache::lonnet::get @@ -668,14 +675,17 @@ sub clickerchanger { my $change=&mt('Save'); my $helplink=&Apache::loncommon::help_open_topic('Clicker_Registration',&mt('Locating your clicker ID')); $r->print(<
-
+

+

+
ENDSCREEN } @@ -848,14 +858,24 @@ sub msgforwardchanger { notv => 'is not a valid e-mail address', toen => "To enter multiple addresses, enter one address at a time, click 'Change' and then add the next one", prme => 'Back', + acti => 'Action', + type => 'Types of message for which notification is sent', + nota => 'Notification address', + exce => 'Excerpt retains HTML tags in message', + modi => 'Modify', + dele => 'Delete', + addn => 'Add new address', + yes => 'Yes', + no => 'No', ); $lt{'foad_exmpl'} = &mt('e.g. [_1]userA:domain1,userB:domain2,...[_2]','',''); $lt{'mnot_exmpl'} = &mt('e.g. [_1]joe@doe.com[_2]','',''); Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changemsgforward', - text => 'Messages & Notifications'}); + text => 'Messages & Notifications'}); $r->print(Apache::loncommon::start_page('Messages & Notifications')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Messages & Notifications')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Messages & Notifications'). + '
'); my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding"); my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification"); my $criticalMessageHelp = &Apache::loncommon::help_open_topic("Course_Critical_Message"); @@ -924,41 +944,41 @@ $validatescript $r->print(<$lt{'fwdm'} $forwardingHelp +

$lt{'fwdm'} $forwardingHelp

-$lt{'foad'} ($lt{'foad_exmpl'}): - -

-

$lt{'noti'} $notificationHelp

-$lt{'mnot'} ($lt{'mnot_exmpl'}):
+ ($lt{'foad_exmpl'}): + +

+

$lt{'noti'} $notificationHelp

+$lt{'mnot'} ($lt{'mnot_exmpl'}):
ENDMSG - my @sortforwards = sort (keys(%allnot)); + my @sortnotify = sort (keys(%allnot)); my $output = &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(). - ' '. - ''.&mt('Action').''. - ''.&mt('Notification address').''. - &mt('Types of message for which notification is sent'). + '#'. + ''.$lt{'acti'}.''. + ''.$lt{'nota'}.''. + $lt{'type'}. $criticalMessageHelp.''. - &mt('Excerpt retains HTML tags in message').''. + $lt{'exce'}.''. &Apache::loncommon::end_data_table_header_row(); my $num = 0; my $counter = 1; - foreach my $item (@sortforwards) { - $output .= &Apache::loncommon::start_data_table_row(). + foreach my $item (@sortnotify) { + $output .= &Apache::loncommon::start_data_table_row('LC_prefs_row'). ''.$counter.''. '   '. + $lt{'modi'}.' '.(' ' x2). ''. - ''; + ')" aria-labelledby="LC_email_notify" />'; my %chk; if (defined($allnot{$item}{'crit'})) { if (defined($allnot{$item}{'reg'})) { @@ -969,13 +989,15 @@ ENDMSG } else { $chk{'reg'} = 'checked="checked" '; } + $output .= '
'.$lt{'type'}.''; foreach my $type ('all','crit','reg') { $output .= ''.(' ' x4); + $lt{$type}.' '.(' ' x2); } + $output .= '
'; my $htmlon = ''; my $htmloff = ''; if (grep/^\Q$item\E/,@allow_html) { @@ -983,14 +1005,16 @@ ENDMSG } else { $htmloff = 'checked="checked" '; } - $output .= ' '.(' ' x2). ''. + $lt{'no'}.''. &Apache::loncommon::end_data_table_row(); $num ++; $counter ++; @@ -1000,24 +1024,27 @@ ENDMSG crit => '', reg => '', ); - $output .= &Apache::loncommon::start_data_table_row(). + $output .= &Apache::loncommon::start_data_table_row('LC_prefs_row'). ''.$counter.''. ''. - ''; + '" value="1" />'.$lt{'addn'}.''. + ''; + $output .= '
'.$lt{'type'}.''; foreach my $type ('all','crit','reg') { $output .= ''.(' ' x4); + $lt{$type}.' '.(' ' x2); } - $output .= ''.(' ' x3). + $output .= '
'. + '
'.$lt{'exce'}.''. + ' '.(' ' x2). ''. + $lt{'no'}.'
'. &Apache::loncommon::end_data_table_row(). &Apache::loncommon::end_data_table(); $num ++; @@ -1027,7 +1054,7 @@ ENDMSG -
+
|); } @@ -1161,7 +1188,8 @@ sub colorschanger { { href => '/adm/preferences?action=changecolors', text => 'Change Colors'}); $r->print(Apache::loncommon::start_page('Page Display Settings')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Colors')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Colors'). + '
'); # figure out colors my $function=&Apache::loncommon::get_users_function(); my $domain=&Apache::loncommon::determinedomain(); @@ -1175,13 +1203,18 @@ sub colorschanger { 'vlink' => 'Visited Link Color', 'alink' => 'Active Link Color', ); - my $start_data_table = &Apache::loncommon::start_data_table(); + my $start_data_table = &Apache::loncommon::start_data_table(). + &Apache::loncommon::data_table_caption(&mt('Colors for LON-CAPA pages')). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Page Element').''.&mt('Color').''. + &Apache::loncommon::end_data_table_header_row(); my $chtable=''; foreach my $item (sort(keys(%colortypes))) { my $curcol=&Apache::loncommon::designparm($function.'.'.$item,$domain); $chtable.=&Apache::loncommon::start_data_table_row(). - ''.$colortypes{$item}.''.$colortypes{$item}.''. + ''. &Apache::loncommon::end_data_table_row()."\n"; } @@ -1203,6 +1236,7 @@ sub colorschanger { +
$start_data_table @@ -1213,7 +1247,7 @@ $end_data_table

-
+
ENDCOL } @@ -1288,7 +1322,7 @@ sub passwordchanger { my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('passwd',$clientip); if ($blocked) { - $r->print('

'.$blocktext.'

'); + $r->print('

'.$blocktext.'

'); return; } } elsif ($caller eq 'reset_by_email') { @@ -1338,13 +1372,18 @@ sub passwordchanger { $r->print( '

' .&mt('Page requested in unexpected context') - .'

' + .'

' ); return; } my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); # Check for authentication types that allow changing of the password. - return if ($currentauth !~ /^(unix|internal):/); + if ($currentauth !~ /^(unix|internal):/) { + unless ($caller eq 'reset_by_email') { + $r->print(''); + } + return; + } # # Generate keys my ($lkey_cpass ,$ukey_cpass ) = &Apache::loncommon::des_keys(); @@ -1383,7 +1422,9 @@ $errormessage ENDFORM $r->print(&server_form($logtoken,$caller,$mailtoken,$extrafields)); $r->print(&client_form($caller,\%hexkey,$currentpass,$domain,$extrafields)); - + unless ($caller eq 'reset_by_email') { + $r->print(''); + } # return; } @@ -1853,7 +1894,8 @@ sub discussionchanger { { href => '/adm/preferences?action=changediscussions', text => 'Change Discussion Preferences'}); $r->print(Apache::loncommon::start_page('Change Discussion Preferences')); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences'). + '
'); my $user = $env{'user.name'}; my $domain = $env{'user.domain'}; my %userenv = &Apache::lonnet::get @@ -1921,15 +1963,15 @@ END $r->print('

'.$lt{'thde'}.'

'); - $r->print(&Apache::loncommon::start_data_table()); + $r->print(&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row()); $r->print(<<"END"); - $lt{'pref'} $lt{'curr'} $lt{'actn'}? - END - $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(&Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row()); $r->print(<<"END"); $lt{'disa'} $lt{$discdisp} @@ -1941,14 +1983,13 @@ END $lt{'npmr'} $lt{$discmark} - END $r->print(&Apache::loncommon::end_data_table_row(). &Apache::loncommon::end_data_table()); $r->print('
' .'' - .'' + .'
' ); } @@ -2180,7 +2221,7 @@ sub author_space_settings { $divsty = 'display:inline-block'; } $r->print(<<"END"); -

$titles{$item}

+

$titles{$item}

$lt{'curd'}: $domdefdisplay

    @@ -2521,10 +2562,12 @@ sub timezonechanger { { href => '/adm/preferences?action=', text => 'Set Your Time Zone'}); $r->print(Apache::loncommon::start_page('Set Your Time Zone',$js,$args)); - $r->print(Apache::lonhtmlcommon::breadcrumbs('Set Your Time Zone')); + $r->print(Apache::lonhtmlcommon::breadcrumbs('Set Your Time Zone'). + '

'); my %userenv = &Apache::lonnet::get('environment',['timezone']); my $timezone = $userenv{'timezone'}; my %lt = &Apache::lonlocal::texthash( + tztu => 'Time Zone in use', lctz => 'Use Time Zone set by LON-CAPA', owntz => 'Use Time Zone set by you', save => 'Save', @@ -2542,15 +2585,17 @@ sub timezonechanger { $r->print(<<"END");
+
$lt{'tztu'}      +$lt{'lctz'}
+
  +$lt{'owntz'}
  $selector -


+

-

+

END } return; @@ -2703,7 +2748,7 @@ my @menu= permission => 'F', #help => 'Change_Discussion_Display', icon => 'chat.png', - alttext => 'Discussions Icon', + alttext => 'Discussions Icon', linktitle => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.' }, ] @@ -2758,7 +2803,7 @@ push(@menu, permission => 'F', #help => 'Change_Password', icon => 'emblem-readonly.png', - alttext => 'Secure Icon', + alttext => 'Secure Icon', linktitle => 'Change your password.', }); } @@ -2797,7 +2842,7 @@ push(@{ $menu[-1]->{items} }, { permission => 'F', #help => '', icon => 'blog.png', - alttext => 'Debugging Icon', + alttext => 'Debugging Icon', linktitle => 'Toggle Debug Messages.', }); } @@ -2858,7 +2903,6 @@ sub handler { $ended = 1; }elsif($env{'form.action'} eq 'changepass'){ &passwordchanger($r); - $r->print(''); }elsif($env{'form.action'} eq 'verify_and_change_pass'){ &verify_and_change_password($r,'preferences','','','',\$ended); }elsif($env{'form.action'} eq 'changescreenname'){