Diff for /loncom/auth/lonlogin.pm between versions 1.147 and 1.166

version 1.147, 2011/03/03 06:37:30 version 1.166, 2016/04/19 18:09:11
Line 1 Line 1
 # The LearningOnline Network  # The LearningOnline Network
 # Login Screen  # Login Screen
 #  #
 # $Id$  # $Id$
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).  # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
 #  #
 # LON-CAPA is free software; you can redistribute it and/or modify  # LON-CAPA is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by  # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or  # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.  # (at your option) any later version.
 #  #
 # LON-CAPA is distributed in the hope that it will be useful,  # LON-CAPA is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of  # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.  # GNU General Public License for more details.
 #  #
 # You should have received a copy of the GNU General Public License  # You should have received a copy of the GNU General Public License
 # along with LON-CAPA; if not, write to the Free Software  # along with LON-CAPA; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #  #
 # /home/httpd/html/adm/gpl.txt  # /home/httpd/html/adm/gpl.txt
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
 package Apache::lonlogin;  package Apache::lonlogin;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::File ();  use Apache::File ();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonauth();  use Apache::lonauth();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::migrateuser();  use Apache::migrateuser();
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA;  use LONCAPA;
     
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
   
     &Apache::loncommon::get_unprocessed_cgi      &Apache::loncommon::get_unprocessed_cgi
  (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},   (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
       $ENV{'REDIRECT_QUERY_STRING'}),        $ENV{'REDIRECT_QUERY_STRING'}),
  ['interface','username','domain','firsturl','localpath','localres',   ['interface','username','domain','firsturl','localpath','localres',
   'token','role','symb']);    'token','role','symb','iptoken']);
     if (!defined($env{'form.firsturl'})) {      if (!defined($env{'form.firsturl'})) {
         &Apache::lonacc::get_posted_cgi($r,['firsturl']);          &Apache::lonacc::get_posted_cgi($r,['firsturl']);
     }      }
   
 # -- check if they are a migrating user  # -- check if they are a migrating user
     if (defined($env{'form.token'})) {      if (defined($env{'form.token'})) {
  return &Apache::migrateuser::handler($r);   return &Apache::migrateuser::handler($r);
     }      }
   
     &Apache::loncommon::no_cache($r);      &Apache::loncommon::no_cache($r);
     &Apache::lonlocal::get_language_handle($r);      &Apache::lonlocal::get_language_handle($r);
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
   
   
 # Are we re-routing?  # Are we re-routing?
     if (-e '/home/httpd/html/lon-status/reroute.txt') {      my $londocroot = $r->dir_config('lonDocRoot');
  &Apache::lonauth::reroute($r);      if (-e "$londocroot/lon-status/reroute.txt") {
  return OK;   &Apache::lonauth::reroute($r);
     }   return OK;
       }
     $env{'form.firsturl'} =~ s/(`)/'/g;  
       $env{'form.firsturl'} =~ s/(`)/'/g;
 # -------------------------------- Prevent users from attempting to login twice  
     my $handle = &Apache::lonnet::check_for_valid_session($r);  # -------------------------------- Prevent users from attempting to login twice
     if ($handle ne '') {      my $handle = &Apache::lonnet::check_for_valid_session($r);
         my $lonidsdir=$r->dir_config('lonIDsDir');      if ($handle ne '') {
         if ($handle=~/^publicuser\_/) {          my $lonidsdir=$r->dir_config('lonIDsDir');
 # For "public user" - remove it, we apparently really want to login          if ($handle=~/^publicuser\_/) {
     unlink($r->dir_config('lonIDsDir')."/$handle.id");  # For "public user" - remove it, we apparently really want to login
         } else {      unlink($r->dir_config('lonIDsDir')."/$handle.id");
 # Indeed, a valid token is found          } else {
             &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);  # Indeed, a valid token is found
     my $start_page =               &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
         &Apache::loncommon::start_page('Already logged in');      my $start_page =
     my $end_page =           &Apache::loncommon::start_page('Already logged in');
         &Apache::loncommon::end_page();      my $end_page =
             my $dest = '/adm/roles';          &Apache::loncommon::end_page();
             if ($env{'form.firsturl'} ne '') {              my $dest = '/adm/roles';
                 $dest = $env{'form.firsturl'};               if ($env{'form.firsturl'} ne '') {
             }                  $dest = $env{'form.firsturl'};
     $r->print(              }
                   $start_page      $r->print(
                  .'<h1>'.&mt('You are already logged in!').'</h1>'                    $start_page
                  .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',                   .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
                   '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
                  .$end_page                    '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
                  );                   .$end_page
             return OK;                   );
         }              return OK;
     }          }
       }
 # ---------------------------------------------------- No valid token, continue  
   # ---------------------------------------------------- No valid token, continue
  # ---------------------------- Not possible to really login to domain "public"  
     if ($env{'form.domain'} eq 'public') {  # ---------------------------- Not possible to really login to domain "public"
  $env{'form.domain'}='';      if ($env{'form.domain'} eq 'public') {
  $env{'form.username'}='';   $env{'form.domain'}='';
     }   $env{'form.username'}='';
 # ----------------------------------------------------------- Process Interface      }
     $env{'form.interface'}=~s/\W//g;  
   # ------ Is this page requested because /adm/migrateuser detected an IP change?
     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};      my %sessiondata;
       if ($env{'form.iptoken'}) {
     my $iconpath=           %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});
  &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));          unless ($sessiondata{'sessionserver'}) {
               my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});
     my $lonhost = $r->dir_config('lonHostID');              delete($env{'form.iptoken'});
     my $domain = &Apache::lonnet::default_login_domain();          }
     if ($lonhost ne '') {      }
         my $redirect = &check_loginvia($domain,$lonhost);  # ----------------------------------------------------------- Process Interface
         if ($redirect) {      $env{'form.interface'}=~s/\W//g;
             $r->print($redirect);  
             return OK;      (undef,undef,undef,undef,undef,undef,my $clientmobile) =
         }           &Apache::loncommon::decode_user_agent();
     }  
       my $iconpath=
     if (($env{'form.domain'}) &&    &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
  (&Apache::lonnet::domain($env{'form.domain'},'description'))) {  
  $domain=$env{'form.domain'};      my $lonhost = $r->dir_config('lonHostID');
     }      my $domain = &Apache::lonnet::default_login_domain();
     my $role    = $r->dir_config('lonRole');      my $defdom = $domain;
     my $loadlim = $r->dir_config('lonLoadLim');      if ($lonhost ne '') {
     my $uloadlim= $r->dir_config('lonUserLoadLim');          unless ($sessiondata{'sessionserver'}) {
     my $servadm = $r->dir_config('lonAdmEMail');              my $redirect = &check_loginvia($domain,$lonhost);
     my $tabdir  = $r->dir_config('lonTabDir');              if ($redirect) {
     my $include = $r->dir_config('lonIncludes');                  $r->print($redirect);
     my $expire  = $r->dir_config('lonExpire');                  return OK;
     my $version = $r->dir_config('lonVersion');              }
     my $host_name = &Apache::lonnet::hostname($lonhost);          }
       }
 # --------------------------------------------- Default values for login fields  
       if (($sessiondata{'domain'}) &&
     my $authusername=($env{'form.username'}?$env{'form.username'}:'');          (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);          $domain=$sessiondata{'domain'};
       } elsif (($env{'form.domain'}) &&
 # ---------------------------------------------------------- Determine own load   (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
     my $loadavg;   $domain=$env{'form.domain'};
     {      }
  my $loadfile=Apache::File->new('/proc/loadavg');  
  $loadavg=<$loadfile>;      my $role    = $r->dir_config('lonRole');
     }      my $loadlim = $r->dir_config('lonLoadLim');
     $loadavg =~ s/\s.*//g;      my $uloadlim= $r->dir_config('lonUserLoadLim');
       my $servadm = $r->dir_config('lonAdmEMail');
     my ($loadpercent,$userloadpercent);      my $tabdir  = $r->dir_config('lonTabDir');
     if ($loadlim) {      my $include = $r->dir_config('lonIncludes');
         $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);      my $expire  = $r->dir_config('lonExpire');
     }      my $version = $r->dir_config('lonVersion');
     if ($uloadlim) {      my $host_name = &Apache::lonnet::hostname($lonhost);
         $userloadpercent=&Apache::lonnet::userload();  
     }  # --------------------------------------------- Default values for login fields
      
     my $firsturl=      my ($authusername,$authdomain);
     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});      if ($sessiondata{'username'}) {
           $authusername=$sessiondata{'username'};
 # ----------------------------------------------------------- Get announcements      } else {
     my $announcements=&Apache::lonnet::getannounce();          $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
 # -------------------------------------------------------- Set login parameters          $authusername=($env{'form.username'}?$env{'form.username'}:'');
       }
     my @hexstr=('0','1','2','3','4','5','6','7',      if ($sessiondata{'domain'}) {
                 '8','9','a','b','c','d','e','f');          $authdomain=$sessiondata{'domain'};
     my $lkey='';      } else {
     for (0..7) {          $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
         $lkey.=$hexstr[rand(15)];          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
     }      }
   
     my $ukey='';  # ---------------------------------------------------------- Determine own load
     for (0..7) {      my $loadavg;
         $ukey.=$hexstr[rand(15)];      {
     }   my $loadfile=Apache::File->new('/proc/loadavg');
    $loadavg=<$loadfile>;
     my $lextkey=hex($lkey);      }
     if ($lextkey>2147483647) { $lextkey-=4294967296; }      $loadavg =~ s/\s.*//g;
   
     my $uextkey=hex($ukey);      my ($loadpercent,$userloadpercent);
     if ($uextkey>2147483647) { $uextkey-=4294967296; }      if ($loadlim) {
           $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
 # -------------------------------------------------------- Store away log token      }
     my $tokenextras;      if ($uloadlim) {
     if ($env{'form.role'}) {          $userloadpercent=&Apache::lonnet::userload();
         $tokenextras = '&role='.&escape($env{'form.role'});      }
     }  
     if ($env{'form.symb'}) {      my $firsturl=
         if (!$tokenextras) {      ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
             $tokenextras = '&';  
         }  # ----------------------------------------------------------- Get announcements
         $tokenextras .= '&symb='.&escape($env{'form.symb'});      my $announcements=&Apache::lonnet::getannounce();
     }  # -------------------------------------------------------- Set login parameters
     my $logtoken=Apache::lonnet::reply(  
        'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,      my @hexstr=('0','1','2','3','4','5','6','7',
        $lonhost);                  '8','9','a','b','c','d','e','f');
       my $lkey='';
 # ------------------- If we cannot talk to ourselves, we are in serious trouble      for (0..7) {
           $lkey.=$hexstr[rand(15)];
     if ($logtoken eq 'con_lost') {      }
         my $spares='';  
  my $last;      my $ukey='';
         foreach my $hostid (sort      for (0..7) {
     {          $ukey.=$hexstr[rand(15)];
  &Apache::lonnet::hostname($a) cmp      }
     &Apache::lonnet::hostname($b);  
     }      my $lextkey=hex($lkey);
     keys(%Apache::lonnet::spareid)) {      if ($lextkey>2147483647) { $lextkey-=4294967296; }
             next if ($hostid eq $lonhost);  
     my $hostname = &Apache::lonnet::hostname($hostid);      my $uextkey=hex($ukey);
     next if ($last eq $hostname);      if ($uextkey>2147483647) { $uextkey-=4294967296; }
             $spares.='<br /><font size="+1"><a href="http://'.  
                 $hostname.  # -------------------------------------------------------- Store away log token
                 '/adm/login?domain='.$authdomain.'">'.      my $tokenextras;
                 $hostname.'</a>'.      if ($env{'form.role'}) {
                 ' '.&mt('(preferred)').'</font>'.$/;          $tokenextras = '&role='.&escape($env{'form.role'});
     $last=$hostname;      }
         }      if ($env{'form.symb'}) {
 $spares.= '<br />';          if (!$tokenextras) {
 my %all_hostnames = &Apache::lonnet::all_hostnames();              $tokenextras = '&';
 foreach my $hostid (sort          }
     {          $tokenextras .= '&symb='.&escape($env{'form.symb'});
  &Apache::lonnet::hostname($a) cmp      }
     &Apache::lonnet::hostname($b);      if ($env{'form.iptoken'}) {
     }          if (!$tokenextras) {
     keys(%all_hostnames)) {              $tokenextras = '&&';
     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});          }
     my $hostname = &Apache::lonnet::hostname($hostid);          $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
     next if ($last eq $hostname);      }
     $spares.='<br /><a href="http://'.      my $logtoken=Apache::lonnet::reply(
  $hostname.         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
  '/adm/login?domain='.$authdomain.'">'.         $lonhost);
  $hostname.'</a>';  
     $last=$hostname;  # -- If we cannot talk to ourselves, or hostID does not map to a hostname
 }  #    we are in serious trouble
 $r->print(  
    '<html>'      if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
   .'<head><title>'          if ($logtoken eq 'no_such_host') {
   .&mt('The LearningOnline Network with CAPA')              &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
   .'</title></head>'          }
   .'<body bgcolor="#FFFFFF">'          my $spares='';
   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'   my $last;
   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'          foreach my $hostid (sort
   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'      {
   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'   &Apache::lonnet::hostname($a) cmp
   .$spares      &Apache::lonnet::hostname($b);
   .'</body>'      }
   .'</html>'      keys(%Apache::lonnet::spareid)) {
 );              next if ($hostid eq $lonhost);
 return OK;      my $hostname = &Apache::lonnet::hostname($hostid);
 }      next if (($last eq $hostname) || ($hostname eq ''));
               $spares.='<br /><font size="+1"><a href="http://'.
 # ----------------------------------------------- Apparently we are in business                  $hostname.
 $servadm=~s/\,/\<br \/\>/g;                  '/adm/login?domain='.$authdomain.'">'.
                   $hostname.'</a>'.
 # ----------------------------------------------------------- Front page design                  ' '.&mt('(preferred)').'</font>'.$/;
 my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);      $last=$hostname;
 my $font=&Apache::loncommon::designparm('login.font',$domain);          }
 my $link=&Apache::loncommon::designparm('login.link',$domain);          if ($spares) {
 my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);              $spares.= '<br />';
 my $alink=&Apache::loncommon::designparm('login.alink',$domain);          }
 my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);          my %all_hostnames = &Apache::lonnet::all_hostnames();
 my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);          foreach my $hostid (sort
 my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);      {
 my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);   &Apache::lonnet::hostname($a) cmp
 my $logo=&Apache::loncommon::designparm('login.logo',$domain);      &Apache::lonnet::hostname($b);
 my $img=&Apache::loncommon::designparm('login.img',$domain);      }
 my $domainlogo=&Apache::loncommon::domainlogo($domain);      keys(%all_hostnames)) {
 my $showbanner = 1;              next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
 my $showmainlogo = 1;              my $hostname = &Apache::lonnet::hostname($hostid);
 if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {              next if (($last eq $hostname) || ($hostname eq ''));
     $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);              $spares.='<br /><a href="http://'.
 }               $hostname.
 if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {               '/adm/login?domain='.$authdomain.'">'.
     $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);               $hostname.'</a>';
 }              $last=$hostname;
 my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);           }
 my $showcoursecat =           $r->print(
 &Apache::loncommon::designparm('login.coursecatalog',$domain);     '<html>'
 my $shownewuserlink =     .'<head><title>'
 &Apache::loncommon::designparm('login.newuser',$domain);    .&mt('The LearningOnline Network with CAPA')
 my $now=time;    .'</title></head>'
 my $js = (<<ENDSCRIPT);    .'<body bgcolor="#FFFFFF">'
     .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
 <script type="text/javascript" language="JavaScript">    .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
 // <![CDATA[    .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
 function send()          if ($spares) {
 {              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
 this.document.server.elements.uname.value                       .'</p>'
 =this.document.client.elements.uname.value;                       .$spares);
           }
 this.document.server.elements.udom.value          $r->print('</body>'
 =this.document.client.elements.udom.value;                   .'</html>'
           );
 uextkey=this.document.client.elements.uextkey.value;          return OK;
 lextkey=this.document.client.elements.lextkey.value;      }
 initkeys();  
   # ----------------------------------------------- Apparently we are in business
 this.document.server.elements.upass0.value      $servadm=~s/\,/\<br \/\>/g;
     =crypted(this.document.client.elements.upass$now.value.substr(0,15));  
 this.document.server.elements.upass1.value  # ----------------------------------------------------------- Front page design
     =crypted(this.document.client.elements.upass$now.value.substr(15,15));      my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
 this.document.server.elements.upass2.value      my $font=&Apache::loncommon::designparm('login.font',$domain);
     =crypted(this.document.client.elements.upass$now.value.substr(30,15));      my $link=&Apache::loncommon::designparm('login.link',$domain);
       my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
 this.document.client.elements.uname.value='';      my $alink=&Apache::loncommon::designparm('login.alink',$domain);
 this.document.client.elements.upass$now.value='';      my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
       my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
 this.document.server.submit();      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
 return false;      my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
 }      my $logo=&Apache::loncommon::designparm('login.logo',$domain);
       my $img=&Apache::loncommon::designparm('login.img',$domain);
 function enableInput() {      my $domainlogo=&Apache::loncommon::domainlogo($domain);
     this.document.client.elements.upass$now.removeAttribute("readOnly");      my $showbanner = 1;
     this.document.client.elements.uname.removeAttribute("readOnly");      my $showmainlogo = 1;
     this.document.client.elements.udom.removeAttribute("readOnly");      if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
     return;          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
 }      }
       if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
 // ]]>          $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
 </script>      }
       my $showadminmail;
 ENDSCRIPT      my @possdoms = &Apache::lonnet::current_machine_domains();
       if (grep(/^\Q$domain\E$/,@possdoms)) {
 # --------------------------------------------------- Print login screen header          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
       }
 my %add_entries = (      my $showcoursecat =
        bgcolor      => "$mainbg",          &Apache::loncommon::designparm('login.coursecatalog',$domain);
        text         => "$font",      my $shownewuserlink =
        link         => "$link",          &Apache::loncommon::designparm('login.newuser',$domain);
        vlink        => "$vlink",      my $showhelpdesk =
        alink        => "$alink",          &Apache::loncommon::designparm('login.helpdesk',$domain);
                onload       => 'javascript:enableInput();',);      my $now=time;
       my $js = (<<ENDSCRIPT);
 $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,  
        { 'redirect'       => [$expire,'/adm/roles'],   <script type="text/javascript" language="JavaScript">
  'add_entries' => \%add_entries,  // <![CDATA[
  'only_body'   => 1,}));  function send()
   {
 # ----------------------------------------------------------------------- Texts  this.document.server.elements.uname.value
   =this.document.client.elements.uname.value;
 my %lt=&Apache::lonlocal::texthash(  
           'un'       => 'Username',  this.document.server.elements.udom.value
           'pw'       => 'Password',  =this.document.client.elements.udom.value;
           'dom'      => 'Domain',  
           'perc'     => 'percent',  uextkey=this.document.client.elements.uextkey.value;
           'load'     => 'Server Load',  lextkey=this.document.client.elements.lextkey.value;
           'userload' => 'User Load',  initkeys();
           'catalog'  => 'Course/Community Catalog',  
           'log'      => 'Log in',  if(this.document.server.action.substr(0,5) === 'http:'){
           'help'     => 'Log-in Help',      this.document.server.elements.upass0.value
           'serv'     => 'Server',          =getCrypted(this.document.client.elements.upass$now.value);
           'servadm'  => 'Server Administration',  } else {
           'helpdesk' => 'Contact Helpdesk',      this.document.server.elements.upass0.value
           'forgotpw' => 'Forgot password?',          =this.document.client.elements.upass$now.value;
           'newuser'  => 'New User?',  
        );  this.document.client.elements.uname.value='';
 # -------------------------------------------------- Change password field name  this.document.client.elements.upass$now.value='';
   
 my $forgotpw = &forgotpwdisplay(%lt);  this.document.server.submit();
 $forgotpw .= '<br />' if $forgotpw;  return false;
 my $loginhelp = &loginhelpdisplay($authdomain,%lt);  }
 $loginhelp .= '<br />' if $loginhelp;  
   function enableInput() {
 # ---------------------------------------------------- Serve out DES JavaScript      this.document.client.elements.upass$now.removeAttribute("readOnly");
 {      this.document.client.elements.uname.removeAttribute("readOnly");
 my $jsh=Apache::File->new($include."/londes.js");      this.document.client.elements.udom.removeAttribute("readOnly");
 $r->print(<$jsh>);      return;
 }  }
 # ---------------------------------------------------------- Serve rest of page  
   // ]]>
 $r->print(  </script>
     '<div class="LC_Box"'  
    .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'  ENDSCRIPT
 );  
   # --------------------------------------------------- Print login screen header
 #  
 #  If the loadbalancing yielded just http:// because perhaps there's no loadbalancing?      my %add_entries = (
 #  then just us a relative link to authenticate:         bgcolor      => "$mainbg",
 #         text         => "$font",
          link         => "$link",
 $r->print(<<ENDSERVERFORM);         vlink        => "$vlink",
 <form name="server" action="/adm/authenticate" method="post" target="_top">         alink        => "$alink",
    <input type="hidden" name="logtoken" value="$logtoken" />                 onload       => 'javascript:enableInput();',);
    <input type="hidden" name="serverid" value="$lonhost" />  
    <input type="hidden" name="uname" value="" />      my ($lonhost_in_use,$headextra,$headextra_exempt,@hosts,%defaultdomconf);
    <input type="hidden" name="upass0" value="" />      @hosts = &Apache::lonnet::current_machine_ids();
    <input type="hidden" name="upass1" value="" />      $lonhost_in_use = $lonhost;
    <input type="hidden" name="upass2" value="" />      if (@hosts > 1) {
    <input type="hidden" name="udom" value="" />          foreach my $hostid (@hosts) {
    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />              if (&Apache::lonnet::host_domain($hostid) eq $defdom) {
    <input type="hidden" name="localres" value="$env{'form.localres'}" />                  $lonhost_in_use = $hostid;
   </form>                  last;
 ENDSERVERFORM              }
 my $coursecatalog;          }
 if (($showcoursecat eq '') || ($showcoursecat)) {      }
     $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';      %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
 }      $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};
 my $newuserlink;      $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};
 if ($shownewuserlink) {      if ($headextra) {
     $newuserlink = &newuser_link($lt{'newuser'}).'<br />';          my $omitextra;
 }          if ($headextra_exempt ne '') {
 my $logintitle =              my @exempt = split(',',$headextra_exempt);
     '<h2 class="LC_hcell"'              my $ip = $ENV{'REMOTE_ADDR'};
    .' style="background:'.$loginbox_header_bgcol.';'              if (grep(/^\Q$ip\E$/,@exempt)) {
    .' color:'.$loginbox_header_textcol.'">'                  $omitextra = 1;
    .$lt{'log'}              }
    .'</h2>';          }
           unless ($omitextra) {
 my $noscript_warning='<noscript><span class="LC_warning"><b>'              my $confname = $defdom.'-domainconfig';
                      .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')              if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {
                     .'</b></span></noscript>';                  my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));
 my $helpdeskscript;                  unless ($extra eq '-1') {
 my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,                      $js .= "\n".$extra."\n";
                                    $authdomain,\$helpdeskscript);                  }
               }
 my $loginform=(<<LFORM);          }
 <form name="client" action="" onsubmit="return(send())">      }
   <input type="hidden" name="lextkey" value="$lextkey" />  
   <input type="hidden" name="uextkey" value="$uextkey" />      $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
   <b><label for="uname">$lt{'un'}</label>:</b><br />         { 'redirect'       => [$expire,'/adm/roles'],
   <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" /><br />   'add_entries' => \%add_entries,
   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />   'only_body'   => 1,}));
   <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />  
   <b><label for="udom">$lt{'dom'}</label>:</b><br />  # ----------------------------------------------------------------------- Texts
   <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" /><br />  
   <input type="submit" value="$lt{'log'}" />      my %lt=&Apache::lonlocal::texthash(
 </form>            'un'       => 'Username',
 LFORM            'pw'       => 'Password',
             'dom'      => 'Domain',
     if ($showbanner) {            'perc'     => 'percent',
         $r->print(<<HEADER);            'load'     => 'Server Load',
 <!-- The LON-CAPA Header -->            'userload' => 'User Load',
 <div style="background:$pgbg;margin:0;width:100%;">            'catalog'  => 'Course/Community Catalog',
   <img src="$img" border="0" alt="The Learning Online Network with CAPA" />            'log'      => 'Log in',
 </div>            'help'     => 'Log-in Help',
 HEADER            'serv'     => 'Server',
     }            'servadm'  => 'Server Administration',
     $r->print(<<ENDTOP);            'helpdesk' => 'Contact Helpdesk',
 <div style="float:left;margin-top:0;">            'forgotpw' => 'Forgot password?',
 <div class="LC_Box" style="background:$loginbox_bg;">            'newuser'  => 'New User?',
   $logintitle         );
   $loginform  # -------------------------------------------------- Change password field name
   $noscript_warning  
 </div>      my $forgotpw = &forgotpwdisplay(%lt);
         $forgotpw .= '<br />' if $forgotpw;
 <div class="LC_Box" style="padding-top: 10px;">      my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
   $loginhelp      if ($loginhelp) {
   $forgotpw          $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
   $contactblock      }
   $newuserlink  
   $coursecatalog  # ---------------------------------------------------- Serve out DES JavaScript
 </div>      {
 </div>      my $jsh=Apache::File->new($include."/londes.js");
       $r->print(<$jsh>);
 <div>      }
 ENDTOP  # ---------------------------------------------------------- Serve rest of page
     if ($showmainlogo) {  
         $r->print(' <img src="'.$logo.'" alt="" />'."\n");      $r->print(
     }      '<div class="LC_Box"'
 $r->print(<<ENDTOP);     .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
 $announcements  );
 </div>  
 <hr style="clear:both;" />      $r->print(<<ENDSERVERFORM);
 ENDTOP  <form name="server" action="/adm/authenticate" method="post" target="_top">
     my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);     <input type="hidden" name="logtoken" value="$logtoken" />
     $domainrow = <<"END";     <input type="hidden" name="serverid" value="$lonhost" />
       <tr>     <input type="hidden" name="uname" value="" />
        <td  align="left" valign="top">     <input type="hidden" name="upass0" value="" />
         <small><b>$lt{'dom'}:&nbsp;</b></small>     <input type="hidden" name="udom" value="" />
        </td>     <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
        <td  align="left" valign="top">     <input type="hidden" name="localres" value="$env{'form.localres'}" />
         <small><tt>&nbsp;$domain</tt></small>    </form>
        </td>  ENDSERVERFORM
       </tr>      my $coursecatalog;
 END      if (($showcoursecat eq '') || ($showcoursecat)) {
     $serverrow = <<"END";          $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
       <tr>      }
        <td  align="left" valign="top">      my $newuserlink;
         <small><b>$lt{'serv'}:&nbsp;</b></small>      if ($shownewuserlink) {
        </td>          $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
        <td align="left" valign="top">      }
         <small><tt>&nbsp;$lonhost ($role)</tt></small>      my $logintitle =
        </td>          '<h2 class="LC_hcell"'
       </tr>         .' style="background:'.$loginbox_header_bgcol.';'
 END         .' color:'.$loginbox_header_textcol.'">'
     if ($loadlim) {         .$lt{'log'}
         $loadrow = <<"END";         .'</h2>';
       <tr>  
        <td align="left" valign="top">      my $noscript_warning='<noscript><span class="LC_warning"><b>'
         <small><b>$lt{'load'}:&nbsp;</b></small>                          .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
        </td>                          .'</b></span></noscript>';
        <td align="left" valign="top">      my $helpdeskscript;
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>      my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
        </td>                                         $authdomain,\$helpdeskscript,
       </tr>                                         $showhelpdesk,\@possdoms);
 END  
     }      my $mobileargs;
     if ($uloadlim) {      if ($clientmobile) {
         $userloadrow = <<"END";          $mobileargs = 'autocapitalize="off" autocorrect="off"';
       <tr>      }
        <td align="left" valign="top">      my $loginform=(<<LFORM);
         <small><b>$lt{'userload'}:&nbsp;</b></small>  <form name="client" action="" onsubmit="return(send())">
        </td>    <input type="hidden" name="lextkey" value="$lextkey" />
        <td align="left" valign="top">    <input type="hidden" name="uextkey" value="$uextkey" />
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>    <b><label for="uname">$lt{'un'}</label>:</b><br />
        </td>    <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" $mobileargs /><br />
       </tr>    <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
 END    <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />
     }    <b><label for="udom">$lt{'dom'}</label>:</b><br />
     if (($version ne '') && ($version ne '<!-- VERSION -->')) {    <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />
         $versionrow = <<"END";    <input type="submit" value="$lt{'log'}" />
       <tr>  </form>
        <td colspan="2" align="left">  LFORM
         <small>$version</small>  
        </td>      if ($showbanner) {
       </tr>          $r->print(<<HEADER);
 END  <!-- The LON-CAPA Header -->
     }  <div style="background:$pgbg;margin:0;width:100%;">
     <img src="$img" border="0" alt="The Learning Online Network with CAPA" />
 $r->print(<<ENDDOCUMENT);  </div>
     <div style="float: left;">  HEADER
      <table border="0" cellspacing="0" cellpadding="0">      }
 $domainrow      $r->print(<<ENDTOP);
 $serverrow  <div style="float:left;margin-top:0;">
 $loadrow      <div class="LC_Box" style="background:$loginbox_bg;">
 $userloadrow    $logintitle
 $versionrow    $loginform
      </table>    $noscript_warning
     </div>  </div>
     <div style="float: right;">   
     $domainlogo  <div class="LC_Box" style="padding-top: 10px;">
     </div>    $loginhelp
     <br style="clear:both;" />    $forgotpw
  </div>    $contactblock
     $newuserlink
 <script type="text/javascript">    $coursecatalog
 // <![CDATA[  </div>
 // the if prevents the script error if the browser can not handle this  </div>
 if ( document.client.uname ) { document.client.uname.focus(); }  
 // ]]>  <div>
 </script>  ENDTOP
 $helpdeskscript      if ($showmainlogo) {
           $r->print(' <img src="'.$logo.'" alt="" />'."\n");
 ENDDOCUMENT      }
     my %endargs = ( 'noredirectlink' => 1, );  $r->print(<<ENDTOP);
     $r->print(&Apache::loncommon::end_page(\%endargs));  $announcements
     return OK;  </div>
 }  <hr style="clear:both;" />
   ENDTOP
 sub check_loginvia {      my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
     my ($domain,$lonhost) = @_;      $domainrow = <<"END";
     if ($domain eq '' || $lonhost eq '') {        <tr>
         return;         <td  align="left" valign="top">
     }          <small><b>$lt{'dom'}:&nbsp;</b></small>
     my %domconfhash = &Apache::loncommon::get_domainconf($domain);         </td>
     my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};         <td  align="left" valign="top">
     my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};          <small><tt>&nbsp;$domain</tt></small>
     my $output;         </td>
     if ($loginvia ne '') {        </tr>
         my $noredirect;  END
         my $ip = $ENV{'REMOTE_ADDR'};      $serverrow = <<"END";
         if ($ip eq '127.0.0.1') {        <tr>
             $noredirect = 1;         <td  align="left" valign="top">
         } else {          <small><b>$lt{'serv'}:&nbsp;</b></small>
             if ($loginvia_exempt ne '') {         </td>
                 my @exempt = split(',',$loginvia_exempt);         <td align="left" valign="top">
                 if (grep(/^\Q$ip\E$/,@exempt)) {          <small><tt>&nbsp;$lonhost ($role)</tt></small>
                     $noredirect = 1;         </td>
                 }        </tr>
             }  END
         }      if ($loadlim) {
         unless ($noredirect) {          $loadrow = <<"END";
             my ($newhost,$path);        <tr>
             if ($loginvia =~ /:/) {         <td align="left" valign="top">
                 ($newhost,$path) = split(':',$loginvia);          <small><b>$lt{'load'}:&nbsp;</b></small>
             } else {         </td>
                 $newhost = $loginvia;         <td align="left" valign="top">
             }          <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
             if ($newhost ne $lonhost) {         </td>
                 if (&Apache::lonnet::hostname($newhost) ne '') {        </tr>
                     $output = &redirect_page($newhost,$path);  END
                 }      }
             }      if ($uloadlim) {
         }          $userloadrow = <<"END";
     }        <tr>
     return $output;         <td align="left" valign="top">
 }          <small><b>$lt{'userload'}:&nbsp;</b></small>
          </td>
 sub redirect_page {         <td align="left" valign="top">
     my ($desthost,$path) = @_;          <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
     my $protocol = $Apache::lonnet::protocol{$desthost};         </td>
     $protocol = 'http' if ($protocol ne 'https');        </tr>
     unless ($path =~ m{^/}) {  END
         $path = '/'.$path;      }
     }      if (($version ne '') && ($version ne '<!-- VERSION -->')) {
     my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;          $versionrow = <<"END";
     if ($env{'form.firsturl'} ne '') {        <tr>
         $url .='?firsturl='.$env{'form.firsturl'};         <td colspan="2" align="left">
     }          <small>$version</small>
     my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,         </td>
                                                     {'redirect' => [0,$url],});        </tr>
     my $end_page   = &Apache::loncommon::end_page();  END
     return $start_page.$end_page;      }
 }  
       $r->print(<<ENDDOCUMENT);
 sub contactdisplay {      <div style="float: left;">
     my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript) = @_;       <table border="0" cellspacing="0" cellpadding="0">
     my $contactblock;  $domainrow
     my $showhelpdesk = 0;  $serverrow
     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};  $loadrow    
     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {  $userloadrow
         $showhelpdesk = 1;  $versionrow
     }       </table>
     if ($servadm && $showadminmail) {      </div>
         $contactblock .= $$lt{'servadm'}.':<br />'.      <div style="float: right;">
                          '<tt>'.$servadm.'</tt><br />';      $domainlogo
     }      </div>
     if ($showhelpdesk) {      <br style="clear:both;" />
         $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';   </div>
         my $thisurl = &escape('/adm/login');  
         $$helpdeskscript = <<"ENDSCRIPT";  <script type="text/javascript">
 <script type="text/javascript">  // <![CDATA[
 // <![CDATA[  // the if prevents the script error if the browser can not handle this
 function helpdesk() {  if ( document.client.uname ) { document.client.uname.focus(); }
     var codedom = document.client.udom.value;  // ]]>
     if (codedom == '') {  </script>
         codedom = "$authdomain";  $helpdeskscript
     }  
     var querystr = "origurl=$thisurl&codedom="+codedom;  ENDDOCUMENT
     document.location.href = "/adm/helpdesk?"+querystr;      my %endargs = ( 'noredirectlink' => 1, );
     return;      $r->print(&Apache::loncommon::end_page(\%endargs));
 }      return OK;
 // ]]>  }
 </script>  
 ENDSCRIPT  sub check_loginvia {
     }      my ($domain,$lonhost) = @_;
     return $contactblock;      if ($domain eq '' || $lonhost eq '') {
 }          return;
       }
 sub forgotpwdisplay {      my %domconfhash = &Apache::loncommon::get_domainconf($domain);
     my (%lt) = @_;      my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};
     my $prompt_for_resetpw = 1;       my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};
     if ($prompt_for_resetpw) {      my $output;
         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';      if ($loginvia ne '') {
     }          my $noredirect;
     return;          my $ip = $ENV{'REMOTE_ADDR'};
 }          if ($ip eq '127.0.0.1') {
               $noredirect = 1;
 sub loginhelpdisplay {          } else {
     my ($authdomain,%lt) = @_;              if ($loginvia_exempt ne '') {
     my $login_help = 1;                  my @exempt = split(',',$loginvia_exempt);
     if ($login_help) {                  if (grep(/^\Q$ip\E$/,@exempt)) {
         my $dom = $authdomain;                      $noredirect = 1;
         if ($dom eq '') {                  }
             $dom = &Apache::lonnet::default_login_domain();              }
         }          }
         my %helpconfig = &Apache::lonnet::get_dom('configuration',['helpsettings'],$dom);          unless ($noredirect) {
         my $loginhelp_url = $helpconfig{'helpsettings'}{'loginhelpurl'};              my ($newhost,$path);
         if ($loginhelp_url ne '') {              if ($loginvia =~ /:/) {
             return '<a href="'.$loginhelp_url.'">'.$lt{'help'}.'</a>';                  ($newhost,$path) = split(':',$loginvia);
         } else {              } else {
             return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';                  $newhost = $loginvia;
         }              }
     }              if ($newhost ne $lonhost) {
     return;                  if (&Apache::lonnet::hostname($newhost) ne '') {
 }                      $output = &redirect_page($newhost,$path);
                   }
 sub coursecatalog_link {              }
     my ($linkname) = @_;          }
     return <<"END";      }
       <a href="/adm/coursecatalog">$linkname</a>      return $output;
 END  }
 }  
   sub redirect_page {
 sub newuser_link {      my ($desthost,$path) = @_;
     my ($linkname) = @_;      my $protocol = $Apache::lonnet::protocol{$desthost};
     return '<a href="/adm/createaccount">'.$linkname.'</a>';      $protocol = 'http' if ($protocol ne 'https');
 }      unless ($path =~ m{^/}) {
           $path = '/'.$path;
 1;      }
 __END__      my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;
       if ($env{'form.firsturl'} ne '') {
           $url .='?firsturl='.$env{'form.firsturl'};
       }
       my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
                                                       {'redirect' => [0,$url],});
       my $end_page   = &Apache::loncommon::end_page();
       return $start_page.$end_page;
   }
   
   sub contactdisplay {
       my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript,$showhelpdesk,
           $possdoms) = @_;
       my $contactblock;
       my $origmail;
       if (ref($possdoms) eq 'ARRAY') {
           if (grep(/^\Q$authdomain\E$/,@{$possdoms})) {
               $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
           }
       }
       my $requestmail =
           &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
                                                    $authdomain,$origmail);
       unless ($showhelpdesk eq '0') {
           if ($requestmail =~ m/[^\@]+\@[^\@]+/) {
               $showhelpdesk = 1;
           } else {
               $showhelpdesk = 0;
           }
       }
       if ($servadm && $showadminmail) {
           $contactblock .= $$lt{'servadm'}.':<br />'.
                            '<tt>'.$servadm.'</tt><br />';
       }
       if ($showhelpdesk) {
           $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
           my $thisurl = &escape('/adm/login');
           $$helpdeskscript = <<"ENDSCRIPT";
   <script type="text/javascript">
   // <![CDATA[
   function helpdesk() {
       var possdom = document.client.udom.value;
       var codedom = possdom.replace( new RegExp("[^A-Za-z0-9.\\-]","g"),'');
       if (codedom == '') {
           codedom = "$authdomain";
       }
       var querystr = "origurl=$thisurl&codedom="+codedom;
       document.location.href = "/adm/helpdesk?"+querystr;
       return;
   }
   // ]]>
   </script>
   ENDSCRIPT
       }
       return $contactblock;
   }
   
   sub forgotpwdisplay {
       my (%lt) = @_;
       my $prompt_for_resetpw = 1;
       if ($prompt_for_resetpw) {
           return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
       }
       return;
   }
   
   sub coursecatalog_link {
       my ($linkname) = @_;
       return <<"END";
         <a href="/adm/coursecatalog">$linkname</a>
   END
   }
   
   sub newuser_link {
       my ($linkname) = @_;
       return '<a href="/adm/createaccount">'.$linkname.'</a>';
   }
   
   1;
   __END__

Removed from v.1.147  
changed lines
  Added in v.1.166


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