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

1.1       albertel    1: # The LearningOnline Network
                      2: # Login Screen
1.11      www         3: #
1.111   ! muellerd    4: # $Id: lonlogin.pm,v 1.110 2008/12/03 13:07:15 muellerd 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.107     tempelho  105:    # my $textbrowsers=$r->dir_config('lonTextBrowsers');
1.32      www       106:     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
                    107:     
1.107     tempelho  108:    # foreach (split(/\:/,$textbrowsers)) {
                    109: #	if ($httpbrowser=~/$_/i) {
                    110: #	    $env{'form.interface'}='textual';
                    111: #        }
                    112: #    }
1.32      www       113: 
1.63      albertel  114:     my $fullgraph=($env{'form.interface'} ne 'textual');
1.94      albertel  115: 
                    116:     my $iconpath= 
                    117: 	&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
                    118: 
1.87      raeburn   119:     my $domain = &Apache::lonnet::default_login_domain();
1.63      albertel  120:     if (($env{'form.domain'}) && 
1.89      albertel  121: 	(&Apache::lonnet::domain($env{'form.domain'},'description'))) {
1.63      albertel  122: 	$domain=$env{'form.domain'};
1.46      www       123:     }
1.1       albertel  124:     my $role    = $r->dir_config('lonRole');
                    125:     my $loadlim = $r->dir_config('lonLoadLim');
1.90      raeburn   126:     my $servadm = $r->dir_config('lonAdmEMail');
1.1       albertel  127:     my $lonhost = $r->dir_config('lonHostID');
                    128:     my $tabdir  = $r->dir_config('lonTabDir');
1.6       www       129:     my $include = $r->dir_config('lonIncludes');
1.37      www       130:     my $expire  = $r->dir_config('lonExpire');
1.44      www       131:     my $version = $r->dir_config('lonVersion');
1.88      albertel  132:     my $host_name = &Apache::lonnet::hostname($lonhost);
1.1       albertel  133: 
1.30      www       134: # --------------------------------------------- Default values for login fields
                    135: 
1.63      albertel  136:     my $authusername=($env{'form.username'}?$env{'form.username'}:'');
                    137:     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
1.30      www       138: 
                    139: # ---------------------------------------------------------- Determine own load
1.1       albertel  140:     my $loadavg;
1.41      albertel  141:     {
                    142: 	my $loadfile=Apache::File->new('/proc/loadavg');
                    143: 	$loadavg=<$loadfile>;
                    144:     }
1.1       albertel  145:     $loadavg =~ s/\s.*//g;
1.57      matthew   146:     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
1.41      albertel  147:     my $userloadpercent=&Apache::lonnet::userload();
1.1       albertel  148: 
1.30      www       149: # ------------------------------------------------------- Do the load balancing
1.80      albertel  150:     my $otherserver= &Apache::lonnet::absolute_url($host_name);
1.31      www       151:     my $firsturl=
1.63      albertel  152:     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.97      albertel  153: # ---------------------------------------------------------- Are we overloaded?
                    154:     if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47      albertel  155:         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
                    156: 	if ($unloaded) { $otherserver=$unloaded; }
1.1       albertel  157:     }
1.6       www       158: 
1.45      www       159: # ----------------------------------------------------------- Get announcements
                    160:     my $announcements=&Apache::lonnet::getannounce();
1.6       www       161: # -------------------------------------------------------- Set login parameters
                    162: 
                    163:     my @hexstr=('0','1','2','3','4','5','6','7',
                    164:                 '8','9','a','b','c','d','e','f');
                    165:     my $lkey='';
                    166:     for (0..7) {
                    167:         $lkey.=$hexstr[rand(15)];
                    168:     }
                    169: 
                    170:     my $ukey='';
                    171:     for (0..7) {
                    172:         $ukey.=$hexstr[rand(15)];
                    173:     }
                    174: 
                    175:     my $lextkey=hex($lkey);
1.15      www       176:     if ($lextkey>2147483647) { $lextkey-=4294967296; }
                    177: 
1.6       www       178:     my $uextkey=hex($ukey);
1.15      www       179:     if ($uextkey>2147483647) { $uextkey-=4294967296; }
                    180: 
1.31      www       181: # -------------------------------------------------------- Store away log token
1.6       www       182:     my $logtoken=Apache::lonnet::reply(
1.7       www       183:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6       www       184:        $lonhost);
1.31      www       185: 
                    186: # ------------------- If we cannot talk to ourselves, we are in serious trouble
                    187: 
                    188:     if ($logtoken eq 'con_lost') {
                    189:         my $spares='';
1.64      albertel  190: 	my $last;
                    191:         foreach my $hostid (sort
                    192: 			    {
1.88      albertel  193: 				&Apache::lonnet::hostname($a) cmp
                    194: 				    &Apache::lonnet::hostname($b);
1.64      albertel  195: 			    }
                    196: 			    keys(%Apache::lonnet::spareid)) {
1.58      matthew   197:             next if ($hostid eq $lonhost);
1.88      albertel  198: 	    my $hostname = &Apache::lonnet::hostname($hostid);
                    199: 	    next if ($last eq $hostname);
1.58      matthew   200:             $spares.='<br /><font size="+1"><a href="http://'.
1.88      albertel  201:                 $hostname.
1.58      matthew   202:                 '/adm/login?domain='.$authdomain.'">'.
1.88      albertel  203:                 $hostname.'</a>'.
1.106     bisitz    204:                 ' '.&mt('(preferred)').'</font>'.$/;
1.88      albertel  205: 	    $last=$hostname;
1.58      matthew   206:         }
1.107     tempelho  207: $spares.= '<br />';
                    208: my %all_hostnames = &Apache::lonnet::all_hostnames();
                    209: foreach my $hostid (sort
                    210: 		    {
                    211: 			&Apache::lonnet::hostname($a) cmp
                    212: 			    &Apache::lonnet::hostname($b);
                    213: 		    }
                    214: 		    keys(%all_hostnames)) {
                    215:     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
                    216:     my $hostname = &Apache::lonnet::hostname($hostid);
                    217:     next if ($last eq $hostname);
                    218:     $spares.='<br /><a href="http://'.
                    219: 	$hostname.
                    220: 	'/adm/login?domain='.$authdomain.'">'.
                    221: 	$hostname.'</a>';
                    222:     $last=$hostname;
                    223: }
                    224: $r->print(
                    225:    '<html>'
                    226:   .'<head><title>'
                    227:   .&mt('The LearningOnline Network with CAPA')
                    228:   .'</title></head>'
                    229:   .'<body bgcolor="#FFFFFF">'
                    230:   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
                    231:   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
                    232:   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
                    233:   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
                    234:   .$spares
                    235:   .'</body>'
                    236:   .'</html>'
                    237: );
                    238: return OK;
                    239: }
1.31      www       240: 
                    241: # ----------------------------------------------- Apparently we are in business
1.107     tempelho  242: $servadm=~s/\,/\<br \/\>/g;
1.38      www       243: 
1.21      www       244: # ----------------------------------------------------------- Front page design
1.107     tempelho  245: my $pgbg=
                    246: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
                    247: my $font=
                    248: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
                    249: my $link=
                    250: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
                    251: my $vlink=
                    252: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
                    253: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
                    254: my $mainbg=
                    255: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
                    256: my $textcol = 
                    257: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
                    258: my $bgcol =
                    259: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
                    260: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
                    261: my $img=&Apache::loncommon::designparm('login.img',$domain);
                    262: my $domainlogo=&Apache::loncommon::domainlogo($domain);
                    263: my $login=&Apache::loncommon::designparm('login.login',$domain);
                    264: if ($login eq '') {
                    265: $login = $iconpath.'/'.&mt('userauthentication.gif');
                    266: }
1.109     raeburn   267: my $showbanner = 1;
                    268: my $showmainlogo = 1;
                    269: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
                    270:     $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
                    271: }
                    272: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
                    273:     $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
                    274: }
1.107     tempelho  275: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
                    276: my $showcoursecat =
                    277: &Apache::loncommon::designparm('login.coursecatalog',$domain);
                    278: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
                    279: my $shownewuserlink = 
                    280: &Apache::loncommon::designparm('login.newuser',$domain);
                    281: my $now=time;
                    282: my $js = (<<ENDSCRIPT);
                    283: 
                    284: <script language="JavaScript">
                    285: function send()
                    286: {
                    287: this.document.server.elements.uname.value
                    288: =this.document.client.elements.uname.value;
                    289: 
                    290: this.document.server.elements.udom.value
                    291: =this.document.client.elements.udom.value;
                    292: 
                    293: uextkey=this.document.client.elements.uextkey.value;
                    294: lextkey=this.document.client.elements.lextkey.value;
                    295: initkeys();
                    296: 
                    297: this.document.server.elements.upass0.value
                    298:     =crypted(this.document.client.elements.upass$now.value.substr(0,15));
                    299: this.document.server.elements.upass1.value
                    300:     =crypted(this.document.client.elements.upass$now.value.substr(15,15));
                    301: this.document.server.elements.upass2.value
                    302:     =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.6       www       303: 
1.107     tempelho  304: this.document.client.elements.uname.value='';
                    305: this.document.client.elements.upass$now.value='';
1.6       www       306: 
1.107     tempelho  307: this.document.server.submit();
                    308: return false;
                    309: }
                    310: </script>
1.98      raeburn   311: 
1.16      www       312: ENDSCRIPT
1.6       www       313: 
1.98      raeburn   314: # --------------------------------------------------- Print login screen header
                    315: 
1.107     tempelho  316: my %add_entries = (topmargin    => "0",
                    317: 	       leftmargin   => "0",
                    318: 	       marginheight => "0",
                    319: 	       marginwidth  => "0",
1.108     tempelho  320: 	       bgcolor      => "$mainbg",
1.107     tempelho  321: 	       text         => "$font",
                    322: 	       link         => "$link",
                    323: 	       vlink        => "$vlink",
                    324: 	       alink        => "$alink",);
                    325: 
                    326: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
                    327: 			       { 'redirect'       => [$expire,'/adm/roles'], 
                    328: 				 'add_entries' => \%add_entries,
                    329: 				 'only_body'   => 1,}));
1.98      raeburn   330: 
                    331: # ----------------------------------------------------------------------- Texts
                    332: 
                    333: my %lt=&Apache::lonlocal::texthash(
1.107     tempelho  334: 	  'un'  => 'Username',
                    335: 	  'pw'  => 'Password',
                    336: 	  'dom' => 'Domain',
                    337: 	  'perc' => 'percent',
                    338: 	  'load' => 'Server Load',
                    339: 	  'userload' => 'User Load',
                    340: 	  'about'  => 'About LON-CAPA',
                    341: 	  'catalog' => 'Course Catalog',
                    342: 	  'log' => 'Log in',
                    343: 	  'help' => 'Log-in Help',
                    344: 	  'serv' => 'Server',
                    345: 	  'servadm' => 'Server Administration',
                    346: 	  'helpdesk' => 'Contact Helpdesk',
                    347: 	  'forgotpw' => 'Forgot password?',
                    348: 	  'newuser'  => 'New User?',
1.111   ! muellerd  349: 	  );
1.98      raeburn   350: # -------------------------------------------------- Change password field name
1.107     tempelho  351: my $forgotpw = &forgotpwdisplay(%lt);
                    352: my $loginhelp = &loginhelpdisplay(%lt);
1.98      raeburn   353: 
                    354: # ---------------------------------------------------- Serve out DES JavaScript
1.107     tempelho  355: {
                    356: my $jsh=Apache::File->new($include."/londes.js");
                    357: $r->print(<$jsh>);
                    358: }
1.98      raeburn   359: # ---------------------------------------------------------- Serve rest of page
                    360: 
1.107     tempelho  361: if ($fullgraph) {
                    362: $r->print(
                    363: 	  '<div class="LC_loginpage_container">');
                    364: }
1.6       www       365: 
1.107     tempelho  366: $r->print(<<ENDSERVERFORM);
                    367: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33      www       368:    <input type="hidden" name="logtoken" value="$logtoken" />
                    369:    <input type="hidden" name="serverid" value="$lonhost" />
                    370:    <input type="hidden" name="uname" value="" />
1.65      www       371:    <input type="hidden" name="upass0" value="" />
                    372:    <input type="hidden" name="upass1" value="" />
                    373:    <input type="hidden" name="upass2" value="" />
1.33      www       374:    <input type="hidden" name="udom" value="" />
1.63      albertel  375:    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
                    376:    <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14      albertel  377:   </form>
1.16      www       378: ENDSERVERFORM
1.108     tempelho  379: my $coursecatalog;
                    380: if (($showcoursecat eq '') || ($showcoursecat)) {
                    381:     $coursecatalog = &coursecatalog_link($lt{'catalog'});
                    382: }
                    383: my $newuserlink;
                    384: if ($shownewuserlink) {
                    385:     $newuserlink = &newuser_link($lt{'newuser'});
                    386: }
                    387: my $logintitle;
                    388: if ($loginheader eq 'text') {
                    389:     $logintitle = $lt{'log'};
                    390: } else {
                    391:     $logintitle = '<img src="'.$login.'" alt="'.
                    392:                   &mt('User Authentication').'" />';
                    393: }
                    394: 
                    395: my $noscript_warning='<noscript><span class="LC_warning"><b>'
                    396:                      .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                    397:                     .'</b></span></noscript>';
                    398: my $helpdeskscript;
                    399: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                    400:                             $version,$authdomain,\$helpdeskscript);
1.107     tempelho  401: 
1.108     tempelho  402: my $loginform=(<<LFORM);
                    403: <form name="client" onsubmit="return(send())">
                    404:   <input type="hidden" name="lextkey" value="$lextkey">
                    405:   <input type="hidden" name="uextkey" value="$uextkey">
                    406:   <b><label for="uname">$lt{'un'}</label>:</b><br />
                    407:   <input type="text" name="uname" size="10" value="$authusername" /><br />
                    408:   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
                    409:   <input type="password" name="upass$now" size="10" /><br />
                    410:   <b><label for="udom">$lt{'dom'}</label>:</b><br />
                    411:   <input type="text" name="udom" size="10" value="$authdomain" /><br />
                    412:   <input type="submit" value="$lt{'log'}" />
                    413: </form>
                    414: LFORM
                    415: 
1.109     raeburn   416: if ($fullgraph) {
                    417:     if ($showbanner) {
                    418:         $r->print(<<HEADER);
                    419: <!-- The LON-CAPA Header -->
                    420: <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">
                    421:  <tr>
                    422:   <td align="left" valign="top" bgcolor="$pgbg">
                    423:       <img src="$img" border=0 alt="The Learning Online Network with CAPA" />
                    424:   </td>
                    425:  </tr>
                    426: </table>
                    427: HEADER
                    428:     }
                    429:     if ($showmainlogo) {
                    430:         $r->print('<div class="LC_loginpage_space">&nbsp;</div>'."\n".
                    431:                   '    <img src="'.$logo.'" alt="" />'."\n");
                    432:     }
                    433:     $r->print(<<ENDTOP);
1.108     tempelho  434: <div class="LC_loginpage_loginContainer">
                    435:  <fieldset class="LC_loginpage_fieldset">
                    436:   <legend class="LC_loginpage_legend">$logintitle</legend>
                    437:    <table border="0" align="left" cellspacing="1" cellpadding="1" width="100%">
                    438:       <tr>
                    439:    	   <td width="50%" align="center" valign="top">
                    440: 		$domainlogo
                    441: 	   </td>
                    442: 	   <td>
                    443: 		$loginform
                    444:            </td>
                    445:       </tr>
                    446:    </table>   	
                    447:    $noscript_warning
                    448:  </fieldset>
                    449: </div>
1.107     tempelho  450:   
                    451: <div class="LC_loginpage_loginInfo">
                    452:         $loginhelp<br />
                    453:         $forgotpw<br /><br />
                    454:         $newuserlink<br />
                    455:         $coursecatalog<br /><br />
1.111   ! muellerd  456:         <a href="/adm/about.html"><b>$lt{'about'}</b></a><br/>
        !           457: 	$contactblock
1.107     tempelho  458: </div>
1.108     tempelho  459: 
1.107     tempelho  460: <div class="LC_loginpage_space">&nbsp;</div>
                    461: $announcements
1.108     tempelho  462: ENDTOP
1.107     tempelho  463: }
1.108     tempelho  464: 
1.107     tempelho  465: if($announcements){$r->print('<div class="LC_loginpage_space">&nbsp;</div>');}
1.14      albertel  466: 
1.108     tempelho  467: if ($fullgraph) {
                    468: $r->print(<<ENDDOCUMENT);
1.14      albertel  469:      <table border=0 cellspacing=0 cellpadding=0>
                    470:       <tr>
1.110     muellerd  471:        <td  align="left" valign="top">
1.51      www       472:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
1.14      albertel  473:        </td>
1.110     muellerd  474:        <td  align="left" valign="top">
1.14      albertel  475:         <small><tt>&nbsp;$domain</tt></small>
                    476:        </td>
                    477:       </tr>
                    478:       <tr>
1.110     muellerd  479:        <td  align="left" valign="top">
1.51      www       480:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
1.14      albertel  481:        </td>
1.110     muellerd  482:        <td align="left" valign="top">
1.14      albertel  483:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
                    484:        </td>
                    485:       </tr>
                    486:       <tr>
1.110     muellerd  487:        <td align="left" valign="top">
1.52      www       488:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
1.14      albertel  489:        </td>
1.110     muellerd  490:        <td align="left" valign="top">
1.51      www       491:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
1.42      albertel  492:        </td>
                    493:       </tr>
                    494:       <tr>
1.110     muellerd  495:        <td align="left" valign="top">
1.52      www       496:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
1.42      albertel  497:        </td>
1.110     muellerd  498:        <td align="left" valign="top">
1.51      www       499:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
1.14      albertel  500:        </td>
                    501:       </tr>
                    502:      </table>
1.107     tempelho  503:  </div>
1.25      bowersj2  504: 
1.59      albertel  505: <script type="text/javascript">
                    506: // the if prevents the script error if the browser can not handle this
1.25      bowersj2  507: if ( document.client.uname ) { document.client.uname.focus(); }
                    508: </script>
1.62      raeburn   509: $helpdeskscript
1.14      albertel  510: 
1.1       albertel  511: ENDDOCUMENT
1.16      www       512: }
1.98      raeburn   513:     my %endargs = ( 'noredirectlink' => 1, );
                    514:     $r->print(&Apache::loncommon::end_page(\%endargs));
1.1       albertel  515:     return OK;
1.60      raeburn   516: }
                    517: 
                    518: sub contactdisplay {
1.90      raeburn   519:     my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60      raeburn   520:     my $contactblock;
1.62      raeburn   521:     my $showhelpdesk = 0;
                    522:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                    523:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
                    524:         $showhelpdesk = 1;
                    525:     }
1.90      raeburn   526:     if ($servadm && $showadminmail) {
                    527:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.
                    528:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';
                    529:     }
1.60      raeburn   530:     if ($showhelpdesk) {
1.111   ! muellerd  531:         $contactblock .= '<b><a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a></b><br />';
1.75      www       532:         my $thisurl = &escape('/adm/login');
1.62      raeburn   533:         $$helpdeskscript = <<"ENDSCRIPT";
                    534: <script type="text/javascript">
                    535: function helpdesk() {
                    536:     var codedom = document.client.udom.value;
                    537:     if (codedom == '') {
                    538:         codedom = "$authdomain";
                    539:     }
                    540:     var querystr = "origurl=$thisurl&codedom="+codedom;
                    541:     document.location.href = "/adm/helpdesk?"+querystr;
                    542:     return;
                    543: }
                    544: </script>
                    545: ENDSCRIPT
1.60      raeburn   546:     }
                    547:     $contactblock .= <<"ENDBLOCK";
                    548:      &nbsp;&nbsp;&nbsp;$version
                    549: ENDBLOCK
                    550:     return $contactblock;
                    551: }
1.83      raeburn   552: 
                    553: sub forgotpwdisplay {
1.84      raeburn   554:     my (%lt) = @_;
1.83      raeburn   555:     my $prompt_for_resetpw = 1; 
                    556:     if ($prompt_for_resetpw) {
1.107     tempelho  557:         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
1.84      raeburn   558:     }
                    559:     return;
                    560: }
                    561: 
                    562: sub loginhelpdisplay {
                    563:     my (%lt) = @_;
                    564:     my $login_help = 1;
                    565:     if ($login_help) {
1.107     tempelho  566:         return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
1.83      raeburn   567:     }
                    568:     return;
                    569: }
1.1       albertel  570: 
1.90      raeburn   571: sub coursecatalog_link {
                    572:     my ($linkname) = @_;
                    573:     return <<"END";
1.107     tempelho  574:       <a href="/adm/coursecatalog">$linkname</a>
1.90      raeburn   575: END
                    576: }
                    577: 
1.101     raeburn   578: sub newuser_link {
                    579:     my ($linkname) = @_;
                    580:     return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
                    581: }
                    582: 
1.1       albertel  583: 1;
                    584: __END__

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