--- loncom/interface/lonpreferences.pm 2009/04/29 16:57:29 1.155 +++ loncom/interface/lonpreferences.pm 2009/07/09 19:28:36 1.167 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.155 2009/04/29 16:57:29 bisitz Exp $ +# $Id: lonpreferences.pm,v 1.167 2009/07/09 19:28:36 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -135,8 +135,9 @@ sub verify_and_change_wysiwyg { my $newsetting=$env{'form.wysiwyg'}; &Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting}); &Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting}); - &print_main_menu($r,'

'.&Apache::lonhtmlcommon::confirm_success(&mt('Setting WYSIWYG editor to:').' ' - .&mt($newsetting)).'

'); + my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('WYSIWYG Editor').'',''.&mt($newsetting).'')); + $message=&Apache::loncommon::confirmwrapper($message); + &print_main_menu($r,$message); } ################################################################ @@ -186,12 +187,13 @@ sub verify_and_change_languages { if ($newlanguage) { &Apache::lonnet::put('environment',{'languages' => $newlanguage}); &Apache::lonnet::appenv({'environment.languages' => $newlanguage}); - $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new preferred languages to ').'"'.$newlanguage.'".'); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Preferred language').'','"'.$newlanguage.'".')); } else { &Apache::lonnet::del('environment',['languages']); &Apache::lonnet::delenv('environment.languages'); - $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred language.')); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Preferred language').'')); } + $message=&Apache::loncommon::confirmwrapper($message); &Apache::loncommon::flush_langs_cache($user,$domain); &print_main_menu($r, $message); } @@ -230,6 +232,21 @@ sub texenginechanger { 'mimetex' => 'mimetex (Convert to Images):', ); + my $jsMathWarning='

' + .'

' + .&mt("It looks like you don't have the TeX math fonts installed.") + .'
' + .'
' + .&mt('The jsMath example on this page may not look right without them. ' + .'The [_1]jsMath Home Page[_2] has information on how to download the ' + .'needed fonts. In the meantime, jsMath will do the best it can ' + .'with the fonts you have, but it may not be pretty and some equations ' + .'may not be rendered correctly.' + ,'' + ,'') + .'
' + .'

'; + $r->print(<$lt{'headline'}
@@ -249,18 +266,7 @@ $lt{'exmpl'} $jsMath_start @@ -300,12 +306,13 @@ sub verify_and_change_texengine { if ($newtexengine) { &Apache::lonnet::put('environment',{'texengine' => $newtexengine}); &Apache::lonnet::appenv({'environment.texengine' => $newtexengine}); - $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new preferred math display to ').'"'.$newtexengine.'".'); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Preferred method to display Math').'','"'.$newtexengine.'"')); } else { &Apache::lonnet::del('environment',['texengine']); &Apache::lonnet::delenv('environment.texengine'); - $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred math display.')); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Preferred method to display Math').'')); } + $message=&Apache::loncommon::confirmwrapper($message); &print_main_menu($r, $message); } @@ -364,13 +371,13 @@ sub rolesprefchanger { my $checked = ""; my $value = $recent_roles{$role_key}; if ($frozen_roles{$role_key}) { - $checked = "checked=\"checked\""; + $checked = ' checked="checked"'; } $count++; $roles_check_list .= &Apache::loncommon::start_data_table_row(). ''. - "". "". @@ -382,10 +389,10 @@ sub rolesprefchanger { $r->print('

'.&mt('Some LON-CAPA users have a long list of '.$lc_role.'s. The Recent '.$role.'s Hotlist feature keeps track of the last N '.$lc_role.'s which have been visited and places a table of these at the top of the '.$lc_role.'s page. People with very few '.$lc_role.'s should leave this feature disabled.').'

- +
+
'.&mt('Number of '.$role.'s in Hotlist:').' ' .&Apache::lonhtmlcommon::start_pick_box() - .&Apache::lonhtmlcommon::row_title(&mt('New screenname (shown if you post anonymously)')) + .&Apache::lonhtmlcommon::row_title(&mt('Screenname').' '.&mt('(shown if you post anonymously)')) .'' .&Apache::lonhtmlcommon::row_closure() - .&Apache::lonhtmlcommon::row_title(&mt('New nickname (shown if you post non-anonymously)')) + .&Apache::lonhtmlcommon::row_title(&mt('Nickname').' '.&mt('(shown if you post non-anonymously)')) .'' .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title() @@ -541,11 +548,11 @@ sub verify_and_change_screenname { if ($newscreen) { &Apache::lonnet::put('environment',{'screenname' => $newscreen}); &Apache::lonnet::appenv({'environment.screenname' => $newscreen}); - $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new screenname to ').'"'.$newscreen.'.".'); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Screenname').'','"'.$newscreen.'"')); } else { &Apache::lonnet::del('environment',['screenname']); &Apache::lonnet::delenv('environment.screenname'); - $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset screenname.')); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Screenname').'')); } # Nickname $message.='
'; @@ -554,13 +561,14 @@ sub verify_and_change_screenname { if ($newscreen) { &Apache::lonnet::put('environment',{'nickname' => $newscreen}); &Apache::lonnet::appenv({'environment.nickname' => $newscreen}); - $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set new nickname to ').'"'.$newscreen.'".'); + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Nickname').'','"'.$newscreen.'"')); } else { &Apache::lonnet::del('environment',['nickname']); &Apache::lonnet::delenv('environment.nickname'); - $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset nickname.')); + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Nickname').'')); } &Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain); + $message=&Apache::loncommon::confirmwrapper($message); &print_main_menu($r, $message); } @@ -609,11 +617,13 @@ sub verify_and_change_icons { my $r = shift; my $user = $env{'user.name'}; my $domain = $env{'user.domain'}; - my $newicons = $env{'form.menumode'}; + my $newicons = $env{'form.menumode'}; &Apache::lonnet::put('environment',{'icons' => $newicons}); &Apache::lonnet::appenv({'environment.icons' => $newicons}); - &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Set menu mode to [_1].',$newicons))); + my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Menu Display').'',''.$newicons.'')); + $message=&Apache::loncommon::confirmwrapper($message); + &print_main_menu($r, $message); } ################################################################ @@ -661,7 +671,9 @@ sub verify_and_change_clicker { $newclickers=~s/\,$//; &Apache::lonnet::put('environment',{'clickers' => $newclickers}); &Apache::lonnet::appenv({'environment.clickers' => $newclickers}); - &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers))); + my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers)); + $message=&Apache::loncommon::confirmwrapper($message); + &print_main_menu($r, $message); } ################################################################ @@ -681,7 +693,7 @@ sub domcoordchanger { ('environment',['domcoord.author']); my $constchecked=''; if ($userenv{'domcoord.author'} eq 'blocked') { - $constchecked='checked="checked"'; + $constchecked=' checked="checked"'; } my $text=&mt('By default, the Domain Coordinator can enter your construction space.'); my $construction=&mt('Block access to construction space'); @@ -690,7 +702,7 @@ sub domcoordchanger { $text
-
+
ENDSCREEN @@ -704,7 +716,15 @@ sub verify_and_change_domcoord { if ($env{'form.construction'}) { $domcoord{'domcoord.author'}='blocked'; } &Apache::lonnet::put('environment',\%domcoord); &Apache::lonnet::appenv({'environment.domcoord.author' => $domcoord{'domcoord.author'}}); - &print_main_menu($r,&Apache::lonhtmlcommon::confirm_success(&mt('Registering Domain Coordinator access restrictions.'))); + my $status=''; + if ($domcoord{'domcoord.author'} eq 'blocked') { + $status=&mt('on'); + } else { + $status=&mt('off'); + } + my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Block access to construction space').'',''.$status.'')); + $message=&Apache::loncommon::confirmwrapper($message); + &print_main_menu($r,$message); } ################################################################# @@ -974,7 +994,7 @@ sub verify_and_change_msgforward { if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') { $newscreen.=$msuser.':'.$msdomain.','; } else { - $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.'
'; + $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.'
'; } } } @@ -1077,13 +1097,16 @@ sub colorschanger { # figure out colors my $function=&Apache::loncommon::get_users_function(); my $domain=&Apache::loncommon::determinedomain(); - my %colortypes=('pgbg' => 'Page Background', - 'tabbg' => 'Header Background', - 'sidebg'=> 'Header Border', - 'font' => 'Font', - 'link' => 'Un-Visited Link', - 'vlink' => 'Visited Link', - 'alink' => 'Active Link'); + my %colortypes=&Apache::lonlocal::texthash( + 'pgbg' => 'Page Background Color', + 'tabbg' => 'Header Background Color', + 'sidebg' => 'Header Border Color', + 'font' => 'Font Color', + 'fontmenu' => 'Font Menu Color', + 'link' => 'Un-Visited Link Color', + 'vlink' => 'Visited Link Color', + 'alink' => 'Active Link Color', + ); my $start_data_table = &Apache::loncommon::start_data_table(); my $chtable=''; foreach my $item (sort(keys(%colortypes))) { @@ -1094,14 +1117,14 @@ sub colorschanger { '" size="10" value="'.$curcol. '" />Select'. + .$item."','parmform.pres','psub'".');">'.&mt('Select').''. &Apache::loncommon::end_data_table_row()."\n"; } my $end_data_table = &Apache::loncommon::end_data_table(); my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); - my $save = &mt('Save'); - my $rstall = &mt('Reset All'); - my $resetdefault = &mt('Reset All Colors to Default'); + my $savebutton = &mt('Save'); + my $resetbutton = &mt('Reset All'); + my $resetbuttondesc = &mt('Reset All Colors to Default'); $r->print(< @@ -1140,8 +1163,10 @@ $start_data_table $chtable $end_data_table - - +

+ + +

ENDCOL } @@ -1151,13 +1176,16 @@ sub verify_and_change_colors { # figure out colors my $function=&Apache::loncommon::get_users_function(); my $domain=&Apache::loncommon::determinedomain(); - my %colortypes=('pgbg' => 'Page Background', - 'tabbg' => 'Header Background', - 'sidebg'=> 'Header Border', - 'font' => 'Font', - 'link' => 'Un-Visited Link', - 'vlink' => 'Visited Link', - 'alink' => 'Active Link'); + my %colortypes=&Apache::lonlocal::texthash( + 'pgbg' => 'Page Background Color', + 'tabbg' => 'Header Background Color', + 'sidebg' => 'Header Border Color', + 'font' => 'Font Color', + 'fontmenu' => 'Font Menu Color', + 'link' => 'Un-Visited Link Color', + 'vlink' => 'Visited Link Color', + 'alink' => 'Active Link Color', + ); my $message=''; foreach my $item (keys %colortypes) { @@ -1166,13 +1194,17 @@ 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.=&Apache::lonhtmlcommon::confirm_success(&mt('Set '.$colortypes{$item}.' to ').'"'.$color.'"').'
'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.$colortypes{$item}.'','"'.$color.'"')) + .'
'; } else { &Apache::lonnet::del('environment',[$entry]); &Apache::lonnet::delenv('environment.'.$entry); - $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset '.$colortypes{$item}.'.')).'
'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.$colortypes{$item}.'')) + .'
'; } } + $message=&Apache::loncommon::confirmwrapper($message); + my $now = time; &Apache::lonnet::put('environment',{'color.timestamp' => $now}); &Apache::lonnet::appenv({'environment.color.timestamp' => $now}); @@ -1325,40 +1357,39 @@ sub client_form { 'confirmpass' => 'Confirm Password', 'changepass' => 'Save'); - my $output = qq| -
- -|; + my $output = '' + .&Apache::lonhtmlcommon::start_pick_box(); if ($caller eq 'reset_by_email') { - $output .= qq| - - - - - - - -'; + $output .= &Apache::lonhtmlcommon::row_title( + '') + .'' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title( + '') + .'' + .'' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title( + '') + .&Apache::loncommon::select_dom_form($defdom,'udom') + .&Apache::lonhtmlcommon::row_closure(); } else { - $output .= qq| - - -|; - } - $output .= <<"ENDFORM"; - - - - -
:
: - - -
: -|; - $output .= &Apache::loncommon::select_dom_form($defdom,'udom').' -
- -
+ $output .= &Apache::lonhtmlcommon::row_title( + '') + .'' + .&Apache::lonhtmlcommon::row_closure(); + } + $output .= &Apache::lonhtmlcommon::row_title( + '') + .'' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title( + '') + .'' + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::end_pick_box(); + $output .= '

' + .qq| @@ -1367,7 +1398,7 @@ sub client_form {

-ENDFORM +|; return $output; } @@ -1533,7 +1564,7 @@ ENDERROR # Inform the user the password has (not?) been changed my $message; if ($result =~ /^ok$/) { - $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for [_1] was successfully changed.',$user)); + $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for user [_1] was successfully changed.',''.$user.'')); if ($caller eq 'reset_by_email') { $r->print($message.'
'); } else { @@ -1542,8 +1573,9 @@ ENDERROR } else { # error error: run in circles, scream and shout $message = &Apache::lonhtmlcommon::confirm_success( - &mt("The password for [_1] was not changed.",$user).' '.&mt('Please make sure your old password was entered correctly.'),1); + &mt("The password for user [_1] was not changed.",''.$user.'').' '.&mt('Please make sure your old password was entered correctly.'),1); unless ($caller eq 'reset_by_email') { + $message=&Apache::loncommon::confirmwrapper($message); &print_main_menu($r, $message); } return 1; @@ -1624,9 +1656,10 @@ sub discussionchanger {
$lt{'sdpf'}
$lt{'prca'}
  1. $lt{'whpo'}
  2. $lt{'unwh'}
-
-
END + + $r->print('

'.$lt{'thde'}.'

'); + $r->print(&Apache::loncommon::start_data_table()); $r->print(<<"END"); @@ -1652,7 +1685,10 @@ END $r->print(&Apache::loncommon::end_data_table_row(). &Apache::loncommon::end_data_table()); - $r->print('



'.&mt('Note').': '.$lt{'thde'}.''); + $r->print('
' + .'' + .'' + ); } sub verify_and_change_discussion { @@ -1684,6 +1720,7 @@ sub verify_and_change_discussion { &Apache::lonnet::delenv('environment.discmarkread'); } } + $message=&Apache::loncommon::confirmwrapper($message); &print_main_menu($r, $message); } @@ -1902,7 +1939,7 @@ push(@{ $menu[0]->{items} }, { if ($env{'environment.remote'} eq 'off') { push(@{ $menu[1]->{items} }, { linktext => 'Launch Remote Control', - url => '/adm/remote?url=/adm/preferences?action=launch', + url => '/adm/remote?url=/adm/preferences&action=launch', permission => 'F', #help => '', icon => 'network-wireless.png', @@ -1911,7 +1948,7 @@ push(@{ $menu[1]->{items} }, { }else{ push(@{ $menu[1]->{items} }, { linktext => 'Collapse Remote Control', - url => '/adm/remote?url=/adm/preferences?action=collapse', + url => '/adm/remote?url=/adm/preferences&action=collapse', permission => 'F', #help => '', icon => 'network-wireless.png', @@ -2048,361 +2085,14 @@ sub handler { &print_main_menu($r); } - return OK; - - -} -#remove when done -#old handler routine -sub handler2 { - my $r = shift; - my $user = $env{'user.name'}; - my $domain = $env{'user.domain'}; - &Apache::loncommon::content_type($r,'text/html'); - # Some pages contain DES keys and should not be cached. - &Apache::loncommon::no_cache($r); - $r->send_http_header; - return OK if $r->header_only; - # - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['action','wysiwyg','returnurl','refpage']); - # - &Apache::lonhtmlcommon::clear_breadcrumbs(); - &Apache::lonhtmlcommon::add_breadcrumb - ({href => '/adm/preferences', - text => 'Set User Preferences'}); - - my @Options; - # Determine current authentication method - my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); - if ($currentauth =~ /^(unix|internal):/) { - push (@Options,({ action => 'changepass', - linktext => 'Change Password', - href => '/adm/preferences', - help => 'Change_Password', - subroutine => \&passwordchanger, - breadcrumb => - { href => '/adm/preferences?action=changepass', - text => 'Change Password'}, - }, - { action => 'verify_and_change_pass', - subroutine => \&verify_and_change_password, - breadcrumb => - { href =>'/adm/preferences?action=changepass', - text => 'Change Password'}, - printmenu => 'not_on_error', - })); - } - push (@Options,({ action => 'changescreenname', - linktext => 'Change Screen Name', - href => '/adm/preferences', - help => 'Prefs_Screen_Name_Nickname', - subroutine => \&screennamechanger, - breadcrumb => - { href => '/adm/preferences?action=changescreenname', - text => 'Change Screen Name'}, - }, - { action => 'verify_and_change_screenname', - subroutine => \&verify_and_change_screenname, - breadcrumb => - { href => '/adm/preferences?action=changescreenname', - text => 'Change Screen Name'}, - printmenu => 'yes', - })); - - push (@Options,({ action => 'changemsgforward', - linktext => 'Change Message Forwarding and Notification E-mail Addresses', - href => '/adm/preferences', - help => 'Prefs_Messages', - breadcrumb => - { href => '/adm/preferences?action=changemsgforward', - text => 'Change Message Forwarding/Notification'}, - subroutine => \&msgforwardchanger, - }, - { action => 'verify_and_change_msgforward', - help => 'Prefs_Messages', - breadcrumb => - { href => '/adm/preferences?action=changemsgforward', - text => 'Change Message Forwarding/Notification'}, - printmenu => 'yes', - subroutine => \&verify_and_change_msgforward })); - my $aboutmeaction= - '/adm/'.$env{'user.domain'}.'/'.$env{'user.name'}.'/aboutme'; - push (@Options,{ action => 'none', - linktext => - q{Edit the Personal Information Page}, - help => 'Prefs_About_Me', - href => $aboutmeaction}); - push (@Options,({ action => 'changecolors', - linktext => 'Change Color Scheme', - href => '/adm/preferences', - help => 'Change_Colors', - breadcrumb => - { href => '/adm/preferences?action=changecolors', - text => 'Change Colors'}, - subroutine => \&colorschanger, - }, - { action => 'verify_and_change_colors', - breadcrumb => - { href => '/adm/preferences?action=changecolors', - text => 'Change Colors'}, - printmenu => 'yes', - subroutine => \&verify_and_change_colors, - })); - push (@Options,({ action => 'changelanguages', - linktext => 'Change Language Preferences', - href => '/adm/preferences', - help => 'Prefs_Language', - breadcrumb=> - { href => '/adm/preferences?action=changelanguages', - text => 'Change Language'}, - subroutine => \&languagechanger, - }, - { action => 'verify_and_change_languages', - breadcrumb=> - {href => '/adm/preferences?action=changelanguages', - text => 'Change Language'}, - printmenu => 'yes', - subroutine=>\&verify_and_change_languages, } - )); - push (@Options,({ action => 'changewysiwyg', - linktext => 'Change WYSIWYG Editor Preferences', - href => '/adm/preferences', - breadcrumb => - { href => '/adm/preferences?action=changewysiwyg', - text => 'Change WYSIWYG Preferences'}, - subroutine => \&wysiwygchanger, - }, - { action => 'set_wysiwyg', - breadcrumb => - { href => '/adm/preferences?action=changewysiwyg', - text => 'Change WYSIWYG Preferences'}, - printmenu => 'yes', - subroutine => \&verify_and_change_wysiwyg, } - )); - push (@Options,({ action => 'changediscussions', - linktext => 'Change Discussion Display Preferences', - href => '/adm/preferences', - help => 'Change_Discussion_Display', - breadcrumb => - { href => '/adm/preferences?action=changediscussions', - text => 'Change Discussion Preferences'}, - subroutine => \&discussionchanger, - }, - { action => 'verify_and_change_discussion', - breadcrumb => - { href => '/adm/preferences?action=changediscussions', - text => 'Change Discussion Preferences'}, - printmenu => 'yes', - subroutine => \&verify_and_change_discussion, } - )); - - my $role = ($env{'user.adv'} ? 'Roles' : 'Course'); - push (@Options,({ action => 'changerolespref', - linktext => 'Change '.$role.' Page Preferences', - href => '/adm/preferences', - subroutine => \&rolesprefchanger, - breadcrumb => - { href => '/adm/preferences?action=changerolespref', - text => 'Change '.$role.' Page Pref'}, - }, - { action => 'verify_and_change_rolespref', - subroutine => \&verify_and_change_rolespref, - breadcrumb => - { href => '/adm/preferences?action=changerolespref', - text => 'Change '.$role.' Page Preferences'}, - printmenu => 'yes', - })); - - push (@Options,({ action => 'changetexenginepref', - linktext => 'Change How Math Equations Are Displayed', - href => '/adm/preferences', - subroutine => \&texenginechanger, - breadcrumb => - { href => '/adm/preferences?action=changetexenginepref', - text => 'Change Math Pref'}, - }, - { action => 'verify_and_change_texengine', - subroutine => \&verify_and_change_texengine, - breadcrumb => - { href => '/adm/preferences?action=changetexenginepref', - text => 'Change Math Preferences'}, - printmenu => 'yes', - })); - - if ($env{'environment.remote'} eq 'off') { - push (@Options,({ action => 'launch', - linktext => 'Launch Remote Control', - href => '/adm/remote?url=/adm/preferences', - })); - } else { - push (@Options,({ action => 'collapse', - linktext => 'Collapse Remote Control', - href => '/adm/remote?url=/adm/preferences', - })); - } - - push (@Options,({ action => 'changeicons', - linktext => 'Change How Menus are Displayed', - href => '/adm/preferences', - subroutine => \&iconchanger, - breadcrumb => - { href => '/adm/preferences?action=changeicons', - text => 'Change Main Menu'}, - }, - { action => 'verify_and_change_icons', - subroutine => \&verify_and_change_icons, - breadcrumb => - { href => '/adm/preferences?action=changeicons', - text => 'Change Main Menu'}, - printmenu => 'yes', - })); - - push (@Options,({ action => 'changeclicker', - linktext => 'Register Response Devices ("Clickers")', - href => '/adm/preferences', - subroutine => \&clickerchanger, - breadcrumb => - { href => '/adm/preferences?action=changeclicker', - text => 'Register Clicker'}, - }, - { action => 'verify_and_change_clicker', - subroutine => \&verify_and_change_clicker, - breadcrumb => - { href => '/adm/preferences?action=changeclicker', - text => 'Register Clicker'}, - printmenu => 'yes', - })); - my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au']); - if (keys(%author_roles) > 0) { - push (@Options,({ action => 'changedomcoord', - linktext => 'Restrict Domain Coordinator Access', - href => '/adm/preferences', - subroutine => \&domcoordchanger, - breadcrumb => - { href => '/adm/preferences?action=changedomcoord', - text => 'Restrict Domain Coordinator Access'}, - }, - { action => 'verify_and_change_domcoord', - subroutine => \&verify_and_change_domcoord, - breadcrumb => - { href => '/adm/preferences?action=changedomcoord', - text => 'Restrict Domain Coordinator Access'}, - printmenu => 'yes', - })); - } - - push (@Options,({ action => 'lockwarning', - subroutine => \&lockwarning, - breadcrumb => - { href => '/adm/preferences?action=lockwarning', - text => 'Lock Warnings'}, - }, - { action => 'verify_and_change_locks', - subroutine => \&verify_and_change_lockwarning, - breadcrumb => - { href => '/adm/preferences?action=lockwarning', - text => 'Lockwarnings'}, - printmenu => 'yes', - })); - - - if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) - || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' - .$env{'request.course.sec'})) { - push (@Options,({ action => 'changecourseinit', - linktext => 'Change Course Initialization Preference', - href => '/adm/preferences', - subroutine => \&coursedisplaychanger, - breadcrumb => - { href => '/adm/preferences?action=changecourseinit', - text => 'Change Course Init. Pref.'}, - }, - { action => 'verify_and_change_coursepage', - breadcrumb => - { href => '/adm/preferences?action=changecourseinit', text => 'Change Course Initialization Preference'}, - printmenu => 'yes', - subroutine => \&verify_and_change_coursepage, - })); - } - - if (($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) - && ($env{'user.domain'} =~/^(msu|gerd)$/)){ - push (@Options,({ action => 'debugtoggle', - printmenu => 'yes', - subroutine => \&toggle_debug, - })); - } - - $r->print(&Apache::loncommon::start_page('Change Preferences')); - - my $call = undef; - my $help = undef; - my $printmenu = 'yes'; - foreach my $option (@Options) { - if ($option->{'action'} eq $env{'form.action'}) { - $call = $option->{'subroutine'}; - $printmenu = $option->{'printmenu'}; - if (exists($option->{'breadcrumb'})) { - &Apache::lonhtmlcommon::add_breadcrumb - ($option->{'breadcrumb'}); - } - $help=$option->{'help'}; - } - } - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Change Preferences',$help)); - my $error; - if (defined($call)) { - $error = $call->($r); - } - if ( ( ($printmenu eq 'yes') - || ($printmenu eq 'not_on_error' && !$error) ) - && (!$env{'form.returnurl'})) { - my $optionlist = ''; - if ($env{'user.name'} =~ - /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/ - ) { - push (@Options,({ action => 'debugtoggle', - linktext => 'Toggle Debug Messages', - text => 'Current Debug status is -'. - $env{'user.debug'}.'-.', - href => '/adm/preferences', - printmenu => 'yes', - subroutine => \&toggle_debug, - })); - } - foreach my $option(@Options) { - my $optiontext = ''; - if (exists($option->{'href'})) { - $option->{'href_args'}{'action'}=$option->{'action'}; - $optiontext .= - ''. - &mt($option->{'linktext'}).''; - } - if (exists($option->{'text'})) { - $optiontext .= ' '.&mt($option->{'text'}); - } - if ($optiontext ne '') { - $optiontext = ''.$optiontext.''; - my $helplink = ' '; - if (exists($option->{'help'})) { - $helplink = &Apache::loncommon::help_open_topic - ($option->{'help'}); - } - $optionlist .= ''. - ''. - ''. - ''; - } - } - $optionlist .= '
'.$helplink.''.$optiontext.'
'; - $r->print($optionlist); - } elsif ($env{'form.returnurl'}) { - $r->print('
'. - &mt('Return').''); + # Properly end the HTML page of all preference pages + # started in each sub routine + # Exception: print_main_menu has its own end_page call + unless (!exists $env{'form.action'} || + $env{'form.action'} eq 'debugtoggle') { + $r->print(&Apache::loncommon::end_page()); } - $r->print(&Apache::loncommon::end_page()); + return OK; }