Annotation of loncom/auth/lonlogin.pm, revision 1.102
1.1 albertel 1: # The LearningOnline Network
2: # Login Screen
1.11 www 3: #
1.102 ! raeburn 4: # $Id: lonlogin.pm,v 1.101 2008/02/24 23:18:37 raeburn 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
86: .'<h1>'.&mt('You are already logged in').'</h1>'
87: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].',
88: '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').'</p>'
89: .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
90: .$end_page
91: );
1.95 albertel 92: return OK;
1.55 www 93: }
94:
95: # ---------------------------------------------------- No valid token, continue
1.16 www 96:
1.70 www 97: # ---------------------------- Not possible to really login to domain "public"
98: if ($env{'form.domain'} eq 'public') {
99: $env{'form.domain'}='';
100: $env{'form.username'}='';
101: }
1.32 www 102: # ----------------------------------------------------------- Process Interface
1.63 albertel 103: $env{'form.interface'}=~s/\W//g;
1.16 www 104:
1.32 www 105: my $textbrowsers=$r->dir_config('lonTextBrowsers');
106: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
107:
108: foreach (split(/\:/,$textbrowsers)) {
109: if ($httpbrowser=~/$_/i) {
1.63 albertel 110: $env{'form.interface'}='textual';
1.32 www 111: }
112: }
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.58 matthew 204: ' (preferred)</font>'.$/;
1.88 albertel 205: $last=$hostname;
1.58 matthew 206: }
207: $spares.= '<br />';
1.88 albertel 208: my %all_hostnames = &Apache::lonnet::all_hostnames();
1.64 albertel 209: foreach my $hostid (sort
210: {
1.88 albertel 211: &Apache::lonnet::hostname($a) cmp
212: &Apache::lonnet::hostname($b);
1.64 albertel 213: }
1.88 albertel 214: keys(%all_hostnames)) {
1.58 matthew 215: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
1.88 albertel 216: my $hostname = &Apache::lonnet::hostname($hostid);
217: next if ($last eq $hostname);
1.58 matthew 218: $spares.='<br /><a href="http://'.
1.88 albertel 219: $hostname.
1.58 matthew 220: '/adm/login?domain='.$authdomain.'">'.
1.88 albertel 221: $hostname.'</a>';
222: $last=$hostname;
1.31 www 223: }
224: $r->print(<<ENDTROUBLE);
225: <html>
226: <head><title>The LearningOnline Network with CAPA</title></head>
227: <body bgcolor="#FFFFFF">
228: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
229: <h3>This LON-CAPA server is temporarily not available for login</h3>
230: <p>Please attempt to login to one of the following servers:</p>$spares
231: </body>
232: </html>
233: ENDTROUBLE
234: return OK;
235: }
236:
237: # ----------------------------------------------- Apparently we are in business
1.90 raeburn 238: $servadm=~s/\,/\<br \/\>/g;
1.38 www 239:
1.21 www 240: # ----------------------------------------------------------- Front page design
1.35 www 241: my $pgbg=
1.46 www 242: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
1.35 www 243: my $font=
1.46 www 244: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
1.35 www 245: my $link=
1.46 www 246: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
1.35 www 247: my $vlink=
1.46 www 248: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
249: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
1.35 www 250: my $mainbg=
1.46 www 251: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
1.35 www 252: my $sidebg=
1.46 www 253: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
1.98 raeburn 254: my $textcol =
255: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
256: my $bgcol =
257: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
1.46 www 258: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
259: my $img=&Apache::loncommon::designparm('login.img',$domain);
1.90 raeburn 260: my $domainlogo=&Apache::loncommon::domainlogo($domain);
1.98 raeburn 261: my $login=&Apache::loncommon::designparm('login.login',$domain);
262: if ($login eq '') {
263: $login = $iconpath.'/'.&mt('userauthentication.gif');
264: }
265: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
1.90 raeburn 266: my $showcoursecat =
267: &Apache::loncommon::designparm('login.coursecatalog',$domain);
1.98 raeburn 268: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
1.101 raeburn 269: my $shownewuserlink =
270: &Apache::loncommon::designparm('login.newuser',$domain);
1.66 www 271: my $now=time;
1.98 raeburn 272: my $js = (<<ENDSCRIPT);
1.6 www 273:
1.14 albertel 274: <script language="JavaScript">
275: function send()
276: {
1.98 raeburn 277: this.document.server.elements.uname.value
1.6 www 278: =this.document.client.elements.uname.value;
279:
280: this.document.server.elements.udom.value
281: =this.document.client.elements.udom.value;
282:
1.33 www 283: this.document.server.elements.imagesuppress.value
1.36 www 284: =this.document.client.elements.imagesuppress.checked;
1.33 www 285:
286: this.document.server.elements.embedsuppress.value
1.36 www 287: =this.document.client.elements.embedsuppress.checked;
1.33 www 288:
1.34 www 289: this.document.server.elements.appletsuppress.value
1.36 www 290: =this.document.client.elements.appletsuppress.checked;
1.34 www 291:
1.33 www 292: this.document.server.elements.fontenhance.value
1.36 www 293: =this.document.client.elements.fontenhance.checked;
1.33 www 294:
295: this.document.server.elements.blackwhite.value
1.36 www 296: =this.document.client.elements.blackwhite.checked;
1.33 www 297:
1.35 www 298: this.document.server.elements.remember.value
1.36 www 299: =this.document.client.elements.remember.checked;
1.35 www 300:
1.6 www 301: uextkey=this.document.client.elements.uextkey.value;
302: lextkey=this.document.client.elements.lextkey.value;
303: initkeys();
304:
1.65 www 305: this.document.server.elements.upass0.value
1.98 raeburn 306: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
307: this.document.server.elements.upass1.value
308: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
309: this.document.server.elements.upass2.value
310: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.66 www 311:
312: this.document.client.elements.uname.value='';
313: this.document.client.elements.upass$now.value='';
1.6 www 314:
315: this.document.server.submit();
1.98 raeburn 316: return false;
1.6 www 317: }
1.14 albertel 318: </script>
1.98 raeburn 319:
1.16 www 320: ENDSCRIPT
1.6 www 321:
1.98 raeburn 322: # --------------------------------------------------- Print login screen header
323:
324: my %add_entries = (topmargin => "0",
325: leftmargin => "0",
326: marginheight => "0",
327: marginwidth => "0",
328: bgcolor => "$pgbg",
329: text => "$font",
330: link => "$link",
331: vlink => "$vlink",
332: alink => "$alink",);
333:
334: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
335: { 'redirect' => [$expire,'/adm/roles'],
336: 'add_entries' => \%add_entries,
337: 'only_body' => 1,}));
338:
339: # ----------------------------------------------------------------------- Texts
340:
341: my %lt=&Apache::lonlocal::texthash(
342: 'un' => 'Username',
343: 'pw' => 'Password',
344: 'dom' => 'Domain',
345: 'perc' => 'percent',
346: 'load' => 'Load',
347: 'userload' => 'User Load',
348: 'about' => 'About LON-CAPA',
349: 'access' => 'Accessibility Options',
350: 'catalog' => 'Course Catalog',
351: 'log' => 'Log in',
352: 'help' => 'Log-in Help',
353: 'serv' => 'Server',
354: 'servadm' => 'Server Administration',
355: 'helpdesk' => 'Contact Helpdesk',
1.99 bisitz 356: 'forgotpw' => 'Forgot password?',
1.101 raeburn 357: 'newuser' => 'New User?',
1.99 bisitz 358: 'options_headline' => 'Select Accessibility Options',
359: 'sprs_img' => 'Suppress rendering of images',
360: 'sprs_applet' => 'Suppress Java applets',
361: 'sprs_embed' => 'Suppress rendering of embedded multimedia',
362: 'sprs_font' => 'Increase font size',
363: 'sprs_blackwhite' => 'Switch to black and white mode',
364: 'remember' => 'Remember these settings for next login');
1.98 raeburn 365: # -------------------------------------------------- Change password field name
366: my $forgotpw = &forgotpwdisplay(%lt);
367: my $loginhelp = &loginhelpdisplay(%lt);
368:
369: # ---------------------------------------------------- Serve out DES JavaScript
370: {
371: my $jsh=Apache::File->new($include."/londes.js");
372: $r->print(<$jsh>);
373: }
374: # ---------------------------------------------------------- Serve rest of page
375:
1.16 www 376: if ($fullgraph) {
377: $r->print(
378: '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
379: }
1.6 www 380:
1.16 www 381: $r->print(<<ENDSERVERFORM);
1.14 albertel 382: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33 www 383: <input type="hidden" name="logtoken" value="$logtoken" />
384: <input type="hidden" name="serverid" value="$lonhost" />
1.63 albertel 385: <input type="hidden" name="interface" value="$env{'form.interface'}" />
1.33 www 386: <input type="hidden" name="uname" value="" />
1.65 www 387: <input type="hidden" name="upass0" value="" />
388: <input type="hidden" name="upass1" value="" />
389: <input type="hidden" name="upass2" value="" />
1.33 www 390: <input type="hidden" name="udom" value="" />
391: <input type="hidden" name="imagesuppress" value="" />
1.34 www 392: <input type="hidden" name="appletsuppress" value="" />
1.33 www 393: <input type="hidden" name="embedsuppress" value="" />
394: <input type="hidden" name="fontenhance" value="" />
395: <input type="hidden" name="blackwhite" value="" />
1.35 www 396: <input type="hidden" name="remember" value="" />
1.63 albertel 397: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
398: <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14 albertel 399: </form>
1.16 www 400: ENDSERVERFORM
1.90 raeburn 401: my $coursecatalog;
1.92 raeburn 402: if (($showcoursecat eq '') || ($showcoursecat)) {
1.90 raeburn 403: $coursecatalog = &coursecatalog_link($lt{'catalog'});
404: }
1.101 raeburn 405: my $newuserlink;
406: if ($shownewuserlink) {
407: $newuserlink = &newuser_link($lt{'newuser'});
408: }
1.16 www 409: if ($fullgraph) { $r->print(<<ENDTOP);
1.14 albertel 410: <!-- The LON-CAPA Header -->
411: <tr>
412:
413: <!-- Row 1 Columns 2-4 -->
1.29 www 414: <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 415: </tr>
416:
417: <!-- The gray bar that starts the two table frames -->
418: <tr>
419:
420: <!-- Row 2 Column 1 -->
1.21 www 421: <td width=182 height=27 bgcolor="$sidebg"> </td>
1.14 albertel 422:
423: <!-- Row 2 Column 2 -->
1.19 bowersj2 424: <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
1.14 albertel 425:
426: <!-- Row 2 Column 3 -->
1.19 bowersj2 427: <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
1.14 albertel 428:
429: <!-- Row 2 Column 4 -->
1.19 bowersj2 430: <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
1.14 albertel 431: </tr>
432: <tr>
433:
1.84 raeburn 434: <!-- A cell that will hold the 'access', 'about', and 'catalog' links -->
1.14 albertel 435: <!-- Row 3 Column 1 -->
1.86 raeburn 436: <td valign="top" height="60" align="left" bgcolor="$sidebg">
1.84 raeburn 437: <table cellpadding="0" cellspacing="2" border="0">
438: <tr>
439: <td> </td>
440: <td><a href="/adm/login?interface=textual"><b>$lt{'access'}</b></a></td>
1.86 raeburn 441: </tr>
442: <tr>
443: <td> </td>
444: <td><a href="/adm/about.html"><b>$lt{'about'}</b></a></td>
1.90 raeburn 445: </tr>$coursecatalog
1.86 raeburn 446: <tr>
1.84 raeburn 447: <td colspan="2"> </td>
1.86 raeburn 448: </tr>
449: </table>
450: </td>
1.14 albertel 451: <!-- The shaded space between the two main columns -->
452: <!-- Row 3 Column 2 -->
1.19 bowersj2 453: <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 454:
455: <!-- The right main column holding the large LON-CAPA logo-->
456: <!-- Rows 3-4 Column 3 -->
1.45 www 457: <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
1.14 albertel 458: <center>
1.21 www 459: <img src="$logo" alt="" />
1.14 albertel 460: </center>
461: </td>
462:
463: <!-- Row 3 Column 4 -->
1.19 bowersj2 464: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 465: </tr>
466: <tr>
467:
468: <!-- The entry form -->
469: <!-- Row 4 Column 1 -->
1.21 www 470: <td align="center" valign="middle" bgcolor="$sidebg">
1.16 www 471: ENDTOP
1.32 www 472: } else {
1.99 bisitz 473: $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1>'
474: .'<h2>'.&mt('Text-based Interface Login').'</h2>'
475: .$announcements);
1.33 www 476: }
477: $r->print('<form name="client" onsubmit="return(send())">');
478: unless ($fullgraph) {
479: $r->print(<<ENDACCESSOPTIONS);
1.99 bisitz 480: <h3>$lt{'options_headline'}</h3>
481: <label><input type="checkbox" name="imagesuppress" /> $lt{'sprs_img'}</label><br />
482: <label><input type="checkbox" name="appletsuppress" /> $lt{'sprs_applet'}</label><br />
483: <label><input type="checkbox" name="embedsuppress" /> $lt{'sprs_embed'}</label><br />
484: <label><input type="checkbox" name="fontenhance" /> $lt{'sprs_font'}</label><br />
485: <label><input type="checkbox" name="blackwhite" /> $lt{'sprs_blackwhite'}</label><br />
486: <br />
487: <input type="checkbox" name="remember" /> $lt{'remember'}<hr />
1.33 www 488: ENDACCESSOPTIONS
489: } else {
490: $r->print(<<ENDNOOPT);
491: <input type="hidden" name="imagesuppress" value="" />
492: <input type="hidden" name="embedsuppress" value="" />
1.34 www 493: <input type="hidden" name="appletsuppress" value="" />
1.33 www 494: <input type="hidden" name="fontenhance" value="" />
495: <input type="hidden" name="blackwhite" value="" />
1.35 www 496: <input type="hidden" name="remember" value="" />
1.33 www 497: ENDNOOPT
1.16 www 498: }
1.98 raeburn 499: my $logintitle;
500: if ($loginheader eq 'text') {
501: $logintitle = '<td bgcolor="'.$bgcol.'" colspan="2"> <b><font size="+1" color="'.$textcol.'">'.$lt{'log'}.'</font></b></td>';
502: } else {
503: $logintitle = '<td bgcolor="'.$sidebg.'" colspan="2"><img src="'.$login.'" alt="'.
504: &mt('User Authentication').'" /></td>';
505: }
1.16 www 506: $r->print(<<ENDLOGIN);
1.14 albertel 507: <input type="hidden" name="lextkey" value="$lextkey">
508: <input type="hidden" name="uextkey" value="$uextkey">
509:
510: <!-- Start the sub-table for text and input alignment -->
511: <table border=0 cellspacing=0 cellpadding=0>
1.98 raeburn 512: <tr>$logintitle</tr>
1.14 albertel 513: <tr>
1.93 www 514: <td bgcolor="$mainbg"><br /><font size=-1><b> <label for="uname">$lt{'un'}</label>:</b></font></td>
1.30 www 515: <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
1.14 albertel 516: </tr>
517: <tr>
1.93 www 518: <td bgcolor="$mainbg"><font size=-1><b> <label for="upass$now">$lt{'pw'}</label>:</b></font></td>
1.66 www 519: <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
1.14 albertel 520: </tr>
521: <tr>
1.93 www 522: <td bgcolor="$mainbg"><font size=-1><b> <label for="udom">$lt{'dom'}</label>:</b></font></td>
1.30 www 523: <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
1.14 albertel 524: </tr>
525: <tr>
1.84 raeburn 526: <td bgcolor="$mainbg"> </td>
1.28 www 527: <td bgcolor="$mainbg" valign="bottom" align="center">
1.14 albertel 528: <br />
1.51 www 529: <input type="submit" value="$lt{'log'}" />
1.14 albertel 530: </td>
531: </tr>
1.83 raeburn 532: <tr>
533: <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
1.84 raeburn 534: $loginhelp
1.83 raeburn 535: $forgotpw
1.101 raeburn 536: $newuserlink
537: <br />
1.83 raeburn 538: </td>
539: </tr>
1.14 albertel 540: </table>
541: <!-- End sub-table -->
542: </form>
1.16 www 543: ENDLOGIN
544: if ($fullgraph) {
1.62 raeburn 545: my $helpdeskscript;
1.90 raeburn 546: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
547: $version,$authdomain,\$helpdeskscript);
1.16 www 548: $r->print(<<ENDDOCUMENT);
1.14 albertel 549: </td>
550:
551: <!-- Row 4 Column 2 -->
1.19 bowersj2 552: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.45 www 553:
554: <!-- Row 4 Column 3 -->
555: <td bgcolor="$mainbg">$announcements</td>
1.14 albertel 556:
557: <!-- Row 4 Column 4 -->
1.19 bowersj2 558: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 559: </tr>
560: <tr>
561:
562: <!-- Row 5 Column 1 -->
1.21 www 563: <td bgcolor="$sidebg" valign="middle" align="left">
1.14 albertel 564: <br />
565: <table border=0 cellspacing=0 cellpadding=0>
566: <tr>
1.21 www 567: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 568: <small><b> $lt{'dom'}: </b></small>
1.14 albertel 569: </td>
1.21 www 570: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 571: <small><tt> $domain</tt></small>
572: </td>
573: </tr>
574: <tr>
1.21 www 575: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 576: <small><b> $lt{'serv'}: </b></small>
1.14 albertel 577: </td>
1.21 www 578: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 579: <small><tt> $lonhost ($role)</tt></small>
580: </td>
581: </tr>
582: <tr>
1.21 www 583: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 584: <small><b> $lt{'load'}: </b></small>
1.14 albertel 585: </td>
1.21 www 586: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 587: <small><tt> $loadpercent $lt{'perc'}</tt></small>
1.42 albertel 588: </td>
589: </tr>
590: <tr>
591: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 592: <small><b> $lt{'userload'}: </b></small>
1.42 albertel 593: </td>
594: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 595: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
1.14 albertel 596: </td>
597: </tr>
598: </table>
599: <br />
1.60 raeburn 600: $contactblock
1.14 albertel 601: </td>
602:
603: <!-- Row 5 Column 2 -->
1.19 bowersj2 604: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 605:
606: <!-- Row 5 Column 3 -->
1.21 www 607: <td width="100%" valign="bottom" bgcolor="$mainbg">
1.20 www 608: $domainlogo
609: </td>
1.14 albertel 610:
611: <!-- Row 5 Column 4 -->
1.19 bowersj2 612: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 613: </tr>
614: <tr>
615:
616: <!-- Row 6 Column 1 -->
1.21 www 617: <td bgcolor="$sidebg"> </td>
1.14 albertel 618:
619: <!-- Row 6 Column 2 -->
1.19 bowersj2 620: <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
1.14 albertel 621:
622: <!-- Row 6 Column 3 -->
1.19 bowersj2 623: <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
1.14 albertel 624:
625: <!-- Row 6 Column 4 -->
1.19 bowersj2 626: <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
1.14 albertel 627: </tr>
1.1 albertel 628: </table>
1.25 bowersj2 629:
1.59 albertel 630: <script type="text/javascript">
631: // the if prevents the script error if the browser can not handle this
1.25 bowersj2 632: if ( document.client.uname ) { document.client.uname.focus(); }
633: </script>
1.62 raeburn 634: $helpdeskscript
1.14 albertel 635:
1.1 albertel 636: ENDDOCUMENT
1.16 www 637: }
1.98 raeburn 638: my %endargs = ( 'noredirectlink' => 1, );
639: $r->print(&Apache::loncommon::end_page(\%endargs));
1.1 albertel 640: return OK;
1.60 raeburn 641: }
642:
643: sub contactdisplay {
1.90 raeburn 644: my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60 raeburn 645: my $contactblock;
1.62 raeburn 646: my $showhelpdesk = 0;
647: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
648: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
649: $showhelpdesk = 1;
650: }
1.90 raeburn 651: if ($servadm && $showadminmail) {
652: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
653: '<tt> '.$servadm.'</tt><br /> <br />';
654: }
1.60 raeburn 655: if ($showhelpdesk) {
1.84 raeburn 656: $contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
1.75 www 657: my $thisurl = &escape('/adm/login');
1.62 raeburn 658: $$helpdeskscript = <<"ENDSCRIPT";
659: <script type="text/javascript">
660: function helpdesk() {
661: var codedom = document.client.udom.value;
662: if (codedom == '') {
663: codedom = "$authdomain";
664: }
665: var querystr = "origurl=$thisurl&codedom="+codedom;
666: document.location.href = "/adm/helpdesk?"+querystr;
667: return;
668: }
669: </script>
670: ENDSCRIPT
1.60 raeburn 671: }
672: $contactblock .= <<"ENDBLOCK";
673: $version
674: ENDBLOCK
675: return $contactblock;
676: }
1.83 raeburn 677:
678: sub forgotpwdisplay {
1.84 raeburn 679: my (%lt) = @_;
1.83 raeburn 680: my $prompt_for_resetpw = 1;
681: if ($prompt_for_resetpw) {
1.101 raeburn 682: return '<br /> <a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br />';
1.84 raeburn 683: }
684: return;
685: }
686:
687: sub loginhelpdisplay {
688: my (%lt) = @_;
689: my $login_help = 1;
690: if ($login_help) {
691: return ' <a href="/adm/loginproblems.html">'.$lt{'help'}.'</a></b>';
1.83 raeburn 692: }
693: return;
694: }
1.1 albertel 695:
1.90 raeburn 696: sub coursecatalog_link {
697: my ($linkname) = @_;
698: return <<"END";
699: <tr>
700: <td> </td>
701: <td><a href="/adm/coursecatalog"><b>$linkname</b></a></td>
702: </tr>
703: END
704: }
705:
1.101 raeburn 706: sub newuser_link {
707: my ($linkname) = @_;
708: return ' <a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
709: }
710:
1.1 albertel 711: 1;
712: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>