Annotation of loncom/auth/lonlogin.pm, revision 1.72

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

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