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

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

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