1: # The LearningOnline Network
2: # Login Screen
3: #
4: # $Id: lonlogin.pm,v 1.147 2011/03/03 06:37:30 raeburn 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 Apache::File ();
34: use Apache::lonnet;
35: use Apache::loncommon();
36: use Apache::lonauth();
37: use Apache::lonlocal;
38: use Apache::migrateuser();
39: use lib '/home/httpd/lib/perl/';
40: use LONCAPA;
41:
42: sub handler {
43: my $r = shift;
44:
45: &Apache::loncommon::get_unprocessed_cgi
46: (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
47: $ENV{'REDIRECT_QUERY_STRING'}),
48: ['interface','username','domain','firsturl','localpath','localres',
49: 'token','role','symb']);
50: if (!defined($env{'form.firsturl'})) {
51: &Apache::lonacc::get_posted_cgi($r,['firsturl']);
52: }
53:
54: # -- check if they are a migrating user
55: if (defined($env{'form.token'})) {
56: return &Apache::migrateuser::handler($r);
57: }
58:
59: &Apache::loncommon::no_cache($r);
60: &Apache::lonlocal::get_language_handle($r);
61: &Apache::loncommon::content_type($r,'text/html');
62: $r->send_http_header;
63: return OK if $r->header_only;
64:
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: }
71:
72: $env{'form.firsturl'} =~ s/(`)/'/g;
73:
74: # -------------------------------- Prevent users from attempting to login twice
75: my $handle = &Apache::lonnet::check_for_valid_session($r);
76: if ($handle ne '') {
77: my $lonidsdir=$r->dir_config('lonIDsDir');
78: if ($handle=~/^publicuser\_/) {
79: # For "public user" - remove it, we apparently really want to login
80: unlink($r->dir_config('lonIDsDir')."/$handle.id");
81: } else {
82: # Indeed, a valid token is found
83: &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
84: my $start_page =
85: &Apache::loncommon::start_page('Already logged in');
86: my $end_page =
87: &Apache::loncommon::end_page();
88: my $dest = '/adm/roles';
89: if ($env{'form.firsturl'} ne '') {
90: $dest = $env{'form.firsturl'};
91: }
92: $r->print(
93: $start_page
94: .'<h1>'.&mt('You are already logged in!').'</h1>'
95: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
96: '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
97: .$end_page
98: );
99: return OK;
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 $httpbrowser=$ENV{"HTTP_USER_AGENT"};
114:
115: my $iconpath=
116: &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
117:
118: my $lonhost = $r->dir_config('lonHostID');
119: my $domain = &Apache::lonnet::default_login_domain();
120: if ($lonhost ne '') {
121: my $redirect = &check_loginvia($domain,$lonhost);
122: if ($redirect) {
123: $r->print($redirect);
124: return OK;
125: }
126: }
127:
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 $uloadlim= $r->dir_config('lonUserLoadLim');
135: my $servadm = $r->dir_config('lonAdmEMail');
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:
155: my ($loadpercent,$userloadpercent);
156: if ($loadlim) {
157: $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
158: }
159: if ($uloadlim) {
160: $userloadpercent=&Apache::lonnet::userload();
161: }
162:
163: my $firsturl=
164: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
165:
166: # ----------------------------------------------------------- Get announcements
167: my $announcements=&Apache::lonnet::getannounce();
168: # -------------------------------------------------------- Set login parameters
169:
170: my @hexstr=('0','1','2','3','4','5','6','7',
171: '8','9','a','b','c','d','e','f');
172: my $lkey='';
173: for (0..7) {
174: $lkey.=$hexstr[rand(15)];
175: }
176:
177: my $ukey='';
178: for (0..7) {
179: $ukey.=$hexstr[rand(15)];
180: }
181:
182: my $lextkey=hex($lkey);
183: if ($lextkey>2147483647) { $lextkey-=4294967296; }
184:
185: my $uextkey=hex($ukey);
186: if ($uextkey>2147483647) { $uextkey-=4294967296; }
187:
188: # -------------------------------------------------------- Store away log token
189: my $tokenextras;
190: if ($env{'form.role'}) {
191: $tokenextras = '&role='.&escape($env{'form.role'});
192: }
193: if ($env{'form.symb'}) {
194: if (!$tokenextras) {
195: $tokenextras = '&';
196: }
197: $tokenextras .= '&symb='.&escape($env{'form.symb'});
198: }
199: my $logtoken=Apache::lonnet::reply(
200: 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
201: $lonhost);
202:
203: # ------------------- If we cannot talk to ourselves, we are in serious trouble
204:
205: if ($logtoken eq 'con_lost') {
206: my $spares='';
207: my $last;
208: foreach my $hostid (sort
209: {
210: &Apache::lonnet::hostname($a) cmp
211: &Apache::lonnet::hostname($b);
212: }
213: keys(%Apache::lonnet::spareid)) {
214: next if ($hostid eq $lonhost);
215: my $hostname = &Apache::lonnet::hostname($hostid);
216: next if ($last eq $hostname);
217: $spares.='<br /><font size="+1"><a href="http://'.
218: $hostname.
219: '/adm/login?domain='.$authdomain.'">'.
220: $hostname.'</a>'.
221: ' '.&mt('(preferred)').'</font>'.$/;
222: $last=$hostname;
223: }
224: $spares.= '<br />';
225: my %all_hostnames = &Apache::lonnet::all_hostnames();
226: foreach my $hostid (sort
227: {
228: &Apache::lonnet::hostname($a) cmp
229: &Apache::lonnet::hostname($b);
230: }
231: keys(%all_hostnames)) {
232: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
233: my $hostname = &Apache::lonnet::hostname($hostid);
234: next if ($last eq $hostname);
235: $spares.='<br /><a href="http://'.
236: $hostname.
237: '/adm/login?domain='.$authdomain.'">'.
238: $hostname.'</a>';
239: $last=$hostname;
240: }
241: $r->print(
242: '<html>'
243: .'<head><title>'
244: .&mt('The LearningOnline Network with CAPA')
245: .'</title></head>'
246: .'<body bgcolor="#FFFFFF">'
247: .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
248: .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
249: .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
250: .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
251: .$spares
252: .'</body>'
253: .'</html>'
254: );
255: return OK;
256: }
257:
258: # ----------------------------------------------- Apparently we are in business
259: $servadm=~s/\,/\<br \/\>/g;
260:
261: # ----------------------------------------------------------- Front page design
262: my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
263: my $font=&Apache::loncommon::designparm('login.font',$domain);
264: my $link=&Apache::loncommon::designparm('login.link',$domain);
265: my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
266: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
267: my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
268: my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
269: my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
270: my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
271: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
272: my $img=&Apache::loncommon::designparm('login.img',$domain);
273: my $domainlogo=&Apache::loncommon::domainlogo($domain);
274: my $showbanner = 1;
275: my $showmainlogo = 1;
276: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
277: $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
278: }
279: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
280: $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
281: }
282: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
283: my $showcoursecat =
284: &Apache::loncommon::designparm('login.coursecatalog',$domain);
285: my $shownewuserlink =
286: &Apache::loncommon::designparm('login.newuser',$domain);
287: my $now=time;
288: my $js = (<<ENDSCRIPT);
289:
290: <script type="text/javascript" language="JavaScript">
291: // <![CDATA[
292: function send()
293: {
294: this.document.server.elements.uname.value
295: =this.document.client.elements.uname.value;
296:
297: this.document.server.elements.udom.value
298: =this.document.client.elements.udom.value;
299:
300: uextkey=this.document.client.elements.uextkey.value;
301: lextkey=this.document.client.elements.lextkey.value;
302: initkeys();
303:
304: this.document.server.elements.upass0.value
305: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
306: this.document.server.elements.upass1.value
307: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
308: this.document.server.elements.upass2.value
309: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
310:
311: this.document.client.elements.uname.value='';
312: this.document.client.elements.upass$now.value='';
313:
314: this.document.server.submit();
315: return false;
316: }
317:
318: function enableInput() {
319: this.document.client.elements.upass$now.removeAttribute("readOnly");
320: this.document.client.elements.uname.removeAttribute("readOnly");
321: this.document.client.elements.udom.removeAttribute("readOnly");
322: return;
323: }
324:
325: // ]]>
326: </script>
327:
328: ENDSCRIPT
329:
330: # --------------------------------------------------- Print login screen header
331:
332: my %add_entries = (
333: bgcolor => "$mainbg",
334: text => "$font",
335: link => "$link",
336: vlink => "$vlink",
337: alink => "$alink",
338: onload => 'javascript:enableInput();',);
339:
340: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
341: { 'redirect' => [$expire,'/adm/roles'],
342: 'add_entries' => \%add_entries,
343: 'only_body' => 1,}));
344:
345: # ----------------------------------------------------------------------- Texts
346:
347: my %lt=&Apache::lonlocal::texthash(
348: 'un' => 'Username',
349: 'pw' => 'Password',
350: 'dom' => 'Domain',
351: 'perc' => 'percent',
352: 'load' => 'Server Load',
353: 'userload' => 'User Load',
354: 'catalog' => 'Course/Community Catalog',
355: 'log' => 'Log in',
356: 'help' => 'Log-in Help',
357: 'serv' => 'Server',
358: 'servadm' => 'Server Administration',
359: 'helpdesk' => 'Contact Helpdesk',
360: 'forgotpw' => 'Forgot password?',
361: 'newuser' => 'New User?',
362: );
363: # -------------------------------------------------- Change password field name
364:
365: my $forgotpw = &forgotpwdisplay(%lt);
366: $forgotpw .= '<br />' if $forgotpw;
367: my $loginhelp = &loginhelpdisplay($authdomain,%lt);
368: $loginhelp .= '<br />' if $loginhelp;
369:
370: # ---------------------------------------------------- Serve out DES JavaScript
371: {
372: my $jsh=Apache::File->new($include."/londes.js");
373: $r->print(<$jsh>);
374: }
375: # ---------------------------------------------------------- Serve rest of page
376:
377: $r->print(
378: '<div class="LC_Box"'
379: .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
380: );
381:
382: #
383: # If the loadbalancing yielded just http:// because perhaps there's no loadbalancing?
384: # then just us a relative link to authenticate:
385: #
386:
387: $r->print(<<ENDSERVERFORM);
388: <form name="server" action="/adm/authenticate" method="post" target="_top">
389: <input type="hidden" name="logtoken" value="$logtoken" />
390: <input type="hidden" name="serverid" value="$lonhost" />
391: <input type="hidden" name="uname" value="" />
392: <input type="hidden" name="upass0" value="" />
393: <input type="hidden" name="upass1" value="" />
394: <input type="hidden" name="upass2" value="" />
395: <input type="hidden" name="udom" value="" />
396: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
397: <input type="hidden" name="localres" value="$env{'form.localres'}" />
398: </form>
399: ENDSERVERFORM
400: my $coursecatalog;
401: if (($showcoursecat eq '') || ($showcoursecat)) {
402: $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
403: }
404: my $newuserlink;
405: if ($shownewuserlink) {
406: $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
407: }
408: my $logintitle =
409: '<h2 class="LC_hcell"'
410: .' style="background:'.$loginbox_header_bgcol.';'
411: .' color:'.$loginbox_header_textcol.'">'
412: .$lt{'log'}
413: .'</h2>';
414:
415: my $noscript_warning='<noscript><span class="LC_warning"><b>'
416: .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
417: .'</b></span></noscript>';
418: my $helpdeskscript;
419: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
420: $authdomain,\$helpdeskscript);
421:
422: my $loginform=(<<LFORM);
423: <form name="client" action="" onsubmit="return(send())">
424: <input type="hidden" name="lextkey" value="$lextkey" />
425: <input type="hidden" name="uextkey" value="$uextkey" />
426: <b><label for="uname">$lt{'un'}</label>:</b><br />
427: <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" /><br />
428: <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
429: <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />
430: <b><label for="udom">$lt{'dom'}</label>:</b><br />
431: <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" /><br />
432: <input type="submit" value="$lt{'log'}" />
433: </form>
434: LFORM
435:
436: if ($showbanner) {
437: $r->print(<<HEADER);
438: <!-- The LON-CAPA Header -->
439: <div style="background:$pgbg;margin:0;width:100%;">
440: <img src="$img" border="0" alt="The Learning Online Network with CAPA" />
441: </div>
442: HEADER
443: }
444: $r->print(<<ENDTOP);
445: <div style="float:left;margin-top:0;">
446: <div class="LC_Box" style="background:$loginbox_bg;">
447: $logintitle
448: $loginform
449: $noscript_warning
450: </div>
451:
452: <div class="LC_Box" style="padding-top: 10px;">
453: $loginhelp
454: $forgotpw
455: $contactblock
456: $newuserlink
457: $coursecatalog
458: </div>
459: </div>
460:
461: <div>
462: ENDTOP
463: if ($showmainlogo) {
464: $r->print(' <img src="'.$logo.'" alt="" />'."\n");
465: }
466: $r->print(<<ENDTOP);
467: $announcements
468: </div>
469: <hr style="clear:both;" />
470: ENDTOP
471: my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
472: $domainrow = <<"END";
473: <tr>
474: <td align="left" valign="top">
475: <small><b>$lt{'dom'}: </b></small>
476: </td>
477: <td align="left" valign="top">
478: <small><tt> $domain</tt></small>
479: </td>
480: </tr>
481: END
482: $serverrow = <<"END";
483: <tr>
484: <td align="left" valign="top">
485: <small><b>$lt{'serv'}: </b></small>
486: </td>
487: <td align="left" valign="top">
488: <small><tt> $lonhost ($role)</tt></small>
489: </td>
490: </tr>
491: END
492: if ($loadlim) {
493: $loadrow = <<"END";
494: <tr>
495: <td align="left" valign="top">
496: <small><b>$lt{'load'}: </b></small>
497: </td>
498: <td align="left" valign="top">
499: <small><tt> $loadpercent $lt{'perc'}</tt></small>
500: </td>
501: </tr>
502: END
503: }
504: if ($uloadlim) {
505: $userloadrow = <<"END";
506: <tr>
507: <td align="left" valign="top">
508: <small><b>$lt{'userload'}: </b></small>
509: </td>
510: <td align="left" valign="top">
511: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
512: </td>
513: </tr>
514: END
515: }
516: if (($version ne '') && ($version ne '<!-- VERSION -->')) {
517: $versionrow = <<"END";
518: <tr>
519: <td colspan="2" align="left">
520: <small>$version</small>
521: </td>
522: </tr>
523: END
524: }
525:
526: $r->print(<<ENDDOCUMENT);
527: <div style="float: left;">
528: <table border="0" cellspacing="0" cellpadding="0">
529: $domainrow
530: $serverrow
531: $loadrow
532: $userloadrow
533: $versionrow
534: </table>
535: </div>
536: <div style="float: right;">
537: $domainlogo
538: </div>
539: <br style="clear:both;" />
540: </div>
541:
542: <script type="text/javascript">
543: // <![CDATA[
544: // the if prevents the script error if the browser can not handle this
545: if ( document.client.uname ) { document.client.uname.focus(); }
546: // ]]>
547: </script>
548: $helpdeskscript
549:
550: ENDDOCUMENT
551: my %endargs = ( 'noredirectlink' => 1, );
552: $r->print(&Apache::loncommon::end_page(\%endargs));
553: return OK;
554: }
555:
556: sub check_loginvia {
557: my ($domain,$lonhost) = @_;
558: if ($domain eq '' || $lonhost eq '') {
559: return;
560: }
561: my %domconfhash = &Apache::loncommon::get_domainconf($domain);
562: my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};
563: my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};
564: my $output;
565: if ($loginvia ne '') {
566: my $noredirect;
567: my $ip = $ENV{'REMOTE_ADDR'};
568: if ($ip eq '127.0.0.1') {
569: $noredirect = 1;
570: } else {
571: if ($loginvia_exempt ne '') {
572: my @exempt = split(',',$loginvia_exempt);
573: if (grep(/^\Q$ip\E$/,@exempt)) {
574: $noredirect = 1;
575: }
576: }
577: }
578: unless ($noredirect) {
579: my ($newhost,$path);
580: if ($loginvia =~ /:/) {
581: ($newhost,$path) = split(':',$loginvia);
582: } else {
583: $newhost = $loginvia;
584: }
585: if ($newhost ne $lonhost) {
586: if (&Apache::lonnet::hostname($newhost) ne '') {
587: $output = &redirect_page($newhost,$path);
588: }
589: }
590: }
591: }
592: return $output;
593: }
594:
595: sub redirect_page {
596: my ($desthost,$path) = @_;
597: my $protocol = $Apache::lonnet::protocol{$desthost};
598: $protocol = 'http' if ($protocol ne 'https');
599: unless ($path =~ m{^/}) {
600: $path = '/'.$path;
601: }
602: my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;
603: if ($env{'form.firsturl'} ne '') {
604: $url .='?firsturl='.$env{'form.firsturl'};
605: }
606: my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
607: {'redirect' => [0,$url],});
608: my $end_page = &Apache::loncommon::end_page();
609: return $start_page.$end_page;
610: }
611:
612: sub contactdisplay {
613: my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript) = @_;
614: my $contactblock;
615: my $showhelpdesk = 0;
616: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
617: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
618: $showhelpdesk = 1;
619: }
620: if ($servadm && $showadminmail) {
621: $contactblock .= $$lt{'servadm'}.':<br />'.
622: '<tt>'.$servadm.'</tt><br />';
623: }
624: if ($showhelpdesk) {
625: $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
626: my $thisurl = &escape('/adm/login');
627: $$helpdeskscript = <<"ENDSCRIPT";
628: <script type="text/javascript">
629: // <![CDATA[
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: // ]]>
640: </script>
641: ENDSCRIPT
642: }
643: return $contactblock;
644: }
645:
646: sub forgotpwdisplay {
647: my (%lt) = @_;
648: my $prompt_for_resetpw = 1;
649: if ($prompt_for_resetpw) {
650: return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
651: }
652: return;
653: }
654:
655: sub loginhelpdisplay {
656: my ($authdomain,%lt) = @_;
657: my $login_help = 1;
658: if ($login_help) {
659: my $dom = $authdomain;
660: if ($dom eq '') {
661: $dom = &Apache::lonnet::default_login_domain();
662: }
663: my %helpconfig = &Apache::lonnet::get_dom('configuration',['helpsettings'],$dom);
664: my $loginhelp_url = $helpconfig{'helpsettings'}{'loginhelpurl'};
665: if ($loginhelp_url ne '') {
666: return '<a href="'.$loginhelp_url.'">'.$lt{'help'}.'</a>';
667: } else {
668: return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
669: }
670: }
671: return;
672: }
673:
674: sub coursecatalog_link {
675: my ($linkname) = @_;
676: return <<"END";
677: <a href="/adm/coursecatalog">$linkname</a>
678: END
679: }
680:
681: sub newuser_link {
682: my ($linkname) = @_;
683: return '<a href="/adm/createaccount">'.$linkname.'</a>';
684: }
685:
686: 1;
687: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>