1: # The LearningOnline Network
2: # Login Screen
3: #
4: # $Id: lonlogin.pm,v 1.77 2006/08/18 17:44:44 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:
44: sub handler {
45: my $r = shift;
46:
47: &Apache::loncommon::get_unprocessed_cgi
48: ($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'},
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=$lonid->value;
77: $handle=~s/\W//g;
78: my $lonidsdir=$r->dir_config('lonIDsDir');
79: if (-e "$lonidsdir/$handle.id") {
80: # Is there an existing token file?
81: if ($handle=~/^publicuser\_/) {
82: # For "public user" - remove it, we apparently really want to login
83: unlink("$lonidsdir/$handle.id");
84: } elsif ($handle ne '') {
85: # Indeed, a valid token is found
86: my $start_page =
87: &Apache::loncommon::start_page('Already logged in');
88: my $end_page =
89: &Apache::loncommon::end_page();
90: $r->print(<<ENDFAILED);
91: $start_page
92: <h1>You are already logged in</h1>
93: <p>Please either <a href="/adm/roles">continue the current session</a> or
94: <a href="/adm/logout">logout</a>.</p>
95: <p>
96: <a href="/adm/loginproblems.html">Problems?</a></p>
97: $end_page
98: ENDFAILED
99: return OK;
100: }
101: }
102: }
103:
104: # ---------------------------------------------------- No valid token, continue
105:
106: # ---------------------------- Not possible to really login to domain "public"
107: if ($env{'form.domain'} eq 'public') {
108: $env{'form.domain'}='';
109: $env{'form.username'}='';
110: }
111: # ----------------------------------------------------------- Process Interface
112: $env{'form.interface'}=~s/\W//g;
113:
114: my $textbrowsers=$r->dir_config('lonTextBrowsers');
115: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
116:
117: foreach (split(/\:/,$textbrowsers)) {
118: if ($httpbrowser=~/$_/i) {
119: $env{'form.interface'}='textual';
120: }
121: }
122:
123: my $fullgraph=($env{'form.interface'} ne 'textual');
124: my $port_to_use=$r->dir_config('lonhttpdPort');
125: if (!defined($port_to_use)) {
126: $port_to_use='8080';
127: }
128: my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use.
129: $r->dir_config('lonIconsURL');
130: my $domain = $r->dir_config('lonDefDomain');
131: my $testdomain=(split(/\./,$ENV{'HTTP_HOST'}))[0];
132: foreach my $posdom (&Apache::lonnet::current_machine_domains()) {
133: if (lc($posdom) eq lc($testdomain)) { $domain=$posdom; }
134: }
135: if (($env{'form.domain'}) &&
136: ($Apache::lonnet::domaindescription{$env{'form.domain'}})) {
137: $domain=$env{'form.domain'};
138: }
139: my $role = $r->dir_config('lonRole');
140: my $loadlim = $r->dir_config('lonLoadLim');
141: my $servadm = $r->dir_config('lonAdmEMail');
142: my $sysadm = $r->dir_config('lonSysEMail');
143: my $lonhost = $r->dir_config('lonHostID');
144: my $tabdir = $r->dir_config('lonTabDir');
145: my $include = $r->dir_config('lonIncludes');
146: my $expire = $r->dir_config('lonExpire');
147: my $version = $r->dir_config('lonVersion');
148: my $host_name = $Apache::lonnet::hostname{$lonhost};
149:
150: # --------------------------------------------- Default values for login fields
151:
152: my $authusername=($env{'form.username'}?$env{'form.username'}:'');
153: my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
154:
155: # ---------------------------------------------------------- Determine own load
156: my $loadavg;
157: {
158: my $loadfile=Apache::File->new('/proc/loadavg');
159: $loadavg=<$loadfile>;
160: }
161: $loadavg =~ s/\s.*//g;
162: my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
163: my $userloadpercent=&Apache::lonnet::userload();
164:
165: # ------------------------------------------------------- Do the load balancing
166: my $otherserver=
167: ($ENV{'SERVER_PORT'} == 443?'https://':'HTTP://').$host_name;
168: my $firsturl=
169: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
170: # ---------------------------------------- Are we access server and overloaded?
171: if (($role eq 'access') &&
172: (($userloadpercent>100.0)||($loadpercent>100.0))) {
173: my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
174: if ($unloaded) { $otherserver=$unloaded; }
175: }
176:
177: # ----------------------------------------------------------- Get announcements
178: my $announcements=&Apache::lonnet::getannounce();
179: # -------------------------------------------------------- Set login parameters
180:
181: my @hexstr=('0','1','2','3','4','5','6','7',
182: '8','9','a','b','c','d','e','f');
183: my $lkey='';
184: for (0..7) {
185: $lkey.=$hexstr[rand(15)];
186: }
187:
188: my $ukey='';
189: for (0..7) {
190: $ukey.=$hexstr[rand(15)];
191: }
192:
193: my $lextkey=hex($lkey);
194: if ($lextkey>2147483647) { $lextkey-=4294967296; }
195:
196: my $uextkey=hex($ukey);
197: if ($uextkey>2147483647) { $uextkey-=4294967296; }
198:
199: # -------------------------------------------------------- Store away log token
200: my $logtoken=Apache::lonnet::reply(
201: 'tmpput:'.$ukey.$lkey.'&'.$firsturl,
202: $lonhost);
203:
204: # ------------------- If we cannot talk to ourselves, we are in serious trouble
205:
206: if ($logtoken eq 'con_lost') {
207: my $spares='';
208: my $last;
209: foreach my $hostid (sort
210: {
211: $Apache::lonnet::hostname{$a} cmp
212: $Apache::lonnet::hostname{$b};
213: }
214: keys(%Apache::lonnet::spareid)) {
215: next if ($hostid eq $lonhost);
216: next if ($last eq $Apache::lonnet::hostname{$hostid});
217: $spares.='<br /><font size="+1"><a href="http://'.
218: $Apache::lonnet::hostname{$hostid}.
219: '/adm/login?domain='.$authdomain.'">'.
220: $Apache::lonnet::hostname{$hostid}.'</a>'.
221: ' (preferred)</font>'.$/;
222: $last=$Apache::lonnet::hostname{$hostid};
223: }
224: $spares.= '<br />';
225: foreach my $hostid (sort
226: {
227: $Apache::lonnet::hostname{$a} cmp
228: $Apache::lonnet::hostname{$b};
229: }
230: keys(%Apache::lonnet::hostname)) {
231: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
232: next if ($last eq $Apache::lonnet::hostname{$hostid});
233: $spares.='<br /><a href="http://'.
234: $Apache::lonnet::hostname{$hostid}.
235: '/adm/login?domain='.$authdomain.'">'.
236: $Apache::lonnet::hostname{$hostid}.'</a>';
237: $last=$Apache::lonnet::hostname{$hostid};
238: }
239: $r->print(<<ENDTROUBLE);
240: <html>
241: <head><title>The LearningOnline Network with CAPA</title></head>
242: <body bgcolor="#FFFFFF">
243: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
244: <h3>This LON-CAPA server is temporarily not available for login</h3>
245: <p>Please attempt to login to one of the following servers:</p>$spares
246: <p>If the problem persists, please contact <tt>$servadm</tt>.</p>
247: </body>
248: </html>
249: ENDTROUBLE
250: return OK;
251: }
252:
253: # ----------------------------------------------- Apparently we are in business
254:
255: my $domainlogo=&Apache::loncommon::domainlogo($domain);
256: $servadm=~s/\,/\<br \/\>/g;
257: $sysadm=~s/\,/\<br \/\>/g;
258:
259: # --------------------------------------------------- Print login screen header
260: $r->print(<<ENDHEADER);
261: <html>
262: <head>
263: <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />
264: <title>The LearningOnline Network with CAPA Login</title>
265: </head>
266: ENDHEADER
267: # ---------------------------------------------------- Serve out DES JavaScript
268: {
269: my $jsh=Apache::File->new($include."/londes.js");
270: $r->print(<$jsh>);
271: }
272:
273: # ----------------------------------------------------------- Front page design
274: my $pgbg=
275: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
276: my $font=
277: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
278: my $link=
279: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
280: my $vlink=
281: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
282: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
283: my $mainbg=
284: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
285: my $sidebg=
286: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
287: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
288: my $img=&Apache::loncommon::designparm('login.img',$domain);
289:
290: # ----------------------------------------------------------------------- Texts
291:
292: my %lt=&Apache::lonlocal::texthash(
293: 'un' => 'Username',
294: 'pw' => 'Password',
295: 'dom' => 'Domain',
296: 'perc' => 'percent',
297: 'load' => 'Load',
298: 'userload' => 'User Load',
299: 'about' => 'aboutlon.gif',
300: 'access' => 'accessbutton.gif',
301: 'auth' => 'userauthentication.gif',
302: 'log' => 'Log in',
303: 'help' => 'Help',
304: 'serv' => 'Server',
305: 'servadm' => 'Server Administration',
306: 'sysadm' => 'System Administration',
307: 'helpdesk' => 'Contact Helpdesk');
308: # -------------------------------------------------- Change password field name
309: my $now=time;
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: if ($fullgraph) { $r->print(<<ENDTOP);
389: <!-- The LON-CAPA Header -->
390: <tr>
391:
392: <!-- Row 1 Columns 2-4 -->
393: <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>
394: </tr>
395:
396: <!-- The gray bar that starts the two table frames -->
397: <tr>
398:
399: <!-- Row 2 Column 1 -->
400: <td width=182 height=27 bgcolor="$sidebg"> </td>
401:
402: <!-- Row 2 Column 2 -->
403: <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
404:
405: <!-- Row 2 Column 3 -->
406: <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
407:
408: <!-- Row 2 Column 4 -->
409: <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
410: </tr>
411: <tr>
412:
413: <!-- A cell that will hold the 'access' and 'about' buttons -->
414: <!-- Row 3 Column 1 -->
415: <td valign="top" height=60 align="center" bgcolor="$sidebg">
416: <a href="/adm/login?interface=textual"><img src="$iconpath/$lt{'access'}" border=0 alt="Accessibility Options" /></a>
417: <br />
418: <a href="/adm/about.html"><img src="$iconpath/$lt{'about'}" border=0 alt="About LON-CAPA" /></a>
419: </td>
420:
421: <!-- The shaded space between the two main columns -->
422: <!-- Row 3 Column 2 -->
423: <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
424:
425: <!-- The right main column holding the large LON-CAPA logo-->
426: <!-- Rows 3-4 Column 3 -->
427: <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
428: <center>
429: <img src="$logo" alt="" />
430: </center>
431: </td>
432:
433: <!-- Row 3 Column 4 -->
434: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
435: </tr>
436: <tr>
437:
438: <!-- The entry form -->
439: <!-- Row 4 Column 1 -->
440: <td align="center" valign="middle" bgcolor="$sidebg">
441: ENDTOP
442: } else {
443: $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);
444: }
445: $r->print('<form name="client" onsubmit="return(send())">');
446: unless ($fullgraph) {
447: $r->print(<<ENDACCESSOPTIONS);
448: <h3>Select Accessibility Options</h3>
449: <label><input type="checkbox" name="imagesuppress" /> Suppress rendering of images</label><br />
450: <label><input type="checkbox" name="appletsuppress" /> Suppress Java applets</label><br />
451: <label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br />
452: <label><input type="checkbox" name="fontenhance" /> Increase font size</label><br />
453: <label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><br />
454: <p>If you have accessibility needs that are not addressed by this interface,
455: please
456: contact the system administrator at <tt>$sysadm</tt>.</p><br />
457: <input type="checkbox" name="remember" /> Remember these settings for next login<hr />
458: ENDACCESSOPTIONS
459: } else {
460: $r->print(<<ENDNOOPT);
461: <input type="hidden" name="imagesuppress" value="" />
462: <input type="hidden" name="embedsuppress" value="" />
463: <input type="hidden" name="appletsuppress" value="" />
464: <input type="hidden" name="fontenhance" value="" />
465: <input type="hidden" name="blackwhite" value="" />
466: <input type="hidden" name="remember" value="" />
467: ENDNOOPT
468: }
469: $r->print(<<ENDLOGIN);
470: <input type="hidden" name="lextkey" value="$lextkey">
471: <input type="hidden" name="uextkey" value="$uextkey">
472:
473: <!-- Start the sub-table for text and input alignment -->
474: <table border=0 cellspacing=0 cellpadding=0>
475: <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>
476: <tr>
477: <td bgcolor="$mainbg"><br /><font size=-1><b> $lt{'un'}:</b></font></td>
478: <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
479: </tr>
480: <tr>
481: <td bgcolor="$mainbg"><font size=-1><b> $lt{'pw'}:</b></font></td>
482: <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
483: </tr>
484: <tr>
485: <td bgcolor="$mainbg"><font size=-1><b> $lt{'dom'}:</b></font></td>
486: <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
487: </tr>
488: <tr>
489: <td bgcolor="$mainbg"> <a href="/adm/loginproblems.html">$lt{'help'}</a></td>
490: <td bgcolor="$mainbg" valign="bottom" align="center">
491: <br />
492: <input type="submit" value="$lt{'log'}" />
493: </td>
494: </tr>
495: </table>
496: <!-- End sub-table -->
497: </form>
498: ENDLOGIN
499: if ($fullgraph) {
500: my $helpdeskscript;
501: my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version,$authdomain,\$helpdeskscript);
502: $r->print(<<ENDDOCUMENT);
503: </td>
504:
505: <!-- Row 4 Column 2 -->
506: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
507:
508: <!-- Row 4 Column 3 -->
509: <td bgcolor="$mainbg">$announcements</td>
510:
511: <!-- Row 4 Column 4 -->
512: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
513: </tr>
514: <tr>
515:
516: <!-- Row 5 Column 1 -->
517: <td bgcolor="$sidebg" valign="middle" align="left">
518: <br />
519: <table border=0 cellspacing=0 cellpadding=0>
520: <tr>
521: <td bgcolor="$sidebg" align="left" valign="top">
522: <small><b> $lt{'dom'}: </b></small>
523: </td>
524: <td bgcolor="$sidebg" align="left" valign="top">
525: <small><tt> $domain</tt></small>
526: </td>
527: </tr>
528: <tr>
529: <td bgcolor="$sidebg" align="left" valign="top">
530: <small><b> $lt{'serv'}: </b></small>
531: </td>
532: <td bgcolor="$sidebg" align="left" valign="top">
533: <small><tt> $lonhost ($role)</tt></small>
534: </td>
535: </tr>
536: <tr>
537: <td bgcolor="$sidebg" align="left" valign="top">
538: <small><b> $lt{'load'}: </b></small>
539: </td>
540: <td bgcolor="$sidebg" align="left" valign="top">
541: <small><tt> $loadpercent $lt{'perc'}</tt></small>
542: </td>
543: </tr>
544: <tr>
545: <td bgcolor="$sidebg" align="left" valign="top">
546: <small><b> $lt{'userload'}: </b></small>
547: </td>
548: <td bgcolor="$sidebg" align="left" valign="top">
549: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
550: </td>
551: </tr>
552: </table>
553: <br />
554: $contactblock
555: </td>
556:
557: <!-- Row 5 Column 2 -->
558: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
559:
560: <!-- Row 5 Column 3 -->
561: <td width="100%" valign="bottom" bgcolor="$mainbg">
562: $domainlogo
563: </td>
564:
565: <!-- Row 5 Column 4 -->
566: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
567: </tr>
568: <tr>
569:
570: <!-- Row 6 Column 1 -->
571: <td bgcolor="$sidebg"> </td>
572:
573: <!-- Row 6 Column 2 -->
574: <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
575:
576: <!-- Row 6 Column 3 -->
577: <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
578:
579: <!-- Row 6 Column 4 -->
580: <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
581: </tr>
582: </table>
583:
584: <script type="text/javascript">
585: // the if prevents the script error if the browser can not handle this
586: if ( document.client.uname ) { document.client.uname.focus(); }
587: </script>
588: $helpdeskscript
589:
590: ENDDOCUMENT
591: }
592: $r->print('</body></html>');
593: return OK;
594: }
595:
596: sub contactdisplay {
597: my ($lt,$sysadm,$servadm,$version,$authdomain,$helpdeskscript) = @_;
598: my $contactblock;
599: my $showsysadm = 1;
600: my $showservadm = 1;
601: my $showhelpdesk = 0;
602: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
603: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
604: $showhelpdesk = 1;
605: }
606: if ($showsysadm) {
607: $contactblock .= '<b> '.$$lt{'sysadm'}.':</b><br />'.
608: '<tt> '.$sysadm.'</tt><br />';
609: }
610: if ($showservadm) {
611: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
612: '<tt> '.$servadm.'</tt><br /> <br />';
613: }
614: if ($showhelpdesk) {
615: $contactblock .= '<b> <a href="javascript:helpdesk()">'.$$lt{'helpdesk'}.'</a></b><br />';
616: my $thisurl = &escape('/adm/login');
617: $$helpdeskscript = <<"ENDSCRIPT";
618: <script type="text/javascript">
619: function helpdesk() {
620: var codedom = document.client.udom.value;
621: if (codedom == '') {
622: codedom = "$authdomain";
623: }
624: var querystr = "origurl=$thisurl&codedom="+codedom;
625: document.location.href = "/adm/helpdesk?"+querystr;
626: return;
627: }
628: </script>
629: ENDSCRIPT
630: }
631: $contactblock .= <<"ENDBLOCK";
632: $version
633: ENDBLOCK
634: return $contactblock;
635: }
636:
637:
638: 1;
639: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>