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

1.1       albertel    1: # The LearningOnline Network
                      2: # Login Screen
1.11      www         3: #
1.108   ! tempelho    4: # $Id: lonlogin.pm,v 1.107 2008/11/22 19:07:02 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.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 $sidebg=
                    257: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
                    258: my $textcol = 
                    259: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
                    260: my $bgcol =
                    261: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
                    262: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
                    263: my $img=&Apache::loncommon::designparm('login.img',$domain);
                    264: my $domainlogo=&Apache::loncommon::domainlogo($domain);
                    265: my $login=&Apache::loncommon::designparm('login.login',$domain);
                    266: if ($login eq '') {
                    267: $login = $iconpath.'/'.&mt('userauthentication.gif');
                    268: }
                    269: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
                    270: my $showcoursecat =
                    271: &Apache::loncommon::designparm('login.coursecatalog',$domain);
                    272: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
                    273: my $shownewuserlink = 
                    274: &Apache::loncommon::designparm('login.newuser',$domain);
                    275: my $now=time;
                    276: my $js = (<<ENDSCRIPT);
                    277: 
                    278: <script language="JavaScript">
                    279: function send()
                    280: {
                    281: this.document.server.elements.uname.value
                    282: =this.document.client.elements.uname.value;
                    283: 
                    284: this.document.server.elements.udom.value
                    285: =this.document.client.elements.udom.value;
                    286: 
                    287: uextkey=this.document.client.elements.uextkey.value;
                    288: lextkey=this.document.client.elements.lextkey.value;
                    289: initkeys();
                    290: 
                    291: this.document.server.elements.upass0.value
                    292:     =crypted(this.document.client.elements.upass$now.value.substr(0,15));
                    293: this.document.server.elements.upass1.value
                    294:     =crypted(this.document.client.elements.upass$now.value.substr(15,15));
                    295: this.document.server.elements.upass2.value
                    296:     =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.6       www       297: 
1.107     tempelho  298: this.document.client.elements.uname.value='';
                    299: this.document.client.elements.upass$now.value='';
1.6       www       300: 
1.107     tempelho  301: this.document.server.submit();
                    302: return false;
                    303: }
                    304: </script>
1.98      raeburn   305: 
1.16      www       306: ENDSCRIPT
1.6       www       307: 
1.98      raeburn   308: # --------------------------------------------------- Print login screen header
                    309: 
1.107     tempelho  310: my %add_entries = (topmargin    => "0",
                    311: 	       leftmargin   => "0",
                    312: 	       marginheight => "0",
                    313: 	       marginwidth  => "0",
1.108   ! tempelho  314: 	       bgcolor      => "$mainbg",
1.107     tempelho  315: 	       text         => "$font",
                    316: 	       link         => "$link",
                    317: 	       vlink        => "$vlink",
                    318: 	       alink        => "$alink",);
                    319: 
                    320: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
                    321: 			       { 'redirect'       => [$expire,'/adm/roles'], 
                    322: 				 'add_entries' => \%add_entries,
                    323: 				 'only_body'   => 1,}));
1.98      raeburn   324: 
                    325: # ----------------------------------------------------------------------- Texts
                    326: 
                    327: my %lt=&Apache::lonlocal::texthash(
1.107     tempelho  328: 	  'un'  => 'Username',
                    329: 	  'pw'  => 'Password',
                    330: 	  'dom' => 'Domain',
                    331: 	  'perc' => 'percent',
                    332: 	  'load' => 'Server Load',
                    333: 	  'userload' => 'User Load',
                    334: 	  'about'  => 'About LON-CAPA',
                    335: 	  'catalog' => 'Course Catalog',
                    336: 	  'log' => 'Log in',
                    337: 	  'help' => 'Log-in Help',
                    338: 	  'serv' => 'Server',
                    339: 	  'servadm' => 'Server Administration',
                    340: 	  'helpdesk' => 'Contact Helpdesk',
                    341: 	  'forgotpw' => 'Forgot password?',
                    342: 	  'newuser'  => 'New User?',
                    343: 	  'options_headline' => 'Select Accessibility Options',
                    344: 	  'sprs_img' => 'Suppress rendering of images',
                    345: 	  'sprs_applet' => 'Suppress Java applets',
                    346: 	  'sprs_embed' => 'Suppress rendering of embedded multimedia',
                    347: 	  'sprs_font' => 'Increase font size',
                    348: 	  'sprs_blackwhite' => 'Switch to black and white mode',
                    349: 	  'remember' => 'Remember these settings for next login');
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);
        !           401: my $loncapaheader=(<<HEADER);
        !           402: <!-- The LON-CAPA Header -->
1.107     tempelho  403: <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">
1.108   ! tempelho  404:  <tr>
        !           405:   <td align="left" valign="top" bgcolor="$pgbg">
        !           406:       <img src="$img" border=0 alt="The Learning Online Network with CAPA" /> 
        !           407:   </td>
        !           408:  </tr>
1.107     tempelho  409: </table>
1.108   ! tempelho  410: HEADER
1.107     tempelho  411: 
1.108   ! tempelho  412: my $loginform=(<<LFORM);
        !           413: <form name="client" onsubmit="return(send())">
        !           414:   <input type="hidden" name="lextkey" value="$lextkey">
        !           415:   <input type="hidden" name="uextkey" value="$uextkey">
        !           416:   <b><label for="uname">$lt{'un'}</label>:</b><br />
        !           417:   <input type="text" name="uname" size="10" value="$authusername" /><br />
        !           418:   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
        !           419:   <input type="password" name="upass$now" size="10" /><br />
        !           420:   <b><label for="udom">$lt{'dom'}</label>:</b><br />
        !           421:   <input type="text" name="udom" size="10" value="$authdomain" /><br />
        !           422:   <input type="submit" value="$lt{'log'}" />
        !           423: </form>
        !           424: LFORM
        !           425: 
        !           426: if ($fullgraph) { 
        !           427: $r->print(<<ENDTOP);
        !           428: $loncapaheader
        !           429: <div class="LC_loginpage_space">&nbsp;</div>
1.107     tempelho  430:     <img src="$logo" alt="" />
1.14      albertel  431: 
1.108   ! tempelho  432: <div class="LC_loginpage_loginContainer">
        !           433:  <fieldset class="LC_loginpage_fieldset">
        !           434:   <legend class="LC_loginpage_legend">$logintitle</legend>
        !           435:    <table border="0" align="left" cellspacing="1" cellpadding="1" width="100%">
        !           436:       <tr>
        !           437:    	   <td width="50%" align="center" valign="top">
        !           438: 		$domainlogo
        !           439: 	   </td>
        !           440: 	   <td>
        !           441: 		$loginform
        !           442:            </td>
        !           443:       </tr>
        !           444:    </table>   	
        !           445:    $noscript_warning
        !           446:  </fieldset>
        !           447: </div>
1.107     tempelho  448:   
                    449: <div class="LC_loginpage_loginInfo">
                    450:         $loginhelp<br />
                    451:         $forgotpw<br /><br />
                    452:         $newuserlink<br />
                    453:         $coursecatalog<br /><br />
                    454:         <a href="/adm/about.html"><b>$lt{'about'}</b></a><br />
                    455:         $helpdeskscript
                    456: </div>
1.108   ! tempelho  457: 
1.107     tempelho  458: <div class="LC_loginpage_space">&nbsp;</div>
                    459: $announcements
1.108   ! tempelho  460: ENDTOP
1.107     tempelho  461: }
1.108   ! tempelho  462: 
1.107     tempelho  463: if($announcements){$r->print('<div class="LC_loginpage_space">&nbsp;</div>');}
1.14      albertel  464: 
1.108   ! tempelho  465: if ($fullgraph) {
        !           466: $r->print(<<ENDDOCUMENT);
1.14      albertel  467:      <table border=0 cellspacing=0 cellpadding=0>
                    468:       <tr>
1.21      www       469:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       470:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
1.14      albertel  471:        </td>
1.21      www       472:        <td bgcolor="$sidebg" align="left" valign="top">
1.14      albertel  473:         <small><tt>&nbsp;$domain</tt></small>
                    474:        </td>
                    475:       </tr>
                    476:       <tr>
1.21      www       477:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       478:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
1.14      albertel  479:        </td>
1.21      www       480:        <td bgcolor="$sidebg" align="left" valign="top">
1.14      albertel  481:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
                    482:        </td>
                    483:       </tr>
                    484:       <tr>
1.21      www       485:        <td bgcolor="$sidebg" align="left" valign="top">
1.52      www       486:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>
1.14      albertel  487:        </td>
1.21      www       488:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       489:         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
1.42      albertel  490:        </td>
                    491:       </tr>
                    492:       <tr>
                    493:        <td bgcolor="$sidebg" align="left" valign="top">
1.52      www       494:         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>
1.42      albertel  495:        </td>
                    496:        <td bgcolor="$sidebg" align="left" valign="top">
1.51      www       497:         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
1.14      albertel  498:        </td>
                    499:       </tr>
                    500:      </table>
1.107     tempelho  501:      
1.60      raeburn   502:     $contactblock
1.14      albertel  503: 
1.107     tempelho  504:  </div>
1.25      bowersj2  505: 
1.59      albertel  506: <script type="text/javascript">
                    507: // the if prevents the script error if the browser can not handle this
1.25      bowersj2  508: if ( document.client.uname ) { document.client.uname.focus(); }
                    509: </script>
1.62      raeburn   510: $helpdeskscript
1.14      albertel  511: 
1.1       albertel  512: ENDDOCUMENT
1.16      www       513: }
1.98      raeburn   514:     my %endargs = ( 'noredirectlink' => 1, );
                    515:     $r->print(&Apache::loncommon::end_page(\%endargs));
1.1       albertel  516:     return OK;
1.60      raeburn   517: }
                    518: 
                    519: sub contactdisplay {
1.90      raeburn   520:     my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60      raeburn   521:     my $contactblock;
1.62      raeburn   522:     my $showhelpdesk = 0;
                    523:     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
                    524:     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
                    525:         $showhelpdesk = 1;
                    526:     }
1.90      raeburn   527:     if ($servadm && $showadminmail) {
                    528:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.
                    529:                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';
                    530:     }
1.60      raeburn   531:     if ($showhelpdesk) {
1.84      raeburn   532:         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;<a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
1.75      www       533:         my $thisurl = &escape('/adm/login');
1.62      raeburn   534:         $$helpdeskscript = <<"ENDSCRIPT";
                    535: <script type="text/javascript">
                    536: function helpdesk() {
                    537:     var codedom = document.client.udom.value;
                    538:     if (codedom == '') {
                    539:         codedom = "$authdomain";
                    540:     }
                    541:     var querystr = "origurl=$thisurl&codedom="+codedom;
                    542:     document.location.href = "/adm/helpdesk?"+querystr;
                    543:     return;
                    544: }
                    545: </script>
                    546: ENDSCRIPT
1.60      raeburn   547:     }
                    548:     $contactblock .= <<"ENDBLOCK";
                    549:      &nbsp;&nbsp;&nbsp;$version
                    550: ENDBLOCK
                    551:     return $contactblock;
                    552: }
1.83      raeburn   553: 
                    554: sub forgotpwdisplay {
1.84      raeburn   555:     my (%lt) = @_;
1.83      raeburn   556:     my $prompt_for_resetpw = 1; 
                    557:     if ($prompt_for_resetpw) {
1.107     tempelho  558:         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
1.84      raeburn   559:     }
                    560:     return;
                    561: }
                    562: 
                    563: sub loginhelpdisplay {
                    564:     my (%lt) = @_;
                    565:     my $login_help = 1;
                    566:     if ($login_help) {
1.107     tempelho  567:         return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
1.83      raeburn   568:     }
                    569:     return;
                    570: }
1.1       albertel  571: 
1.90      raeburn   572: sub coursecatalog_link {
                    573:     my ($linkname) = @_;
                    574:     return <<"END";
1.107     tempelho  575:       <a href="/adm/coursecatalog">$linkname</a>
1.90      raeburn   576: END
                    577: }
                    578: 
1.101     raeburn   579: sub newuser_link {
                    580:     my ($linkname) = @_;
                    581:     return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
                    582: }
                    583: 
1.1       albertel  584: 1;
                    585: __END__

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