Diff for /loncom/auth/lonlogin.pm between versions 1.146 and 1.170

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


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