Annotation of loncom/auth/lonlogin.pm, revision 1.100
1.1 albertel 1: # The LearningOnline Network
2: # Login Screen
1.11 www 3: #
1.100 ! bisitz 4: # $Id: lonlogin.pm,v 1.99 2008/01/24 14:30:28 bisitz Exp $
1.11 www 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.14 albertel 28:
1.1 albertel 29: package Apache::lonlogin;
30:
31: use strict;
32: use Apache::Constants qw(:common);
33: use Apache::File ();
1.63 albertel 34: use Apache::lonnet;
1.12 albertel 35: use Apache::loncommon();
1.49 www 36: use Apache::lonauth();
1.50 www 37: use Apache::lonlocal;
1.71 albertel 38: use Apache::migrateuser();
1.75 www 39: use lib '/home/httpd/lib/perl/';
40: use LONCAPA;
41:
1.1 albertel 42: sub handler {
43: my $r = shift;
1.71 albertel 44:
45: &Apache::loncommon::get_unprocessed_cgi
1.79 albertel 46: (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
47: $ENV{'REDIRECT_QUERY_STRING'}),
1.71 albertel 48: ['interface','username','domain','firsturl','localpath','localres',
49: 'token']);
50:
51: # -- check if they are a migrating user
52: if (defined($env{'form.token'})) {
53: return &Apache::migrateuser::handler($r);
54: }
55:
1.53 www 56: &Apache::loncommon::no_cache($r);
57: &Apache::lonlocal::get_language_handle($r);
1.54 www 58: &Apache::loncommon::content_type($r,'text/html');
1.1 albertel 59: $r->send_http_header;
60: return OK if $r->header_only;
61:
1.49 www 62:
63: # Are we re-routing?
64: if (-e '/home/httpd/html/lon-status/reroute.txt') {
65: &Apache::lonauth::reroute($r);
66: return OK;
67: }
1.55 www 68:
1.71 albertel 69:
1.55 www 70: # -------------------------------- Prevent users from attempting to login twice
1.95 albertel 71: my $handle = &Apache::lonnet::check_for_valid_session($r);
72: if ($handle=~/^publicuser\_/) {
1.70 www 73: # For "public user" - remove it, we apparently really want to login
1.95 albertel 74: unlink($r->dir_config('lonIDsDir')."/$handle.id");
75: } elsif ($handle ne '') {
1.55 www 76: # Indeed, a valid token is found
1.95 albertel 77: my $start_page =
78: &Apache::loncommon::start_page('Already logged in');
79: my $end_page =
80: &Apache::loncommon::end_page();
1.100 ! bisitz 81: $r->print(
! 82: $start_page
! 83: .'<h1>'.&mt('You are already logged in').'</h1>'
! 84: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].',
! 85: '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').'</p>'
! 86: .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
! 87: .$end_page
! 88: );
1.95 albertel 89: return OK;
1.55 www 90: }
91:
92: # ---------------------------------------------------- No valid token, continue
1.16 www 93:
1.70 www 94: # ---------------------------- Not possible to really login to domain "public"
95: if ($env{'form.domain'} eq 'public') {
96: $env{'form.domain'}='';
97: $env{'form.username'}='';
98: }
1.32 www 99: # ----------------------------------------------------------- Process Interface
1.63 albertel 100: $env{'form.interface'}=~s/\W//g;
1.16 www 101:
1.32 www 102: my $textbrowsers=$r->dir_config('lonTextBrowsers');
103: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
104:
105: foreach (split(/\:/,$textbrowsers)) {
106: if ($httpbrowser=~/$_/i) {
1.63 albertel 107: $env{'form.interface'}='textual';
1.32 www 108: }
109: }
110:
1.63 albertel 111: my $fullgraph=($env{'form.interface'} ne 'textual');
1.94 albertel 112:
113: my $iconpath=
114: &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
115:
1.87 raeburn 116: my $domain = &Apache::lonnet::default_login_domain();
1.63 albertel 117: if (($env{'form.domain'}) &&
1.89 albertel 118: (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
1.63 albertel 119: $domain=$env{'form.domain'};
1.46 www 120: }
1.1 albertel 121: my $role = $r->dir_config('lonRole');
122: my $loadlim = $r->dir_config('lonLoadLim');
1.90 raeburn 123: my $servadm = $r->dir_config('lonAdmEMail');
1.1 albertel 124: my $lonhost = $r->dir_config('lonHostID');
125: my $tabdir = $r->dir_config('lonTabDir');
1.6 www 126: my $include = $r->dir_config('lonIncludes');
1.37 www 127: my $expire = $r->dir_config('lonExpire');
1.44 www 128: my $version = $r->dir_config('lonVersion');
1.88 albertel 129: my $host_name = &Apache::lonnet::hostname($lonhost);
1.1 albertel 130:
1.30 www 131: # --------------------------------------------- Default values for login fields
132:
1.63 albertel 133: my $authusername=($env{'form.username'}?$env{'form.username'}:'');
134: my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
1.30 www 135:
136: # ---------------------------------------------------------- Determine own load
1.1 albertel 137: my $loadavg;
1.41 albertel 138: {
139: my $loadfile=Apache::File->new('/proc/loadavg');
140: $loadavg=<$loadfile>;
141: }
1.1 albertel 142: $loadavg =~ s/\s.*//g;
1.57 matthew 143: my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
1.41 albertel 144: my $userloadpercent=&Apache::lonnet::userload();
1.1 albertel 145:
1.30 www 146: # ------------------------------------------------------- Do the load balancing
1.80 albertel 147: my $otherserver= &Apache::lonnet::absolute_url($host_name);
1.31 www 148: my $firsturl=
1.63 albertel 149: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.97 albertel 150: # ---------------------------------------------------------- Are we overloaded?
151: if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47 albertel 152: my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
153: if ($unloaded) { $otherserver=$unloaded; }
1.1 albertel 154: }
1.6 www 155:
1.45 www 156: # ----------------------------------------------------------- Get announcements
157: my $announcements=&Apache::lonnet::getannounce();
1.6 www 158: # -------------------------------------------------------- Set login parameters
159:
160: my @hexstr=('0','1','2','3','4','5','6','7',
161: '8','9','a','b','c','d','e','f');
162: my $lkey='';
163: for (0..7) {
164: $lkey.=$hexstr[rand(15)];
165: }
166:
167: my $ukey='';
168: for (0..7) {
169: $ukey.=$hexstr[rand(15)];
170: }
171:
172: my $lextkey=hex($lkey);
1.15 www 173: if ($lextkey>2147483647) { $lextkey-=4294967296; }
174:
1.6 www 175: my $uextkey=hex($ukey);
1.15 www 176: if ($uextkey>2147483647) { $uextkey-=4294967296; }
177:
1.31 www 178: # -------------------------------------------------------- Store away log token
1.6 www 179: my $logtoken=Apache::lonnet::reply(
1.7 www 180: 'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6 www 181: $lonhost);
1.31 www 182:
183: # ------------------- If we cannot talk to ourselves, we are in serious trouble
184:
185: if ($logtoken eq 'con_lost') {
186: my $spares='';
1.64 albertel 187: my $last;
188: foreach my $hostid (sort
189: {
1.88 albertel 190: &Apache::lonnet::hostname($a) cmp
191: &Apache::lonnet::hostname($b);
1.64 albertel 192: }
193: keys(%Apache::lonnet::spareid)) {
1.58 matthew 194: next if ($hostid eq $lonhost);
1.88 albertel 195: my $hostname = &Apache::lonnet::hostname($hostid);
196: next if ($last eq $hostname);
1.58 matthew 197: $spares.='<br /><font size="+1"><a href="http://'.
1.88 albertel 198: $hostname.
1.58 matthew 199: '/adm/login?domain='.$authdomain.'">'.
1.88 albertel 200: $hostname.'</a>'.
1.58 matthew 201: ' (preferred)</font>'.$/;
1.88 albertel 202: $last=$hostname;
1.58 matthew 203: }
204: $spares.= '<br />';
1.88 albertel 205: my %all_hostnames = &Apache::lonnet::all_hostnames();
1.64 albertel 206: foreach my $hostid (sort
207: {
1.88 albertel 208: &Apache::lonnet::hostname($a) cmp
209: &Apache::lonnet::hostname($b);
1.64 albertel 210: }
1.88 albertel 211: keys(%all_hostnames)) {
1.58 matthew 212: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
1.88 albertel 213: my $hostname = &Apache::lonnet::hostname($hostid);
214: next if ($last eq $hostname);
1.58 matthew 215: $spares.='<br /><a href="http://'.
1.88 albertel 216: $hostname.
1.58 matthew 217: '/adm/login?domain='.$authdomain.'">'.
1.88 albertel 218: $hostname.'</a>';
219: $last=$hostname;
1.31 www 220: }
221: $r->print(<<ENDTROUBLE);
222: <html>
223: <head><title>The LearningOnline Network with CAPA</title></head>
224: <body bgcolor="#FFFFFF">
225: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
226: <h3>This LON-CAPA server is temporarily not available for login</h3>
227: <p>Please attempt to login to one of the following servers:</p>$spares
228: </body>
229: </html>
230: ENDTROUBLE
231: return OK;
232: }
233:
234: # ----------------------------------------------- Apparently we are in business
1.90 raeburn 235: $servadm=~s/\,/\<br \/\>/g;
1.38 www 236:
1.21 www 237: # ----------------------------------------------------------- Front page design
1.35 www 238: my $pgbg=
1.46 www 239: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
1.35 www 240: my $font=
1.46 www 241: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
1.35 www 242: my $link=
1.46 www 243: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
1.35 www 244: my $vlink=
1.46 www 245: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
246: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
1.35 www 247: my $mainbg=
1.46 www 248: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
1.35 www 249: my $sidebg=
1.46 www 250: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
1.98 raeburn 251: my $textcol =
252: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
253: my $bgcol =
254: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
1.46 www 255: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
256: my $img=&Apache::loncommon::designparm('login.img',$domain);
1.90 raeburn 257: my $domainlogo=&Apache::loncommon::domainlogo($domain);
1.98 raeburn 258: my $login=&Apache::loncommon::designparm('login.login',$domain);
259: if ($login eq '') {
260: $login = $iconpath.'/'.&mt('userauthentication.gif');
261: }
262: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
1.90 raeburn 263: my $showcoursecat =
264: &Apache::loncommon::designparm('login.coursecatalog',$domain);
1.98 raeburn 265: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
1.66 www 266: my $now=time;
1.98 raeburn 267: my $js = (<<ENDSCRIPT);
1.6 www 268:
1.14 albertel 269: <script language="JavaScript">
270: function send()
271: {
1.98 raeburn 272: this.document.server.elements.uname.value
1.6 www 273: =this.document.client.elements.uname.value;
274:
275: this.document.server.elements.udom.value
276: =this.document.client.elements.udom.value;
277:
1.33 www 278: this.document.server.elements.imagesuppress.value
1.36 www 279: =this.document.client.elements.imagesuppress.checked;
1.33 www 280:
281: this.document.server.elements.embedsuppress.value
1.36 www 282: =this.document.client.elements.embedsuppress.checked;
1.33 www 283:
1.34 www 284: this.document.server.elements.appletsuppress.value
1.36 www 285: =this.document.client.elements.appletsuppress.checked;
1.34 www 286:
1.33 www 287: this.document.server.elements.fontenhance.value
1.36 www 288: =this.document.client.elements.fontenhance.checked;
1.33 www 289:
290: this.document.server.elements.blackwhite.value
1.36 www 291: =this.document.client.elements.blackwhite.checked;
1.33 www 292:
1.35 www 293: this.document.server.elements.remember.value
1.36 www 294: =this.document.client.elements.remember.checked;
1.35 www 295:
1.6 www 296: uextkey=this.document.client.elements.uextkey.value;
297: lextkey=this.document.client.elements.lextkey.value;
298: initkeys();
299:
1.65 www 300: this.document.server.elements.upass0.value
1.98 raeburn 301: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
302: this.document.server.elements.upass1.value
303: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
304: this.document.server.elements.upass2.value
305: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.66 www 306:
307: this.document.client.elements.uname.value='';
308: this.document.client.elements.upass$now.value='';
1.6 www 309:
310: this.document.server.submit();
1.98 raeburn 311: return false;
1.6 www 312: }
1.14 albertel 313: </script>
1.98 raeburn 314:
1.16 www 315: ENDSCRIPT
1.6 www 316:
1.98 raeburn 317: # --------------------------------------------------- Print login screen header
318:
319: my %add_entries = (topmargin => "0",
320: leftmargin => "0",
321: marginheight => "0",
322: marginwidth => "0",
323: bgcolor => "$pgbg",
324: text => "$font",
325: link => "$link",
326: vlink => "$vlink",
327: alink => "$alink",);
328:
329: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
330: { 'redirect' => [$expire,'/adm/roles'],
331: 'add_entries' => \%add_entries,
332: 'only_body' => 1,}));
333:
334: # ----------------------------------------------------------------------- Texts
335:
336: my %lt=&Apache::lonlocal::texthash(
337: 'un' => 'Username',
338: 'pw' => 'Password',
339: 'dom' => 'Domain',
340: 'perc' => 'percent',
341: 'load' => 'Load',
342: 'userload' => 'User Load',
343: 'about' => 'About LON-CAPA',
344: 'access' => 'Accessibility Options',
345: 'catalog' => 'Course Catalog',
346: 'log' => 'Log in',
347: 'help' => 'Log-in Help',
348: 'serv' => 'Server',
349: 'servadm' => 'Server Administration',
350: 'helpdesk' => 'Contact Helpdesk',
1.99 bisitz 351: 'forgotpw' => 'Forgot password?',
352: 'options_headline' => 'Select Accessibility Options',
353: 'sprs_img' => 'Suppress rendering of images',
354: 'sprs_applet' => 'Suppress Java applets',
355: 'sprs_embed' => 'Suppress rendering of embedded multimedia',
356: 'sprs_font' => 'Increase font size',
357: 'sprs_blackwhite' => 'Switch to black and white mode',
358: 'remember' => 'Remember these settings for next login');
1.98 raeburn 359: # -------------------------------------------------- Change password field name
360: my $forgotpw = &forgotpwdisplay(%lt);
361: my $loginhelp = &loginhelpdisplay(%lt);
362:
363: # ---------------------------------------------------- Serve out DES JavaScript
364: {
365: my $jsh=Apache::File->new($include."/londes.js");
366: $r->print(<$jsh>);
367: }
368: # ---------------------------------------------------------- Serve rest of page
369:
1.16 www 370: if ($fullgraph) {
371: $r->print(
372: '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
373: }
1.6 www 374:
1.16 www 375: $r->print(<<ENDSERVERFORM);
1.14 albertel 376: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33 www 377: <input type="hidden" name="logtoken" value="$logtoken" />
378: <input type="hidden" name="serverid" value="$lonhost" />
1.63 albertel 379: <input type="hidden" name="interface" value="$env{'form.interface'}" />
1.33 www 380: <input type="hidden" name="uname" value="" />
1.65 www 381: <input type="hidden" name="upass0" value="" />
382: <input type="hidden" name="upass1" value="" />
383: <input type="hidden" name="upass2" value="" />
1.33 www 384: <input type="hidden" name="udom" value="" />
385: <input type="hidden" name="imagesuppress" value="" />
1.34 www 386: <input type="hidden" name="appletsuppress" value="" />
1.33 www 387: <input type="hidden" name="embedsuppress" value="" />
388: <input type="hidden" name="fontenhance" value="" />
389: <input type="hidden" name="blackwhite" value="" />
1.35 www 390: <input type="hidden" name="remember" value="" />
1.63 albertel 391: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
392: <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14 albertel 393: </form>
1.16 www 394: ENDSERVERFORM
1.90 raeburn 395: my $coursecatalog;
1.92 raeburn 396: if (($showcoursecat eq '') || ($showcoursecat)) {
1.90 raeburn 397: $coursecatalog = &coursecatalog_link($lt{'catalog'});
398: }
1.16 www 399: if ($fullgraph) { $r->print(<<ENDTOP);
1.14 albertel 400: <!-- The LON-CAPA Header -->
401: <tr>
402:
403: <!-- Row 1 Columns 2-4 -->
1.29 www 404: <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td>
1.14 albertel 405: </tr>
406:
407: <!-- The gray bar that starts the two table frames -->
408: <tr>
409:
410: <!-- Row 2 Column 1 -->
1.21 www 411: <td width=182 height=27 bgcolor="$sidebg"> </td>
1.14 albertel 412:
413: <!-- Row 2 Column 2 -->
1.19 bowersj2 414: <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
1.14 albertel 415:
416: <!-- Row 2 Column 3 -->
1.19 bowersj2 417: <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
1.14 albertel 418:
419: <!-- Row 2 Column 4 -->
1.19 bowersj2 420: <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
1.14 albertel 421: </tr>
422: <tr>
423:
1.84 raeburn 424: <!-- A cell that will hold the 'access', 'about', and 'catalog' links -->
1.14 albertel 425: <!-- Row 3 Column 1 -->
1.86 raeburn 426: <td valign="top" height="60" align="left" bgcolor="$sidebg">
1.84 raeburn 427: <table cellpadding="0" cellspacing="2" border="0">
428: <tr>
429: <td> </td>
430: <td><a href="/adm/login?interface=textual"><b>$lt{'access'}</b></a></td>
1.86 raeburn 431: </tr>
432: <tr>
433: <td> </td>
434: <td><a href="/adm/about.html"><b>$lt{'about'}</b></a></td>
1.90 raeburn 435: </tr>$coursecatalog
1.86 raeburn 436: <tr>
1.84 raeburn 437: <td colspan="2"> </td>
1.86 raeburn 438: </tr>
439: </table>
440: </td>
1.14 albertel 441: <!-- The shaded space between the two main columns -->
442: <!-- Row 3 Column 2 -->
1.19 bowersj2 443: <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 444:
445: <!-- The right main column holding the large LON-CAPA logo-->
446: <!-- Rows 3-4 Column 3 -->
1.45 www 447: <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
1.14 albertel 448: <center>
1.21 www 449: <img src="$logo" alt="" />
1.14 albertel 450: </center>
451: </td>
452:
453: <!-- Row 3 Column 4 -->
1.19 bowersj2 454: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 455: </tr>
456: <tr>
457:
458: <!-- The entry form -->
459: <!-- Row 4 Column 1 -->
1.21 www 460: <td align="center" valign="middle" bgcolor="$sidebg">
1.16 www 461: ENDTOP
1.32 www 462: } else {
1.99 bisitz 463: $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1>'
464: .'<h2>'.&mt('Text-based Interface Login').'</h2>'
465: .$announcements);
1.33 www 466: }
467: $r->print('<form name="client" onsubmit="return(send())">');
468: unless ($fullgraph) {
469: $r->print(<<ENDACCESSOPTIONS);
1.99 bisitz 470: <h3>$lt{'options_headline'}</h3>
471: <label><input type="checkbox" name="imagesuppress" /> $lt{'sprs_img'}</label><br />
472: <label><input type="checkbox" name="appletsuppress" /> $lt{'sprs_applet'}</label><br />
473: <label><input type="checkbox" name="embedsuppress" /> $lt{'sprs_embed'}</label><br />
474: <label><input type="checkbox" name="fontenhance" /> $lt{'sprs_font'}</label><br />
475: <label><input type="checkbox" name="blackwhite" /> $lt{'sprs_blackwhite'}</label><br />
476: <br />
477: <input type="checkbox" name="remember" /> $lt{'remember'}<hr />
1.33 www 478: ENDACCESSOPTIONS
479: } else {
480: $r->print(<<ENDNOOPT);
481: <input type="hidden" name="imagesuppress" value="" />
482: <input type="hidden" name="embedsuppress" value="" />
1.34 www 483: <input type="hidden" name="appletsuppress" value="" />
1.33 www 484: <input type="hidden" name="fontenhance" value="" />
485: <input type="hidden" name="blackwhite" value="" />
1.35 www 486: <input type="hidden" name="remember" value="" />
1.33 www 487: ENDNOOPT
1.16 www 488: }
1.98 raeburn 489: my $logintitle;
490: if ($loginheader eq 'text') {
491: $logintitle = '<td bgcolor="'.$bgcol.'" colspan="2"> <b><font size="+1" color="'.$textcol.'">'.$lt{'log'}.'</font></b></td>';
492: } else {
493: $logintitle = '<td bgcolor="'.$sidebg.'" colspan="2"><img src="'.$login.'" alt="'.
494: &mt('User Authentication').'" /></td>';
495: }
1.16 www 496: $r->print(<<ENDLOGIN);
1.14 albertel 497: <input type="hidden" name="lextkey" value="$lextkey">
498: <input type="hidden" name="uextkey" value="$uextkey">
499:
500: <!-- Start the sub-table for text and input alignment -->
501: <table border=0 cellspacing=0 cellpadding=0>
1.98 raeburn 502: <tr>$logintitle</tr>
1.14 albertel 503: <tr>
1.93 www 504: <td bgcolor="$mainbg"><br /><font size=-1><b> <label for="uname">$lt{'un'}</label>:</b></font></td>
1.30 www 505: <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
1.14 albertel 506: </tr>
507: <tr>
1.93 www 508: <td bgcolor="$mainbg"><font size=-1><b> <label for="upass$now">$lt{'pw'}</label>:</b></font></td>
1.66 www 509: <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
1.14 albertel 510: </tr>
511: <tr>
1.93 www 512: <td bgcolor="$mainbg"><font size=-1><b> <label for="udom">$lt{'dom'}</label>:</b></font></td>
1.30 www 513: <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
1.14 albertel 514: </tr>
515: <tr>
1.84 raeburn 516: <td bgcolor="$mainbg"> </td>
1.28 www 517: <td bgcolor="$mainbg" valign="bottom" align="center">
1.14 albertel 518: <br />
1.51 www 519: <input type="submit" value="$lt{'log'}" />
1.14 albertel 520: </td>
521: </tr>
1.83 raeburn 522: <tr>
523: <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
1.84 raeburn 524: $loginhelp
1.83 raeburn 525: $forgotpw
526: </td>
527: </tr>
1.14 albertel 528: </table>
529: <!-- End sub-table -->
530: </form>
1.16 www 531: ENDLOGIN
532: if ($fullgraph) {
1.62 raeburn 533: my $helpdeskscript;
1.90 raeburn 534: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
535: $version,$authdomain,\$helpdeskscript);
1.16 www 536: $r->print(<<ENDDOCUMENT);
1.14 albertel 537: </td>
538:
539: <!-- Row 4 Column 2 -->
1.19 bowersj2 540: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.45 www 541:
542: <!-- Row 4 Column 3 -->
543: <td bgcolor="$mainbg">$announcements</td>
1.14 albertel 544:
545: <!-- Row 4 Column 4 -->
1.19 bowersj2 546: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 547: </tr>
548: <tr>
549:
550: <!-- Row 5 Column 1 -->
1.21 www 551: <td bgcolor="$sidebg" valign="middle" align="left">
1.14 albertel 552: <br />
553: <table border=0 cellspacing=0 cellpadding=0>
554: <tr>
1.21 www 555: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 556: <small><b> $lt{'dom'}: </b></small>
1.14 albertel 557: </td>
1.21 www 558: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 559: <small><tt> $domain</tt></small>
560: </td>
561: </tr>
562: <tr>
1.21 www 563: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 564: <small><b> $lt{'serv'}: </b></small>
1.14 albertel 565: </td>
1.21 www 566: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 567: <small><tt> $lonhost ($role)</tt></small>
568: </td>
569: </tr>
570: <tr>
1.21 www 571: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 572: <small><b> $lt{'load'}: </b></small>
1.14 albertel 573: </td>
1.21 www 574: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 575: <small><tt> $loadpercent $lt{'perc'}</tt></small>
1.42 albertel 576: </td>
577: </tr>
578: <tr>
579: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 580: <small><b> $lt{'userload'}: </b></small>
1.42 albertel 581: </td>
582: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 583: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
1.14 albertel 584: </td>
585: </tr>
586: </table>
587: <br />
1.60 raeburn 588: $contactblock
1.14 albertel 589: </td>
590:
591: <!-- Row 5 Column 2 -->
1.19 bowersj2 592: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 593:
594: <!-- Row 5 Column 3 -->
1.21 www 595: <td width="100%" valign="bottom" bgcolor="$mainbg">
1.20 www 596: $domainlogo
597: </td>
1.14 albertel 598:
599: <!-- Row 5 Column 4 -->
1.19 bowersj2 600: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 601: </tr>
602: <tr>
603:
604: <!-- Row 6 Column 1 -->
1.21 www 605: <td bgcolor="$sidebg"> </td>
1.14 albertel 606:
607: <!-- Row 6 Column 2 -->
1.19 bowersj2 608: <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
1.14 albertel 609:
610: <!-- Row 6 Column 3 -->
1.19 bowersj2 611: <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
1.14 albertel 612:
613: <!-- Row 6 Column 4 -->
1.19 bowersj2 614: <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
1.14 albertel 615: </tr>
1.1 albertel 616: </table>
1.25 bowersj2 617:
1.59 albertel 618: <script type="text/javascript">
619: // the if prevents the script error if the browser can not handle this
1.25 bowersj2 620: if ( document.client.uname ) { document.client.uname.focus(); }
621: </script>
1.62 raeburn 622: $helpdeskscript
1.14 albertel 623:
1.1 albertel 624: ENDDOCUMENT
1.16 www 625: }
1.98 raeburn 626: my %endargs = ( 'noredirectlink' => 1, );
627: $r->print(&Apache::loncommon::end_page(\%endargs));
1.1 albertel 628: return OK;
1.60 raeburn 629: }
630:
631: sub contactdisplay {
1.90 raeburn 632: my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60 raeburn 633: my $contactblock;
1.62 raeburn 634: my $showhelpdesk = 0;
635: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
636: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
637: $showhelpdesk = 1;
638: }
1.90 raeburn 639: if ($servadm && $showadminmail) {
640: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
641: '<tt> '.$servadm.'</tt><br /> <br />';
642: }
1.60 raeburn 643: if ($showhelpdesk) {
1.84 raeburn 644: $contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
1.75 www 645: my $thisurl = &escape('/adm/login');
1.62 raeburn 646: $$helpdeskscript = <<"ENDSCRIPT";
647: <script type="text/javascript">
648: function helpdesk() {
649: var codedom = document.client.udom.value;
650: if (codedom == '') {
651: codedom = "$authdomain";
652: }
653: var querystr = "origurl=$thisurl&codedom="+codedom;
654: document.location.href = "/adm/helpdesk?"+querystr;
655: return;
656: }
657: </script>
658: ENDSCRIPT
1.60 raeburn 659: }
660: $contactblock .= <<"ENDBLOCK";
661: $version
662: ENDBLOCK
663: return $contactblock;
664: }
1.83 raeburn 665:
666: sub forgotpwdisplay {
1.84 raeburn 667: my (%lt) = @_;
1.83 raeburn 668: my $prompt_for_resetpw = 1;
669: if ($prompt_for_resetpw) {
1.84 raeburn 670: return '<br /> <a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br /><br />';
671: }
672: return;
673: }
674:
675: sub loginhelpdisplay {
676: my (%lt) = @_;
677: my $login_help = 1;
678: if ($login_help) {
679: return ' <a href="/adm/loginproblems.html">'.$lt{'help'}.'</a></b>';
1.83 raeburn 680: }
681: return;
682: }
1.1 albertel 683:
1.90 raeburn 684: sub coursecatalog_link {
685: my ($linkname) = @_;
686: return <<"END";
687: <tr>
688: <td> </td>
689: <td><a href="/adm/coursecatalog"><b>$linkname</b></a></td>
690: </tr>
691: END
692: }
693:
1.1 albertel 694: 1;
695: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>