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

1.1       albertel    1: # The LearningOnline Network
                      2: # Login Screen
1.11      www         3: #
1.114   ! tempelho    4: # $Id: lonlogin.pm,v 1.113 2008/12/15 11:44:46 tempelho Exp $
1.11      www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
1.14      albertel   28: 
1.1       albertel   29: package Apache::lonlogin;
                     30: 
                     31: use strict;
                     32: use Apache::Constants qw(:common);
                     33: use Apache::File ();
1.63      albertel   34: use Apache::lonnet;
1.12      albertel   35: use Apache::loncommon();
1.49      www        36: use Apache::lonauth();
1.50      www        37: use Apache::lonlocal;
1.71      albertel   38: use Apache::migrateuser();
1.75      www        39: use lib '/home/httpd/lib/perl/';
                     40: use LONCAPA;
                     41:  
1.1       albertel   42: sub handler {
                     43:     my $r = shift;
1.71      albertel   44: 
                     45:     &Apache::loncommon::get_unprocessed_cgi
1.79      albertel   46: 	(join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
                     47: 	      $ENV{'REDIRECT_QUERY_STRING'}),
1.71      albertel   48: 	 ['interface','username','domain','firsturl','localpath','localres',
                     49: 	  'token']);
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.100     bisitz     87:                  .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].',
                     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"};
                    106:     
1.63      albertel  107:     my $fullgraph=($env{'form.interface'} ne 'textual');
1.94      albertel  108: 
                    109:     my $iconpath= 
                    110: 	&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
                    111: 
1.87      raeburn   112:     my $domain = &Apache::lonnet::default_login_domain();
1.63      albertel  113:     if (($env{'form.domain'}) && 
1.89      albertel  114: 	(&Apache::lonnet::domain($env{'form.domain'},'description'))) {
1.63      albertel  115: 	$domain=$env{'form.domain'};
1.46      www       116:     }
1.1       albertel  117:     my $role    = $r->dir_config('lonRole');
                    118:     my $loadlim = $r->dir_config('lonLoadLim');
1.90      raeburn   119:     my $servadm = $r->dir_config('lonAdmEMail');
1.1       albertel  120:     my $lonhost = $r->dir_config('lonHostID');
                    121:     my $tabdir  = $r->dir_config('lonTabDir');
1.6       www       122:     my $include = $r->dir_config('lonIncludes');
1.37      www       123:     my $expire  = $r->dir_config('lonExpire');
1.44      www       124:     my $version = $r->dir_config('lonVersion');
1.88      albertel  125:     my $host_name = &Apache::lonnet::hostname($lonhost);
1.1       albertel  126: 
1.30      www       127: # --------------------------------------------- Default values for login fields
                    128: 
1.63      albertel  129:     my $authusername=($env{'form.username'}?$env{'form.username'}:'');
                    130:     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
1.30      www       131: 
                    132: # ---------------------------------------------------------- Determine own load
1.1       albertel  133:     my $loadavg;
1.41      albertel  134:     {
                    135: 	my $loadfile=Apache::File->new('/proc/loadavg');
                    136: 	$loadavg=<$loadfile>;
                    137:     }
1.1       albertel  138:     $loadavg =~ s/\s.*//g;
1.57      matthew   139:     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
1.41      albertel  140:     my $userloadpercent=&Apache::lonnet::userload();
1.1       albertel  141: 
1.30      www       142: # ------------------------------------------------------- Do the load balancing
1.80      albertel  143:     my $otherserver= &Apache::lonnet::absolute_url($host_name);
1.31      www       144:     my $firsturl=
1.63      albertel  145:     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.97      albertel  146: # ---------------------------------------------------------- Are we overloaded?
                    147:     if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47      albertel  148:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
                    149: 	if ($unloaded) { $otherserver=$unloaded; }
1.1       albertel  150:     }
1.6       www       151: 
1.45      www       152: # ----------------------------------------------------------- Get announcements
                    153:     my $announcements=&Apache::lonnet::getannounce();
1.6       www       154: # -------------------------------------------------------- Set login parameters
                    155: 
                    156:     my @hexstr=('0','1','2','3','4','5','6','7',
                    157:                 '8','9','a','b','c','d','e','f');
                    158:     my $lkey='';
                    159:     for (0..7) {
                    160:         $lkey.=$hexstr[rand(15)];
                    161:     }
                    162: 
                    163:     my $ukey='';
                    164:     for (0..7) {
                    165:         $ukey.=$hexstr[rand(15)];
                    166:     }
                    167: 
                    168:     my $lextkey=hex($lkey);
1.15      www       169:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
                    170: 
1.6       www       171:     my $uextkey=hex($ukey);
1.15      www       172:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
                    173: 
1.31      www       174: # -------------------------------------------------------- Store away log token
1.6       www       175:     my $logtoken=Apache::lonnet::reply(
1.7       www       176:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6       www       177:        $lonhost);
1.31      www       178: 
                    179: # ------------------- If we cannot talk to ourselves, we are in serious trouble
                    180: 
                    181:     if ($logtoken eq 'con_lost') {
                    182:         my $spares='';
1.64      albertel  183: 	my $last;
                    184:         foreach my $hostid (sort
                    185: 			    {
1.88      albertel  186: 				&Apache::lonnet::hostname($a) cmp
                    187: 				    &Apache::lonnet::hostname($b);
1.64      albertel  188: 			    }
                    189: 			    keys(%Apache::lonnet::spareid)) {
1.58      matthew   190:             next if ($hostid eq $lonhost);
1.88      albertel  191: 	    my $hostname = &Apache::lonnet::hostname($hostid);
                    192: 	    next if ($last eq $hostname);
1.58      matthew   193:             $spares.='<br /><font size="+1"><a href="http://'.
1.88      albertel  194:                 $hostname.
1.58      matthew   195:                 '/adm/login?domain='.$authdomain.'">'.
1.88      albertel  196:                 $hostname.'</a>'.
1.106     bisitz    197:                 ' '.&mt('(preferred)').'</font>'.$/;
1.88      albertel  198: 	    $last=$hostname;
1.58      matthew   199:         }
1.107     tempelho  200: $spares.= '<br />';
                    201: my %all_hostnames = &Apache::lonnet::all_hostnames();
                    202: foreach my $hostid (sort
                    203: 		    {
                    204: 			&Apache::lonnet::hostname($a) cmp
                    205: 			    &Apache::lonnet::hostname($b);
                    206: 		    }
                    207: 		    keys(%all_hostnames)) {
                    208:     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
                    209:     my $hostname = &Apache::lonnet::hostname($hostid);
                    210:     next if ($last eq $hostname);
                    211:     $spares.='<br /><a href="http://'.
                    212: 	$hostname.
                    213: 	'/adm/login?domain='.$authdomain.'">'.
                    214: 	$hostname.'</a>';
                    215:     $last=$hostname;
                    216: }
                    217: $r->print(
                    218:    '<html>'
                    219:   .'<head><title>'
                    220:   .&mt('The LearningOnline Network with CAPA')
                    221:   .'</title></head>'
                    222:   .'<body bgcolor="#FFFFFF">'
                    223:   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
                    224:   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
                    225:   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
                    226:   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
                    227:   .$spares
                    228:   .'</body>'
                    229:   .'</html>'
                    230: );
                    231: return OK;
                    232: }
1.31      www       233: 
                    234: # ----------------------------------------------- Apparently we are in business
1.107     tempelho  235: $servadm=~s/\,/\<br \/\>/g;
1.38      www       236: 
1.21      www       237: # ----------------------------------------------------------- Front page design
1.107     tempelho  238: my $pgbg=
                    239: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
                    240: my $font=
                    241: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
                    242: my $link=
                    243: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
                    244: my $vlink=
                    245: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
                    246: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
                    247: my $mainbg=
                    248: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
                    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: 
                    273: <script language="JavaScript">
                    274: function send()
                    275: {
                    276: this.document.server.elements.uname.value
                    277: =this.document.client.elements.uname.value;
                    278: 
                    279: this.document.server.elements.udom.value
                    280: =this.document.client.elements.udom.value;
                    281: 
                    282: uextkey=this.document.client.elements.uextkey.value;
                    283: lextkey=this.document.client.elements.lextkey.value;
                    284: initkeys();
                    285: 
                    286: this.document.server.elements.upass0.value
                    287:     =crypted(this.document.client.elements.upass$now.value.substr(0,15));
                    288: this.document.server.elements.upass1.value
                    289:     =crypted(this.document.client.elements.upass$now.value.substr(15,15));
                    290: this.document.server.elements.upass2.value
                    291:     =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.6       www       292: 
1.107     tempelho  293: this.document.client.elements.uname.value='';
                    294: this.document.client.elements.upass$now.value='';
1.6       www       295: 
1.107     tempelho  296: this.document.server.submit();
                    297: return false;
                    298: }
                    299: </script>
1.98      raeburn   300: 
1.16      www       301: ENDSCRIPT
1.6       www       302: 
1.98      raeburn   303: # --------------------------------------------------- Print login screen header
                    304: 
1.107     tempelho  305: my %add_entries = (topmargin    => "0",
                    306: 	       leftmargin   => "0",
                    307: 	       marginheight => "0",
                    308: 	       marginwidth  => "0",
1.108     tempelho  309: 	       bgcolor      => "$mainbg",
1.107     tempelho  310: 	       text         => "$font",
                    311: 	       link         => "$link",
                    312: 	       vlink        => "$vlink",
                    313: 	       alink        => "$alink",);
                    314: 
                    315: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
                    316: 			       { 'redirect'       => [$expire,'/adm/roles'], 
                    317: 				 'add_entries' => \%add_entries,
                    318: 				 'only_body'   => 1,}));
1.98      raeburn   319: 
                    320: # ----------------------------------------------------------------------- Texts
                    321: 
                    322: my %lt=&Apache::lonlocal::texthash(
1.107     tempelho  323: 	  'un'  => 'Username',
                    324: 	  'pw'  => 'Password',
                    325: 	  'dom' => 'Domain',
                    326: 	  'perc' => 'percent',
                    327: 	  'load' => 'Server Load',
                    328: 	  'userload' => 'User Load',
                    329: 	  'about'  => 'About LON-CAPA',
                    330: 	  'catalog' => 'Course Catalog',
                    331: 	  'log' => 'Log in',
                    332: 	  'help' => 'Log-in Help',
                    333: 	  'serv' => 'Server',
                    334: 	  'servadm' => 'Server Administration',
                    335: 	  'helpdesk' => 'Contact Helpdesk',
                    336: 	  'forgotpw' => 'Forgot password?',
                    337: 	  'newuser'  => 'New User?',
1.111     muellerd  338: 	  );
1.98      raeburn   339: # -------------------------------------------------- Change password field name
1.107     tempelho  340: my $forgotpw = &forgotpwdisplay(%lt);
                    341: my $loginhelp = &loginhelpdisplay(%lt);
1.98      raeburn   342: 
                    343: # ---------------------------------------------------- Serve out DES JavaScript
1.107     tempelho  344: {
                    345: my $jsh=Apache::File->new($include."/londes.js");
                    346: $r->print(<$jsh>);
                    347: }
1.98      raeburn   348: # ---------------------------------------------------------- Serve rest of page
                    349: 
1.107     tempelho  350: if ($fullgraph) {
                    351: $r->print(
                    352: 	  '<div class="LC_loginpage_container">');
                    353: }
1.6       www       354: 
1.107     tempelho  355: $r->print(<<ENDSERVERFORM);
                    356: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33      www       357:    <input type="hidden" name="logtoken" value="$logtoken" />
                    358:    <input type="hidden" name="serverid" value="$lonhost" />
                    359:    <input type="hidden" name="uname" value="" />
1.65      www       360:    <input type="hidden" name="upass0" value="" />
                    361:    <input type="hidden" name="upass1" value="" />
                    362:    <input type="hidden" name="upass2" value="" />
1.33      www       363:    <input type="hidden" name="udom" value="" />
1.63      albertel  364:    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
                    365:    <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14      albertel  366:   </form>
1.16      www       367: ENDSERVERFORM
1.108     tempelho  368: my $coursecatalog;
                    369: if (($showcoursecat eq '') || ($showcoursecat)) {
                    370:     $coursecatalog = &coursecatalog_link($lt{'catalog'});
                    371: }
                    372: my $newuserlink;
                    373: if ($shownewuserlink) {
1.114   ! tempelho  374:     $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
1.108     tempelho  375: }
                    376: my $logintitle;
                    377: if ($loginheader eq 'text') {
1.113     tempelho  378:     $logintitle ='<h2>'.$lt{'log'}.'</h2>';
1.108     tempelho  379: } else {
                    380:     $logintitle = '<img src="'.$login.'" alt="'.
                    381:                   &mt('User Authentication').'" />';
                    382: }
                    383: 
                    384: my $noscript_warning='<noscript><span class="LC_warning"><b>'
                    385:                      .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                    386:                     .'</b></span></noscript>';
                    387: my $helpdeskscript;
                    388: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                    389:                             $version,$authdomain,\$helpdeskscript);
1.107     tempelho  390: 
1.108     tempelho  391: my $loginform=(<<LFORM);
                    392: <form name="client" onsubmit="return(send())">
                    393:   <input type="hidden" name="lextkey" value="$lextkey">
                    394:   <input type="hidden" name="uextkey" value="$uextkey">
                    395:   <b><label for="uname">$lt{'un'}</label>:</b><br />
1.113     tempelho  396:   <input type="text" name="uname" size="15" value="$authusername" /><br />
1.108     tempelho  397:   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
1.113     tempelho  398:   <input type="password" name="upass$now" size="15" /><br />
1.108     tempelho  399:   <b><label for="udom">$lt{'dom'}</label>:</b><br />
1.113     tempelho  400:   <input type="text" name="udom" size="15" value="$authdomain" /><br />
1.108     tempelho  401:   <input type="submit" value="$lt{'log'}" />
                    402: </form>
                    403: LFORM
                    404: 
1.109     raeburn   405: if ($fullgraph) {
                    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">
                    412:       <img src="$img" border=0 alt="The Learning Online Network with CAPA" />
                    413:   </td>
                    414:  </tr>
                    415: </table>
                    416: HEADER
                    417:     }
                    418:     if ($showmainlogo) {
                    419:         $r->print('<div class="LC_loginpage_space">&nbsp;</div>'."\n".
                    420:                   '    <img src="'.$logo.'" alt="" />'."\n");
                    421:     }
                    422:     $r->print(<<ENDTOP);
1.112     muellerd  423: <div class="LC_loginpage_loginDomain">$domainlogo</div>
1.108     tempelho  424: <div class="LC_loginpage_loginContainer">
1.112     muellerd  425:   $logintitle
                    426:    <table border="0" align="left" cellspacing="1" cellpadding="2" width="100%">
1.108     tempelho  427:       <tr>
                    428: 	   <td>
                    429: 		$loginform
                    430:            </td>
                    431:       </tr>
                    432:    </table>   	
                    433:    $noscript_warning
                    434: </div>
1.107     tempelho  435:   
                    436: <div class="LC_loginpage_loginInfo">
                    437:         $loginhelp<br />
1.114   ! tempelho  438:         $forgotpw<br />
        !           439: 	$contactblock<br />
        !           440:         $newuserlink
1.107     tempelho  441:         $coursecatalog<br /><br />
1.114   ! tempelho  442:         <a href="/adm/about.html"><b>$lt{'about'}</b></a>
1.107     tempelho  443: </div>
1.108     tempelho  444: 
1.107     tempelho  445: <div class="LC_loginpage_space">&nbsp;</div>
                    446: $announcements
1.108     tempelho  447: ENDTOP
1.107     tempelho  448: }
1.108     tempelho  449: 
1.107     tempelho  450: if($announcements){$r->print('<div class="LC_loginpage_space">&nbsp;</div>');}
1.14      albertel  451: 
1.108     tempelho  452: if ($fullgraph) {
                    453: $r->print(<<ENDDOCUMENT);
1.14      albertel  454:      <table border=0 cellspacing=0 cellpadding=0>
                    455:       <tr>
1.110     muellerd  456:        <td  align="left" valign="top">
1.51      www       457:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
1.14      albertel  458:        </td>
1.110     muellerd  459:        <td  align="left" valign="top">
1.14      albertel  460:         <small><tt>&nbsp;$domain</tt></small>
                    461:        </td>
                    462:       </tr>
                    463:       <tr>
1.110     muellerd  464:        <td  align="left" valign="top">
1.51      www       465:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
1.14      albertel  466:        </td>
1.110     muellerd  467:        <td align="left" valign="top">
1.14      albertel  468:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
                    469:        </td>
                    470:       </tr>
                    471:       <tr>
1.110     muellerd  472:        <td align="left" valign="top">
1.52      www       473:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
1.14      albertel  474:        </td>
1.110     muellerd  475:        <td align="left" valign="top">
1.51      www       476:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
1.42      albertel  477:        </td>
                    478:       </tr>
                    479:       <tr>
1.110     muellerd  480:        <td align="left" valign="top">
1.52      www       481:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
1.42      albertel  482:        </td>
1.110     muellerd  483:        <td align="left" valign="top">
1.51      www       484:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
1.14      albertel  485:        </td>
                    486:       </tr>
                    487:      </table>
1.107     tempelho  488:  </div>
1.25      bowersj2  489: 
1.59      albertel  490: <script type="text/javascript">
                    491: // the if prevents the script error if the browser can not handle this
1.25      bowersj2  492: if ( document.client.uname ) { document.client.uname.focus(); }
                    493: </script>
1.62      raeburn   494: $helpdeskscript
1.14      albertel  495: 
1.1       albertel  496: ENDDOCUMENT
1.16      www       497: }
1.98      raeburn   498:     my %endargs = ( 'noredirectlink' => 1, );
                    499:     $r->print(&Apache::loncommon::end_page(\%endargs));
1.1       albertel  500:     return OK;
1.60      raeburn   501: }
                    502: 
                    503: sub contactdisplay {
1.90      raeburn   504:     my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60      raeburn   505:     my $contactblock;
1.62      raeburn   506:     my $showhelpdesk = 0;
                    507:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                    508:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
                    509:         $showhelpdesk = 1;
                    510:     }
1.90      raeburn   511:     if ($servadm && $showadminmail) {
                    512:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.
                    513:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';
                    514:     }
1.60      raeburn   515:     if ($showhelpdesk) {
1.114   ! tempelho  516:         $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
1.75      www       517:         my $thisurl = &escape('/adm/login');
1.62      raeburn   518:         $$helpdeskscript = <<"ENDSCRIPT";
                    519: <script type="text/javascript">
                    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: }
                    529: </script>
                    530: ENDSCRIPT
1.60      raeburn   531:     }
                    532:     $contactblock .= <<"ENDBLOCK";
                    533:      &nbsp;&nbsp;&nbsp;$version
                    534: ENDBLOCK
                    535:     return $contactblock;
                    536: }
1.83      raeburn   537: 
                    538: sub forgotpwdisplay {
1.84      raeburn   539:     my (%lt) = @_;
1.83      raeburn   540:     my $prompt_for_resetpw = 1; 
                    541:     if ($prompt_for_resetpw) {
1.107     tempelho  542:         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
1.84      raeburn   543:     }
                    544:     return;
                    545: }
                    546: 
                    547: sub loginhelpdisplay {
                    548:     my (%lt) = @_;
                    549:     my $login_help = 1;
                    550:     if ($login_help) {
1.107     tempelho  551:         return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
1.83      raeburn   552:     }
                    553:     return;
                    554: }
1.1       albertel  555: 
1.90      raeburn   556: sub coursecatalog_link {
                    557:     my ($linkname) = @_;
                    558:     return <<"END";
1.107     tempelho  559:       <a href="/adm/coursecatalog">$linkname</a>
1.90      raeburn   560: END
                    561: }
                    562: 
1.101     raeburn   563: sub newuser_link {
                    564:     my ($linkname) = @_;
                    565:     return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
                    566: }
                    567: 
1.1       albertel  568: 1;
                    569: __END__

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