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

1.1       albertel    1: # The LearningOnline Network
                      2: # Login Screen
1.11      www         3: #
1.123   ! raeburn     4: # $Id: lonlogin.pm,v 1.122 2009/05/22 17:01:28 bisitz 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',
1.123   ! raeburn    49: 	  'token','role','symb']);
1.102     raeburn    50:     if (!defined($env{'form.firsturl'})) {
                     51:         &Apache::lonacc::get_posted_cgi($r,['firsturl']);
                     52:     }
1.71      albertel   53: 
                     54: # -- check if they are a migrating user
                     55:     if (defined($env{'form.token'})) {
                     56: 	return &Apache::migrateuser::handler($r);
                     57:     }
                     58: 
1.53      www        59:     &Apache::loncommon::no_cache($r);
                     60:     &Apache::lonlocal::get_language_handle($r);
1.54      www        61:     &Apache::loncommon::content_type($r,'text/html');
1.1       albertel   62:     $r->send_http_header;
                     63:     return OK if $r->header_only;
                     64: 
1.49      www        65: 
                     66: # Are we re-routing?
                     67:     if (-e '/home/httpd/html/lon-status/reroute.txt') {
                     68: 	&Apache::lonauth::reroute($r);
                     69: 	return OK;
                     70:     }
1.55      www        71: 
1.71      albertel   72: 
1.55      www        73: # -------------------------------- Prevent users from attempting to login twice
1.95      albertel   74:     my $handle = &Apache::lonnet::check_for_valid_session($r);
                     75:     if ($handle=~/^publicuser\_/) {
1.70      www        76: # For "public user" - remove it, we apparently really want to login
1.95      albertel   77: 	unlink($r->dir_config('lonIDsDir')."/$handle.id");
                     78:     } elsif ($handle ne '') {
1.55      www        79: # Indeed, a valid token is found
1.95      albertel   80: 	my $start_page = 
                     81: 	    &Apache::loncommon::start_page('Already logged in');
                     82: 	my $end_page = 
                     83: 	    &Apache::loncommon::end_page();
1.100     bisitz     84: 	$r->print(
                     85:                   $start_page
1.103     bisitz     86:                  .'<h1>'.&mt('You are already logged in!').'</h1>'
1.117     hauer      87:                  .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
1.100     bisitz     88:                   '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').'</p>'
                     89:                  .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
                     90:                  .$end_page
                     91:                  );
1.95      albertel   92:         return OK;
1.55      www        93:     }
                     94: 
                     95: # ---------------------------------------------------- No valid token, continue
1.16      www        96: 
1.70      www        97:  # ---------------------------- Not possible to really login to domain "public"
                     98:     if ($env{'form.domain'} eq 'public') {
                     99: 	$env{'form.domain'}='';
                    100: 	$env{'form.username'}='';
                    101:     }
1.32      www       102: # ----------------------------------------------------------- Process Interface
1.63      albertel  103:     $env{'form.interface'}=~s/\W//g;
1.16      www       104: 
1.32      www       105:     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
1.94      albertel  106: 
                    107:     my $iconpath= 
                    108: 	&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
                    109: 
1.87      raeburn   110:     my $domain = &Apache::lonnet::default_login_domain();
1.63      albertel  111:     if (($env{'form.domain'}) && 
1.89      albertel  112: 	(&Apache::lonnet::domain($env{'form.domain'},'description'))) {
1.63      albertel  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');
1.90      raeburn   117:     my $servadm = $r->dir_config('lonAdmEMail');
1.1       albertel  118:     my $lonhost = $r->dir_config('lonHostID');
                    119:     my $tabdir  = $r->dir_config('lonTabDir');
1.6       www       120:     my $include = $r->dir_config('lonIncludes');
1.37      www       121:     my $expire  = $r->dir_config('lonExpire');
1.44      www       122:     my $version = $r->dir_config('lonVersion');
1.88      albertel  123:     my $host_name = &Apache::lonnet::hostname($lonhost);
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.80      albertel  141:     my $otherserver= &Apache::lonnet::absolute_url($host_name);
1.31      www       142:     my $firsturl=
1.63      albertel  143:     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.97      albertel  144: # ---------------------------------------------------------- Are we overloaded?
                    145:     if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47      albertel  146:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
                    147: 	if ($unloaded) { $otherserver=$unloaded; }
1.1       albertel  148:     }
1.6       www       149: 
1.45      www       150: # ----------------------------------------------------------- Get announcements
                    151:     my $announcements=&Apache::lonnet::getannounce();
1.6       www       152: # -------------------------------------------------------- Set login parameters
                    153: 
                    154:     my @hexstr=('0','1','2','3','4','5','6','7',
                    155:                 '8','9','a','b','c','d','e','f');
                    156:     my $lkey='';
                    157:     for (0..7) {
                    158:         $lkey.=$hexstr[rand(15)];
                    159:     }
                    160: 
                    161:     my $ukey='';
                    162:     for (0..7) {
                    163:         $ukey.=$hexstr[rand(15)];
                    164:     }
                    165: 
                    166:     my $lextkey=hex($lkey);
1.15      www       167:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
                    168: 
1.6       www       169:     my $uextkey=hex($ukey);
1.15      www       170:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
                    171: 
1.31      www       172: # -------------------------------------------------------- Store away log token
1.123   ! raeburn   173:     my $tokenextras;
        !           174:     if ($env{'form.role'}) {
        !           175:         $tokenextras = '&role='.&escape($env{'form.role'});
        !           176:     }
        !           177:     if ($env{'form.symb'}) {
        !           178:         $tokenextras .= '&symb='.&escape($env{'form.symb'});
        !           179:     }
1.6       www       180:     my $logtoken=Apache::lonnet::reply(
1.123   ! raeburn   181:        'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
1.6       www       182:        $lonhost);
1.31      www       183: 
                    184: # ------------------- If we cannot talk to ourselves, we are in serious trouble
                    185: 
                    186:     if ($logtoken eq 'con_lost') {
                    187:         my $spares='';
1.64      albertel  188: 	my $last;
                    189:         foreach my $hostid (sort
                    190: 			    {
1.88      albertel  191: 				&Apache::lonnet::hostname($a) cmp
                    192: 				    &Apache::lonnet::hostname($b);
1.64      albertel  193: 			    }
                    194: 			    keys(%Apache::lonnet::spareid)) {
1.58      matthew   195:             next if ($hostid eq $lonhost);
1.88      albertel  196: 	    my $hostname = &Apache::lonnet::hostname($hostid);
                    197: 	    next if ($last eq $hostname);
1.58      matthew   198:             $spares.='<br /><font size="+1"><a href="http://'.
1.88      albertel  199:                 $hostname.
1.58      matthew   200:                 '/adm/login?domain='.$authdomain.'">'.
1.88      albertel  201:                 $hostname.'</a>'.
1.106     bisitz    202:                 ' '.&mt('(preferred)').'</font>'.$/;
1.88      albertel  203: 	    $last=$hostname;
1.58      matthew   204:         }
1.107     tempelho  205: $spares.= '<br />';
                    206: my %all_hostnames = &Apache::lonnet::all_hostnames();
                    207: foreach my $hostid (sort
                    208: 		    {
                    209: 			&Apache::lonnet::hostname($a) cmp
                    210: 			    &Apache::lonnet::hostname($b);
                    211: 		    }
                    212: 		    keys(%all_hostnames)) {
                    213:     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
                    214:     my $hostname = &Apache::lonnet::hostname($hostid);
                    215:     next if ($last eq $hostname);
                    216:     $spares.='<br /><a href="http://'.
                    217: 	$hostname.
                    218: 	'/adm/login?domain='.$authdomain.'">'.
                    219: 	$hostname.'</a>';
                    220:     $last=$hostname;
                    221: }
                    222: $r->print(
                    223:    '<html>'
                    224:   .'<head><title>'
                    225:   .&mt('The LearningOnline Network with CAPA')
                    226:   .'</title></head>'
                    227:   .'<body bgcolor="#FFFFFF">'
                    228:   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
                    229:   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
                    230:   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
                    231:   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
                    232:   .$spares
                    233:   .'</body>'
                    234:   .'</html>'
                    235: );
                    236: return OK;
                    237: }
1.31      www       238: 
                    239: # ----------------------------------------------- Apparently we are in business
1.107     tempelho  240: $servadm=~s/\,/\<br \/\>/g;
1.38      www       241: 
1.21      www       242: # ----------------------------------------------------------- Front page design
1.119     tempelho  243: my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
                    244: my $font=&Apache::loncommon::designparm('login.font',$domain);
                    245: my $link=&Apache::loncommon::designparm('login.link',$domain);
                    246: my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
1.107     tempelho  247: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
1.119     tempelho  248: my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
1.107     tempelho  249: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
                    250: my $img=&Apache::loncommon::designparm('login.img',$domain);
                    251: my $domainlogo=&Apache::loncommon::domainlogo($domain);
                    252: my $login=&Apache::loncommon::designparm('login.login',$domain);
                    253: if ($login eq '') {
                    254: $login = $iconpath.'/'.&mt('userauthentication.gif');
                    255: }
1.109     raeburn   256: my $showbanner = 1;
                    257: my $showmainlogo = 1;
                    258: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
                    259:     $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
                    260: }
                    261: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
                    262:     $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
                    263: }
1.107     tempelho  264: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
                    265: my $showcoursecat =
                    266: &Apache::loncommon::designparm('login.coursecatalog',$domain);
                    267: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
                    268: my $shownewuserlink = 
                    269: &Apache::loncommon::designparm('login.newuser',$domain);
                    270: my $now=time;
                    271: my $js = (<<ENDSCRIPT);
                    272: 
1.116     bisitz    273: <script type="text/javascript" language="JavaScript">
1.122     bisitz    274: // <![CDATA[
1.107     tempelho  275: function send()
                    276: {
                    277: this.document.server.elements.uname.value
                    278: =this.document.client.elements.uname.value;
                    279: 
                    280: this.document.server.elements.udom.value
                    281: =this.document.client.elements.udom.value;
                    282: 
                    283: uextkey=this.document.client.elements.uextkey.value;
                    284: lextkey=this.document.client.elements.lextkey.value;
                    285: initkeys();
                    286: 
                    287: this.document.server.elements.upass0.value
                    288:     =crypted(this.document.client.elements.upass$now.value.substr(0,15));
                    289: this.document.server.elements.upass1.value
                    290:     =crypted(this.document.client.elements.upass$now.value.substr(15,15));
                    291: this.document.server.elements.upass2.value
                    292:     =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.6       www       293: 
1.107     tempelho  294: this.document.client.elements.uname.value='';
                    295: this.document.client.elements.upass$now.value='';
1.6       www       296: 
1.107     tempelho  297: this.document.server.submit();
                    298: return false;
                    299: }
1.122     bisitz    300: // ]]>
1.107     tempelho  301: </script>
1.98      raeburn   302: 
1.16      www       303: ENDSCRIPT
1.6       www       304: 
1.98      raeburn   305: # --------------------------------------------------- Print login screen header
                    306: 
1.118     tempelho  307: my %add_entries = (
1.108     tempelho  308: 	       bgcolor      => "$mainbg",
1.107     tempelho  309: 	       text         => "$font",
                    310: 	       link         => "$link",
                    311: 	       vlink        => "$vlink",
                    312: 	       alink        => "$alink",);
                    313: 
                    314: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
                    315: 			       { 'redirect'       => [$expire,'/adm/roles'], 
                    316: 				 'add_entries' => \%add_entries,
                    317: 				 'only_body'   => 1,}));
1.98      raeburn   318: 
                    319: # ----------------------------------------------------------------------- Texts
                    320: 
                    321: my %lt=&Apache::lonlocal::texthash(
1.107     tempelho  322: 	  'un'  => 'Username',
                    323: 	  'pw'  => 'Password',
                    324: 	  'dom' => 'Domain',
                    325: 	  'perc' => 'percent',
                    326: 	  'load' => 'Server Load',
                    327: 	  'userload' => 'User Load',
                    328: 	  'catalog' => 'Course Catalog',
                    329: 	  'log' => 'Log in',
                    330: 	  'help' => 'Log-in Help',
                    331: 	  'serv' => 'Server',
                    332: 	  'servadm' => 'Server Administration',
                    333: 	  'helpdesk' => 'Contact Helpdesk',
                    334: 	  'forgotpw' => 'Forgot password?',
                    335: 	  'newuser'  => 'New User?',
1.111     muellerd  336: 	  );
1.98      raeburn   337: # -------------------------------------------------- Change password field name
1.107     tempelho  338: my $forgotpw = &forgotpwdisplay(%lt);
                    339: my $loginhelp = &loginhelpdisplay(%lt);
1.98      raeburn   340: 
                    341: # ---------------------------------------------------- Serve out DES JavaScript
1.107     tempelho  342: {
                    343: my $jsh=Apache::File->new($include."/londes.js");
                    344: $r->print(<$jsh>);
                    345: }
1.98      raeburn   346: # ---------------------------------------------------------- Serve rest of page
                    347: 
1.107     tempelho  348: $r->print(
                    349: 	  '<div class="LC_loginpage_container">');
1.6       www       350: 
1.120     foxr      351: #
                    352: #  If the loadbalancing yielded just http:// because perhaps there's no loadbalancing?
                    353: #  then just us a relative link to authenticate:
                    354: #
                    355: 
1.107     tempelho  356: $r->print(<<ENDSERVERFORM);
                    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" />
                    360:    <input type="hidden" name="uname" value="" />
1.65      www       361:    <input type="hidden" name="upass0" value="" />
                    362:    <input type="hidden" name="upass1" value="" />
                    363:    <input type="hidden" name="upass2" value="" />
1.33      www       364:    <input type="hidden" name="udom" value="" />
1.63      albertel  365:    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
                    366:    <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14      albertel  367:   </form>
1.16      www       368: ENDSERVERFORM
1.108     tempelho  369: my $coursecatalog;
                    370: if (($showcoursecat eq '') || ($showcoursecat)) {
                    371:     $coursecatalog = &coursecatalog_link($lt{'catalog'});
                    372: }
                    373: my $newuserlink;
                    374: if ($shownewuserlink) {
1.114     tempelho  375:     $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
1.108     tempelho  376: }
                    377: my $logintitle;
                    378: if ($loginheader eq 'text') {
1.113     tempelho  379:     $logintitle ='<h2>'.$lt{'log'}.'</h2>';
1.108     tempelho  380: } else {
                    381:     $logintitle = '<img src="'.$login.'" alt="'.
                    382:                   &mt('User Authentication').'" />';
                    383: }
                    384: 
                    385: my $noscript_warning='<noscript><span class="LC_warning"><b>'
                    386:                      .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                    387:                     .'</b></span></noscript>';
                    388: my $helpdeskscript;
                    389: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                    390:                             $version,$authdomain,\$helpdeskscript);
1.107     tempelho  391: 
1.108     tempelho  392: my $loginform=(<<LFORM);
1.122     bisitz    393: <form name="client" action="" onsubmit="return(send())">
1.115     bisitz    394:   <input type="hidden" name="lextkey" value="$lextkey" />
                    395:   <input type="hidden" name="uextkey" value="$uextkey" />
1.108     tempelho  396:   <b><label for="uname">$lt{'un'}</label>:</b><br />
1.113     tempelho  397:   <input type="text" name="uname" size="15" value="$authusername" /><br />
1.108     tempelho  398:   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
1.113     tempelho  399:   <input type="password" name="upass$now" size="15" /><br />
1.108     tempelho  400:   <b><label for="udom">$lt{'dom'}</label>:</b><br />
1.113     tempelho  401:   <input type="text" name="udom" size="15" value="$authdomain" /><br />
1.108     tempelho  402:   <input type="submit" value="$lt{'log'}" />
                    403: </form>
                    404: LFORM
                    405: 
1.109     raeburn   406:     if ($showbanner) {
                    407:         $r->print(<<HEADER);
                    408: <!-- The LON-CAPA Header -->
                    409: <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">
                    410:  <tr>
                    411:   <td align="left" valign="top" bgcolor="$pgbg">
1.115     bisitz    412:       <img src="$img" border="0" alt="The Learning Online Network with CAPA" />
1.109     raeburn   413:   </td>
                    414:  </tr>
                    415: </table>
                    416: HEADER
                    417:     }
                    418:     $r->print(<<ENDTOP);
1.118     tempelho  419: <div class="LC_loginpage_space">&nbsp;</div>
                    420: <div class="LC_loginpage_floatLeft">
1.108     tempelho  421: <div class="LC_loginpage_loginContainer">
1.112     muellerd  422:   $logintitle
                    423:    <table border="0" align="left" cellspacing="1" cellpadding="2" width="100%">
1.108     tempelho  424:       <tr>
                    425: 	   <td>
                    426: 		$loginform
                    427:            </td>
                    428:       </tr>
                    429:    </table>   	
                    430:    $noscript_warning
                    431: </div>
1.107     tempelho  432:   
                    433: <div class="LC_loginpage_loginInfo">
                    434:         $loginhelp<br />
1.114     tempelho  435:         $forgotpw<br />
                    436: 	$contactblock<br />
                    437:         $newuserlink
1.119     tempelho  438:         $coursecatalog
1.107     tempelho  439: </div>
1.118     tempelho  440: </div>
                    441: ENDTOP
                    442:     if ($showmainlogo) {
                    443:         $r->print(' <img src="'.$logo.'" alt="" />'."\n");
                    444:     }
                    445: $r->print(<<ENDTOP);
                    446: $announcements
                    447: $domainlogo
1.107     tempelho  448: <div class="LC_loginpage_space">&nbsp;</div>
1.108     tempelho  449: ENDTOP
                    450: 
                    451: $r->print(<<ENDDOCUMENT);
1.115     bisitz    452:      <table border="0" cellspacing="0" cellpadding="0">
1.14      albertel  453:       <tr>
1.110     muellerd  454:        <td  align="left" valign="top">
1.51      www       455:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
1.14      albertel  456:        </td>
1.110     muellerd  457:        <td  align="left" valign="top">
1.14      albertel  458:         <small><tt>&nbsp;$domain</tt></small>
                    459:        </td>
                    460:       </tr>
                    461:       <tr>
1.110     muellerd  462:        <td  align="left" valign="top">
1.51      www       463:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
1.14      albertel  464:        </td>
1.110     muellerd  465:        <td align="left" valign="top">
1.14      albertel  466:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
                    467:        </td>
                    468:       </tr>
                    469:       <tr>
1.110     muellerd  470:        <td align="left" valign="top">
1.52      www       471:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
1.14      albertel  472:        </td>
1.110     muellerd  473:        <td align="left" valign="top">
1.51      www       474:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
1.42      albertel  475:        </td>
                    476:       </tr>
                    477:       <tr>
1.110     muellerd  478:        <td align="left" valign="top">
1.52      www       479:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
1.42      albertel  480:        </td>
1.110     muellerd  481:        <td align="left" valign="top">
1.51      www       482:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
1.14      albertel  483:        </td>
                    484:       </tr>
                    485:      </table>
1.107     tempelho  486:  </div>
1.25      bowersj2  487: 
1.59      albertel  488: <script type="text/javascript">
1.122     bisitz    489: // <![CDATA[
1.59      albertel  490: // the if prevents the script error if the browser can not handle this
1.25      bowersj2  491: if ( document.client.uname ) { document.client.uname.focus(); }
1.122     bisitz    492: // ]]>
1.25      bowersj2  493: </script>
1.62      raeburn   494: $helpdeskscript
1.14      albertel  495: 
1.1       albertel  496: ENDDOCUMENT
1.98      raeburn   497:     my %endargs = ( 'noredirectlink' => 1, );
                    498:     $r->print(&Apache::loncommon::end_page(\%endargs));
1.1       albertel  499:     return OK;
1.60      raeburn   500: }
                    501: 
                    502: sub contactdisplay {
1.90      raeburn   503:     my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60      raeburn   504:     my $contactblock;
1.62      raeburn   505:     my $showhelpdesk = 0;
                    506:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                    507:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
                    508:         $showhelpdesk = 1;
                    509:     }
1.90      raeburn   510:     if ($servadm && $showadminmail) {
                    511:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.
                    512:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';
                    513:     }
1.60      raeburn   514:     if ($showhelpdesk) {
1.114     tempelho  515:         $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
1.75      www       516:         my $thisurl = &escape('/adm/login');
1.62      raeburn   517:         $$helpdeskscript = <<"ENDSCRIPT";
                    518: <script type="text/javascript">
1.122     bisitz    519: // <![CDATA[
1.62      raeburn   520: function helpdesk() {
                    521:     var codedom = document.client.udom.value;
                    522:     if (codedom == '') {
                    523:         codedom = "$authdomain";
                    524:     }
                    525:     var querystr = "origurl=$thisurl&codedom="+codedom;
                    526:     document.location.href = "/adm/helpdesk?"+querystr;
                    527:     return;
                    528: }
1.122     bisitz    529: // ]]>
1.62      raeburn   530: </script>
                    531: ENDSCRIPT
1.60      raeburn   532:     }
                    533:     $contactblock .= <<"ENDBLOCK";
                    534:      &nbsp;&nbsp;&nbsp;$version
                    535: ENDBLOCK
                    536:     return $contactblock;
                    537: }
1.83      raeburn   538: 
                    539: sub forgotpwdisplay {
1.84      raeburn   540:     my (%lt) = @_;
1.83      raeburn   541:     my $prompt_for_resetpw = 1; 
                    542:     if ($prompt_for_resetpw) {
1.107     tempelho  543:         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
1.84      raeburn   544:     }
                    545:     return;
                    546: }
                    547: 
                    548: sub loginhelpdisplay {
                    549:     my (%lt) = @_;
                    550:     my $login_help = 1;
                    551:     if ($login_help) {
1.107     tempelho  552:         return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
1.83      raeburn   553:     }
                    554:     return;
                    555: }
1.1       albertel  556: 
1.90      raeburn   557: sub coursecatalog_link {
                    558:     my ($linkname) = @_;
                    559:     return <<"END";
1.107     tempelho  560:       <a href="/adm/coursecatalog">$linkname</a>
1.90      raeburn   561: END
                    562: }
                    563: 
1.101     raeburn   564: sub newuser_link {
                    565:     my ($linkname) = @_;
                    566:     return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
                    567: }
                    568: 
1.1       albertel  569: 1;
                    570: __END__

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