Diff for /loncom/auth/lonlogin.pm between versions 1.59 and 1.171

version 1.59, 2004/11/02 23:20:17 version 1.171, 2017/09/25 00:36:30
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 CGI::Cookie();  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 lib '/home/httpd/lib/perl/';
 sub handler {  use LONCAPA;
     my $r = shift;  use CGI::Cookie();
     &Apache::loncommon::no_cache($r);   
     &Apache::lonlocal::get_language_handle($r);  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      my $r = shift;
     $r->send_http_header;  
     return OK if $r->header_only;      &Apache::loncommon::get_unprocessed_cgi
    (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
         $ENV{'REDIRECT_QUERY_STRING'}),
 # Are we re-routing?   ['interface','username','domain','firsturl','localpath','localres',
     if (-e '/home/httpd/html/lon-status/reroute.txt') {    'token','role','symb','iptoken']);
  &Apache::lonauth::reroute($r);      if (!defined($env{'form.firsturl'})) {
  return OK;          &Apache::lonacc::get_posted_cgi($r,['firsturl']);
     }      }
   
 # -------------------------------- Prevent users from attempting to login twice  # -- check if they are a migrating user
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));      if (defined($env{'form.token'})) {
     my $lonid=$cookies{'lonID'};   return &Apache::migrateuser::handler($r);
     my $cookie;      }
     if ($lonid) {  
  my $handle=$lonid->value;  # For "public user" - remove any exising "public" cookie, as user really wants to log-in
         $handle=~s/\W//g;      my ($handle,$lonidsdir,$expirepub,$userdom);
         my $lonidsdir=$r->dir_config('lonIDsDir');      unless ($r->header_only) {
         if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {          $handle = &Apache::lonnet::check_for_valid_session($r,'lonID',undef,\$userdom);
 # Indeed, a valid token is found          if ($handle ne '') {
     my $bodytag=&Apache::loncommon::bodytag('Already logged in');              $lonidsdir=$r->dir_config('lonIDsDir');
     $r->print(<<ENDFAILED);              if ($handle=~/^publicuser\_/) {
 <html>                  unlink($r->dir_config('lonIDsDir')."/$handle.id");
 <head>                  undef($handle);
 <title>Already logged in</title>                  undef($userdom);
 </head>                  $expirepub = 1;
 $bodytag              }
 <h1>You are already logged in</h1>          }
 <p>Please either <a href="/adm/roles">continue the current session</a> or      }
 <a href="/adm/logout">logout</a>.</p>  
 <p>      &Apache::loncommon::no_cache($r);
 <a href="/adm/loginproblems.html">Problems?</a></p>      &Apache::lonlocal::get_language_handle($r);
 </body>      &Apache::loncommon::content_type($r,'text/html');
 </html>      if ($expirepub) {
 ENDFAILED          my $c = new CGI::Cookie(-name    => 'lonPubID',
            return OK;                                  -value   => '',
  }                                  -expires => '-10y',);
     }          $r->header_out('Set-cookie' => $c);
       } elsif (($handle eq '') && ($userdom ne '')) {
 # ---------------------------------------------------- No valid token, continue          my $c = new CGI::Cookie(-name    => 'lonID',
                                   -value   => '',
     &Apache::loncommon::get_unprocessed_cgi                                  -expires => '-10y',);
      ($ENV{'QUERY_STRING'}.'&'.$ENV{'request.querystring'},          $r->headers_out->add('Set-cookie' => $c);
       ['interface','username','domain','firsturl','localpath','localres']);      }
        $r->send_http_header;
       return OK if $r->header_only;
 # ----------------------------------------------------------- Process Interface  
     $ENV{'form.interface'}=~s/\W//g;  
   # Are we re-routing?
     my $textbrowsers=$r->dir_config('lonTextBrowsers');      my $londocroot = $r->dir_config('lonDocRoot');
     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};      if (-e "$londocroot/lon-status/reroute.txt") {
        &Apache::lonauth::reroute($r);
     foreach (split(/\:/,$textbrowsers)) {   return OK;
  if ($httpbrowser=~/$_/i) {      }
     $ENV{'form.interface'}='textual';  
         }  #
     }  # If browser sent an old cookie for which the session file had been removed
   # check if configuration for user's domain has a portal URL set.  If so
     my $fullgraph=($ENV{'form.interface'} ne 'textual');  # switch user's log-in to the portal.
     my $port_to_use=$r->dir_config('lonhttpdPort');  #
     if (!defined($port_to_use)) {  
  $port_to_use='8080';      if (($handle eq '') && ($userdom ne '')) {
     }          my %domdefaults = &Apache::lonnet::get_domain_defaults($userdom);
     my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use.          if ($domdefaults{'portal_def'} =~ /^https?\:/) {
                   $r->dir_config('lonIconsURL');              my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
     my $domain  = $r->dir_config('lonDefDomain');                                            {'redirect' => [0,$domdefaults{'portal_def'}],});
     if (($ENV{'form.domain'}) &&               my $end_page   = &Apache::loncommon::end_page();
  ($Apache::lonnet::domaindescription{$ENV{'form.domain'}})) {              $r->print($start_page.$end_page);
  $domain=$ENV{'form.domain'};              return OK;
     }          }
     my $role    = $r->dir_config('lonRole');      }
     my $loadlim = $r->dir_config('lonLoadLim');  
     my $servadm = $r->dir_config('lonAdmEMail');      $env{'form.firsturl'} =~ s/(`)/'/g;
     my $sysadm  = $r->dir_config('lonSysEMail');  
     my $lonhost = $r->dir_config('lonHostID');  # -------------------------------- Prevent users from attempting to login twice
     my $tabdir  = $r->dir_config('lonTabDir');      if ($handle ne '') {
     my $include = $r->dir_config('lonIncludes');          &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
     my $expire  = $r->dir_config('lonExpire');   my $start_page =
     my $version = $r->dir_config('lonVersion');      &Apache::loncommon::start_page('Already logged in');
    my $end_page =
 # --------------------------------------------- Default values for login fields      &Apache::loncommon::end_page();
           my $dest = '/adm/roles';
     my $authusername=($ENV{'form.username'}?$ENV{'form.username'}:'');          if ($env{'form.firsturl'} ne '') {
     my $authdomain=($ENV{'form.domain'}?$ENV{'form.domain'}:$domain);              $dest = $env{'form.firsturl'};
           }
 # ---------------------------------------------------------- Determine own load   $r->print(
     my $loadavg;                    $start_page
     {                   .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
  my $loadfile=Apache::File->new('/proc/loadavg');                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
  $loadavg=<$loadfile>;                    '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
     }                   .$end_page
     $loadavg =~ s/\s.*//g;                   );
     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);          return OK;
     my $userloadpercent=&Apache::lonnet::userload();      }
   
 # ------------------------------------------------------- Do the load balancing  # ---------------------------------------------------- No valid token, continue
     my $otherserver='http://'.$ENV{'SERVER_NAME'};  
     my $firsturl=  # ---------------------------- Not possible to really login to domain "public"
     ($ENV{'request.firsturl'}?$ENV{'request.firsturl'}:$ENV{'form.firsturl'});      if ($env{'form.domain'} eq 'public') {
 # ---------------------------------------- Are we access server and overloaded?   $env{'form.domain'}='';
     if (($role eq 'access') &&   $env{'form.username'}='';
  (($userloadpercent>100.0)||($loadpercent>100.0))) {      }
         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);  
  if ($unloaded) { $otherserver=$unloaded; }  # ------ Is this page requested because /adm/migrateuser detected an IP change?
     }      my %sessiondata;
       if ($env{'form.iptoken'}) {
 # ----------------------------------------------------------- Get announcements          %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});
     my $announcements=&Apache::lonnet::getannounce();          unless ($sessiondata{'sessionserver'}) {
 # -------------------------------------------------------- Set login parameters              my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});
               delete($env{'form.iptoken'});
     my @hexstr=('0','1','2','3','4','5','6','7',          }
                 '8','9','a','b','c','d','e','f');      }
     my $lkey='';  # ----------------------------------------------------------- Process Interface
     for (0..7) {      $env{'form.interface'}=~s/\W//g;
         $lkey.=$hexstr[rand(15)];  
     }      (undef,undef,undef,undef,undef,undef,my $clientmobile) =
           &Apache::loncommon::decode_user_agent();
     my $ukey='';  
     for (0..7) {      my $iconpath=
         $ukey.=$hexstr[rand(15)];   &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
     }  
       my $lonhost = $r->dir_config('lonHostID');
     my $lextkey=hex($lkey);      my $domain = &Apache::lonnet::default_login_domain();
     if ($lextkey>2147483647) { $lextkey-=4294967296; }      my $defdom = $domain;
       if ($lonhost ne '') {
     my $uextkey=hex($ukey);          unless ($sessiondata{'sessionserver'}) {
     if ($uextkey>2147483647) { $uextkey-=4294967296; }              my $redirect = &check_loginvia($domain,$lonhost);
               if ($redirect) {
 # -------------------------------------------------------- Store away log token                  $r->print($redirect);
     my $logtoken=Apache::lonnet::reply(                  return OK;
        'tmpput:'.$ukey.$lkey.'&'.$firsturl,              }
        $lonhost);          }
       }
 # ------------------- If we cannot talk to ourselves, we are in serious trouble  
       if (($sessiondata{'domain'}) &&
     if ($logtoken eq 'con_lost') {          (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
         my $spares='';          $domain=$sessiondata{'domain'};
       } elsif (($env{'form.domain'}) &&
         foreach my $hostid (keys(%Apache::lonnet::spareid)) {   (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
             next if ($hostid eq $lonhost);   $domain=$env{'form.domain'};
             $spares.='<br /><font size="+1"><a href="http://'.      }
                 $Apache::lonnet::hostname{$hostid}.  
                 '/adm/login?domain='.$authdomain.'">'.      my $role    = $r->dir_config('lonRole');
                 $Apache::lonnet::hostname{$hostid}.'</a>'.      my $loadlim = $r->dir_config('lonLoadLim');
                 ' (preferred)</font>'.$/;      my $uloadlim= $r->dir_config('lonUserLoadLim');
         }      my $servadm = $r->dir_config('lonAdmEMail');
         $spares.= '<br />';      my $tabdir  = $r->dir_config('lonTabDir');
         foreach my $hostid (keys(%Apache::lonnet::hostname)) {      my $include = $r->dir_config('lonIncludes');
             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});      my $expire  = $r->dir_config('lonExpire');
             $spares.='<br /><a href="http://'.      my $version = $r->dir_config('lonVersion');
                 $Apache::lonnet::hostname{$hostid}.      my $host_name = &Apache::lonnet::hostname($lonhost);
                 '/adm/login?domain='.$authdomain.'">'.  
                 $Apache::lonnet::hostname{$hostid}.'</a>';  # --------------------------------------------- Default values for login fields
         }     
  $r->print(<<ENDTROUBLE);      my ($authusername,$authdomain);
 <html>      if ($sessiondata{'username'}) {
 <head><title>The LearningOnline Network with CAPA</title></head>          $authusername=$sessiondata{'username'};
 <body bgcolor="#FFFFFF">      } else {
 <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />          $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
 <h3>This LON-CAPA server is temporarily not available for login</h3>          $authusername=($env{'form.username'}?$env{'form.username'}:'');
 <p>Please attempt to login to one of the following servers:</p>$spares      }
 <p>If the problem persists, please contact <tt>$servadm</tt>.</p>      if ($sessiondata{'domain'}) {
 </body>          $authdomain=$sessiondata{'domain'};
 </html>      } else {
 ENDTROUBLE          $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
         return OK;          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
     }      }
   
 # ----------------------------------------------- Apparently we are in business  # ---------------------------------------------------------- Determine own load
       my $loadavg;
     my $domainlogo=&Apache::loncommon::domainlogo($domain);      {
     $servadm=~s/\,/\<br \/\>/g;   my $loadfile=Apache::File->new('/proc/loadavg');
     $sysadm=~s/\,/\<br \/\>/g;   $loadavg=<$loadfile>;
       }
 # --------------------------------------------------- Print login screen header      $loadavg =~ s/\s.*//g;
     $r->print(<<ENDHEADER);  
 <html>      my ($loadpercent,$userloadpercent);
 <head>      if ($loadlim) {
 <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />          $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
 <title>The LearningOnline Network with CAPA Login</title>      }
 </head>      if ($uloadlim) {
 ENDHEADER          $userloadpercent=&Apache::lonnet::userload();
 # ---------------------------------------------------- Serve out DES JavaScript      }
     {  
  my $jsh=Apache::File->new($include."/londes.js");      my $firsturl=
         $r->print(<$jsh>);      ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
     }  
   # ----------------------------------------------------------- Get announcements
 # ----------------------------------------------------------- Front page design      my $announcements=&Apache::lonnet::getannounce();
     my $pgbg=  # -------------------------------------------------------- Set login parameters
       ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');  
     my $font=      my @hexstr=('0','1','2','3','4','5','6','7',
       ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');                  '8','9','a','b','c','d','e','f');
     my $link=      my $lkey='';
       ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');      for (0..7) {
     my $vlink=          $lkey.=$hexstr[rand(15)];
       ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');      }
     my $alink=&Apache::loncommon::designparm('login.alink',$domain);  
     my $mainbg=      my $ukey='';
       ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');      for (0..7) {
     my $sidebg=          $ukey.=$hexstr[rand(15)];
       ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');      }
     my $logo=&Apache::loncommon::designparm('login.logo',$domain);  
     my $img=&Apache::loncommon::designparm('login.img',$domain);      my $lextkey=hex($lkey);
       if ($lextkey>2147483647) { $lextkey-=4294967296; }
 # ----------------------------------------------------------------------- Texts  
       my $uextkey=hex($ukey);
 my %lt=&Apache::lonlocal::texthash(      if ($uextkey>2147483647) { $uextkey-=4294967296; }
   'un'  => 'Username',  
   'pw'  => 'Password',  # -------------------------------------------------------- Store away log token
   'dom' => 'Domain',      my $tokenextras;
   'perc' => 'percent',      if ($env{'form.role'}) {
   'load' => 'Load',          $tokenextras = '&role='.&escape($env{'form.role'});
                   'userload' => 'User Load',      }
                   'about'  => 'aboutlon.gif',      if ($env{'form.symb'}) {
                   'access' => 'accessbutton.gif',          if (!$tokenextras) {
   'auth' => 'userauthentication.gif',              $tokenextras = '&';
   'log' => 'Log in',          }
   'help' => 'Help',          $tokenextras .= '&symb='.&escape($env{'form.symb'});
   'serv' => 'Server',      }
                   'servadm' => 'Server Administration',      if ($env{'form.iptoken'}) {
                   'sysadm' => 'System Administration');          if (!$tokenextras) {
               $tokenextras = '&&';
           }
 # ---------------------------------------------------------- Serve rest of page          $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
     $r->print(<<ENDSCRIPT);      }
       my $logtoken=Apache::lonnet::reply(
 <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
   topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>         $lonhost);
   
  <script language="JavaScript">  # -- If we cannot talk to ourselves, or hostID does not map to a hostname
     function send()  #    we are in serious trouble
     {  
  this.document.server.elements.uname.value      if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
        =this.document.client.elements.uname.value;          if ($logtoken eq 'no_such_host') {
               &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
         this.document.server.elements.udom.value          }
        =this.document.client.elements.udom.value;          my $spares='';
    my $last;
         this.document.server.elements.imagesuppress.value          foreach my $hostid (sort
        =this.document.client.elements.imagesuppress.checked;      {
    &Apache::lonnet::hostname($a) cmp
         this.document.server.elements.embedsuppress.value      &Apache::lonnet::hostname($b);
        =this.document.client.elements.embedsuppress.checked;      }
       keys(%Apache::lonnet::spareid)) {
         this.document.server.elements.appletsuppress.value              next if ($hostid eq $lonhost);
        =this.document.client.elements.appletsuppress.checked;      my $hostname = &Apache::lonnet::hostname($hostid);
       next if (($last eq $hostname) || ($hostname eq ''));
         this.document.server.elements.fontenhance.value              $spares.='<br /><font size="+1"><a href="http://'.
        =this.document.client.elements.fontenhance.checked;                  $hostname.
                   '/adm/login?domain='.$authdomain.'">'.
         this.document.server.elements.blackwhite.value                  $hostname.'</a>'.
        =this.document.client.elements.blackwhite.checked;                  ' '.&mt('(preferred)').'</font>'.$/;
       $last=$hostname;
         this.document.server.elements.remember.value          }
        =this.document.client.elements.remember.checked;          if ($spares) {
               $spares.= '<br />';
         uextkey=this.document.client.elements.uextkey.value;          }
         lextkey=this.document.client.elements.lextkey.value;          my %all_hostnames = &Apache::lonnet::all_hostnames();
         initkeys();          foreach my $hostid (sort
       {
         this.document.server.elements.upass.value   &Apache::lonnet::hostname($a) cmp
     =crypted(this.document.client.elements.upass.value);      &Apache::lonnet::hostname($b);
       }
         this.document.server.submit();      keys(%all_hostnames)) {
  return false;              next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
     }              my $hostname = &Apache::lonnet::hostname($hostid);
  </script>              next if (($last eq $hostname) || ($hostname eq ''));
 ENDSCRIPT              $spares.='<br /><a href="http://'.
                $hostname.
     if ($fullgraph) {               '/adm/login?domain='.$authdomain.'">'.
  $r->print(               $hostname.'</a>';
   '<table width="100%" cellpadding=0 cellspacing=0 border=0>');              $last=$hostname;
     }           }
            $r->print(
     $r->print(<<ENDSERVERFORM);     '<html>'
   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">    .'<head><title>'
    <input type="hidden" name="logtoken" value="$logtoken" />    .&mt('The LearningOnline Network with CAPA')
    <input type="hidden" name="serverid" value="$lonhost" />    .'</title></head>'
    <input type="hidden" name="interface" value="$ENV{'form.interface'}" />    .'<body bgcolor="#FFFFFF">'
    <input type="hidden" name="uname" value="" />    .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
    <input type="hidden" name="upass" value="" />    .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
    <input type="hidden" name="udom" value="" />    .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
    <input type="hidden" name="imagesuppress"  value="" />          if ($spares) {
    <input type="hidden" name="appletsuppress"  value="" />              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
    <input type="hidden" name="embedsuppress"  value="" />                       .'</p>'
    <input type="hidden" name="fontenhance"  value="" />                       .$spares);
    <input type="hidden" name="blackwhite"  value="" />          }
    <input type="hidden" name="remember"  value="" />          $r->print('</body>'
    <input type="hidden" name="localpath" value="$ENV{'form.localpath'}" />                   .'</html>'
    <input type="hidden" name="localres" value="$ENV{'form.localres'}" />          );
   </form>          return OK;
 ENDSERVERFORM      }
     if ($fullgraph) { $r->print(<<ENDTOP);  
   <!-- The LON-CAPA Header -->  # ----------------------------------------------- Apparently we are in business
   <tr>      $servadm=~s/\,/\<br \/\>/g;
   
    <!-- Row 1 Columns 2-4 -->  # ----------------------------------------------------------- Front page design
    <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td>      my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
   </tr>      my $font=&Apache::loncommon::designparm('login.font',$domain);
       my $link=&Apache::loncommon::designparm('login.link',$domain);
   <!-- The gray bar that starts the two table frames -->      my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
   <tr>      my $alink=&Apache::loncommon::designparm('login.alink',$domain);
       my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
    <!-- Row 2 Column 1 -->      my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
    <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
       my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
    <!-- Row 2 Column 2 -->      my $logo=&Apache::loncommon::designparm('login.logo',$domain);
    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>      my $img=&Apache::loncommon::designparm('login.img',$domain);
       my $domainlogo=&Apache::loncommon::domainlogo($domain);
    <!-- Row 2 Column 3 -->      my $showbanner = 1;
    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>      my $showmainlogo = 1;
       if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
    <!-- Row 2 Column 4 -->          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>      }
   </tr>      if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
   <tr>          $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
          }
    <!-- A cell that will hold the 'access' and 'about' buttons -->      my $showadminmail;
    <!-- Row 3 Column 1 -->      my @possdoms = &Apache::lonnet::current_machine_domains();
    <td valign="top" height=60 align="center" bgcolor="$sidebg">      if (grep(/^\Q$domain\E$/,@possdoms)) {
     <a href="/adm/login?interface=textual"><img src="$iconpath/$lt{'access'}" border=0 alt="Accessibility Options" /></a>          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
     <br />      }
     <a href="/adm/about.html"><img src="$iconpath/$lt{'about'}" border=0 alt="About LON-CAPA" /></a>      my $showcoursecat =
    </td>          &Apache::loncommon::designparm('login.coursecatalog',$domain);
       my $shownewuserlink =
    <!-- The shaded space between the two main columns -->          &Apache::loncommon::designparm('login.newuser',$domain);
    <!-- Row 3 Column 2 -->      my $showhelpdesk =
    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>          &Apache::loncommon::designparm('login.helpdesk',$domain);
       my $now=time;
    <!-- The right main column holding the large LON-CAPA logo-->      my $js = (<<ENDSCRIPT);
    <!-- Rows 3-4 Column 3 -->  
    <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">  <script type="text/javascript" language="JavaScript">
     <center>  // <![CDATA[
      <img src="$logo" alt="" />  function send()
     </center>  {
    </td>  this.document.server.elements.uname.value
   =this.document.client.elements.uname.value;
    <!-- Row 3 Column 4 -->  
    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>  this.document.server.elements.udom.value
   </tr>  =this.document.client.elements.udom.value;
   <tr>  
   uextkey=this.document.client.elements.uextkey.value;
    <!-- The entry form -->  lextkey=this.document.client.elements.lextkey.value;
    <!-- Row 4 Column 1 -->  initkeys();
    <td align="center" valign="middle" bgcolor="$sidebg">  
 ENDTOP  if(this.document.server.action.substr(0,5) === 'http:'){
 } else {      this.document.server.elements.upass0.value
     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);          =getCrypted(this.document.client.elements.upass$now.value);
 }  } else {
     $r->print('<form name="client" onsubmit="return(send())">');      this.document.server.elements.upass0.value
     unless ($fullgraph) {          =this.document.client.elements.upass$now.value;
         $r->print(<<ENDACCESSOPTIONS);  }
 <h3>Select Accessibility Options</h3>  
 <input type="checkbox" name="imagesuppress" /> Suppress rendering of images<br />  this.document.client.elements.uname.value='';
 <input type="checkbox" name="appletsuppress" /> Suppress Java applets<br />  this.document.client.elements.upass$now.value='';
 <input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia<br />  
 <input type="checkbox" name="fontenhance" /> Increase font size<br />  this.document.server.submit();
 <input type="checkbox" name="blackwhite" /> Switch to black and white mode<br />  return false;
 <p>If you have accessibility needs that are not addressed by this interface,   }
 please  
 contact the system administrator at <tt>$sysadm</tt>.</p><br />  function enableInput() {
 <input type="checkbox" name="remember" /> Remember these settings for next login<hr />      this.document.client.elements.upass$now.removeAttribute("readOnly");
 ENDACCESSOPTIONS      this.document.client.elements.uname.removeAttribute("readOnly");
 } else {      this.document.client.elements.udom.removeAttribute("readOnly");
     $r->print(<<ENDNOOPT);      return;
 <input type="hidden" name="imagesuppress"  value="" />  }
 <input type="hidden" name="embedsuppress"  value="" />  
 <input type="hidden" name="appletsuppress"  value="" />  // ]]>
 <input type="hidden" name="fontenhance"  value="" />  </script>
 <input type="hidden" name="blackwhite"  value="" />  
 <input type="hidden" name="remember"  value="" />  ENDSCRIPT
 ENDNOOPT  
 }  # --------------------------------------------------- Print login screen header
     $r->print(<<ENDLOGIN);  
      <input type="hidden" name="lextkey" value="$lextkey">      my %add_entries = (
      <input type="hidden" name="uextkey" value="$uextkey">         bgcolor      => "$mainbg",
          text         => "$font",
      <!-- Start the sub-table for text and input alignment -->         link         => "$link",
      <table border=0 cellspacing=0 cellpadding=0>         vlink        => "$vlink",
       <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>         alink        => "$alink",
       <tr>                 onload       => 'javascript:enableInput();',);
        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'un'}:</b></font></td>  
        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>      my ($lonhost_in_use,$headextra,$headextra_exempt,@hosts,%defaultdomconf);
       </tr>      @hosts = &Apache::lonnet::current_machine_ids();
       <tr>      $lonhost_in_use = $lonhost;
        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'pw'}:</b></font></td>      if (@hosts > 1) {
        <td bgcolor="$mainbg"><input type="password" name="upass" size="10" /></td>          foreach my $hostid (@hosts) {
       </tr>              if (&Apache::lonnet::host_domain($hostid) eq $defdom) {
       <tr>                  $lonhost_in_use = $hostid;
        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:</b></font></td>                  last;
        <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>              }
       </tr>          }
       <tr>      }
        <td bgcolor="$mainbg">&nbsp;&nbsp;&nbsp;<a href="/adm/loginproblems.html">$lt{'help'}</a></td>      %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
        <td bgcolor="$mainbg" valign="bottom" align="center">      $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};
         <br />      $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};
         <input type="submit" value="$lt{'log'}" />      if ($headextra) {
        </td>          my $omitextra;
       </tr>          if ($headextra_exempt ne '') {
      </table>              my @exempt = split(',',$headextra_exempt);
      <!-- End sub-table -->              my $ip = $ENV{'REMOTE_ADDR'};
     </form>              if (grep(/^\Q$ip\E$/,@exempt)) {
 ENDLOGIN                  $omitextra = 1;
     if ($fullgraph) {              }
  $r->print(<<ENDDOCUMENT);          }
    </td>          unless ($omitextra) {
               my $confname = $defdom.'-domainconfig';
    <!-- Row 4 Column 2 -->              if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {
    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>                  my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));
                   unless ($extra eq '-1') {
    <!-- Row 4 Column 3 -->                      $js .= "\n".$extra."\n";
 <td bgcolor="$mainbg">$announcements</td>                  }
               }
    <!-- Row 4 Column 4 -->          }
    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>      }
   </tr>  
   <tr>      $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
          { 'redirect'       => [$expire,'/adm/roles'],
    <!-- Row 5 Column 1 -->   'add_entries' => \%add_entries,
    <td bgcolor="$sidebg" valign="middle" align="left">   'only_body'   => 1,}));
      <br />  
      <table border=0 cellspacing=0 cellpadding=0>  # ----------------------------------------------------------------------- Texts
       <tr>  
        <td bgcolor="$sidebg" align="left" valign="top">      my %lt=&Apache::lonlocal::texthash(
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>            'un'       => 'Username',
        </td>            'pw'       => 'Password',
        <td bgcolor="$sidebg" align="left" valign="top">            'dom'      => 'Domain',
         <small><tt>&nbsp;$domain</tt></small>            'perc'     => 'percent',
        </td>            'load'     => 'Server Load',
       </tr>            'userload' => 'User Load',
       <tr>            'catalog'  => 'Course/Community Catalog',
        <td bgcolor="$sidebg" align="left" valign="top">            'log'      => 'Log in',
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>            'help'     => 'Log-in Help',
        </td>            'serv'     => 'Server',
        <td bgcolor="$sidebg" align="left" valign="top">            'servadm'  => 'Server Administration',
         <small><tt>&nbsp;$lonhost ($role)</tt></small>            'helpdesk' => 'Contact Helpdesk',
        </td>            'forgotpw' => 'Forgot password?',
       </tr>            'newuser'  => 'New User?',
       <tr>         );
        <td bgcolor="$sidebg" align="left" valign="top">  # -------------------------------------------------- Change password field name
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>  
        </td>      my $forgotpw = &forgotpwdisplay(%lt);
        <td bgcolor="$sidebg" align="left" valign="top">      $forgotpw .= '<br />' if $forgotpw;
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>      my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
        </td>      if ($loginhelp) {
       </tr>          $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
       <tr>      }
        <td bgcolor="$sidebg" align="left" valign="top">  
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>  # ---------------------------------------------------- Serve out DES JavaScript
        </td>      {
        <td bgcolor="$sidebg" align="left" valign="top">      my $jsh=Apache::File->new($include."/londes.js");
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>      $r->print(<$jsh>);
        </td>      }
       </tr>  # ---------------------------------------------------------- Serve rest of page
      </table>  
      <br />      $r->print(
     <small>      '<div class="LC_Box"'
      <b>&nbsp;&nbsp;&nbsp;$lt{'sysadm'}:</b><br />     .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
      <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sysadm</tt><br />  );
      <b>&nbsp;&nbsp;&nbsp;$lt{'servadm'}:</b><br />  
      <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$servadm</tt><br />&nbsp;<br />      $r->print(<<ENDSERVERFORM);
      &nbsp;&nbsp;&nbsp;$version  <form name="server" action="/adm/authenticate" method="post" target="_top">
     </small>     <input type="hidden" name="logtoken" value="$logtoken" />
    </td>     <input type="hidden" name="serverid" value="$lonhost" />
      <input type="hidden" name="uname" value="" />
    <!-- Row 5 Column 2 -->     <input type="hidden" name="upass0" value="" />
    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>     <input type="hidden" name="udom" value="" />
      <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
    <!-- Row 5 Column 3 -->     <input type="hidden" name="localres" value="$env{'form.localres'}" />
    <td width="100%" valign="bottom" bgcolor="$mainbg">    </form>
 $domainlogo  ENDSERVERFORM
 </td>      my $coursecatalog;
       if (($showcoursecat eq '') || ($showcoursecat)) {
    <!-- Row 5 Column 4 -->          $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>      }
   </tr>      my $newuserlink;
   <tr>      if ($shownewuserlink) {
           $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
    <!-- Row 6 Column 1 -->      }
    <td bgcolor="$sidebg">&nbsp;</td>      my $logintitle =
           '<h2 class="LC_hcell"'
    <!-- Row 6 Column 2 -->         .' style="background:'.$loginbox_header_bgcol.';'
    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>         .' color:'.$loginbox_header_textcol.'">'
          .$lt{'log'}
    <!-- Row 6 Column 3 -->         .'</h2>';
    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>  
       my $noscript_warning='<noscript><span class="LC_warning"><b>'
    <!-- Row 6 Column 4 -->                          .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>                          .'</b></span></noscript>';
   </tr>      my $helpdeskscript;
  </table>      my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                                          $authdomain,\$helpdeskscript,
 <script type="text/javascript">                                         $showhelpdesk,\@possdoms);
 // the if prevents the script error if the browser can not handle this  
 if ( document.client.uname ) { document.client.uname.focus(); }      my $mobileargs;
 </script>      if ($clientmobile) {
           $mobileargs = 'autocapitalize="off" autocorrect="off"';
 ENDDOCUMENT      }
 }      my $loginform=(<<LFORM);
     $r->print('</body></html>');  <form name="client" action="" onsubmit="return(send())">
     return OK;    <input type="hidden" name="lextkey" value="$lextkey" />
 }     <input type="hidden" name="uextkey" value="$uextkey" />
     <b><label for="uname">$lt{'un'}</label>:</b><br />
 1;    <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" $mobileargs /><br />
 __END__    <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 />
     <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />
     <input type="submit" value="$lt{'log'}" />
   </form>
   LFORM
   
       if ($showbanner) {
           $r->print(<<HEADER);
   <!-- The LON-CAPA Header -->
   <div style="background:$pgbg;margin:0;width:100%;">
     <img src="$img" border="0" alt="The Learning Online Network with CAPA" class="LC_maxwidth" />
   </div>
   HEADER
       }
       $r->print(<<ENDTOP);
   <div style="float:left;margin-top:0;">
   <div class="LC_Box" style="background:$loginbox_bg;">
     $logintitle
     $loginform
     $noscript_warning
   </div>
    
   <div class="LC_Box" style="padding-top: 10px;">
     $loginhelp
     $forgotpw
     $contactblock
     $newuserlink
     $coursecatalog
   </div>
   </div>
   
   <div>
   ENDTOP
       if ($showmainlogo) {
           $r->print(' <img src="'.$logo.'" alt="" class="LC_maxwidth" />'."\n");
       }
   $r->print(<<ENDTOP);
   $announcements
   </div>
   <hr style="clear:both;" />
   ENDTOP
       my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
       $domainrow = <<"END";
         <tr>
          <td  align="left" valign="top">
           <small><b>$lt{'dom'}:&nbsp;</b></small>
          </td>
          <td  align="left" valign="top">
           <small><tt>&nbsp;$domain</tt></small>
          </td>
         </tr>
   END
       $serverrow = <<"END";
         <tr>
          <td  align="left" valign="top">
           <small><b>$lt{'serv'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$lonhost ($role)</tt></small>
          </td>
         </tr>
   END
       if ($loadlim) {
           $loadrow = <<"END";
         <tr>
          <td align="left" valign="top">
           <small><b>$lt{'load'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
          </td>
         </tr>
   END
       }
       if ($uloadlim) {
           $userloadrow = <<"END";
         <tr>
          <td align="left" valign="top">
           <small><b>$lt{'userload'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
          </td>
         </tr>
   END
       }
       if (($version ne '') && ($version ne '<!-- VERSION -->')) {
           $versionrow = <<"END";
         <tr>
          <td colspan="2" align="left">
           <small>$version</small>
          </td>
         </tr>
   END
       }
   
       $r->print(<<ENDDOCUMENT);
       <div style="float: left;">
        <table border="0" cellspacing="0" cellpadding="0">
   $domainrow
   $serverrow
   $loadrow    
   $userloadrow
   $versionrow
        </table>
       </div>
       <div style="float: right;">
       $domainlogo
       </div>
       <br style="clear:both;" />
    </div>
   
   <script type="text/javascript">
   // <![CDATA[
   // the if prevents the script error if the browser can not handle this
   if ( document.client.uname ) { document.client.uname.focus(); }
   // ]]>
   </script>
   $helpdeskscript
   
   ENDDOCUMENT
       my %endargs = ( 'noredirectlink' => 1, );
       $r->print(&Apache::loncommon::end_page(\%endargs));
       return OK;
   }
   
   sub check_loginvia {
       my ($domain,$lonhost) = @_;
       if ($domain eq '' || $lonhost eq '') {
           return;
       }
       my %domconfhash = &Apache::loncommon::get_domainconf($domain);
       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.59  
changed lines
  Added in v.1.171


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