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