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

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

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