--- loncom/interface/lonpreferences.pm 2009/04/05 17:18:29 1.150 +++ loncom/interface/lonpreferences.pm 2009/04/29 16:57:29 1.155 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.150 2009/04/05 17:18:29 droeschl Exp $ +# $Id: lonpreferences.pm,v 1.155 2009/04/29 16:57:29 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -135,9 +135,8 @@ sub verify_and_change_wysiwyg { my $newsetting=$env{'form.wysiwyg'}; &Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting}); &Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting}); -# $r->print('<p>'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'</p>'); - print_main_menu($r,'<p>'.&mt('Setting WYSIWYG editor to:').' ' - .&mt($newsetting).'</p>'); + &print_main_menu($r,'<p>'.&Apache::lonhtmlcommon::confirm_success(&mt('Setting WYSIWYG editor to:').' ' + .&mt($newsetting)).'</p>'); } ################################################################ @@ -187,17 +186,14 @@ sub verify_and_change_languages { if ($newlanguage) { &Apache::lonnet::put('environment',{'languages' => $newlanguage}); &Apache::lonnet::appenv({'environment.languages' => $newlanguage}); - $message=&mt('Set new preferred languages to ').'<tt>"'.$newlanguage.'"</tt>.'; + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new preferred languages to ').'<tt>"'.$newlanguage.'"</tt>.'); } else { &Apache::lonnet::del('environment',['languages']); &Apache::lonnet::delenv('environment.languages'); - $message=&mt('Reset preferred language.'); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred language.')); } &Apache::loncommon::flush_langs_cache($user,$domain); - print_main_menu($r, $message); -# $r->print(<<ENDVCSCREEN); -#$message -#ENDVCSCREEN + &print_main_menu($r, $message); } ################################################################ @@ -304,18 +300,13 @@ sub verify_and_change_texengine { if ($newtexengine) { &Apache::lonnet::put('environment',{'texengine' => $newtexengine}); &Apache::lonnet::appenv({'environment.texengine' => $newtexengine}); - $message=&mt('Set new preferred math display to ').'<tt>"'.$newtexengine.'"</tt>.'; + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new preferred math display to ').'<tt>"'.$newtexengine.'"</tt>.'); } else { &Apache::lonnet::del('environment',['texengine']); &Apache::lonnet::delenv('environment.texengine'); - $message=&mt('Reset preferred math display.'); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred math display.')); } - - -# $r->print(<<ENDVCSCREEN); -#$message -#ENDVCSCREEN - print_main_menu($r, $message); + &print_main_menu($r, $message); } ################################################################ @@ -482,7 +473,7 @@ sub verify_and_change_rolespref { # Unset any roles that were previously frozen but aren't in list foreach my $role_key (sort(keys(%recent_roles))) { if (($frozen_roles{$role_key}) && (!exists($freeze{$role_key}))) { - $message .= "<br />".&mt('Unfreezing '.$role.': [_1]',$role_text{$role_key})."\n"; + $message .= "<br />".&Apache::lonhtmlcommon::confirm_success(&mt('Unfreezing '.$role.': [_1]',$role_text{$role_key}))."\n"; &Apache::lonhtmlcommon::store_recent('roles',$role_key,' ',0); } } @@ -490,17 +481,14 @@ sub verify_and_change_rolespref { # Freeze selected roles foreach my $role_key (@freeze_list) { if (!$frozen_roles{$role_key}) { - $message .= "<br />".&mt('Freezing '.$role.': [_1]',$role_text{$role_key})."\n"; + $message .= "<br />". + &Apache::lonhtmlcommon::confirm_success(&mt('Freezing '.$role.': [_1]',$role_text{$role_key}))."\n"; &Apache::lonhtmlcommon::store_recent('roles', $role_key,' ',1); } } $message .= "<hr /><br />\n"; - -# $r->print(<<ENDRPSCREEN); -#$message -#ENDRPSCREEN - print_main_menu($r, $message); + &print_main_menu($r, $message); } @@ -553,11 +541,11 @@ sub verify_and_change_screenname { if ($newscreen) { &Apache::lonnet::put('environment',{'screenname' => $newscreen}); &Apache::lonnet::appenv({'environment.screenname' => $newscreen}); - $message=&mt('Set new screenname to ').'<tt>"'.$newscreen.'."</tt>.'; + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new screenname to ').'<tt>"'.$newscreen.'."</tt>.'); } else { &Apache::lonnet::del('environment',['screenname']); &Apache::lonnet::delenv('environment.screenname'); - $message=&mt('Reset screenname.'); + $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset screenname.')); } # Nickname $message.='<br />'; @@ -566,17 +554,14 @@ sub verify_and_change_screenname { if ($newscreen) { &Apache::lonnet::put('environment',{'nickname' => $newscreen}); &Apache::lonnet::appenv({'environment.nickname' => $newscreen}); - $message.=&mt('Set new nickname to ').'<tt>"'.$newscreen.'"</tt>.'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set new nickname to ').'<tt>"'.$newscreen.'"</tt>.'); } else { &Apache::lonnet::del('environment',['nickname']); &Apache::lonnet::delenv('environment.nickname'); - $message.=&mt('Reset nickname.'); + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset nickname.')); } &Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain); -# $r->print(<<ENDVCSCREEN); -#$message -#ENDVCSCREEN - print_main_menu($r, $message); + &print_main_menu($r, $message); } ################################################################ @@ -584,7 +569,7 @@ sub verify_and_change_screenname { ################################################################ sub iconchanger { my $r = shift; - Apache::lonhtmlcommon::add_breadcrumb( + &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changeicons', text => 'Change Main Menu'}); $r->print(Apache::loncommon::start_page('Page Display Settings')); @@ -628,8 +613,7 @@ sub verify_and_change_icons { &Apache::lonnet::put('environment',{'icons' => $newicons}); &Apache::lonnet::appenv({'environment.icons' => $newicons}); -# $r->print(&mt('Set menu mode to [_1].',$newicons)); - print_main_menu($r, &mt('Set menu mode to [_1].',$newicons)); + &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Set menu mode to [_1].',$newicons))); } ################################################################ @@ -638,7 +622,7 @@ sub verify_and_change_icons { sub clickerchanger { my $r = shift; - Apache::lonhtmlcommon::add_breadcrumb( + &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changeclicker', text => 'Register Clicker'}); $r->print(Apache::loncommon::start_page('Other')); @@ -650,14 +634,15 @@ sub clickerchanger { my $clickers=$userenv{'clickers'}; $clickers=~s/\,/\n/gs; my $text=&mt('Enter response device ("clicker") numbers'); - my $change=&mt('Register'); + my $change=&mt('Save'); my $helplink=&Apache::loncommon::help_open_topic('Clicker_Registration',&mt('Locating your clicker ID')); $r->print(<<ENDSCREEN); <form name="prefs" action="/adm/preferences" method="post"> <input type="hidden" name="action" value="verify_and_change_clicker" /> -<label>$text $helplink<br /> +<label>$helplink<br /><br />$text<br /> <textarea name="clickers" rows="5" cols="20">$clickers</textarea> </label> +<br /> <input type="submit" value="$change" /> </form> ENDSCREEN @@ -676,8 +661,7 @@ sub verify_and_change_clicker { $newclickers=~s/\,$//; &Apache::lonnet::put('environment',{'clickers' => $newclickers}); &Apache::lonnet::appenv({'environment.clickers' => $newclickers}); -# $r->print(&mt('Registering clickers: [_1]',$newclickers)); - print_main_menu($r, &mt('Registering clickers: [_1]',$newclickers)); + &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers))); } ################################################################ @@ -686,7 +670,7 @@ sub verify_and_change_clicker { sub domcoordchanger { my $r = shift; - Apache::lonhtmlcommon::add_breadcrumb( + &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changedomcoord', text => 'Restrict Domain Coordinator Access'}); $r->print(Apache::loncommon::start_page('Restrict Domain Coordinator Access')); @@ -720,8 +704,7 @@ 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'}}); -# $r->print(&mt('Registering Domain Coordinator access restrictions.')); - print_main_menu($r, &mt('Registering Domain Coordinator access restrictions.')); + &print_main_menu($r,&Apache::lonhtmlcommon::confirm_success(&mt('Registering Domain Coordinator access restrictions.'))); } ################################################################# @@ -1183,24 +1166,18 @@ 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.=&mt('Set '.$colortypes{$item}.' to ').'<tt>"'.$color.'"</tt>.<br />'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set '.$colortypes{$item}.' to ').'<tt>"'.$color.'"</tt>').'<br />'; } else { &Apache::lonnet::del('environment',[$entry]); &Apache::lonnet::delenv('environment.'.$entry); - $message.=&mt('Reset '.$colortypes{$item}.'.').'<br />'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset '.$colortypes{$item}.'.')).'<br />'; } } my $now = time; &Apache::lonnet::put('environment',{'color.timestamp' => $now}); &Apache::lonnet::appenv({'environment.color.timestamp' => $now}); - print_main_menu($r, $message); -# $r->print(<<ENDVCCOL); -#$message -#<form name="client" action="/adm/preferences" method="post"> -#<input type="hidden" name="action" value="changecolors" /> -#</form> -#ENDVCCOL + &print_main_menu($r, $message); } ###################################################### @@ -1212,7 +1189,7 @@ sub passwordchanger { # Passwords are encrypted using londes.js (DES encryption) $errormessage = ($errormessage || ''); my ($user,$domain,$currentpass,$defdom); - Apache::lonhtmlcommon::add_breadcrumb( + &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changepass', text => 'Change Password'}); unless ($caller eq 'reset_by_email') { @@ -1229,7 +1206,9 @@ 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 <a href="/adm/resetpw">new request</a> 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 [_1]new request[_2] 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.' + ,'<a href="/adm/resetpw">','</a>') + ); return; } if (defined($data{time})) { @@ -1554,21 +1533,19 @@ ENDERROR # Inform the user the password has (not?) been changed my $message; if ($result =~ /^ok$/) { - $message = &mt('The password for [_1] was successfully changed.',$user); + $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for [_1] was successfully changed.',$user)); if ($caller eq 'reset_by_email') { $r->print($message.'<br />'); } else { &print_main_menu($r, $message); } -# $r->print("<h3>".&mt('The password for [_1] was successfully changed',$user)."</h3>"); } else { # error error: run in circles, scream and shout - $message = &mt("The password for [_1] was not changed.",$user).' '.&mt('Please make sure your old password was entered correctly.'); + $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); unless ($caller eq 'reset_by_email') { &print_main_menu($r, $message); } -# $r->print("<h3><span class='LC_error'>".&mt("The password for [_1] was not changed",$user)."</span></h3>". -# &mt('Please make sure your old password was entered correctly.')); return 1; } return; @@ -1698,19 +1675,16 @@ sub verify_and_change_discussion { if (defined($env{'form.discmark'}) ) { my $newmark = $env{'form.newmark'}; if ($newmark eq 'ondisp') { - $message.=&mt('In discussions: new posts will be cease to be identified as "NEW" after display.').'<br />'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: new posts will be cease to be identified as "NEW" after display.')).'<br />'; &Apache::lonnet::put('environment',{'discmarkread' => $newmark}); &Apache::lonnet::appenv({'environment.discmarkread' => $newmark}); } else { - $message.=&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.').'<br />'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.')).'<br />'; &Apache::lonnet::del('environment',['discmarkread']); &Apache::lonnet::delenv('environment.discmarkread'); } } -# $r->print(<<ENDVCSCREEN); -#$message -#ENDVCSCREEN - print_main_menu($r, $message); + &print_main_menu($r, $message); } ################################################################ @@ -1718,7 +1692,7 @@ sub verify_and_change_discussion { ################################################################ sub coursedisplaychanger { my $r = shift; - Apache::lonhtmlcommon::add_breadcrumb( + &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/preferences?action=changecourseinit', text => 'Change Course Init. Pref.'}); $r->print(Apache::loncommon::start_page('Change Course Initialization Preference')); @@ -1797,11 +1771,7 @@ sub verify_and_change_coursepage { $refpage.'">'.$lt{'dasp'}.'</a></font>'; } } -# $r->print(<<ENDVCSCREEN); -#$message -#<br /><br /> -#ENDVCSCREEN - print_main_menu($r, $message); + &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success($message)); } sub print_main_menu { @@ -1890,7 +1860,7 @@ my @menu= }, { categorytitle=>'Message Management', items =>[ - { linktext => 'Messages & Notifications', + { linktext => 'Messages & Notifications', url => '/adm/preferences?action=changemsgforward', permission => 'F', #help => 'Prefs_Messages', @@ -1908,7 +1878,7 @@ my @menu= }, { categorytitle=>'Other', items =>[ - { linktext => 'Register Response Devices ("Clickers")', + { linktext => 'Register Response Devices ("Clickers")', url => '/adm/preferences?action=changeclicker', permission => 'F', #help => '', @@ -2074,8 +2044,8 @@ sub handler { }elsif($env{'form.action'} eq 'verify_and_change_coursepage'){ &verify_and_change_coursepage($r); }elsif($env{'form.action'} eq 'debugtoggle'){ - toggle_debug(); - print_main_menu($r); + &toggle_debug(); + &print_main_menu($r); } return OK; @@ -2356,7 +2326,8 @@ sub handler2 { })); } - if ($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) { + if (($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) + && ($env{'user.domain'} =~/^(msu|gerd)$/)){ push (@Options,({ action => 'debugtoggle', printmenu => 'yes', subroutine => \&toggle_debug,