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