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