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