Annotation of loncom/auth/lonlogin.pm, revision 1.107
1.1 albertel 1: # The LearningOnline Network
2: # Login Screen
1.11 www 3: #
1.107 ! tempelho 4: # $Id: lonlogin.pm,v 1.106 2008/10/02 11:28:49 bisitz 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: }
! 269: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
! 270: my $showcoursecat =
! 271: &Apache::loncommon::designparm('login.coursecatalog',$domain);
! 272: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
! 273: my $shownewuserlink =
! 274: &Apache::loncommon::designparm('login.newuser',$domain);
! 275: my $now=time;
! 276: my $js = (<<ENDSCRIPT);
! 277:
! 278: <script language="JavaScript">
! 279: function send()
! 280: {
! 281: this.document.server.elements.uname.value
! 282: =this.document.client.elements.uname.value;
! 283:
! 284: this.document.server.elements.udom.value
! 285: =this.document.client.elements.udom.value;
! 286:
! 287: uextkey=this.document.client.elements.uextkey.value;
! 288: lextkey=this.document.client.elements.lextkey.value;
! 289: initkeys();
! 290:
! 291: this.document.server.elements.upass0.value
! 292: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
! 293: this.document.server.elements.upass1.value
! 294: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
! 295: this.document.server.elements.upass2.value
! 296: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
1.6 www 297:
1.107 ! tempelho 298: this.document.client.elements.uname.value='';
! 299: this.document.client.elements.upass$now.value='';
1.6 www 300:
1.107 ! tempelho 301: this.document.server.submit();
! 302: return false;
! 303: }
! 304: </script>
1.98 raeburn 305:
1.16 www 306: ENDSCRIPT
1.6 www 307:
1.98 raeburn 308: # --------------------------------------------------- Print login screen header
309:
1.107 ! tempelho 310: my %add_entries = (topmargin => "0",
! 311: leftmargin => "0",
! 312: marginheight => "0",
! 313: marginwidth => "0",
! 314: bgcolor => "$pgbg",
! 315: text => "$font",
! 316: link => "$link",
! 317: vlink => "$vlink",
! 318: alink => "$alink",);
! 319:
! 320: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
! 321: { 'redirect' => [$expire,'/adm/roles'],
! 322: 'add_entries' => \%add_entries,
! 323: 'only_body' => 1,}));
1.98 raeburn 324:
325: # ----------------------------------------------------------------------- Texts
326:
327: my %lt=&Apache::lonlocal::texthash(
1.107 ! tempelho 328: 'un' => 'Username',
! 329: 'pw' => 'Password',
! 330: 'dom' => 'Domain',
! 331: 'perc' => 'percent',
! 332: 'load' => 'Server Load',
! 333: 'userload' => 'User Load',
! 334: 'about' => 'About LON-CAPA',
! 335: 'catalog' => 'Course Catalog',
! 336: 'log' => 'Log in',
! 337: 'help' => 'Log-in Help',
! 338: 'serv' => 'Server',
! 339: 'servadm' => 'Server Administration',
! 340: 'helpdesk' => 'Contact Helpdesk',
! 341: 'forgotpw' => 'Forgot password?',
! 342: 'newuser' => 'New User?',
! 343: 'options_headline' => 'Select Accessibility Options',
! 344: 'sprs_img' => 'Suppress rendering of images',
! 345: 'sprs_applet' => 'Suppress Java applets',
! 346: 'sprs_embed' => 'Suppress rendering of embedded multimedia',
! 347: 'sprs_font' => 'Increase font size',
! 348: 'sprs_blackwhite' => 'Switch to black and white mode',
! 349: 'remember' => 'Remember these settings for next login');
1.98 raeburn 350: # -------------------------------------------------- Change password field name
1.107 ! tempelho 351: my $forgotpw = &forgotpwdisplay(%lt);
! 352: my $loginhelp = &loginhelpdisplay(%lt);
1.98 raeburn 353:
354: # ---------------------------------------------------- Serve out DES JavaScript
1.107 ! tempelho 355: {
! 356: my $jsh=Apache::File->new($include."/londes.js");
! 357: $r->print(<$jsh>);
! 358: }
1.98 raeburn 359: # ---------------------------------------------------------- Serve rest of page
360:
1.107 ! tempelho 361: if ($fullgraph) {
! 362: $r->print(
! 363: '<div class="LC_loginpage_container">');
! 364: }
1.6 www 365:
1.107 ! tempelho 366: $r->print(<<ENDSERVERFORM);
! 367: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33 www 368: <input type="hidden" name="logtoken" value="$logtoken" />
369: <input type="hidden" name="serverid" value="$lonhost" />
370: <input type="hidden" name="uname" value="" />
1.65 www 371: <input type="hidden" name="upass0" value="" />
372: <input type="hidden" name="upass1" value="" />
373: <input type="hidden" name="upass2" value="" />
1.33 www 374: <input type="hidden" name="udom" value="" />
1.63 albertel 375: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
376: <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14 albertel 377: </form>
1.16 www 378: ENDSERVERFORM
1.90 raeburn 379: my $coursecatalog;
1.92 raeburn 380: if (($showcoursecat eq '') || ($showcoursecat)) {
1.90 raeburn 381: $coursecatalog = &coursecatalog_link($lt{'catalog'});
382: }
1.101 raeburn 383: my $newuserlink;
384: if ($shownewuserlink) {
385: $newuserlink = &newuser_link($lt{'newuser'});
386: }
1.98 raeburn 387: my $logintitle;
388: if ($loginheader eq 'text') {
1.107 ! tempelho 389: $logintitle = $lt{'log'};
1.98 raeburn 390: } else {
1.107 ! tempelho 391: $logintitle = '<img src="'.$login.'" alt="'.
! 392: &mt('User Authentication').'" />';
1.98 raeburn 393: }
1.107 ! tempelho 394:
! 395: my $noscript_warning='<noscript>'
1.104 bisitz 396: .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
1.107 ! tempelho 397: .'</noscript>';
! 398: my $helpdeskscript;
! 399: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
! 400: $version,$authdomain,\$helpdeskscript);
! 401:
! 402: if ($fullgraph) {
! 403: $r->print(<<ENDTOP);
! 404: <!-- The LON-CAPA Header -->
! 405: <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">
! 406: <tr>
! 407: <td align="left" valign="top" bgcolor="$pgbg"> <img src="$img" border=0 alt="The Learning Online Network with CAPA" /> </td>
! 408: </tr>
! 409: </table>
! 410:
! 411: <div class="LC_loginpage_space"> </div>
! 412: <img src="$logo" alt="" />
! 413: <div class="LC_loginpage_loginContainer"><fieldset class="LC_loginpage_fieldset">
! 414: <legend class="LC_loginpage_legend">$logintitle</legend>
! 415: <table border="0" align="left" cellspacing="1" cellpadding="1" width="100%">
! 416: <tr>
! 417: <td width="50%" align="center" valign="top">$domainlogo</td>
! 418: <td>
! 419: ENDTOP
! 420:
! 421: $r->print('<form name="client" onsubmit="return(send())">');
1.14 albertel 422:
1.107 ! tempelho 423: $r->print(<<ENDTOPP)
! 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" size="10" value="$authusername" /><br />
! 428: <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
! 429: <input type="password" name="upass$now" size="10" /><br />
! 430: <b><label for="udom">$lt{'dom'}</label>:</b><br />
! 431: <input type="text" name="udom" size="10" value="$authdomain" /><br />
! 432: <input type="submit" value="$lt{'log'}" />
! 433: </form>
! 434: </td>
! 435: </tr>
! 436: </table>
! 437: $noscript_warning
! 438: </fieldset></div>
! 439:
! 440: <div class="LC_loginpage_loginInfo">
! 441: $loginhelp<br />
! 442: $forgotpw<br /><br />
! 443: $newuserlink<br />
! 444: $coursecatalog<br /><br />
! 445: <a href="/adm/about.html"><b>$lt{'about'}</b></a><br />
! 446: $helpdeskscript
! 447: </div>
! 448: <div class="LC_loginpage_space"> </div>
! 449: $announcements
! 450: ENDTOPP
! 451: }
! 452: if($announcements){$r->print('<div class="LC_loginpage_space"> </div>');}
1.14 albertel 453:
1.45 www 454:
1.107 ! tempelho 455: if ($fullgraph) {
! 456:
! 457: $r->print(<<ENDDOCUMENT);
! 458:
1.14 albertel 459:
460: <table border=0 cellspacing=0 cellpadding=0>
461: <tr>
1.21 www 462: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 463: <small><b> $lt{'dom'}: </b></small>
1.14 albertel 464: </td>
1.21 www 465: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 466: <small><tt> $domain</tt></small>
467: </td>
468: </tr>
469: <tr>
1.21 www 470: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 471: <small><b> $lt{'serv'}: </b></small>
1.14 albertel 472: </td>
1.21 www 473: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 474: <small><tt> $lonhost ($role)</tt></small>
475: </td>
476: </tr>
477: <tr>
1.21 www 478: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 479: <small><b> $lt{'load'}: </b></small>
1.14 albertel 480: </td>
1.21 www 481: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 482: <small><tt> $loadpercent $lt{'perc'}</tt></small>
1.42 albertel 483: </td>
484: </tr>
485: <tr>
486: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 487: <small><b> $lt{'userload'}: </b></small>
1.42 albertel 488: </td>
489: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 490: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
1.14 albertel 491: </td>
492: </tr>
493: </table>
1.107 ! tempelho 494:
1.60 raeburn 495: $contactblock
1.14 albertel 496:
1.107 ! tempelho 497: </div>
1.25 bowersj2 498:
1.59 albertel 499: <script type="text/javascript">
500: // the if prevents the script error if the browser can not handle this
1.25 bowersj2 501: if ( document.client.uname ) { document.client.uname.focus(); }
502: </script>
1.62 raeburn 503: $helpdeskscript
1.14 albertel 504:
1.1 albertel 505: ENDDOCUMENT
1.16 www 506: }
1.98 raeburn 507: my %endargs = ( 'noredirectlink' => 1, );
508: $r->print(&Apache::loncommon::end_page(\%endargs));
1.1 albertel 509: return OK;
1.60 raeburn 510: }
511:
512: sub contactdisplay {
1.90 raeburn 513: my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
1.60 raeburn 514: my $contactblock;
1.62 raeburn 515: my $showhelpdesk = 0;
516: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
517: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
518: $showhelpdesk = 1;
519: }
1.90 raeburn 520: if ($servadm && $showadminmail) {
521: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
522: '<tt> '.$servadm.'</tt><br /> <br />';
523: }
1.60 raeburn 524: if ($showhelpdesk) {
1.84 raeburn 525: $contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
1.75 www 526: my $thisurl = &escape('/adm/login');
1.62 raeburn 527: $$helpdeskscript = <<"ENDSCRIPT";
528: <script type="text/javascript">
529: function helpdesk() {
530: var codedom = document.client.udom.value;
531: if (codedom == '') {
532: codedom = "$authdomain";
533: }
534: var querystr = "origurl=$thisurl&codedom="+codedom;
535: document.location.href = "/adm/helpdesk?"+querystr;
536: return;
537: }
538: </script>
539: ENDSCRIPT
1.60 raeburn 540: }
541: $contactblock .= <<"ENDBLOCK";
542: $version
543: ENDBLOCK
544: return $contactblock;
545: }
1.83 raeburn 546:
547: sub forgotpwdisplay {
1.84 raeburn 548: my (%lt) = @_;
1.83 raeburn 549: my $prompt_for_resetpw = 1;
550: if ($prompt_for_resetpw) {
1.107 ! tempelho 551: return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
1.84 raeburn 552: }
553: return;
554: }
555:
556: sub loginhelpdisplay {
557: my (%lt) = @_;
558: my $login_help = 1;
559: if ($login_help) {
1.107 ! tempelho 560: return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
1.83 raeburn 561: }
562: return;
563: }
1.1 albertel 564:
1.90 raeburn 565: sub coursecatalog_link {
566: my ($linkname) = @_;
567: return <<"END";
1.107 ! tempelho 568: <a href="/adm/coursecatalog">$linkname</a>
1.90 raeburn 569: END
570: }
571:
1.101 raeburn 572: sub newuser_link {
573: my ($linkname) = @_;
574: return ' <a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
575: }
576:
1.1 albertel 577: 1;
578: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>