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

1.1       albertel    1: # The LearningOnline Network
                      2: # Login Screen
1.11      www         3: #
1.87    ! raeburn     4: # $Id: lonlogin.pm,v 1.86 2007/01/13 20:39:57 raeburn 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.75      www        40: use lib '/home/httpd/lib/perl/';
                     41: use LONCAPA;
                     42:  
1.1       albertel   43: sub handler {
                     44:     my $r = shift;
1.71      albertel   45: 
                     46:     &Apache::loncommon::get_unprocessed_cgi
1.79      albertel   47: 	(join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
                     48: 	      $ENV{'REDIRECT_QUERY_STRING'}),
1.71      albertel   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: 
1.53      www        57:     &Apache::loncommon::no_cache($r);
                     58:     &Apache::lonlocal::get_language_handle($r);
1.54      www        59:     &Apache::loncommon::content_type($r,'text/html');
1.1       albertel   60:     $r->send_http_header;
                     61:     return OK if $r->header_only;
                     62: 
1.49      www        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:     }
1.55      www        69: 
1.71      albertel   70: 
1.55      www        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) {
1.85      albertel   76: 	my $handle=&LONCAPA::clean_handle($lonid->value);
1.55      www        77:         my $lonidsdir=$r->dir_config('lonIDsDir');
1.70      www        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 '') {
1.55      www        84: # Indeed, a valid token is found
1.74      albertel   85: 		my $start_page = 
                     86: 		    &Apache::loncommon::start_page('Already logged in');
                     87: 		my $end_page = 
                     88: 		    &Apache::loncommon::end_page();
1.70      www        89: 		$r->print(<<ENDFAILED);
1.74      albertel   90: $start_page
1.55      www        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>
1.74      albertel   96: $end_page
1.55      www        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.87    ! raeburn   129:     my $domain = &Apache::lonnet::default_login_domain();
1.63      albertel  130:     if (($env{'form.domain'}) && 
                    131: 	 ($Apache::lonnet::domaindescription{$env{'form.domain'}})) {
                    132: 	$domain=$env{'form.domain'};
1.46      www       133:     }
1.1       albertel  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');
1.6       www       138:     my $include = $r->dir_config('lonIncludes');
1.37      www       139:     my $expire  = $r->dir_config('lonExpire');
1.44      www       140:     my $version = $r->dir_config('lonVersion');
1.76      albertel  141:     my $host_name = $Apache::lonnet::hostname{$lonhost};
1.1       albertel  142: 
1.30      www       143: # --------------------------------------------- Default values for login fields
                    144: 
1.63      albertel  145:     my $authusername=($env{'form.username'}?$env{'form.username'}:'');
                    146:     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
1.30      www       147: 
                    148: # ---------------------------------------------------------- Determine own load
1.1       albertel  149:     my $loadavg;
1.41      albertel  150:     {
                    151: 	my $loadfile=Apache::File->new('/proc/loadavg');
                    152: 	$loadavg=<$loadfile>;
                    153:     }
1.1       albertel  154:     $loadavg =~ s/\s.*//g;
1.57      matthew   155:     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
1.41      albertel  156:     my $userloadpercent=&Apache::lonnet::userload();
1.1       albertel  157: 
1.30      www       158: # ------------------------------------------------------- Do the load balancing
1.80      albertel  159:     my $otherserver= &Apache::lonnet::absolute_url($host_name);
1.31      www       160:     my $firsturl=
1.63      albertel  161:     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.1       albertel  162: # ---------------------------------------- Are we access server and overloaded?
1.41      albertel  163:     if (($role eq 'access') &&
                    164: 	(($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47      albertel  165:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
                    166: 	if ($unloaded) { $otherserver=$unloaded; }
1.1       albertel  167:     }
1.6       www       168: 
1.45      www       169: # ----------------------------------------------------------- Get announcements
                    170:     my $announcements=&Apache::lonnet::getannounce();
1.6       www       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);
1.15      www       186:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
                    187: 
1.6       www       188:     my $uextkey=hex($ukey);
1.15      www       189:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
                    190: 
1.31      www       191: # -------------------------------------------------------- Store away log token
1.6       www       192:     my $logtoken=Apache::lonnet::reply(
1.7       www       193:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6       www       194:        $lonhost);
1.31      www       195: 
                    196: # ------------------- If we cannot talk to ourselves, we are in serious trouble
                    197: 
                    198:     if ($logtoken eq 'con_lost') {
                    199:         my $spares='';
1.64      albertel  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)) {
1.58      matthew   207:             next if ($hostid eq $lonhost);
1.64      albertel  208:             next if ($last eq $Apache::lonnet::hostname{$hostid});
1.58      matthew   209:             $spares.='<br /><font size="+1"><a href="http://'.
                    210:                 $Apache::lonnet::hostname{$hostid}.
                    211:                 '/adm/login?domain='.$authdomain.'">'.
                    212:                 $Apache::lonnet::hostname{$hostid}.'</a>'.
                    213:                 ' (preferred)</font>'.$/;
1.64      albertel  214: 	    $last=$Apache::lonnet::hostname{$hostid};
1.58      matthew   215:         }
                    216:         $spares.= '<br />';
1.64      albertel  217:         foreach my $hostid (sort
                    218: 			    {
                    219: 				$Apache::lonnet::hostname{$a} cmp
                    220: 				    $Apache::lonnet::hostname{$b};
                    221: 			    }
                    222: 			    keys(%Apache::lonnet::hostname)) {
1.58      matthew   223:             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
1.64      albertel  224:             next if ($last eq $Apache::lonnet::hostname{$hostid});
1.58      matthew   225:             $spares.='<br /><a href="http://'.
                    226:                 $Apache::lonnet::hostname{$hostid}.
                    227:                 '/adm/login?domain='.$authdomain.'">'.
                    228:                 $Apache::lonnet::hostname{$hostid}.'</a>';
1.64      albertel  229: 	    $last=$Apache::lonnet::hostname{$hostid};
1.31      www       230:         }
                    231: 	$r->print(<<ENDTROUBLE);
                    232: <html>
                    233: <head><title>The LearningOnline Network with CAPA</title></head>
                    234: <body bgcolor="#FFFFFF">
                    235: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
                    236: <h3>This LON-CAPA server is temporarily not available for login</h3>
                    237: <p>Please attempt to login to one of the following servers:</p>$spares
                    238: </body>
                    239: </html>
                    240: ENDTROUBLE
                    241:         return OK;
                    242:     }
                    243: 
                    244: # ----------------------------------------------- Apparently we are in business
                    245: 
1.48      albertel  246:     my $domainlogo=&Apache::loncommon::domainlogo($domain);
1.38      www       247: 
1.6       www       248: # --------------------------------------------------- Print login screen header
                    249:     $r->print(<<ENDHEADER);
1.1       albertel  250: <html>
                    251: <head>
1.37      www       252: <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />
1.2       www       253: <title>The LearningOnline Network with CAPA Login</title>
1.1       albertel  254: </head>
1.6       www       255: ENDHEADER
                    256: # ---------------------------------------------------- Serve out DES JavaScript
                    257:     {
                    258: 	my $jsh=Apache::File->new($include."/londes.js");
                    259:         $r->print(<$jsh>);
                    260:     }
1.21      www       261: 
                    262: # ----------------------------------------------------------- Front page design
1.35      www       263:     my $pgbg=
1.46      www       264:       ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
1.35      www       265:     my $font=
1.46      www       266:       ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
1.35      www       267:     my $link=
1.46      www       268:       ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
1.35      www       269:     my $vlink=
1.46      www       270:       ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
                    271:     my $alink=&Apache::loncommon::designparm('login.alink',$domain);
1.35      www       272:     my $mainbg=
1.46      www       273:       ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
1.35      www       274:     my $sidebg=
1.46      www       275:       ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
                    276:     my $logo=&Apache::loncommon::designparm('login.logo',$domain);
                    277:     my $img=&Apache::loncommon::designparm('login.img',$domain);
1.21      www       278: 
1.51      www       279: # ----------------------------------------------------------------------- Texts
                    280: 
                    281: my %lt=&Apache::lonlocal::texthash(
                    282: 		  'un'  => 'Username',
                    283: 		  'pw'  => 'Password',
                    284: 		  'dom' => 'Domain',
                    285: 		  'perc' => 'percent',
1.52      www       286: 		  'load' => 'Load',
                    287:                   'userload' => 'User Load',
1.84      raeburn   288:                   'about'  => 'About LON-CAPA',
                    289:                   'access' => 'Accessibility Options',
                    290:                   'catalog' => 'Course Catalog',
1.52      www       291: 		  'auth' => 'userauthentication.gif',
1.51      www       292: 		  'log' => 'Log in',
1.84      raeburn   293: 		  'help' => 'Log-in Help',
1.51      www       294: 		  'serv' => 'Server',
1.83      raeburn   295:                   'helpdesk' => 'Contact Helpdesk',
                    296:                   'forgotpw' => 'Forgot password?');
1.66      www       297: # -------------------------------------------------- Change password field name
                    298:     my $now=time;
1.84      raeburn   299:     my $forgotpw = &forgotpwdisplay(%lt);
                    300:     my $loginhelp = &loginhelpdisplay(%lt);
1.6       www       301: # ---------------------------------------------------------- Serve rest of page
1.16      www       302:     $r->print(<<ENDSCRIPT);
1.6       www       303: 
1.21      www       304: <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"
1.27      albertel  305:   topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
1.6       www       306: 
1.14      albertel  307:  <script language="JavaScript">
                    308:     function send()
                    309:     {
1.6       www       310: 	this.document.server.elements.uname.value
                    311:        =this.document.client.elements.uname.value;
                    312: 
                    313:         this.document.server.elements.udom.value
                    314:        =this.document.client.elements.udom.value;
                    315: 
1.33      www       316:         this.document.server.elements.imagesuppress.value
1.36      www       317:        =this.document.client.elements.imagesuppress.checked;
1.33      www       318: 
                    319:         this.document.server.elements.embedsuppress.value
1.36      www       320:        =this.document.client.elements.embedsuppress.checked;
1.33      www       321: 
1.34      www       322:         this.document.server.elements.appletsuppress.value
1.36      www       323:        =this.document.client.elements.appletsuppress.checked;
1.34      www       324: 
1.33      www       325:         this.document.server.elements.fontenhance.value
1.36      www       326:        =this.document.client.elements.fontenhance.checked;
1.33      www       327: 
                    328:         this.document.server.elements.blackwhite.value
1.36      www       329:        =this.document.client.elements.blackwhite.checked;
1.33      www       330: 
1.35      www       331:         this.document.server.elements.remember.value
1.36      www       332:        =this.document.client.elements.remember.checked;
1.35      www       333: 
1.6       www       334:         uextkey=this.document.client.elements.uextkey.value;
                    335:         lextkey=this.document.client.elements.lextkey.value;
                    336:         initkeys();
                    337: 
1.65      www       338:         this.document.server.elements.upass0.value
1.66      www       339: 	    =crypted(this.document.client.elements.upass$now.value.substr(0,15));
1.65      www       340: 	this.document.server.elements.upass1.value
1.66      www       341: 	    =crypted(this.document.client.elements.upass$now.value.substr(15,15));
1.65      www       342: 	this.document.server.elements.upass2.value
1.66      www       343: 	    =crypted(this.document.client.elements.upass$now.value.substr(30,15));
                    344: 
                    345:         this.document.client.elements.uname.value='';
                    346:         this.document.client.elements.upass$now.value='';
1.6       www       347: 
                    348:         this.document.server.submit();
1.19      bowersj2  349: 	return false;
1.6       www       350:     }
1.14      albertel  351:  </script>
1.16      www       352: ENDSCRIPT
1.6       www       353: 
1.16      www       354:     if ($fullgraph) {
                    355: 	$r->print(
                    356: 		  '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
                    357:     }
1.6       www       358: 
1.16      www       359:     $r->print(<<ENDSERVERFORM);
1.14      albertel  360:   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33      www       361:    <input type="hidden" name="logtoken" value="$logtoken" />
                    362:    <input type="hidden" name="serverid" value="$lonhost" />
1.63      albertel  363:    <input type="hidden" name="interface" value="$env{'form.interface'}" />
1.33      www       364:    <input type="hidden" name="uname" value="" />
1.65      www       365:    <input type="hidden" name="upass0" value="" />
                    366:    <input type="hidden" name="upass1" value="" />
                    367:    <input type="hidden" name="upass2" value="" />
1.33      www       368:    <input type="hidden" name="udom" value="" />
                    369:    <input type="hidden" name="imagesuppress"  value="" />
1.34      www       370:    <input type="hidden" name="appletsuppress"  value="" />
1.33      www       371:    <input type="hidden" name="embedsuppress"  value="" />
                    372:    <input type="hidden" name="fontenhance"  value="" />
                    373:    <input type="hidden" name="blackwhite"  value="" />
1.35      www       374:    <input type="hidden" name="remember"  value="" />
1.63      albertel  375:    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
                    376:    <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14      albertel  377:   </form>
1.16      www       378: ENDSERVERFORM
                    379:     if ($fullgraph) { $r->print(<<ENDTOP);
1.14      albertel  380:   <!-- The LON-CAPA Header -->
                    381:   <tr>
                    382: 
                    383:    <!-- Row 1 Columns 2-4 -->
1.29      www       384:    <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  385:   </tr>
                    386: 
                    387:   <!-- The gray bar that starts the two table frames -->
                    388:   <tr>
                    389: 
                    390:    <!-- Row 2 Column 1 -->
1.21      www       391:    <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>
1.14      albertel  392: 
                    393:    <!-- Row 2 Column 2 -->
1.19      bowersj2  394:    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
1.14      albertel  395: 
                    396:    <!-- Row 2 Column 3 -->
1.19      bowersj2  397:    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
1.14      albertel  398: 
                    399:    <!-- Row 2 Column 4 -->
1.19      bowersj2  400:    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
1.14      albertel  401:   </tr>
                    402:   <tr>
                    403:    
1.84      raeburn   404:    <!-- A cell that will hold the 'access', 'about', and 'catalog' links -->
1.14      albertel  405:    <!-- Row 3 Column 1 -->
1.86      raeburn   406:    <td valign="top" height="60" align="left" bgcolor="$sidebg">
1.84      raeburn   407:     <table cellpadding="0" cellspacing="2" border="0">
                    408:      <tr>
                    409:       <td>&nbsp;</td>
                    410:       <td><a href="/adm/login?interface=textual"><b>$lt{'access'}</b></a></td>
1.86      raeburn   411:      </tr>
                    412:      <tr>
                    413:       <td>&nbsp;</td>
                    414:       <td><a href="/adm/about.html"><b>$lt{'about'}</b></a></td>
                    415:      </tr>
                    416:      <tr>
                    417:       <td>&nbsp;</td>
                    418:       <td><a href="/adm/coursecatalog"><b>$lt{'catalog'}</b></a></td>
                    419:      </tr>
                    420:      <tr>
1.84      raeburn   421:       <td colspan="2">&nbsp;</td>
1.86      raeburn   422:      </tr>
                    423:     </table>
                    424:    </td>
1.14      albertel  425:    <!-- The shaded space between the two main columns -->
                    426:    <!-- Row 3 Column 2 -->
1.19      bowersj2  427:    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14      albertel  428: 
                    429:    <!-- The right main column holding the large LON-CAPA logo-->
                    430:    <!-- Rows 3-4 Column 3 -->
1.45      www       431:    <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
1.14      albertel  432:     <center>
1.21      www       433:      <img src="$logo" alt="" />
1.14      albertel  434:     </center>
                    435:    </td>
                    436: 
                    437:    <!-- Row 3 Column 4 -->
1.19      bowersj2  438:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14      albertel  439:   </tr>
                    440:   <tr>
                    441: 
                    442:    <!-- The entry form -->
                    443:    <!-- Row 4 Column 1 -->
1.21      www       444:    <td align="center" valign="middle" bgcolor="$sidebg">
1.16      www       445: ENDTOP
1.32      www       446: } else {
1.45      www       447:     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);
1.33      www       448: }
                    449:     $r->print('<form name="client" onsubmit="return(send())">');
                    450:     unless ($fullgraph) {
                    451:         $r->print(<<ENDACCESSOPTIONS);
1.35      www       452: <h3>Select Accessibility Options</h3>
1.67      albertel  453: <label><input type="checkbox" name="imagesuppress" /> Suppress rendering of images</label><br />
                    454: <label><input type="checkbox" name="appletsuppress" /> Suppress Java applets</label><br />
                    455: <label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br />
                    456: <label><input type="checkbox" name="fontenhance" /> Increase font size</label><br />
                    457: <label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><br />
1.35      www       458: <input type="checkbox" name="remember" /> Remember these settings for next login<hr />
1.33      www       459: ENDACCESSOPTIONS
                    460: } else {
                    461:     $r->print(<<ENDNOOPT);
                    462: <input type="hidden" name="imagesuppress"  value="" />
                    463: <input type="hidden" name="embedsuppress"  value="" />
1.34      www       464: <input type="hidden" name="appletsuppress"  value="" />
1.33      www       465: <input type="hidden" name="fontenhance"  value="" />
                    466: <input type="hidden" name="blackwhite"  value="" />
1.35      www       467: <input type="hidden" name="remember"  value="" />
1.33      www       468: ENDNOOPT
1.16      www       469: }
                    470:     $r->print(<<ENDLOGIN);
1.14      albertel  471:      <input type="hidden" name="lextkey" value="$lextkey">
                    472:      <input type="hidden" name="uextkey" value="$uextkey">
                    473: 
                    474:      <!-- Start the sub-table for text and input alignment -->
                    475:      <table border=0 cellspacing=0 cellpadding=0>
1.52      www       476:       <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>
1.14      albertel  477:       <tr>
1.51      www       478:        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'un'}:</b></font></td>
1.30      www       479:        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
1.14      albertel  480:       </tr>
                    481:       <tr>
1.51      www       482:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'pw'}:</b></font></td>
1.66      www       483:        <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
1.14      albertel  484:       </tr>
                    485:       <tr>
1.51      www       486:        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:</b></font></td>
1.30      www       487:        <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
1.14      albertel  488:       </tr>
                    489:       <tr>
1.84      raeburn   490:        <td bgcolor="$mainbg">&nbsp;</td>
1.28      www       491:        <td bgcolor="$mainbg" valign="bottom" align="center">
1.14      albertel  492:         <br />
1.51      www       493:         <input type="submit" value="$lt{'log'}" />
1.14      albertel  494:        </td>
                    495:       </tr>
1.83      raeburn   496:       <tr>
                    497:        <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
1.84      raeburn   498:         $loginhelp
1.83      raeburn   499:         $forgotpw
                    500:        </td>
                    501:       </tr>
1.14      albertel  502:      </table>
                    503:      <!-- End sub-table -->
                    504:     </form>
1.16      www       505: ENDLOGIN
                    506:     if ($fullgraph) {
1.62      raeburn   507:         my $helpdeskscript;
1.82      www       508:         my $contactblock = &contactdisplay(\%lt,$version,$authdomain,\$helpdeskscript);
1.16      www       509: 	$r->print(<<ENDDOCUMENT);
1.14      albertel  510:    </td>
                    511: 
                    512:    <!-- Row 4 Column 2 -->
1.19      bowersj2  513:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.45      www       514: 
                    515:    <!-- Row 4 Column 3 -->
                    516: <td bgcolor="$mainbg">$announcements</td>
1.14      albertel  517: 
                    518:    <!-- Row 4 Column 4 -->
1.19      bowersj2  519:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14      albertel  520:   </tr>
                    521:   <tr>
                    522: 
                    523:    <!-- Row 5 Column 1 -->
1.21      www       524:    <td bgcolor="$sidebg" valign="middle" align="left">
1.14      albertel  525:      <br />
                    526:      <table border=0 cellspacing=0 cellpadding=0>
                    527:       <tr>
1.21      www       528:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       529:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
1.14      albertel  530:        </td>
1.21      www       531:        <td bgcolor="$sidebg" align="left" valign="top">
1.14      albertel  532:         <small><tt>&nbsp;$domain</tt></small>
                    533:        </td>
                    534:       </tr>
                    535:       <tr>
1.21      www       536:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       537:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
1.14      albertel  538:        </td>
1.21      www       539:        <td bgcolor="$sidebg" align="left" valign="top">
1.14      albertel  540:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
                    541:        </td>
                    542:       </tr>
                    543:       <tr>
1.21      www       544:        <td bgcolor="$sidebg" align="left" valign="top">
1.52      www       545:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
1.14      albertel  546:        </td>
1.21      www       547:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       548:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
1.42      albertel  549:        </td>
                    550:       </tr>
                    551:       <tr>
                    552:        <td bgcolor="$sidebg" align="left" valign="top">
1.52      www       553:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
1.42      albertel  554:        </td>
                    555:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       556:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
1.14      albertel  557:        </td>
                    558:       </tr>
                    559:      </table>
                    560:      <br />
1.60      raeburn   561:     $contactblock
1.14      albertel  562:    </td>
                    563: 
                    564:    <!-- Row 5 Column 2 -->
1.19      bowersj2  565:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14      albertel  566: 
                    567:    <!-- Row 5 Column 3 -->
1.21      www       568:    <td width="100%" valign="bottom" bgcolor="$mainbg">
1.20      www       569: $domainlogo
                    570: </td>
1.14      albertel  571: 
                    572:    <!-- Row 5 Column 4 -->
1.19      bowersj2  573:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14      albertel  574:   </tr>
                    575:   <tr>
                    576: 
                    577:    <!-- Row 6 Column 1 -->
1.21      www       578:    <td bgcolor="$sidebg">&nbsp;</td>
1.14      albertel  579: 
                    580:    <!-- Row 6 Column 2 -->
1.19      bowersj2  581:    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
1.14      albertel  582: 
                    583:    <!-- Row 6 Column 3 -->
1.19      bowersj2  584:    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
1.14      albertel  585: 
                    586:    <!-- Row 6 Column 4 -->
1.19      bowersj2  587:    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
1.14      albertel  588:   </tr>
1.1       albertel  589:  </table>
1.25      bowersj2  590: 
1.59      albertel  591: <script type="text/javascript">
                    592: // the if prevents the script error if the browser can not handle this
1.25      bowersj2  593: if ( document.client.uname ) { document.client.uname.focus(); }
                    594: </script>
1.62      raeburn   595: $helpdeskscript
1.14      albertel  596: 
1.1       albertel  597: ENDDOCUMENT
1.16      www       598: }
                    599:     $r->print('</body></html>');
1.1       albertel  600:     return OK;
1.60      raeburn   601: }
                    602: 
                    603: sub contactdisplay {
1.82      www       604:     my ($lt,$version,$authdomain,$helpdeskscript) = @_;
1.60      raeburn   605:     my $contactblock;
1.62      raeburn   606:     my $showhelpdesk = 0;
                    607:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                    608:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
                    609:         $showhelpdesk = 1;
                    610:     }
1.60      raeburn   611:     if ($showhelpdesk) {
1.84      raeburn   612:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;<a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
1.75      www       613:         my $thisurl = &escape('/adm/login');
1.62      raeburn   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: }
1.83      raeburn   633: 
                    634: sub forgotpwdisplay {
1.84      raeburn   635:     my (%lt) = @_;
1.83      raeburn   636:     my $prompt_for_resetpw = 1; 
                    637:     if ($prompt_for_resetpw) {
1.84      raeburn   638:         return '<br />&nbsp;&nbsp;&nbsp;<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br /><br />';
                    639:     }
                    640:     return;
                    641: }
                    642: 
                    643: sub loginhelpdisplay {
                    644:     my (%lt) = @_;
                    645:     my $login_help = 1;
                    646:     if ($login_help) {
                    647:         return '&nbsp;&nbsp;&nbsp;<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a></b>';
1.83      raeburn   648:     }
                    649:     return;
                    650: }
1.1       albertel  651: 
                    652: 1;
                    653: __END__

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