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

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

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