Diff for /loncom/interface/lonpreferences.pm between versions 1.71 and 1.76

version 1.71, 2005/12/20 15:52:27 version 1.76, 2006/03/15 22:11:04
Line 659  sub passwordchanger { Line 659  sub passwordchanger {
     $lkey_npass2= hex($lkey_npass2);      $lkey_npass2= hex($lkey_npass2);
     # Output javascript to deal with passwords      # Output javascript to deal with passwords
     # Output DES javascript      # Output DES javascript
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print($html."<head>");  
     {      {
  my $include = $r->dir_config('lonIncludes');   my $include = $r->dir_config('lonIncludes');
  my $jsh=Apache::File->new($include."/londes.js");   my $jsh=Apache::File->new($include."/londes.js");
Line 741  sub verify_and_change_password { Line 739  sub verify_and_change_password {
     # Check for authentication types that allow changing of the password.      # Check for authentication types that allow changing of the password.
     return if ($currentauth !~ /^(unix|internal):/);      return if ($currentauth !~ /^(unix|internal):/);
     #      #
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDHEADER);  
 $html  
 <head>  
 <title>LON-CAPA Preferences:  Change password for $user</title>  
 </head>  
 ENDHEADER  
     #  
     my $currentpass = $env{'form.currentpass'};       my $currentpass = $env{'form.currentpass'}; 
     my $newpass1    = $env{'form.newpass_1'};       my $newpass1    = $env{'form.newpass_1'}; 
     my $newpass2    = $env{'form.newpass_2'};      my $newpass2    = $env{'form.newpass_2'};
Line 773  password decryption.  Please log out and Line 763  password decryption.  Please log out and
 </p>  </p>
 ENDERROR  ENDERROR
         # Probably should log an error here          # Probably should log an error here
         return;          return 1;
     }      }
     my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);      my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);
     #       # 
Line 786  ENDERROR Line 776  ENDERROR
  '<font color="#ff0000">ERROR:</font>'.   '<font color="#ff0000">ERROR:</font>'.
  'The new passwords you entered do not match.  '.   'The new passwords you entered do not match.  '.
  'Please try again.');   'Please try again.');
  return;   return 1;
     }      }
     if (length($newpass1) < 7) {      if (length($newpass1) < 7) {
  &passwordchanger($r,   &passwordchanger($r,
  '<font color="#ff0000">ERROR:</font>'.   '<font color="#ff0000">ERROR:</font>'.
  'Passwords must be a minimum of 7 characters long.  '.   'Passwords must be a minimum of 7 characters long.  '.
  'Please try again.');   'Please try again.');
  return;   return 1;
     }      }
     #      #
     # Check for bad characters      # Check for bad characters
Line 828  ENDTEXT Line 818  ENDTEXT
 <h2><font color="#ff0000">The password for $user was not changed</font></h2>  <h2><font color="#ff0000">The password for $user was not changed</font></h2>
 Please make sure your old password was entered correctly.  Please make sure your old password was entered correctly.
 ENDERROR  ENDERROR
           return 1;
     }      }
     return;      return;
 }  }
Line 983  sub coursedisplaychanger { Line 974  sub coursedisplaychanger {
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
     my %userenv = &Apache::lonnet::get('environment',['course_init_display']);      my %userenv = &Apache::lonnet::get('environment',['course_init_display']);
     my $currvalue = 'whatsnew';      my $currvalue = 'whatsnew';
     my $firstselect='checked="checked"';      my $firstselect = '';
     my $whatsnewselect='';      my $whatsnewselect = 'checked="checked"';
     if (exists($userenv{'course_init_display'})) {      if (exists($userenv{'course_init_display'})) {
         if ($userenv{'course_init_display'} eq 'firstres') {          if ($userenv{'course_init_display'} eq 'firstres') {
             $currvalue = 'firstres';              $currvalue = 'firstres';
             $firstselect='';              $firstselect = 'checked="checked"';
             $whatsnewselect='checked="checked"';      $whatsnewselect = '';
         }          }
     }      }
     my %pagenames = (      my %pagenames = (
Line 1003  sub coursedisplaychanger { Line 994  sub coursedisplaychanger {
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <form name="server" action="/adm/preferences" method="post">  <form name="server" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_coursepage" />  <input type="hidden" name="action" value="verify_and_change_coursepage" />
   <br />
 <label><input type="radio" name="newdisp" value="firstres" $firstselect /> $whatsnew_off</label><br />  <label><input type="radio" name="newdisp" value="firstres" $firstselect /> $whatsnew_off</label><br />
 <label><input type="radio" name="newdisp" value="whatsnew" $whatsnewselect /> $whatsnew_on</label><input type="hidden" name="refpage" value="$env{'form.refpage'}" />  <label><input type="radio" name="newdisp" value="whatsnew" $whatsnewselect /> $whatsnew_on</label><input type="hidden" name="refpage" value="$env{'form.refpage'}" />
 ENDLSCREEN  ENDLSCREEN
Line 1095  sub handler { Line 1087  sub handler {
                           breadcrumb =>                             breadcrumb => 
                               { href =>'/adm/preferences?action=changepass',                                { href =>'/adm/preferences?action=changepass',
                                 text => 'Change Password'},                                  text => 'Change Password'},
                           printmenu => 'yes',                            printmenu => 'not_on_error',
                           }));                            }));
     }      }
     push (@Options,({ action   => 'changescreenname',      push (@Options,({ action   => 'changescreenname',
Line 1232  sub handler { Line 1224  sub handler {
                             text => 'Change Math Preferences'},                              text => 'Change Math Preferences'},
                       printmenu => 'yes',                        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',          push (@Options,({ action => 'changecourseinit',
                           linktext => 'Change Course Initialization Preference',                            linktext => 'Change Course Initialization Preference',
                           href => '/adm/preferences',                            href => '/adm/preferences',
Line 1255  sub handler { Line 1249  sub handler {
                           subroutine => \&toggle_debug,                            subroutine => \&toggle_debug,
                           }));                            }));
     }      }
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDHEADER);      $r->print(&Apache::loncommon::start_page('Change Preferences'));
 $html  
 <head>  
 <title>LON-CAPA Preferences</title>  
 </head>  
 ENDHEADER  
     my $call = undef;      my $call = undef;
     my $help = undef;      my $help = undef;
     my $printmenu = 'yes';      my $printmenu = 'yes';
Line 1276  ENDHEADER Line 1266  ENDHEADER
     $help=$option->{'help'};      $help=$option->{'help'};
         }          }
     }      }
     $r->print(&Apache::loncommon::bodytag('Change Preferences'));  
     $r->print(&Apache::lonhtmlcommon::breadcrumbs      $r->print(&Apache::lonhtmlcommon::breadcrumbs
               (undef,'Change Preferences',$help));                (undef,'Change Preferences',$help));
       my $error;
     if (defined($call)) {      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 = '<table cellpadding="5">';          my $optionlist = '<table cellpadding="5">';
         if ($env{'user.name'} =~           if ($env{'user.name'} =~ 
                          /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/                           /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/
Line 1326  ENDHEADER Line 1318  ENDHEADER
  $r->print('<br /><a href="'.$env{'form.returnurl'}.'"><font size="+1">'.   $r->print('<br /><a href="'.$env{'form.returnurl'}.'"><font size="+1">'.
   &mt('Return').'</font></a>');    &mt('Return').'</font></a>');
     }      }
     $r->print(&Apache::loncommon::endbodytag().'</html>');      $r->print(&Apache::loncommon::end_page());
     return OK;      return OK;
 }  }
   

Removed from v.1.71  
changed lines
  Added in v.1.76


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>