File:  [LON-CAPA] / loncom / auth / lonlogin.pm
Revision 1.63: download - view: text, annotated - select for diffs
Thu Apr 7 06:56:21 2005 UTC (19 years, 1 month ago) by albertel
Branches: MAIN
CVS tags: version_1_99_0_tmcc, HEAD
- ENV -> env

    1: # The LearningOnline Network
    2: # Login Screen
    3: #
    4: # $Id: lonlogin.pm,v 1.63 2005/04/07 06:56:21 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: # ---------------------------------------- Are we access server and overloaded?
  145:     if (($role eq 'access') &&
  146: 	(($userloadpercent>100.0)||($loadpercent>100.0))) {
  147:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
  148: 	if ($unloaded) { $otherserver=$unloaded; }
  149:     }
  150: 
  151: # ----------------------------------------------------------- Get announcements
  152:     my $announcements=&Apache::lonnet::getannounce();
  153: # -------------------------------------------------------- Set login parameters
  154: 
  155:     my @hexstr=('0','1','2','3','4','5','6','7',
  156:                 '8','9','a','b','c','d','e','f');
  157:     my $lkey='';
  158:     for (0..7) {
  159:         $lkey.=$hexstr[rand(15)];
  160:     }
  161: 
  162:     my $ukey='';
  163:     for (0..7) {
  164:         $ukey.=$hexstr[rand(15)];
  165:     }
  166: 
  167:     my $lextkey=hex($lkey);
  168:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
  169: 
  170:     my $uextkey=hex($ukey);
  171:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
  172: 
  173: # -------------------------------------------------------- Store away log token
  174:     my $logtoken=Apache::lonnet::reply(
  175:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
  176:        $lonhost);
  177: 
  178: # ------------------- If we cannot talk to ourselves, we are in serious trouble
  179: 
  180:     if ($logtoken eq 'con_lost') {
  181:         my $spares='';
  182: 
  183:         foreach my $hostid (keys(%Apache::lonnet::spareid)) {
  184:             next if ($hostid eq $lonhost);
  185:             $spares.='<br /><font size="+1"><a href="http://'.
  186:                 $Apache::lonnet::hostname{$hostid}.
  187:                 '/adm/login?domain='.$authdomain.'">'.
  188:                 $Apache::lonnet::hostname{$hostid}.'</a>'.
  189:                 ' (preferred)</font>'.$/;
  190:         }
  191:         $spares.= '<br />';
  192:         foreach my $hostid (keys(%Apache::lonnet::hostname)) {
  193:             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
  194:             $spares.='<br /><a href="http://'.
  195:                 $Apache::lonnet::hostname{$hostid}.
  196:                 '/adm/login?domain='.$authdomain.'">'.
  197:                 $Apache::lonnet::hostname{$hostid}.'</a>';
  198:         }
  199: 	$r->print(<<ENDTROUBLE);
  200: <html>
  201: <head><title>The LearningOnline Network with CAPA</title></head>
  202: <body bgcolor="#FFFFFF">
  203: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
  204: <h3>This LON-CAPA server is temporarily not available for login</h3>
  205: <p>Please attempt to login to one of the following servers:</p>$spares
  206: <p>If the problem persists, please contact <tt>$servadm</tt>.</p>
  207: </body>
  208: </html>
  209: ENDTROUBLE
  210:         return OK;
  211:     }
  212: 
  213: # ----------------------------------------------- Apparently we are in business
  214: 
  215:     my $domainlogo=&Apache::loncommon::domainlogo($domain);
  216:     $servadm=~s/\,/\<br \/\>/g;
  217:     $sysadm=~s/\,/\<br \/\>/g;
  218: 
  219: # --------------------------------------------------- Print login screen header
  220:     $r->print(<<ENDHEADER);
  221: <html>
  222: <head>
  223: <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />
  224: <title>The LearningOnline Network with CAPA Login</title>
  225: </head>
  226: ENDHEADER
  227: # ---------------------------------------------------- Serve out DES JavaScript
  228:     {
  229: 	my $jsh=Apache::File->new($include."/londes.js");
  230:         $r->print(<$jsh>);
  231:     }
  232: 
  233: # ----------------------------------------------------------- Front page design
  234:     my $pgbg=
  235:       ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
  236:     my $font=
  237:       ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
  238:     my $link=
  239:       ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
  240:     my $vlink=
  241:       ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
  242:     my $alink=&Apache::loncommon::designparm('login.alink',$domain);
  243:     my $mainbg=
  244:       ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
  245:     my $sidebg=
  246:       ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
  247:     my $logo=&Apache::loncommon::designparm('login.logo',$domain);
  248:     my $img=&Apache::loncommon::designparm('login.img',$domain);
  249: 
  250: # ----------------------------------------------------------------------- Texts
  251: 
  252: my %lt=&Apache::lonlocal::texthash(
  253: 		  'un'  => 'Username',
  254: 		  'pw'  => 'Password',
  255: 		  'dom' => 'Domain',
  256: 		  'perc' => 'percent',
  257: 		  'load' => 'Load',
  258:                   'userload' => 'User Load',
  259:                   'about'  => 'aboutlon.gif',
  260:                   'access' => 'accessbutton.gif',
  261: 		  'auth' => 'userauthentication.gif',
  262: 		  'log' => 'Log in',
  263: 		  'help' => 'Help',
  264: 		  'serv' => 'Server',
  265:                   'servadm' => 'Server Administration',
  266:                   'sysadm' => 'System Administration',
  267:                   'helpdesk' => 'Contact Helpdesk');
  268: 
  269: # ---------------------------------------------------------- Serve rest of page
  270:     $r->print(<<ENDSCRIPT);
  271: 
  272: <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"
  273:   topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
  274: 
  275:  <script language="JavaScript">
  276:     function send()
  277:     {
  278: 	this.document.server.elements.uname.value
  279:        =this.document.client.elements.uname.value;
  280: 
  281:         this.document.server.elements.udom.value
  282:        =this.document.client.elements.udom.value;
  283: 
  284:         this.document.server.elements.imagesuppress.value
  285:        =this.document.client.elements.imagesuppress.checked;
  286: 
  287:         this.document.server.elements.embedsuppress.value
  288:        =this.document.client.elements.embedsuppress.checked;
  289: 
  290:         this.document.server.elements.appletsuppress.value
  291:        =this.document.client.elements.appletsuppress.checked;
  292: 
  293:         this.document.server.elements.fontenhance.value
  294:        =this.document.client.elements.fontenhance.checked;
  295: 
  296:         this.document.server.elements.blackwhite.value
  297:        =this.document.client.elements.blackwhite.checked;
  298: 
  299:         this.document.server.elements.remember.value
  300:        =this.document.client.elements.remember.checked;
  301: 
  302:         uextkey=this.document.client.elements.uextkey.value;
  303:         lextkey=this.document.client.elements.lextkey.value;
  304:         initkeys();
  305: 
  306:         this.document.server.elements.upass.value
  307: 	    =crypted(this.document.client.elements.upass.value);
  308: 
  309:         this.document.server.submit();
  310: 	return false;
  311:     }
  312:  </script>
  313: ENDSCRIPT
  314: 
  315:     if ($fullgraph) {
  316: 	$r->print(
  317: 		  '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
  318:     }
  319: 
  320:     $r->print(<<ENDSERVERFORM);
  321:   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
  322:    <input type="hidden" name="logtoken" value="$logtoken" />
  323:    <input type="hidden" name="serverid" value="$lonhost" />
  324:    <input type="hidden" name="interface" value="$env{'form.interface'}" />
  325:    <input type="hidden" name="uname" value="" />
  326:    <input type="hidden" name="upass" value="" />
  327:    <input type="hidden" name="udom" value="" />
  328:    <input type="hidden" name="imagesuppress"  value="" />
  329:    <input type="hidden" name="appletsuppress"  value="" />
  330:    <input type="hidden" name="embedsuppress"  value="" />
  331:    <input type="hidden" name="fontenhance"  value="" />
  332:    <input type="hidden" name="blackwhite"  value="" />
  333:    <input type="hidden" name="remember"  value="" />
  334:    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
  335:    <input type="hidden" name="localres" value="$env{'form.localres'}" />
  336:   </form>
  337: ENDSERVERFORM
  338:     if ($fullgraph) { $r->print(<<ENDTOP);
  339:   <!-- The LON-CAPA Header -->
  340:   <tr>
  341: 
  342:    <!-- Row 1 Columns 2-4 -->
  343:    <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>
  344:   </tr>
  345: 
  346:   <!-- The gray bar that starts the two table frames -->
  347:   <tr>
  348: 
  349:    <!-- Row 2 Column 1 -->
  350:    <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>
  351: 
  352:    <!-- Row 2 Column 2 -->
  353:    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
  354: 
  355:    <!-- Row 2 Column 3 -->
  356:    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
  357: 
  358:    <!-- Row 2 Column 4 -->
  359:    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
  360:   </tr>
  361:   <tr>
  362:    
  363:    <!-- A cell that will hold the 'access' and 'about' buttons -->
  364:    <!-- Row 3 Column 1 -->
  365:    <td valign="top" height=60 align="center" bgcolor="$sidebg">
  366:     <a href="/adm/login?interface=textual"><img src="$iconpath/$lt{'access'}" border=0 alt="Accessibility Options" /></a>
  367:     <br />
  368:     <a href="/adm/about.html"><img src="$iconpath/$lt{'about'}" border=0 alt="About LON-CAPA" /></a>
  369:    </td>
  370: 
  371:    <!-- The shaded space between the two main columns -->
  372:    <!-- Row 3 Column 2 -->
  373:    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  374: 
  375:    <!-- The right main column holding the large LON-CAPA logo-->
  376:    <!-- Rows 3-4 Column 3 -->
  377:    <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
  378:     <center>
  379:      <img src="$logo" alt="" />
  380:     </center>
  381:    </td>
  382: 
  383:    <!-- Row 3 Column 4 -->
  384:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  385:   </tr>
  386:   <tr>
  387: 
  388:    <!-- The entry form -->
  389:    <!-- Row 4 Column 1 -->
  390:    <td align="center" valign="middle" bgcolor="$sidebg">
  391: ENDTOP
  392: } else {
  393:     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);
  394: }
  395:     $r->print('<form name="client" onsubmit="return(send())">');
  396:     unless ($fullgraph) {
  397:         $r->print(<<ENDACCESSOPTIONS);
  398: <h3>Select Accessibility Options</h3>
  399: <input type="checkbox" name="imagesuppress" /> Suppress rendering of images<br />
  400: <input type="checkbox" name="appletsuppress" /> Suppress Java applets<br />
  401: <input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia<br />
  402: <input type="checkbox" name="fontenhance" /> Increase font size<br />
  403: <input type="checkbox" name="blackwhite" /> Switch to black and white mode<br />
  404: <p>If you have accessibility needs that are not addressed by this interface, 
  405: please
  406: contact the system administrator at <tt>$sysadm</tt>.</p><br />
  407: <input type="checkbox" name="remember" /> Remember these settings for next login<hr />
  408: ENDACCESSOPTIONS
  409: } else {
  410:     $r->print(<<ENDNOOPT);
  411: <input type="hidden" name="imagesuppress"  value="" />
  412: <input type="hidden" name="embedsuppress"  value="" />
  413: <input type="hidden" name="appletsuppress"  value="" />
  414: <input type="hidden" name="fontenhance"  value="" />
  415: <input type="hidden" name="blackwhite"  value="" />
  416: <input type="hidden" name="remember"  value="" />
  417: ENDNOOPT
  418: }
  419:     $r->print(<<ENDLOGIN);
  420:      <input type="hidden" name="lextkey" value="$lextkey">
  421:      <input type="hidden" name="uextkey" value="$uextkey">
  422: 
  423:      <!-- Start the sub-table for text and input alignment -->
  424:      <table border=0 cellspacing=0 cellpadding=0>
  425:       <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>
  426:       <tr>
  427:        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'un'}:</b></font></td>
  428:        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
  429:       </tr>
  430:       <tr>
  431:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'pw'}:</b></font></td>
  432:        <td bgcolor="$mainbg"><input type="password" name="upass" size="10" /></td>
  433:       </tr>
  434:       <tr>
  435:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:</b></font></td>
  436:        <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
  437:       </tr>
  438:       <tr>
  439:        <td bgcolor="$mainbg">&nbsp;&nbsp;&nbsp;<a href="/adm/loginproblems.html">$lt{'help'}</a></td>
  440:        <td bgcolor="$mainbg" valign="bottom" align="center">
  441:         <br />
  442:         <input type="submit" value="$lt{'log'}" />
  443:        </td>
  444:       </tr>
  445:      </table>
  446:      <!-- End sub-table -->
  447:     </form>
  448: ENDLOGIN
  449:     if ($fullgraph) {
  450:         my $helpdeskscript;
  451:         my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version,$authdomain,\$helpdeskscript);
  452: 	$r->print(<<ENDDOCUMENT);
  453:    </td>
  454: 
  455:    <!-- Row 4 Column 2 -->
  456:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  457: 
  458:    <!-- Row 4 Column 3 -->
  459: <td bgcolor="$mainbg">$announcements</td>
  460: 
  461:    <!-- Row 4 Column 4 -->
  462:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  463:   </tr>
  464:   <tr>
  465: 
  466:    <!-- Row 5 Column 1 -->
  467:    <td bgcolor="$sidebg" valign="middle" align="left">
  468:      <br />
  469:      <table border=0 cellspacing=0 cellpadding=0>
  470:       <tr>
  471:        <td bgcolor="$sidebg" align="left" valign="top">
  472:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
  473:        </td>
  474:        <td bgcolor="$sidebg" align="left" valign="top">
  475:         <small><tt>&nbsp;$domain</tt></small>
  476:        </td>
  477:       </tr>
  478:       <tr>
  479:        <td bgcolor="$sidebg" align="left" valign="top">
  480:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
  481:        </td>
  482:        <td bgcolor="$sidebg" align="left" valign="top">
  483:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
  484:        </td>
  485:       </tr>
  486:       <tr>
  487:        <td bgcolor="$sidebg" align="left" valign="top">
  488:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
  489:        </td>
  490:        <td bgcolor="$sidebg" align="left" valign="top">
  491:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
  492:        </td>
  493:       </tr>
  494:       <tr>
  495:        <td bgcolor="$sidebg" align="left" valign="top">
  496:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
  497:        </td>
  498:        <td bgcolor="$sidebg" align="left" valign="top">
  499:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
  500:        </td>
  501:       </tr>
  502:      </table>
  503:      <br />
  504:     $contactblock
  505:    </td>
  506: 
  507:    <!-- Row 5 Column 2 -->
  508:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
  509: 
  510:    <!-- Row 5 Column 3 -->
  511:    <td width="100%" valign="bottom" bgcolor="$mainbg">
  512: $domainlogo
  513: </td>
  514: 
  515:    <!-- Row 5 Column 4 -->
  516:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
  517:   </tr>
  518:   <tr>
  519: 
  520:    <!-- Row 6 Column 1 -->
  521:    <td bgcolor="$sidebg">&nbsp;</td>
  522: 
  523:    <!-- Row 6 Column 2 -->
  524:    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
  525: 
  526:    <!-- Row 6 Column 3 -->
  527:    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
  528: 
  529:    <!-- Row 6 Column 4 -->
  530:    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
  531:   </tr>
  532:  </table>
  533: 
  534: <script type="text/javascript">
  535: // the if prevents the script error if the browser can not handle this
  536: if ( document.client.uname ) { document.client.uname.focus(); }
  537: </script>
  538: $helpdeskscript
  539: 
  540: ENDDOCUMENT
  541: }
  542:     $r->print('</body></html>');
  543:     return OK;
  544: }
  545: 
  546: sub contactdisplay {
  547:     my ($lt,$sysadm,$servadm,$version,$authdomain,$helpdeskscript) = @_;
  548:     my $contactblock;
  549:     my $showsysadm = 1;
  550:     my $showservadm = 1;
  551:     my $showhelpdesk = 0;
  552:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
  553:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
  554:         $showhelpdesk = 1;
  555:     }
  556:     if ($showsysadm) {
  557:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'sysadm'}.':</b><br />'.
  558:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$sysadm.'</tt><br />';
  559:     }
  560:     if ($showservadm) {
  561:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.
  562:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';
  563:     }
  564:     if ($showhelpdesk) {
  565:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;<a href="javascript:helpdesk()">'.$$lt{'helpdesk'}.'</a></b><br />';
  566:         my $thisurl = &Apache::lonnet::escape('/adm/login');
  567:         $$helpdeskscript = <<"ENDSCRIPT";
  568: <script type="text/javascript">
  569: function helpdesk() {
  570:     var codedom = document.client.udom.value;
  571:     if (codedom == '') {
  572:         codedom = "$authdomain";
  573:     }
  574:     var querystr = "origurl=$thisurl&codedom="+codedom;
  575:     document.location.href = "/adm/helpdesk?"+querystr;
  576:     return;
  577: }
  578: </script>
  579: ENDSCRIPT
  580:     }
  581:     $contactblock .= <<"ENDBLOCK";
  582:      &nbsp;&nbsp;&nbsp;$version
  583: ENDBLOCK
  584:     return $contactblock;
  585: }
  586:  
  587: 
  588: 1;
  589: __END__

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