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

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

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