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