File:  [LON-CAPA] / loncom / auth / lonlogin.pm
Revision 1.89: download - view: text, annotated - select for diffs
Thu Mar 8 01:58:48 2007 UTC (17 years, 2 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- eliminating the domain hash globals in favor of functional access

    1: # The LearningOnline Network
    2: # Login Screen
    3: #
    4: # $Id: lonlogin.pm,v 1.89 2007/03/08 01:58:48 albertel Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: 
   29: package Apache::lonlogin;
   30: 
   31: use strict;
   32: use Apache::Constants qw(:common);
   33: use CGI::Cookie();
   34: use Apache::File ();
   35: use Apache::lonnet;
   36: use Apache::loncommon();
   37: use Apache::lonauth();
   38: use Apache::lonlocal;
   39: use Apache::migrateuser();
   40: use lib '/home/httpd/lib/perl/';
   41: use LONCAPA;
   42:  
   43: sub handler {
   44:     my $r = shift;
   45: 
   46:     &Apache::loncommon::get_unprocessed_cgi
   47: 	(join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
   48: 	      $ENV{'REDIRECT_QUERY_STRING'}),
   49: 	 ['interface','username','domain','firsturl','localpath','localres',
   50: 	  'token']);
   51: 
   52: # -- check if they are a migrating user
   53:     if (defined($env{'form.token'})) {
   54: 	return &Apache::migrateuser::handler($r);
   55:     }
   56: 
   57:     &Apache::loncommon::no_cache($r);
   58:     &Apache::lonlocal::get_language_handle($r);
   59:     &Apache::loncommon::content_type($r,'text/html');
   60:     $r->send_http_header;
   61:     return OK if $r->header_only;
   62: 
   63: 
   64: # Are we re-routing?
   65:     if (-e '/home/httpd/html/lon-status/reroute.txt') {
   66: 	&Apache::lonauth::reroute($r);
   67: 	return OK;
   68:     }
   69: 
   70: 
   71: # -------------------------------- Prevent users from attempting to login twice
   72:     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
   73:     my $lonid=$cookies{'lonID'};
   74:     my $cookie;
   75:     if ($lonid) {
   76: 	my $handle=&LONCAPA::clean_handle($lonid->value);
   77:         my $lonidsdir=$r->dir_config('lonIDsDir');
   78: 	if (-e "$lonidsdir/$handle.id") {
   79: # Is there an existing token file?
   80: 	    if ($handle=~/^publicuser\_/) {
   81: # For "public user" - remove it, we apparently really want to login
   82: 		unlink("$lonidsdir/$handle.id");
   83: 	    } elsif ($handle ne '') {
   84: # Indeed, a valid token is found
   85: 		my $start_page = 
   86: 		    &Apache::loncommon::start_page('Already logged in');
   87: 		my $end_page = 
   88: 		    &Apache::loncommon::end_page();
   89: 		$r->print(<<ENDFAILED);
   90: $start_page
   91: <h1>You are already logged in</h1>
   92: <p>Please either <a href="/adm/roles">continue the current session</a> or
   93: <a href="/adm/logout">logout</a>.</p>
   94: <p>
   95: <a href="/adm/loginproblems.html">Problems?</a></p>
   96: $end_page
   97: ENDFAILED
   98:                 return OK;
   99:  	    }  
  100: 	}
  101:     }
  102: 
  103: # ---------------------------------------------------- No valid token, continue
  104: 
  105:  # ---------------------------- Not possible to really login to domain "public"
  106:     if ($env{'form.domain'} eq 'public') {
  107: 	$env{'form.domain'}='';
  108: 	$env{'form.username'}='';
  109:     }
  110: # ----------------------------------------------------------- Process Interface
  111:     $env{'form.interface'}=~s/\W//g;
  112: 
  113:     my $textbrowsers=$r->dir_config('lonTextBrowsers');
  114:     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
  115:     
  116:     foreach (split(/\:/,$textbrowsers)) {
  117: 	if ($httpbrowser=~/$_/i) {
  118: 	    $env{'form.interface'}='textual';
  119:         }
  120:     }
  121: 
  122:     my $fullgraph=($env{'form.interface'} ne 'textual');
  123:     my $port_to_use=$r->dir_config('lonhttpdPort');
  124:     if (!defined($port_to_use)) {
  125: 	$port_to_use='8080';
  126:     }
  127:     my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use.
  128:                   $r->dir_config('lonIconsURL');
  129:     my $domain = &Apache::lonnet::default_login_domain();
  130:     if (($env{'form.domain'}) && 
  131: 	(&Apache::lonnet::domain($env{'form.domain'},'description'))) {
  132: 	$domain=$env{'form.domain'};
  133:     }
  134:     my $role    = $r->dir_config('lonRole');
  135:     my $loadlim = $r->dir_config('lonLoadLim');
  136:     my $lonhost = $r->dir_config('lonHostID');
  137:     my $tabdir  = $r->dir_config('lonTabDir');
  138:     my $include = $r->dir_config('lonIncludes');
  139:     my $expire  = $r->dir_config('lonExpire');
  140:     my $version = $r->dir_config('lonVersion');
  141:     my $host_name = &Apache::lonnet::hostname($lonhost);
  142: 
  143: # --------------------------------------------- Default values for login fields
  144: 
  145:     my $authusername=($env{'form.username'}?$env{'form.username'}:'');
  146:     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
  147: 
  148: # ---------------------------------------------------------- Determine own load
  149:     my $loadavg;
  150:     {
  151: 	my $loadfile=Apache::File->new('/proc/loadavg');
  152: 	$loadavg=<$loadfile>;
  153:     }
  154:     $loadavg =~ s/\s.*//g;
  155:     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
  156:     my $userloadpercent=&Apache::lonnet::userload();
  157: 
  158: # ------------------------------------------------------- Do the load balancing
  159:     my $otherserver= &Apache::lonnet::absolute_url($host_name);
  160:     my $firsturl=
  161:     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
  162: # ---------------------------------------- Are we access server and overloaded?
  163:     if (($role eq 'access') &&
  164: 	(($userloadpercent>100.0)||($loadpercent>100.0))) {
  165:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
  166: 	if ($unloaded) { $otherserver=$unloaded; }
  167:     }
  168: 
  169: # ----------------------------------------------------------- Get announcements
  170:     my $announcements=&Apache::lonnet::getannounce();
  171: # -------------------------------------------------------- Set login parameters
  172: 
  173:     my @hexstr=('0','1','2','3','4','5','6','7',
  174:                 '8','9','a','b','c','d','e','f');
  175:     my $lkey='';
  176:     for (0..7) {
  177:         $lkey.=$hexstr[rand(15)];
  178:     }
  179: 
  180:     my $ukey='';
  181:     for (0..7) {
  182:         $ukey.=$hexstr[rand(15)];
  183:     }
  184: 
  185:     my $lextkey=hex($lkey);
  186:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
  187: 
  188:     my $uextkey=hex($ukey);
  189:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
  190: 
  191: # -------------------------------------------------------- Store away log token
  192:     my $logtoken=Apache::lonnet::reply(
  193:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
  194:        $lonhost);
  195: 
  196: # ------------------- If we cannot talk to ourselves, we are in serious trouble
  197: 
  198:     if ($logtoken eq 'con_lost') {
  199:         my $spares='';
  200: 	my $last;
  201:         foreach my $hostid (sort
  202: 			    {
  203: 				&Apache::lonnet::hostname($a) cmp
  204: 				    &Apache::lonnet::hostname($b);
  205: 			    }
  206: 			    keys(%Apache::lonnet::spareid)) {
  207:             next if ($hostid eq $lonhost);
  208: 	    my $hostname = &Apache::lonnet::hostname($hostid);
  209: 	    next if ($last eq $hostname);
  210:             $spares.='<br /><font size="+1"><a href="http://'.
  211:                 $hostname.
  212:                 '/adm/login?domain='.$authdomain.'">'.
  213:                 $hostname.'</a>'.
  214:                 ' (preferred)</font>'.$/;
  215: 	    $last=$hostname;
  216:         }
  217:         $spares.= '<br />';
  218: 	my %all_hostnames = &Apache::lonnet::all_hostnames();
  219:         foreach my $hostid (sort
  220: 			    {
  221: 				&Apache::lonnet::hostname($a) cmp
  222: 				    &Apache::lonnet::hostname($b);
  223: 			    }
  224: 			    keys(%all_hostnames)) {
  225:             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
  226: 	    my $hostname = &Apache::lonnet::hostname($hostid);
  227:             next if ($last eq $hostname);
  228:             $spares.='<br /><a href="http://'.
  229:                 $hostname.
  230:                 '/adm/login?domain='.$authdomain.'">'.
  231:                 $hostname.'</a>';
  232: 	    $last=$hostname;
  233:         }
  234: 	$r->print(<<ENDTROUBLE);
  235: <html>
  236: <head><title>The LearningOnline Network with CAPA</title></head>
  237: <body bgcolor="#FFFFFF">
  238: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
  239: <h3>This LON-CAPA server is temporarily not available for login</h3>
  240: <p>Please attempt to login to one of the following servers:</p>$spares
  241: </body>
  242: </html>
  243: ENDTROUBLE
  244:         return OK;
  245:     }
  246: 
  247: # ----------------------------------------------- Apparently we are in business
  248: 
  249:     my $domainlogo=&Apache::loncommon::domainlogo($domain);
  250: 
  251: # --------------------------------------------------- Print login screen header
  252:     $r->print(<<ENDHEADER);
  253: <html>
  254: <head>
  255: <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />
  256: <title>The LearningOnline Network with CAPA Login</title>
  257: </head>
  258: ENDHEADER
  259: # ---------------------------------------------------- Serve out DES JavaScript
  260:     {
  261: 	my $jsh=Apache::File->new($include."/londes.js");
  262:         $r->print(<$jsh>);
  263:     }
  264: 
  265: # ----------------------------------------------------------- Front page design
  266:     my $pgbg=
  267:       ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
  268:     my $font=
  269:       ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
  270:     my $link=
  271:       ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
  272:     my $vlink=
  273:       ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
  274:     my $alink=&Apache::loncommon::designparm('login.alink',$domain);
  275:     my $mainbg=
  276:       ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
  277:     my $sidebg=
  278:       ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
  279:     my $logo=&Apache::loncommon::designparm('login.logo',$domain);
  280:     my $img=&Apache::loncommon::designparm('login.img',$domain);
  281: 
  282: # ----------------------------------------------------------------------- Texts
  283: 
  284: my %lt=&Apache::lonlocal::texthash(
  285: 		  'un'  => 'Username',
  286: 		  'pw'  => 'Password',
  287: 		  'dom' => 'Domain',
  288: 		  'perc' => 'percent',
  289: 		  'load' => 'Load',
  290:                   'userload' => 'User Load',
  291:                   'about'  => 'About LON-CAPA',
  292:                   'access' => 'Accessibility Options',
  293:                   'catalog' => 'Course Catalog',
  294: 		  'auth' => 'userauthentication.gif',
  295: 		  'log' => 'Log in',
  296: 		  'help' => 'Log-in Help',
  297: 		  'serv' => 'Server',
  298:                   'helpdesk' => 'Contact Helpdesk',
  299:                   'forgotpw' => 'Forgot password?');
  300: # -------------------------------------------------- Change password field name
  301:     my $now=time;
  302:     my $forgotpw = &forgotpwdisplay(%lt);
  303:     my $loginhelp = &loginhelpdisplay(%lt);
  304: # ---------------------------------------------------------- Serve rest of page
  305:     $r->print(<<ENDSCRIPT);
  306: 
  307: <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"
  308:   topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
  309: 
  310:  <script language="JavaScript">
  311:     function send()
  312:     {
  313: 	this.document.server.elements.uname.value
  314:        =this.document.client.elements.uname.value;
  315: 
  316:         this.document.server.elements.udom.value
  317:        =this.document.client.elements.udom.value;
  318: 
  319:         this.document.server.elements.imagesuppress.value
  320:        =this.document.client.elements.imagesuppress.checked;
  321: 
  322:         this.document.server.elements.embedsuppress.value
  323:        =this.document.client.elements.embedsuppress.checked;
  324: 
  325:         this.document.server.elements.appletsuppress.value
  326:        =this.document.client.elements.appletsuppress.checked;
  327: 
  328:         this.document.server.elements.fontenhance.value
  329:        =this.document.client.elements.fontenhance.checked;
  330: 
  331:         this.document.server.elements.blackwhite.value
  332:        =this.document.client.elements.blackwhite.checked;
  333: 
  334:         this.document.server.elements.remember.value
  335:        =this.document.client.elements.remember.checked;
  336: 
  337:         uextkey=this.document.client.elements.uextkey.value;
  338:         lextkey=this.document.client.elements.lextkey.value;
  339:         initkeys();
  340: 
  341:         this.document.server.elements.upass0.value
  342: 	    =crypted(this.document.client.elements.upass$now.value.substr(0,15));
  343: 	this.document.server.elements.upass1.value
  344: 	    =crypted(this.document.client.elements.upass$now.value.substr(15,15));
  345: 	this.document.server.elements.upass2.value
  346: 	    =crypted(this.document.client.elements.upass$now.value.substr(30,15));
  347: 
  348:         this.document.client.elements.uname.value='';
  349:         this.document.client.elements.upass$now.value='';
  350: 
  351:         this.document.server.submit();
  352: 	return false;
  353:     }
  354:  </script>
  355: ENDSCRIPT
  356: 
  357:     if ($fullgraph) {
  358: 	$r->print(
  359: 		  '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
  360:     }
  361: 
  362:     $r->print(<<ENDSERVERFORM);
  363:   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
  364:    <input type="hidden" name="logtoken" value="$logtoken" />
  365:    <input type="hidden" name="serverid" value="$lonhost" />
  366:    <input type="hidden" name="interface" value="$env{'form.interface'}" />
  367:    <input type="hidden" name="uname" value="" />
  368:    <input type="hidden" name="upass0" value="" />
  369:    <input type="hidden" name="upass1" value="" />
  370:    <input type="hidden" name="upass2" value="" />
  371:    <input type="hidden" name="udom" value="" />
  372:    <input type="hidden" name="imagesuppress"  value="" />
  373:    <input type="hidden" name="appletsuppress"  value="" />
  374:    <input type="hidden" name="embedsuppress"  value="" />
  375:    <input type="hidden" name="fontenhance"  value="" />
  376:    <input type="hidden" name="blackwhite"  value="" />
  377:    <input type="hidden" name="remember"  value="" />
  378:    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
  379:    <input type="hidden" name="localres" value="$env{'form.localres'}" />
  380:   </form>
  381: ENDSERVERFORM
  382:     if ($fullgraph) { $r->print(<<ENDTOP);
  383:   <!-- The LON-CAPA Header -->
  384:   <tr>
  385: 
  386:    <!-- Row 1 Columns 2-4 -->
  387:    <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>
  388:   </tr>
  389: 
  390:   <!-- The gray bar that starts the two table frames -->
  391:   <tr>
  392: 
  393:    <!-- Row 2 Column 1 -->
  394:    <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>
  395: 
  396:    <!-- Row 2 Column 2 -->
  397:    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
  398: 
  399:    <!-- Row 2 Column 3 -->
  400:    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
  401: 
  402:    <!-- Row 2 Column 4 -->
  403:    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
  404:   </tr>
  405:   <tr>
  406:    
  407:    <!-- A cell that will hold the 'access', 'about', and 'catalog' links -->
  408:    <!-- Row 3 Column 1 -->
  409:    <td valign="top" height="60" align="left" bgcolor="$sidebg">
  410:     <table cellpadding="0" cellspacing="2" border="0">
  411:      <tr>
  412:       <td>&nbsp;</td>
  413:       <td><a href="/adm/login?interface=textual"><b>$lt{'access'}</b></a></td>
  414:      </tr>
  415:      <tr>
  416:       <td>&nbsp;</td>
  417:       <td><a href="/adm/about.html"><b>$lt{'about'}</b></a></td>
  418:      </tr>
  419:      <tr>
  420:       <td>&nbsp;</td>
  421:       <td><a href="/adm/coursecatalog"><b>$lt{'catalog'}</b></a></td>
  422:      </tr>
  423:      <tr>
  424:       <td colspan="2">&nbsp;</td>
  425:      </tr>
  426:     </table>
  427:    </td>
  428:    <!-- The shaded space between the two main columns -->
  429:    <!-- Row 3 Column 2 -->
  430:    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  431: 
  432:    <!-- The right main column holding the large LON-CAPA logo-->
  433:    <!-- Rows 3-4 Column 3 -->
  434:    <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
  435:     <center>
  436:      <img src="$logo" alt="" />
  437:     </center>
  438:    </td>
  439: 
  440:    <!-- Row 3 Column 4 -->
  441:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  442:   </tr>
  443:   <tr>
  444: 
  445:    <!-- The entry form -->
  446:    <!-- Row 4 Column 1 -->
  447:    <td align="center" valign="middle" bgcolor="$sidebg">
  448: ENDTOP
  449: } else {
  450:     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);
  451: }
  452:     $r->print('<form name="client" onsubmit="return(send())">');
  453:     unless ($fullgraph) {
  454:         $r->print(<<ENDACCESSOPTIONS);
  455: <h3>Select Accessibility Options</h3>
  456: <label><input type="checkbox" name="imagesuppress" /> Suppress rendering of images</label><br />
  457: <label><input type="checkbox" name="appletsuppress" /> Suppress Java applets</label><br />
  458: <label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br />
  459: <label><input type="checkbox" name="fontenhance" /> Increase font size</label><br />
  460: <label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><br />
  461: <input type="checkbox" name="remember" /> Remember these settings for next login<hr />
  462: ENDACCESSOPTIONS
  463: } else {
  464:     $r->print(<<ENDNOOPT);
  465: <input type="hidden" name="imagesuppress"  value="" />
  466: <input type="hidden" name="embedsuppress"  value="" />
  467: <input type="hidden" name="appletsuppress"  value="" />
  468: <input type="hidden" name="fontenhance"  value="" />
  469: <input type="hidden" name="blackwhite"  value="" />
  470: <input type="hidden" name="remember"  value="" />
  471: ENDNOOPT
  472: }
  473:     $r->print(<<ENDLOGIN);
  474:      <input type="hidden" name="lextkey" value="$lextkey">
  475:      <input type="hidden" name="uextkey" value="$uextkey">
  476: 
  477:      <!-- Start the sub-table for text and input alignment -->
  478:      <table border=0 cellspacing=0 cellpadding=0>
  479:       <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>
  480:       <tr>
  481:        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'un'}:</b></font></td>
  482:        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
  483:       </tr>
  484:       <tr>
  485:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'pw'}:</b></font></td>
  486:        <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
  487:       </tr>
  488:       <tr>
  489:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:</b></font></td>
  490:        <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
  491:       </tr>
  492:       <tr>
  493:        <td bgcolor="$mainbg">&nbsp;</td>
  494:        <td bgcolor="$mainbg" valign="bottom" align="center">
  495:         <br />
  496:         <input type="submit" value="$lt{'log'}" />
  497:        </td>
  498:       </tr>
  499:       <tr>
  500:        <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
  501:         $loginhelp
  502:         $forgotpw
  503:        </td>
  504:       </tr>
  505:      </table>
  506:      <!-- End sub-table -->
  507:     </form>
  508: ENDLOGIN
  509:     if ($fullgraph) {
  510:         my $helpdeskscript;
  511:         my $contactblock = &contactdisplay(\%lt,$version,$authdomain,\$helpdeskscript);
  512: 	$r->print(<<ENDDOCUMENT);
  513:    </td>
  514: 
  515:    <!-- Row 4 Column 2 -->
  516:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  517: 
  518:    <!-- Row 4 Column 3 -->
  519: <td bgcolor="$mainbg">$announcements</td>
  520: 
  521:    <!-- Row 4 Column 4 -->
  522:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  523:   </tr>
  524:   <tr>
  525: 
  526:    <!-- Row 5 Column 1 -->
  527:    <td bgcolor="$sidebg" valign="middle" align="left">
  528:      <br />
  529:      <table border=0 cellspacing=0 cellpadding=0>
  530:       <tr>
  531:        <td bgcolor="$sidebg" align="left" valign="top">
  532:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
  533:        </td>
  534:        <td bgcolor="$sidebg" align="left" valign="top">
  535:         <small><tt>&nbsp;$domain</tt></small>
  536:        </td>
  537:       </tr>
  538:       <tr>
  539:        <td bgcolor="$sidebg" align="left" valign="top">
  540:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
  541:        </td>
  542:        <td bgcolor="$sidebg" align="left" valign="top">
  543:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
  544:        </td>
  545:       </tr>
  546:       <tr>
  547:        <td bgcolor="$sidebg" align="left" valign="top">
  548:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
  549:        </td>
  550:        <td bgcolor="$sidebg" align="left" valign="top">
  551:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
  552:        </td>
  553:       </tr>
  554:       <tr>
  555:        <td bgcolor="$sidebg" align="left" valign="top">
  556:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
  557:        </td>
  558:        <td bgcolor="$sidebg" align="left" valign="top">
  559:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
  560:        </td>
  561:       </tr>
  562:      </table>
  563:      <br />
  564:     $contactblock
  565:    </td>
  566: 
  567:    <!-- Row 5 Column 2 -->
  568:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  569: 
  570:    <!-- Row 5 Column 3 -->
  571:    <td width="100%" valign="bottom" bgcolor="$mainbg">
  572: $domainlogo
  573: </td>
  574: 
  575:    <!-- Row 5 Column 4 -->
  576:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  577:   </tr>
  578:   <tr>
  579: 
  580:    <!-- Row 6 Column 1 -->
  581:    <td bgcolor="$sidebg">&nbsp;</td>
  582: 
  583:    <!-- Row 6 Column 2 -->
  584:    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
  585: 
  586:    <!-- Row 6 Column 3 -->
  587:    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
  588: 
  589:    <!-- Row 6 Column 4 -->
  590:    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
  591:   </tr>
  592:  </table>
  593: 
  594: <script type="text/javascript">
  595: // the if prevents the script error if the browser can not handle this
  596: if ( document.client.uname ) { document.client.uname.focus(); }
  597: </script>
  598: $helpdeskscript
  599: 
  600: ENDDOCUMENT
  601: }
  602:     $r->print('</body></html>');
  603:     return OK;
  604: }
  605: 
  606: sub contactdisplay {
  607:     my ($lt,$version,$authdomain,$helpdeskscript) = @_;
  608:     my $contactblock;
  609:     my $showhelpdesk = 0;
  610:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
  611:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
  612:         $showhelpdesk = 1;
  613:     }
  614:     if ($showhelpdesk) {
  615:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;<a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
  616:         my $thisurl = &escape('/adm/login');
  617:         $$helpdeskscript = <<"ENDSCRIPT";
  618: <script type="text/javascript">
  619: function helpdesk() {
  620:     var codedom = document.client.udom.value;
  621:     if (codedom == '') {
  622:         codedom = "$authdomain";
  623:     }
  624:     var querystr = "origurl=$thisurl&codedom="+codedom;
  625:     document.location.href = "/adm/helpdesk?"+querystr;
  626:     return;
  627: }
  628: </script>
  629: ENDSCRIPT
  630:     }
  631:     $contactblock .= <<"ENDBLOCK";
  632:      &nbsp;&nbsp;&nbsp;$version
  633: ENDBLOCK
  634:     return $contactblock;
  635: }
  636: 
  637: sub forgotpwdisplay {
  638:     my (%lt) = @_;
  639:     my $prompt_for_resetpw = 1; 
  640:     if ($prompt_for_resetpw) {
  641:         return '<br />&nbsp;&nbsp;&nbsp;<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br /><br />';
  642:     }
  643:     return;
  644: }
  645: 
  646: sub loginhelpdisplay {
  647:     my (%lt) = @_;
  648:     my $login_help = 1;
  649:     if ($login_help) {
  650:         return '&nbsp;&nbsp;&nbsp;<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a></b>';
  651:     }
  652:     return;
  653: }
  654: 
  655: 1;
  656: __END__

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