--- loncom/interface/lonpreferences.pm 2005/12/20 15:52:27 1.71 +++ loncom/interface/lonpreferences.pm 2006/03/15 22:11:04 1.76 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.71 2005/12/20 15:52:27 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.76 2006/03/15 22:11:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -659,8 +659,6 @@ sub passwordchanger { $lkey_npass2= hex($lkey_npass2); # Output javascript to deal with passwords # Output DES javascript - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.""); { my $include = $r->dir_config('lonIncludes'); my $jsh=Apache::File->new($include."/londes.js"); @@ -741,14 +739,6 @@ sub verify_and_change_password { # Check for authentication types that allow changing of the password. return if ($currentauth !~ /^(unix|internal):/); # - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -LON-CAPA Preferences: Change password for $user - -ENDHEADER - # my $currentpass = $env{'form.currentpass'}; my $newpass1 = $env{'form.newpass_1'}; my $newpass2 = $env{'form.newpass_2'}; @@ -773,7 +763,7 @@ password decryption. Please log out and

ENDERROR # Probably should log an error here - return; + return 1; } my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo); # @@ -786,14 +776,14 @@ ENDERROR 'ERROR:'. 'The new passwords you entered do not match. '. 'Please try again.'); - return; + return 1; } if (length($newpass1) < 7) { &passwordchanger($r, 'ERROR:'. 'Passwords must be a minimum of 7 characters long. '. 'Please try again.'); - return; + return 1; } # # Check for bad characters @@ -828,6 +818,7 @@ ENDTEXT

The password for $user was not changed

Please make sure your old password was entered correctly. ENDERROR + return 1; } return; } @@ -983,13 +974,13 @@ sub coursedisplaychanger { my $domain = $env{'user.domain'}; my %userenv = &Apache::lonnet::get('environment',['course_init_display']); my $currvalue = 'whatsnew'; - my $firstselect='checked="checked"'; - my $whatsnewselect=''; + my $firstselect = ''; + my $whatsnewselect = 'checked="checked"'; if (exists($userenv{'course_init_display'})) { if ($userenv{'course_init_display'} eq 'firstres') { $currvalue = 'firstres'; - $firstselect=''; - $whatsnewselect='checked="checked"'; + $firstselect = 'checked="checked"'; + $whatsnewselect = ''; } } my %pagenames = ( @@ -1003,6 +994,7 @@ sub coursedisplaychanger { $r->print(< +

ENDLSCREEN @@ -1095,7 +1087,7 @@ sub handler { breadcrumb => { href =>'/adm/preferences?action=changepass', text => 'Change Password'}, - printmenu => 'yes', + printmenu => 'not_on_error', })); } push (@Options,({ action => 'changescreenname', @@ -1232,7 +1224,9 @@ sub handler { text => 'Change Math Preferences'}, printmenu => 'yes', })); - if ($env{'user.adv'}) { + 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', @@ -1255,13 +1249,9 @@ sub handler { subroutine => \&toggle_debug, })); } - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -LON-CAPA Preferences - -ENDHEADER + + $r->print(&Apache::loncommon::start_page('Change Preferences')); + my $call = undef; my $help = undef; my $printmenu = 'yes'; @@ -1276,13 +1266,15 @@ ENDHEADER $help=$option->{'help'}; } } - $r->print(&Apache::loncommon::bodytag('Change Preferences')); $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Change Preferences',$help)); + my $error; if (defined($call)) { - $call->($r); + $error = $call->($r); } - if (($printmenu eq 'yes') && (!$env{'form.returnurl'})) { + 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)$/ @@ -1326,7 +1318,7 @@ ENDHEADER $r->print('
'. &mt('Return').''); } - $r->print(&Apache::loncommon::endbodytag().''); + $r->print(&Apache::loncommon::end_page()); return OK; }