--- loncom/interface/lonpreferences.pm 2009/05/20 15:05:19 1.125.4.1 +++ loncom/interface/lonpreferences.pm 2009/10/09 04:13:55 1.125.4.8 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.125.4.1 2009/05/20 15:05:19 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.125.4.8 2009/10/09 04:13:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,6 +42,7 @@ use Apache::loncommon(); use Apache::lonhtmlcommon(); use Apache::lonlocal; use Apache::lonnet; +use LONCAPA::lonauthcgi(); use LONCAPA(); # @@ -204,7 +205,8 @@ sub texenginechanger { 'tth' => 'tth (TeX to HTML)', #'ttm' => 'TeX to MathML', 'jsMath' => 'jsMath', - 'mimetex' => 'mimetex (Convert to Images)' + 'mimetex' => 'mimetex (Convert to Images)', + 'raw' => 'Raw (Screen Reader)' ); my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine', %mathchoices); @@ -687,6 +689,12 @@ 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'}}); + 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); $r->print(< 'New Password', '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| @@ -1345,7 +1353,7 @@ sub client_form {

-ENDFORM +|; return $output; } @@ -1367,6 +1375,7 @@ sub server_form { + |; } @@ -1509,8 +1518,9 @@ ENDERROR my $result = &Apache::lonnet::changepass ($user,$domain,$currentpass,$newpass1,$homeserver,$caller); # Inform the user the password has (not?) been changed + my $message; if ($result =~ /^ok$/) { - $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for user [_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 { @@ -1518,14 +1528,17 @@ ENDERROR } } else { # error error: run in circles, scream and shout - $message = &Apache::lonhtmlcommon::confirm_success( - &mt("The password for user [_1] was not changed.",''.$user.'').' '.&mt('Please make sure your old password was entered correctly.'),1); if ($caller eq 'reset_by_email') { - $r->print($message.'
'); + if (!$result) { + return 1; + } else { + return $result; + } } else { + $message = &Apache::lonhtmlcommon::confirm_success( + &mt("The password for user [_1] was not changed.",''.$user.'').' '.&mt('Please make sure your old password was entered correctly.'),1); $r->print(&Apache::loncommon::confirmwrapper($message)); } - return 1; } return; } @@ -1548,7 +1561,7 @@ sub discussionchanger { } } if (defined($userenv{'discmarkread'})) { - unless ($userenv{'discdisplay'} eq '') { + unless ($userenv{'discmarkread'} eq '') { $discmark = $userenv{'discmarkread'}; } } @@ -1638,11 +1651,11 @@ sub verify_and_change_discussion { if (defined($env{'form.discdisp'}) ) { my $newdisp = $env{'form.newdisp'}; if ($newdisp eq 'unread') { - $message .=&mt('In discussions: only new posts will be displayed.').'
'; + $message .= &Apache::lonhtmlcommon::confirm_success(&mt('In discussions: only new posts will be displayed.')).'
'; &Apache::lonnet::put('environment',{'discdisplay' => $newdisp}); &Apache::lonnet::appenv({'environment.discdisplay' => $newdisp}); } else { - $message .= &mt('In discussions: all posts will be displayed.').'
'; + $message .= &Apache::lonhtmlcommon::confirm_success(&mt('In discussions: all posts will be displayed.')).'
'; &Apache::lonnet::del('environment',['discdisplay']); &Apache::lonnet::delenv('environment.discdisplay'); } @@ -1742,7 +1755,7 @@ sub verify_and_change_coursepage { $refpage.'">'.$lt{'dasp'}.''; } } - $message = &Apache::lonhtmlcommon::confirm_success($message) + $message = &Apache::lonhtmlcommon::confirm_success($message); $r->print(< 'debugtoggle', printmenu => 'yes', subroutine => \&toggle_debug, @@ -2060,13 +2073,11 @@ sub handler { || ($printmenu eq 'not_on_error' && !$error) ) && (!$env{'form.returnurl'})) { my $optionlist = ''; - if ($env{'user.name'} =~ - /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/ - ) { + if (&can_toggle_debug()) { push (@Options,({ action => 'debugtoggle', linktext => 'Toggle Debug Messages', - text => 'Current Debug status is -'. - $env{'user.debug'}.'-.', + text => 'Current Debug status is: '. + ($env{'user.debug'} ? 'on' : 'off'), href => '/adm/preferences', printmenu => 'yes', subroutine => \&toggle_debug, @@ -2108,12 +2119,26 @@ sub handler { } sub toggle_debug { - if ($env{'user.debug'}) { - &Apache::lonnet::delenv('user.debug'); - } else { - &Apache::lonnet::appenv({'user.debug' => 1}); + if (&can_toggle_debug()) { + if ($env{'user.debug'}) { + &Apache::lonnet::delenv('user.debug'); + } else { + &Apache::lonnet::appenv({'user.debug' => 1}); + } + } +} + +sub can_toggle_debug { + my $can_toggle = 0; + my $page = 'toggledebug'; + if (&LONCAPA::lonauthcgi::can_view($page)) { + $can_toggle = 1; + } elsif (&LONCAPA::lonauthcgi::check_ipbased_access($page)) { + $can_toggle = 1; } + return $can_toggle; } + 1; __END__