File:  [LON-CAPA] / loncom / auth / lonlogin.pm
Revision 1.62.2.1: download - view: text, annotated - select for diffs
Mon Feb 21 18:29:25 2005 UTC (19 years, 3 months ago) by albertel
Branches: version_1_3_2_nsdl
Diff to branchpoint 1.62: preferred, unified
- nsdl version

    1: # The LearningOnline Network
    2: # Login Screen
    3: #
    4: # $Id: lonlogin.pm,v 1.62.2.1 2005/02/21 18:29:25 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: 
   40: sub handler {
   41:     my $r = shift;
   42:     &Apache::loncommon::no_cache($r);
   43:     &Apache::lonlocal::get_language_handle($r);
   44:     &Apache::loncommon::content_type($r,'text/html');
   45:     $r->send_http_header;
   46:     return OK if $r->header_only;
   47: 
   48: 
   49: # Are we re-routing?
   50:     if (-e '/home/httpd/html/lon-status/reroute.txt') {
   51: 	&Apache::lonauth::reroute($r);
   52: 	return OK;
   53:     }
   54: 
   55: # -------------------------------- Prevent users from attempting to login twice
   56:     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
   57:     my $lonid=$cookies{'lonID'};
   58:     my $cookie;
   59:     if ($lonid) {
   60: 	my $handle=$lonid->value;
   61:         $handle=~s/\W//g;
   62:         my $lonidsdir=$r->dir_config('lonIDsDir');
   63:         if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
   64: # Indeed, a valid token is found
   65: 	    my $bodytag=&Apache::loncommon::bodytag('Already logged in');
   66: 	    $r->print(<<ENDFAILED);
   67: <html>
   68: <head>
   69: <title>Already logged in</title>
   70: </head>
   71: $bodytag
   72: <h1>You are already logged in</h1>
   73: <p>Please either <a href="/adm/roles">continue the current session</a> or
   74: <a href="/adm/logout">logout</a>.</p>
   75: <p>
   76: <a href="/adm/loginproblems.html">Problems?</a></p>
   77: </body>
   78: </html>
   79: ENDFAILED
   80:            return OK;
   81: 	}
   82:     }
   83: 
   84: # ---------------------------------------------------- No valid token, continue
   85: 
   86:     &Apache::loncommon::get_unprocessed_cgi
   87:      ($ENV{'QUERY_STRING'}.'&'.$ENV{'request.querystring'},
   88:       ['interface','username','domain','firsturl','localpath','localres']);
   89:  
   90: 
   91: # ----------------------------------------------------------- Process Interface
   92:     $ENV{'form.interface'}=~s/\W//g;
   93: 
   94:     my $textbrowsers=$r->dir_config('lonTextBrowsers');
   95:     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
   96:     
   97:     foreach (split(/\:/,$textbrowsers)) {
   98: 	if ($httpbrowser=~/$_/i) {
   99: 	    $ENV{'form.interface'}='textual';
  100:         }
  101:     }
  102: 
  103:     my $fullgraph=($ENV{'form.interface'} ne 'textual');
  104:     my $port_to_use=$r->dir_config('lonhttpdPort');
  105:     if (!defined($port_to_use)) {
  106: 	$port_to_use='8080';
  107:     }
  108:     my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use.
  109:                   $r->dir_config('lonIconsURL');
  110:     my $domain  = $r->dir_config('lonDefDomain');
  111:     if (($ENV{'form.domain'}) && 
  112: 	 ($Apache::lonnet::domaindescription{$ENV{'form.domain'}})) {
  113: 	$domain=$ENV{'form.domain'};
  114:     }
  115:     my $role    = $r->dir_config('lonRole');
  116:     my $loadlim = $r->dir_config('lonLoadLim');
  117:     my $servadm = $r->dir_config('lonAdmEMail');
  118:     my $sysadm  = $r->dir_config('lonSysEMail');
  119:     my $lonhost = $r->dir_config('lonHostID');
  120:     my $tabdir  = $r->dir_config('lonTabDir');
  121:     my $include = $r->dir_config('lonIncludes');
  122:     my $expire  = $r->dir_config('lonExpire');
  123:     my $version = $r->dir_config('lonVersion');
  124: 
  125: # --------------------------------------------- Default values for login fields
  126: 
  127:     my $authusername=($ENV{'form.username'}?$ENV{'form.username'}:'');
  128:     my $authdomain=($ENV{'form.domain'}?$ENV{'form.domain'}:$domain);
  129: 
  130: # ---------------------------------------------------------- Determine own load
  131:     my $loadavg;
  132:     {
  133: 	my $loadfile=Apache::File->new('/proc/loadavg');
  134: 	$loadavg=<$loadfile>;
  135:     }
  136:     $loadavg =~ s/\s.*//g;
  137:     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
  138:     my $userloadpercent=&Apache::lonnet::userload();
  139: 
  140: # ------------------------------------------------------- Do the load balancing
  141:     my $otherserver='http://'.$ENV{'SERVER_NAME'};
  142:     my $firsturl=
  143:     ($ENV{'request.firsturl'}?$ENV{'request.firsturl'}:$ENV{'form.firsturl'});
  144:     my $escfirsturl=&Apache::lonnet::escape($firsturl);
  145: # ---------------------------------------- Are we access server and overloaded?
  146:     if (($role eq 'access') &&
  147: 	(($userloadpercent>100.0)||($loadpercent>100.0))) {
  148:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
  149: 	if ($unloaded) { $otherserver=$unloaded; }
  150:     }
  151: 
  152: # ----------------------------------------------------------- Get announcements
  153:     my $announcements=&Apache::lonnet::getannounce();
  154: # -------------------------------------------------------- Set login parameters
  155: 
  156:     my @hexstr=('0','1','2','3','4','5','6','7',
  157:                 '8','9','a','b','c','d','e','f');
  158:     my $lkey='';
  159:     for (0..7) {
  160:         $lkey.=$hexstr[rand(15)];
  161:     }
  162: 
  163:     my $ukey='';
  164:     for (0..7) {
  165:         $ukey.=$hexstr[rand(15)];
  166:     }
  167: 
  168:     my $lextkey=hex($lkey);
  169:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
  170: 
  171:     my $uextkey=hex($ukey);
  172:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
  173: 
  174: # -------------------------------------------------------- Store away log token
  175:     my $logtoken=Apache::lonnet::reply(
  176:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
  177:        $lonhost);
  178: 
  179: # ------------------- If we cannot talk to ourselves, we are in serious trouble
  180: 
  181:     if ($logtoken eq 'con_lost') {
  182:         my $spares='';
  183: 
  184:         foreach my $hostid (keys(%Apache::lonnet::spareid)) {
  185:             next if ($hostid eq $lonhost);
  186:             $spares.='<br /><font size="+1"><a href="http://'.
  187:                 $Apache::lonnet::hostname{$hostid}.
  188:                 '/adm/login?domain='.$authdomain.'">'.
  189:                 $Apache::lonnet::hostname{$hostid}.'</a>'.
  190:                 ' (preferred)</font>'.$/;
  191:         }
  192:         $spares.= '<br />';
  193:         foreach my $hostid (keys(%Apache::lonnet::hostname)) {
  194:             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
  195:             $spares.='<br /><a href="http://'.
  196:                 $Apache::lonnet::hostname{$hostid}.
  197:                 '/adm/login?domain='.$authdomain.'">'.
  198:                 $Apache::lonnet::hostname{$hostid}.'</a>';
  199:         }
  200: 	$r->print(<<ENDTROUBLE);
  201: <html>
  202: <head><title>The LearningOnline Network with CAPA</title></head>
  203: <body bgcolor="#FFFFFF">
  204: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
  205: <h3>This LON-CAPA server is temporarily not available for login</h3>
  206: <p>Please attempt to login to one of the following servers:</p>$spares
  207: <p>If the problem persists, please contact <tt>$servadm</tt>.</p>
  208: </body>
  209: </html>
  210: ENDTROUBLE
  211:         return OK;
  212:     }
  213: 
  214: # ----------------------------------------------- Apparently we are in business
  215: 
  216:     my $domainlogo=&Apache::loncommon::domainlogo($domain);
  217:     $servadm=~s/\,/\<br \/\>/g;
  218:     $sysadm=~s/\,/\<br \/\>/g;
  219: 
  220: # --------------------------------------------------- Print login screen header
  221:     $r->print(<<ENDHEADER);
  222: <html>
  223: <head>
  224: <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />
  225: <title>The LearningOnline Network with CAPA Login</title>
  226: </head>
  227: ENDHEADER
  228: # ---------------------------------------------------- Serve out DES JavaScript
  229:     {
  230: 	my $jsh=Apache::File->new($include."/londes.js");
  231:         $r->print(<$jsh>);
  232:     }
  233: 
  234: # ----------------------------------------------------------- Front page design
  235:     my $pgbg=
  236:       ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
  237:     my $font=
  238:       ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
  239:     my $link=
  240:       ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
  241:     my $vlink=
  242:       ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
  243:     my $alink=&Apache::loncommon::designparm('login.alink',$domain);
  244:     my $mainbg=
  245:       ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
  246:     my $sidebg=
  247:       ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
  248:     my $logo=&Apache::loncommon::designparm('login.logo',$domain);
  249:     my $img=&Apache::loncommon::designparm('login.img',$domain);
  250: 
  251: # ----------------------------------------------------------------------- Texts
  252: 
  253: my %lt=&Apache::lonlocal::texthash(
  254: 		  'un'  => 'Username',
  255: 		  'pw'  => 'Password',
  256: 		  'dom' => 'Domain',
  257: 		  'perc' => 'percent',
  258: 		  'load' => 'Load',
  259:                   'userload' => 'User Load',
  260:                   'about'  => 'aboutlon.gif',
  261:                   'access' => 'accessbutton.gif',
  262: 		  'auth' => 'userauthentication.gif',
  263: 		  'log' => 'Log in',
  264: 		  'help' => 'Help',
  265: 		  'serv' => 'Server',
  266:                   'servadm' => 'Server Administration',
  267:                   'sysadm' => 'System Administration',
  268:                   'helpdesk' => 'Contact Helpdesk');
  269: 
  270: # ---------------------------------------------------------- Serve rest of page
  271:     $r->print(<<ENDSCRIPT);
  272: 
  273: <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"
  274:   topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
  275: 
  276:  <script language="JavaScript">
  277:     function send()
  278:     {
  279: 	this.document.server.elements.uname.value
  280:        =this.document.client.elements.uname.value;
  281: 
  282:         this.document.server.elements.udom.value
  283:        =this.document.client.elements.udom.value;
  284: 
  285:         this.document.server.elements.imagesuppress.value
  286:        =this.document.client.elements.imagesuppress.checked;
  287: 
  288:         this.document.server.elements.embedsuppress.value
  289:        =this.document.client.elements.embedsuppress.checked;
  290: 
  291:         this.document.server.elements.appletsuppress.value
  292:        =this.document.client.elements.appletsuppress.checked;
  293: 
  294:         this.document.server.elements.fontenhance.value
  295:        =this.document.client.elements.fontenhance.checked;
  296: 
  297:         this.document.server.elements.blackwhite.value
  298:        =this.document.client.elements.blackwhite.checked;
  299: 
  300:         this.document.server.elements.remember.value
  301:        =this.document.client.elements.remember.checked;
  302: 
  303:         uextkey=this.document.client.elements.uextkey.value;
  304:         lextkey=this.document.client.elements.lextkey.value;
  305:         initkeys();
  306: 
  307:         this.document.server.elements.upass.value
  308: 	    =crypted(this.document.client.elements.upass.value);
  309: 
  310:         this.document.server.submit();
  311: 	return false;
  312:     }
  313:  </script>
  314: ENDSCRIPT
  315: 
  316:     if ($fullgraph) {
  317: 	$r->print(
  318: 		  '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
  319:     }
  320: 
  321:     $r->print(<<ENDSERVERFORM);
  322:   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
  323:    <input type="hidden" name="logtoken" value="$logtoken" />
  324:    <input type="hidden" name="serverid" value="$lonhost" />
  325:    <input type="hidden" name="interface" value="$ENV{'form.interface'}" />
  326:    <input type="hidden" name="uname" value="" />
  327:    <input type="hidden" name="upass" value="" />
  328:    <input type="hidden" name="udom" value="" />
  329:    <input type="hidden" name="imagesuppress"  value="" />
  330:    <input type="hidden" name="appletsuppress"  value="" />
  331:    <input type="hidden" name="embedsuppress"  value="" />
  332:    <input type="hidden" name="fontenhance"  value="" />
  333:    <input type="hidden" name="blackwhite"  value="" />
  334:    <input type="hidden" name="remember"  value="" />
  335:    <input type="hidden" name="localpath" value="$ENV{'form.localpath'}" />
  336:    <input type="hidden" name="localres" value="$ENV{'form.localres'}" />
  337:   </form>
  338: ENDSERVERFORM
  339:     if ($fullgraph) { $r->print(<<ENDTOP);
  340:   <!-- The LON-CAPA Header -->
  341:   <tr>
  342: 
  343:    <!-- Row 1 Columns 2-4 -->
  344:    <td width="100%" colspan=4 bgcolor="$sidebg"><h1><font color="$pgbg">Welcome to the LON-CAPA NSDL Gateway</font></h1><a href="/cgi-bin/signon.pl?$escfirsturl"><h3><font color="$pgbg">Sign up for a Guest Login</font></h3></a></td>
  345:   </tr>
  346: 
  347:   <!-- The gray bar that starts the two table frames -->
  348:   <tr>
  349: 
  350:    <!-- Row 2 Column 1 -->
  351:    <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>
  352: 
  353:    <!-- Row 2 Column 2 -->
  354:    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
  355: 
  356:    <!-- Row 2 Column 3 -->
  357:    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
  358: 
  359:    <!-- Row 2 Column 4 -->
  360:    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
  361:   </tr>
  362:   <tr>
  363:    
  364:    <!-- A cell that will hold the 'access' and 'about' buttons -->
  365:    <!-- Row 3 Column 1 -->
  366:    <td valign="top" height=60 align="center" bgcolor="$sidebg">
  367:     <a href="/adm/login?interface=textual"><img src="$iconpath/$lt{'access'}" border=0 alt="Accessibility Options" /></a>
  368:     <br />
  369:     <a href="/adm/about.html"><img src="$iconpath/$lt{'about'}" border=0 alt="About LON-CAPA" /></a>
  370:    </td>
  371: 
  372:    <!-- The shaded space between the two main columns -->
  373:    <!-- Row 3 Column 2 -->
  374:    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  375: 
  376:    <!-- The right main column holding the large LON-CAPA logo-->
  377:    <!-- Rows 3-4 Column 3 -->
  378:    <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
  379:     <center>
  380:      <img src="$logo" alt="" />
  381:     </center>
  382:    </td>
  383: 
  384:    <!-- Row 3 Column 4 -->
  385:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  386:   </tr>
  387:   <tr>
  388: 
  389:    <!-- The entry form -->
  390:    <!-- Row 4 Column 1 -->
  391:    <td align="center" valign="middle" bgcolor="$sidebg">
  392: ENDTOP
  393: } else {
  394:     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);
  395: }
  396:     $r->print('<form name="client" onsubmit="return(send())">');
  397:     unless ($fullgraph) {
  398:         $r->print(<<ENDACCESSOPTIONS);
  399: <h3>Select Accessibility Options</h3>
  400: <input type="checkbox" name="imagesuppress" /> Suppress rendering of images<br />
  401: <input type="checkbox" name="appletsuppress" /> Suppress Java applets<br />
  402: <input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia<br />
  403: <input type="checkbox" name="fontenhance" /> Increase font size<br />
  404: <input type="checkbox" name="blackwhite" /> Switch to black and white mode<br />
  405: <p>If you have accessibility needs that are not addressed by this interface, 
  406: please
  407: contact the system administrator at <tt>$sysadm</tt>.</p><br />
  408: <input type="checkbox" name="remember" /> Remember these settings for next login<hr />
  409: ENDACCESSOPTIONS
  410: } else {
  411:     $r->print(<<ENDNOOPT);
  412: <input type="hidden" name="imagesuppress"  value="" />
  413: <input type="hidden" name="embedsuppress"  value="" />
  414: <input type="hidden" name="appletsuppress"  value="" />
  415: <input type="hidden" name="fontenhance"  value="" />
  416: <input type="hidden" name="blackwhite"  value="" />
  417: <input type="hidden" name="remember"  value="" />
  418: ENDNOOPT
  419: }
  420:     $r->print(<<ENDLOGIN);
  421:      <input type="hidden" name="lextkey" value="$lextkey">
  422:      <input type="hidden" name="uextkey" value="$uextkey">
  423: 
  424:      <!-- Start the sub-table for text and input alignment -->
  425:      <table border=0 cellspacing=0 cellpadding=0>
  426:       <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>
  427:       <tr>
  428:        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'un'}:</b></font></td>
  429:        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
  430:       </tr>
  431:       <tr>
  432:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'pw'}:</b></font></td>
  433:        <td bgcolor="$mainbg"><input type="password" name="upass" size="10" /></td>
  434:       </tr>
  435:       <tr>
  436:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:</b></font></td>
  437:        <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
  438:       </tr>
  439:       <tr>
  440:        <td bgcolor="$mainbg">&nbsp;&nbsp;&nbsp;<a href="/adm/loginproblems.html">$lt{'help'}</a></td>
  441:        <td bgcolor="$mainbg" valign="bottom" align="center">
  442:         <br />
  443:         <input type="submit" value="$lt{'log'}" />
  444:        </td>
  445:       </tr>
  446:      </table>
  447:      <!-- End sub-table -->
  448:     </form>
  449: ENDLOGIN
  450:     if ($fullgraph) {
  451:         my $helpdeskscript;
  452:         my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version,$authdomain,\$helpdeskscript);
  453: 	$r->print(<<ENDDOCUMENT);
  454:    </td>
  455: 
  456:    <!-- Row 4 Column 2 -->
  457:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  458: 
  459:    <!-- Row 4 Column 3 -->
  460: <td bgcolor="$mainbg">$announcements</td>
  461: 
  462:    <!-- Row 4 Column 4 -->
  463:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  464:   </tr>
  465:   <tr>
  466: 
  467:    <!-- Row 5 Column 1 -->
  468:    <td bgcolor="$sidebg" valign="middle" align="left">
  469:      <br />
  470:      <table border=0 cellspacing=0 cellpadding=0>
  471:       <tr>
  472:        <td bgcolor="$sidebg" align="left" valign="top">
  473:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
  474:        </td>
  475:        <td bgcolor="$sidebg" align="left" valign="top">
  476:         <small><tt>&nbsp;$domain</tt></small>
  477:        </td>
  478:       </tr>
  479:       <tr>
  480:        <td bgcolor="$sidebg" align="left" valign="top">
  481:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
  482:        </td>
  483:        <td bgcolor="$sidebg" align="left" valign="top">
  484:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
  485:        </td>
  486:       </tr>
  487:       <tr>
  488:        <td bgcolor="$sidebg" align="left" valign="top">
  489:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
  490:        </td>
  491:        <td bgcolor="$sidebg" align="left" valign="top">
  492:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
  493:        </td>
  494:       </tr>
  495:       <tr>
  496:        <td bgcolor="$sidebg" align="left" valign="top">
  497:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
  498:        </td>
  499:        <td bgcolor="$sidebg" align="left" valign="top">
  500:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
  501:        </td>
  502:       </tr>
  503:      </table>
  504:      <br />
  505:     $contactblock
  506:    </td>
  507: 
  508:    <!-- Row 5 Column 2 -->
  509:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  510: 
  511:    <!-- Row 5 Column 3 -->
  512:    <td width="100%" valign="bottom" bgcolor="$mainbg">
  513: $domainlogo
  514: </td>
  515: 
  516:    <!-- Row 5 Column 4 -->
  517:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  518:   </tr>
  519:   <tr>
  520: 
  521:    <!-- Row 6 Column 1 -->
  522:    <td bgcolor="$sidebg">&nbsp;</td>
  523: 
  524:    <!-- Row 6 Column 2 -->
  525:    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
  526: 
  527:    <!-- Row 6 Column 3 -->
  528:    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
  529: 
  530:    <!-- Row 6 Column 4 -->
  531:    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
  532:   </tr>
  533:  </table>
  534: 
  535: <script type="text/javascript">
  536: // the if prevents the script error if the browser can not handle this
  537: if ( document.client.uname ) { document.client.uname.focus(); }
  538: </script>
  539: $helpdeskscript
  540: 
  541: ENDDOCUMENT
  542: }
  543:     $r->print('</body></html>');
  544:     return OK;
  545: }
  546: 
  547: sub contactdisplay {
  548:     my ($lt,$sysadm,$servadm,$version,$authdomain,$helpdeskscript) = @_;
  549:     my $contactblock;
  550:     my $showsysadm = 1;
  551:     my $showservadm = 1;
  552:     my $showhelpdesk = 0;
  553:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
  554:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
  555:         $showhelpdesk = 1;
  556:     }
  557:     if ($showsysadm) {
  558:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'sysadm'}.':</b><br />'.
  559:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$sysadm.'</tt><br />';
  560:     }
  561:     if ($showservadm) {
  562:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.
  563:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';
  564:     }
  565:     if ($showhelpdesk) {
  566:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;<a href="javascript:helpdesk()">'.$$lt{'helpdesk'}.'</a></b><br />';
  567:         my $thisurl = &Apache::lonnet::escape('/adm/login');
  568:         $$helpdeskscript = <<"ENDSCRIPT";
  569: <script type="text/javascript">
  570: function helpdesk() {
  571:     var codedom = document.client.udom.value;
  572:     if (codedom == '') {
  573:         codedom = "$authdomain";
  574:     }
  575:     var querystr = "origurl=$thisurl&codedom="+codedom;
  576:     document.location.href = "/adm/helpdesk?"+querystr;
  577:     return;
  578: }
  579: </script>
  580: ENDSCRIPT
  581:     }
  582:     $contactblock .= <<"ENDBLOCK";
  583:      &nbsp;&nbsp;&nbsp;$version
  584: ENDBLOCK
  585:     return $contactblock;
  586: }
  587:  
  588: 
  589: 1;
  590: __END__

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