Annotation of loncom/auth/lonlogin.pm, revision 1.109
1.1 albertel 1: # The LearningOnline Network
2: # Login Screen
1.11 www 3: #
1.109 ! raeburn 4: # $Id: lonlogin.pm,v 1.108 2008/11/23 11:01:01 tempelho Exp $
1.11 www 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.14 albertel 28:
1.1 albertel 29: package Apache::lonlogin;
30:
31: use strict;
32: use Apache::Constants qw(:common);
33: use Apache::File ();
1.63 albertel 34: use Apache::lonnet;
1.12 albertel 35: use Apache::loncommon();
1.49 www 36: use Apache::lonauth();
1.50 www 37: use Apache::lonlocal;
1.71 albertel 38: use Apache::migrateuser();
1.75 www 39: use lib '/home/httpd/lib/perl/';
40: use LONCAPA;
41:
1.1 albertel 42: sub handler {
43: my $r = shift;
1.71 albertel 44:
45: &Apache::loncommon::get_unprocessed_cgi
1.79 albertel 46: (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
47: $ENV{'REDIRECT_QUERY_STRING'}),
1.71 albertel 48: ['interface','username','domain','firsturl','localpath','localres',
49: 'token']);
1.102 raeburn 50: if (!defined($env{'form.firsturl'})) {
51: &Apache::lonacc::get_posted_cgi($r,['firsturl']);
52: }
1.71 albertel 53:
54: # -- check if they are a migrating user
55: if (defined($env{'form.token'})) {
56: return &Apache::migrateuser::handler($r);
57: }
58:
1.53 www 59: &Apache::loncommon::no_cache($r);
60: &Apache::lonlocal::get_language_handle($r);
1.54 www 61: &Apache::loncommon::content_type($r,'text/html');
1.1 albertel 62: $r->send_http_header;
63: return OK if $r->header_only;
64:
1.49 www 65:
66: # Are we re-routing?
67: if (-e '/home/httpd/html/lon-status/reroute.txt') {
68: &Apache::lonauth::reroute($r);
69: return OK;
70: }
1.55 www 71:
1.71 albertel 72:
1.55 www 73: # -------------------------------- Prevent users from attempting to login twice
1.95 albertel 74: my $handle = &Apache::lonnet::check_for_valid_session($r);
75: if ($handle=~/^publicuser\_/) {
1.70 www 76: # For "public user" - remove it, we apparently really want to login
1.95 albertel 77: unlink($r->dir_config('lonIDsDir')."/$handle.id");
78: } elsif ($handle ne '') {
1.55 www 79: # Indeed, a valid token is found
1.95 albertel 80: my $start_page =
81: &Apache::loncommon::start_page('Already logged in');
82: my $end_page =
83: &Apache::loncommon::end_page();
1.100 bisitz 84: $r->print(
85: $start_page
1.103 bisitz 86: .'<h1>'.&mt('You are already logged in!').'</h1>'
1.100 bisitz 87: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].',
88: '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').'</p>'
89: .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
90: .$end_page
91: );
1.95 albertel 92: return OK;
1.55 www 93: }
94:
95: # ---------------------------------------------------- No valid token, continue
1.16 www 96:
1.70 www 97: # ---------------------------- Not possible to really login to domain "public"
98: if ($env{'form.domain'} eq 'public') {
99: $env{'form.domain'}='';
100: $env{'form.username'}='';
101: }
1.32 www 102: # ----------------------------------------------------------- Process Interface
1.63 albertel 103: $env{'form.interface'}=~s/\W//g;
1.16 www 104:
1.107 tempelho 105: # my $textbrowsers=$r->dir_config('lonTextBrowsers');
1.32 www 106: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
107:
1.107 tempelho 108: # foreach (split(/\:/,$textbrowsers)) {
109: # if ($httpbrowser=~/$_/i) {
110: # $env{'form.interface'}='textual';
111: # }
112: # }
1.32 www 113:
1.63 albertel 114: my $fullgraph=($env{'form.interface'} ne 'textual');
1.94 albertel 115:
116: my $iconpath=
117: &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
118:
1.87 raeburn 119: my $domain = &Apache::lonnet::default_login_domain();
1.63 albertel 120: if (($env{'form.domain'}) &&
1.89 albertel 121: (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
1.63 albertel 122: $domain=$env{'form.domain'};
1.46 www 123: }
1.1 albertel 124: my $role = $r->dir_config('lonRole');
125: my $loadlim = $r->dir_config('lonLoadLim');
1.90 raeburn 126: my $servadm = $r->dir_config('lonAdmEMail');
1.1 albertel 127: my $lonhost = $r->dir_config('lonHostID');
128: my $tabdir = $r->dir_config('lonTabDir');
1.6 www 129: my $include = $r->dir_config('lonIncludes');
1.37 www 130: my $expire = $r->dir_config('lonExpire');
1.44 www 131: my $version = $r->dir_config('lonVersion');
1.88 albertel 132: my $host_name = &Apache::lonnet::hostname($lonhost);
1.1 albertel 133:
1.30 www 134: # --------------------------------------------- Default values for login fields
135:
1.63 albertel 136: my $authusername=($env{'form.username'}?$env{'form.username'}:'');
137: my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
1.30 www 138:
139: # ---------------------------------------------------------- Determine own load
1.1 albertel 140: my $loadavg;
1.41 albertel 141: {
142: my $loadfile=Apache::File->new('/proc/loadavg');
143: $loadavg=<$loadfile>;
144: }
1.1 albertel 145: $loadavg =~ s/\s.*//g;
1.57 matthew 146: my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
1.41 albertel 147: my $userloadpercent=&Apache::lonnet::userload();
1.1 albertel 148:
1.30 www 149: # ------------------------------------------------------- Do the load balancing
1.80 albertel 150: my $otherserver= &Apache::lonnet::absolute_url($host_name);
1.31 www 151: my $firsturl=
1.63 albertel 152: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.97 albertel 153: # ---------------------------------------------------------- Are we overloaded?
154: if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47 albertel 155: my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
156: if ($unloaded) { $otherserver=$unloaded; }
1.1 albertel 157: }
1.6 www 158:
1.45 www 159: # ----------------------------------------------------------- Get announcements
160: my $announcements=&Apache::lonnet::getannounce();
1.6 www 161: # -------------------------------------------------------- Set login parameters
162:
163: my @hexstr=('0','1','2','3','4','5','6','7',
164: '8','9','a','b','c','d','e','f');
165: my $lkey='';
166: for (0..7) {
167: $lkey.=$hexstr[rand(15)];
168: }
169:
170: my $ukey='';
171: for (0..7) {
172: $ukey.=$hexstr[rand(15)];
173: }
174:
175: my $lextkey=hex($lkey);
1.15 www 176: if ($lextkey>2147483647) { $lextkey-=4294967296; }
177:
1.6 www 178: my $uextkey=hex($ukey);
1.15 www 179: if ($uextkey>2147483647) { $uextkey-=4294967296; }
180:
1.31 www 181: # -------------------------------------------------------- Store away log token
1.6 www 182: my $logtoken=Apache::lonnet::reply(
1.7 www 183: 'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6 www 184: $lonhost);
1.31 www 185:
186: # ------------------- If we cannot talk to ourselves, we are in serious trouble
187:
188: if ($logtoken eq 'con_lost') {
189: my $spares='';
1.64 albertel 190: my $last;
191: foreach my $hostid (sort
192: {
1.88 albertel 193: &Apache::lonnet::hostname($a) cmp
194: &Apache::lonnet::hostname($b);
1.64 albertel 195: }
196: keys(%Apache::lonnet::spareid)) {
1.58 matthew 197: next if ($hostid eq $lonhost);
1.88 albertel 198: my $hostname = &Apache::lonnet::hostname($hostid);
199: next if ($last eq $hostname);
1.58 matthew 200: $spares.='<br /><font size="+1"><a href="http://'.
1.88 albertel 201: $hostname.
1.58 matthew 202: '/adm/login?domain='.$authdomain.'">'.
1.88 albertel 203: $hostname.'</a>'.
1.106 bisitz 204: ' '.&mt('(preferred)').'</font>'.$/;
1.88 albertel 205: $last=$hostname;
1.58 matthew 206: }
1.107 tempelho 207: $spares.= '<br />';
208: my %all_hostnames = &Apache::lonnet::all_hostnames();
209: foreach my $hostid (sort
210: {
211: &Apache::lonnet::hostname($a) cmp
212: &Apache::lonnet::hostname($b);
213: }
214: keys(%all_hostnames)) {
215: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
216: my $hostname = &Apache::lonnet::hostname($hostid);
217: next if ($last eq $hostname);
218: $spares.='<br /><a href="http://'.
219: $hostname.
220: '/adm/login?domain='.$authdomain.'">'.
221: $hostname.'</a>';
222: $last=$hostname;
223: }
224: $r->print(
225: '<html>'
226: .'<head><title>'
227: .&mt('The LearningOnline Network with CAPA')
228: .'</title></head>'
229: .'<body bgcolor="#FFFFFF">'
230: .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
231: .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
232: .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
233: .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
234: .$spares
235: .'</body>'
236: .'</html>'
237: );
238: return OK;
239: }
1.31 www 240:
241: # ----------------------------------------------- Apparently we are in business
1.107 tempelho 242: $servadm=~s/\,/\<br \/\>/g;
1.38 www 243:
1.21 www 244: # ----------------------------------------------------------- Front page design
1.107 tempelho 245: my $pgbg=
246: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
247: my $font=
248: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
249: my $link=
250: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
251: my $vlink=
252: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
253: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
254: my $mainbg=
255: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
256: my $sidebg=
257: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
258: my $textcol =
259: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
260: my $bgcol =
261: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
262: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
263: my $img=&Apache::loncommon::designparm('login.img',$domain);
264: my $domainlogo=&Apache::loncommon::domainlogo($domain);
265: my $login=&Apache::loncommon::designparm('login.login',$domain);
266: if ($login eq '') {
267: $login = $iconpath.'/'.&mt('userauthentication.gif');
268: }
1.109 ! raeburn 269: my $showbanner = 1;
! 270: my $showmainlogo = 1;
! 271: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
! 272: $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
! 273: }
! 274: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
! 275: $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
! 276: }
1.107 tempelho 277: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
278: my $showcoursecat =
279: &Apache::loncommon::designparm('login.coursecatalog',$domain);
280: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
281: my $shownewuserlink =
282: &Apache::loncommon::designparm('login.newuser',$domain);
283: my $now=time;
284: my $js = (<<ENDSCRIPT);
285:
286: <script language="JavaScript">
287: function send()
288: {
289: this.document.server.elements.uname.value
290: =this.document.client.elements.uname.value;
291:
292: this.document.server.elements.udom.value
293: =this.document.client.elements.udom.value;
294:
295: uextkey=this.document.client.elements.uextkey.value;
296: lextkey=this.document.client.elements.lextkey.value;
297: initkeys();
298:
299: this.document.server.elements.upass0.value
300: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
301: this.document.server.elements.upass1.value
302: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
303: this.document.server.elements.upass2.value
304: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.6 www 305:
1.107 tempelho 306: this.document.client.elements.uname.value='';
307: this.document.client.elements.upass$now.value='';
1.6 www 308:
1.107 tempelho 309: this.document.server.submit();
310: return false;
311: }
312: </script>
1.98 raeburn 313:
1.16 www 314: ENDSCRIPT
1.6 www 315:
1.98 raeburn 316: # --------------------------------------------------- Print login screen header
317:
1.107 tempelho 318: my %add_entries = (topmargin => "0",
319: leftmargin => "0",
320: marginheight => "0",
321: marginwidth => "0",
1.108 tempelho 322: bgcolor => "$mainbg",
1.107 tempelho 323: text => "$font",
324: link => "$link",
325: vlink => "$vlink",
326: alink => "$alink",);
327:
328: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
329: { 'redirect' => [$expire,'/adm/roles'],
330: 'add_entries' => \%add_entries,
331: 'only_body' => 1,}));
1.98 raeburn 332:
333: # ----------------------------------------------------------------------- Texts
334:
335: my %lt=&Apache::lonlocal::texthash(
1.107 tempelho 336: 'un' => 'Username',
337: 'pw' => 'Password',
338: 'dom' => 'Domain',
339: 'perc' => 'percent',
340: 'load' => 'Server Load',
341: 'userload' => 'User Load',
342: 'about' => 'About LON-CAPA',
343: 'catalog' => 'Course Catalog',
344: 'log' => 'Log in',
345: 'help' => 'Log-in Help',
346: 'serv' => 'Server',
347: 'servadm' => 'Server Administration',
348: 'helpdesk' => 'Contact Helpdesk',
349: 'forgotpw' => 'Forgot password?',
350: 'newuser' => 'New User?',
351: 'options_headline' => 'Select Accessibility Options',
352: 'sprs_img' => 'Suppress rendering of images',
353: 'sprs_applet' => 'Suppress Java applets',
354: 'sprs_embed' => 'Suppress rendering of embedded multimedia',
355: 'sprs_font' => 'Increase font size',
356: 'sprs_blackwhite' => 'Switch to black and white mode',
357: 'remember' => 'Remember these settings for next login');
1.98 raeburn 358: # -------------------------------------------------- Change password field name
1.107 tempelho 359: my $forgotpw = &forgotpwdisplay(%lt);
360: my $loginhelp = &loginhelpdisplay(%lt);
1.98 raeburn 361:
362: # ---------------------------------------------------- Serve out DES JavaScript
1.107 tempelho 363: {
364: my $jsh=Apache::File->new($include."/londes.js");
365: $r->print(<$jsh>);
366: }
1.98 raeburn 367: # ---------------------------------------------------------- Serve rest of page
368:
1.107 tempelho 369: if ($fullgraph) {
370: $r->print(
371: '<div class="LC_loginpage_container">');
372: }
1.6 www 373:
1.107 tempelho 374: $r->print(<<ENDSERVERFORM);
375: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33 www 376: <input type="hidden" name="logtoken" value="$logtoken" />
377: <input type="hidden" name="serverid" value="$lonhost" />
378: <input type="hidden" name="uname" value="" />
1.65 www 379: <input type="hidden" name="upass0" value="" />
380: <input type="hidden" name="upass1" value="" />
381: <input type="hidden" name="upass2" value="" />
1.33 www 382: <input type="hidden" name="udom" value="" />
1.63 albertel 383: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
384: <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14 albertel 385: </form>
1.16 www 386: ENDSERVERFORM
1.108 tempelho 387: my $coursecatalog;
388: if (($showcoursecat eq '') || ($showcoursecat)) {
389: $coursecatalog = &coursecatalog_link($lt{'catalog'});
390: }
391: my $newuserlink;
392: if ($shownewuserlink) {
393: $newuserlink = &newuser_link($lt{'newuser'});
394: }
395: my $logintitle;
396: if ($loginheader eq 'text') {
397: $logintitle = $lt{'log'};
398: } else {
399: $logintitle = '<img src="'.$login.'" alt="'.
400: &mt('User Authentication').'" />';
401: }
402:
403: my $noscript_warning='<noscript><span class="LC_warning"><b>'
404: .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
405: .'</b></span></noscript>';
406: my $helpdeskscript;
407: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
408: $version,$authdomain,\$helpdeskscript);
1.107 tempelho 409:
1.108 tempelho 410: my $loginform=(<<LFORM);
411: <form name="client" onsubmit="return(send())">
412: <input type="hidden" name="lextkey" value="$lextkey">
413: <input type="hidden" name="uextkey" value="$uextkey">
414: <b><label for="uname">$lt{'un'}</label>:</b><br />
415: <input type="text" name="uname" size="10" value="$authusername" /><br />
416: <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
417: <input type="password" name="upass$now" size="10" /><br />
418: <b><label for="udom">$lt{'dom'}</label>:</b><br />
419: <input type="text" name="udom" size="10" value="$authdomain" /><br />
420: <input type="submit" value="$lt{'log'}" />
421: </form>
422: LFORM
423:
1.109 ! raeburn 424: if ($fullgraph) {
! 425: if ($showbanner) {
! 426: $r->print(<<HEADER);
! 427: <!-- The LON-CAPA Header -->
! 428: <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">
! 429: <tr>
! 430: <td align="left" valign="top" bgcolor="$pgbg">
! 431: <img src="$img" border=0 alt="The Learning Online Network with CAPA" />
! 432: </td>
! 433: </tr>
! 434: </table>
! 435: HEADER
! 436: }
! 437: if ($showmainlogo) {
! 438: $r->print('<div class="LC_loginpage_space"> </div>'."\n".
! 439: ' <img src="'.$logo.'" alt="" />'."\n");
! 440: }
! 441: $r->print(<<ENDTOP);
1.108 tempelho 442: <div class="LC_loginpage_loginContainer">
443: <fieldset class="LC_loginpage_fieldset">
444: <legend class="LC_loginpage_legend">$logintitle</legend>
445: <table border="0" align="left" cellspacing="1" cellpadding="1" width="100%">
446: <tr>
447: <td width="50%" align="center" valign="top">
448: $domainlogo
449: </td>
450: <td>
451: $loginform
452: </td>
453: </tr>
454: </table>
455: $noscript_warning
456: </fieldset>
457: </div>
1.107 tempelho 458:
459: <div class="LC_loginpage_loginInfo">
460: $loginhelp<br />
461: $forgotpw<br /><br />
462: $newuserlink<br />
463: $coursecatalog<br /><br />
464: <a href="/adm/about.html"><b>$lt{'about'}</b></a><br />
465: $helpdeskscript
466: </div>
1.108 tempelho 467:
1.107 tempelho 468: <div class="LC_loginpage_space"> </div>
469: $announcements
1.108 tempelho 470: ENDTOP
1.107 tempelho 471: }
1.108 tempelho 472:
1.107 tempelho 473: if($announcements){$r->print('<div class="LC_loginpage_space"> </div>');}
1.14 albertel 474:
1.108 tempelho 475: if ($fullgraph) {
476: $r->print(<<ENDDOCUMENT);
1.14 albertel 477: <table border=0 cellspacing=0 cellpadding=0>
478: <tr>
1.21 www 479: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 480: <small><b> $lt{'dom'}: </b></small>
1.14 albertel 481: </td>
1.21 www 482: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 483: <small><tt> $domain</tt></small>
484: </td>
485: </tr>
486: <tr>
1.21 www 487: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 488: <small><b> $lt{'serv'}: </b></small>
1.14 albertel 489: </td>
1.21 www 490: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 491: <small><tt> $lonhost ($role)</tt></small>
492: </td>
493: </tr>
494: <tr>
1.21 www 495: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 496: <small><b> $lt{'load'}: </b></small>
1.14 albertel 497: </td>
1.21 www 498: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 499: <small><tt> $loadpercent $lt{'perc'}</tt></small>
1.42 albertel 500: </td>
501: </tr>
502: <tr>
503: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 504: <small><b> $lt{'userload'}: </b></small>
1.42 albertel 505: </td>
506: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 507: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
1.14 albertel 508: </td>
509: </tr>
510: </table>
1.107 tempelho 511:
1.60 raeburn 512: $contactblock
1.14 albertel 513:
1.107 tempelho 514: </div>
1.25 bowersj2 515:
1.59 albertel 516: <script type="text/javascript">
517: // the if prevents the script error if the browser can not handle this
1.25 bowersj2 518: if ( document.client.uname ) { document.client.uname.focus(); }
519: </script>
1.62 raeburn 520: $helpdeskscript
1.14 albertel 521:
1.1 albertel 522: ENDDOCUMENT
1.16 www 523: }
1.98 raeburn 524: my %endargs = ( 'noredirectlink' => 1, );
525: $r->print(&Apache::loncommon::end_page(\%endargs));
1.1 albertel 526: return OK;
1.60 raeburn 527: }
528:
529: sub contactdisplay {
1.90 raeburn 530: my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60 raeburn 531: my $contactblock;
1.62 raeburn 532: my $showhelpdesk = 0;
533: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
534: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
535: $showhelpdesk = 1;
536: }
1.90 raeburn 537: if ($servadm && $showadminmail) {
538: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
539: '<tt> '.$servadm.'</tt><br /> <br />';
540: }
1.60 raeburn 541: if ($showhelpdesk) {
1.84 raeburn 542: $contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
1.75 www 543: my $thisurl = &escape('/adm/login');
1.62 raeburn 544: $$helpdeskscript = <<"ENDSCRIPT";
545: <script type="text/javascript">
546: function helpdesk() {
547: var codedom = document.client.udom.value;
548: if (codedom == '') {
549: codedom = "$authdomain";
550: }
551: var querystr = "origurl=$thisurl&codedom="+codedom;
552: document.location.href = "/adm/helpdesk?"+querystr;
553: return;
554: }
555: </script>
556: ENDSCRIPT
1.60 raeburn 557: }
558: $contactblock .= <<"ENDBLOCK";
559: $version
560: ENDBLOCK
561: return $contactblock;
562: }
1.83 raeburn 563:
564: sub forgotpwdisplay {
1.84 raeburn 565: my (%lt) = @_;
1.83 raeburn 566: my $prompt_for_resetpw = 1;
567: if ($prompt_for_resetpw) {
1.107 tempelho 568: return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
1.84 raeburn 569: }
570: return;
571: }
572:
573: sub loginhelpdisplay {
574: my (%lt) = @_;
575: my $login_help = 1;
576: if ($login_help) {
1.107 tempelho 577: return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
1.83 raeburn 578: }
579: return;
580: }
1.1 albertel 581:
1.90 raeburn 582: sub coursecatalog_link {
583: my ($linkname) = @_;
584: return <<"END";
1.107 tempelho 585: <a href="/adm/coursecatalog">$linkname</a>
1.90 raeburn 586: END
587: }
588:
1.101 raeburn 589: sub newuser_link {
590: my ($linkname) = @_;
591: return ' <a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
592: }
593:
1.1 albertel 594: 1;
595: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>