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

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

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