Annotation of modules/gci/lonlogin.pm, revision 1.6
1.1 gci 1: # The LearningOnline Network
2: # Login Screen
3: #
1.6 ! gci 4: # $Id: lonlogin.pm,v 1.5 2009/11/19 15:22:20 gci Exp $
1.1 gci 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',
1.2 gci 49: 'token','role','symb']);
1.1 gci 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:
73: # -------------------------------- Prevent users from attempting to login twice
74: my $handle = &Apache::lonnet::check_for_valid_session($r);
75: if ($handle=~/^publicuser\_/) {
76: # For "public user" - remove it, we apparently really want to login
77: unlink($r->dir_config('lonIDsDir')."/$handle.id");
78: } elsif ($handle ne '') {
79: # Indeed, a valid token is found
80: my $start_page =
81: &Apache::loncommon::start_page('Already logged in');
82: my $end_page =
83: &Apache::loncommon::end_page();
1.4 gci 84: my $dest = '/adm/roles';
85: if ($env{'form.firsturl'} ne '') {
86: $dest = $env{'form.firsturl'};
87: }
1.1 gci 88: $r->print(
89: $start_page
90: .'<h1>'.&mt('You are already logged in!').'</h1>'
1.2 gci 91: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
1.4 gci 92: '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
1.1 gci 93: .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
94: .$end_page
95: );
96: return OK;
97: }
98:
99: # ---------------------------------------------------- No valid token, continue
100:
101: # ---------------------------- Not possible to really login to domain "public"
102: if ($env{'form.domain'} eq 'public') {
103: $env{'form.domain'}='';
104: $env{'form.username'}='';
105: }
106: # ----------------------------------------------------------- Process Interface
107: $env{'form.interface'}=~s/\W//g;
108:
109: my $textbrowsers=$r->dir_config('lonTextBrowsers');
110: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
111:
112: foreach (split(/\:/,$textbrowsers)) {
113: if ($httpbrowser=~/$_/i) {
114: $env{'form.interface'}='textual';
115: }
116: }
117:
118: my $fullgraph=($env{'form.interface'} ne 'textual');
119:
120: my $iconpath=
121: &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
122:
123: my $domain = &Apache::lonnet::default_login_domain();
124: if (($env{'form.domain'}) &&
125: (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
126: $domain=$env{'form.domain'};
127: }
1.4 gci 128: my $sitename = 'GCI WebCenter';
129: my $shortsitename = 'WebCenter';
130: my $existing = 'Existing WebCenter user?';
131: my $sitedesc = &mt('The Geoscience Concept Inventory (GCI) [_1]WebCenter[_2] is a place to comment on existing concept questions, or submit new ones, and is also a place to build and manage Concept Tests which your students will complete via the [_3]Testing Center[_2].','<a href="http://gci.lite.msu.edu/">','</a>','<a href="http://gcitest.lite.msu.edu/adm/login">');
1.1 gci 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);
1.4 gci 141: if ($domain eq 'gcitest') {
1.5 gci 142: $lonhost = 'gcitestl1';
143: $host_name = 'gcitest.lite.msu.edu';
1.4 gci 144: $sitename = 'GCI Testing Center';
145: $shortsitename = 'Testing Center';
146: $existing = 'Student with Testing Center account?';
147: $sitedesc = &mt('The GCI Testing Center is used by [_1]students[_2] to complete online concept tests created by their instructors using questions available in the Geoscience Concept Inventory.','<i>','</i>');
148: }
1.1 gci 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= &Apache::lonnet::absolute_url($host_name);
167: my $firsturl=
168: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
169: # ---------------------------------------------------------- Are we overloaded?
170: if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
171: my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
172: if ($unloaded) { $otherserver=$unloaded; }
173: }
174:
175: # ----------------------------------------------------------- Get announcements
176: my $announcements=&Apache::lonnet::getannounce();
177: # -------------------------------------------------------- Set login parameters
178:
179: my @hexstr=('0','1','2','3','4','5','6','7',
180: '8','9','a','b','c','d','e','f');
181: my $lkey='';
182: for (0..7) {
183: $lkey.=$hexstr[rand(15)];
184: }
185:
186: my $ukey='';
187: for (0..7) {
188: $ukey.=$hexstr[rand(15)];
189: }
190:
191: my $lextkey=hex($lkey);
192: if ($lextkey>2147483647) { $lextkey-=4294967296; }
193:
194: my $uextkey=hex($ukey);
195: if ($uextkey>2147483647) { $uextkey-=4294967296; }
196:
197: # -------------------------------------------------------- Store away log token
1.2 gci 198: my $tokenextras;
199: if ($env{'form.role'}) {
200: $tokenextras = '&role='.&escape($env{'form.role'});
201: }
1.6 ! gci 202: if ($domain eq 'gci') {
! 203: $env{'form.symb'} = '/adm/gci_info';
! 204: }
1.2 gci 205: if ($env{'form.symb'}) {
206: if (!$tokenextras) {
207: $tokenextras = '&';
208: }
209: $tokenextras .= '&symb='.&escape($env{'form.symb'});
210: }
1.1 gci 211: my $logtoken=Apache::lonnet::reply(
1.6 ! gci 212: 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
1.1 gci 213: $lonhost);
214:
215: # ------------------- If we cannot talk to ourselves, we are in serious trouble
216:
217: if ($logtoken eq 'con_lost') {
218: my $spares='';
219: my $last;
220: foreach my $hostid (sort
221: {
222: &Apache::lonnet::hostname($a) cmp
223: &Apache::lonnet::hostname($b);
224: }
225: keys(%Apache::lonnet::spareid)) {
226: next if ($hostid eq $lonhost);
227: my $hostname = &Apache::lonnet::hostname($hostid);
228: next if ($last eq $hostname);
229: $spares.='<br /><font size="+1"><a href="http://'.
230: $hostname.
231: '/adm/login?domain='.$authdomain.'">'.
232: $hostname.'</a>'.
233: ' '.&mt('(preferred)').'</font>'.$/;
234: $last=$hostname;
235: }
236: $spares.= '<br />';
237: my %all_hostnames = &Apache::lonnet::all_hostnames();
238: foreach my $hostid (sort
239: {
240: &Apache::lonnet::hostname($a) cmp
241: &Apache::lonnet::hostname($b);
242: }
243: keys(%all_hostnames)) {
244: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
245: my $hostname = &Apache::lonnet::hostname($hostid);
246: next if ($last eq $hostname);
247: $spares.='<br /><a href="http://'.
248: $hostname.
249: '/adm/login?domain='.$authdomain.'">'.
250: $hostname.'</a>';
251: $last=$hostname;
252: }
253: $r->print(
254: '<html>'
255: .'<head><title>'
256: .&mt('The LearningOnline Network with CAPA')
257: .'</title></head>'
258: .'<body bgcolor="#FFFFFF">'
259: .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
260: .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
1.4 gci 261: .'<h3>'.&mt("The $sitename server is temporarily not available for login.").'</h3>'
1.1 gci 262: .'</body>'
263: .'</html>'
264: );
265: return OK;
266: }
267:
268: # ----------------------------------------------- Apparently we are in business
269: $servadm=~s/\,/\<br \/\>/g;
270:
271: # ----------------------------------------------------------- Front page design
272: my $pgbg=
273: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
274: my $font=
275: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
276: my $link=
277: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
278: my $vlink=
279: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
280: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
281: my $mainbg=
282: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
283: my $sidebg=
284: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
285: my $textcol =
286: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
287: my $bgcol =
288: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
289: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
290: my $img=&Apache::loncommon::designparm('login.img',$domain);
291: my $domainlogo=&Apache::loncommon::domainlogo($domain);
292: my $login=&Apache::loncommon::designparm('login.login',$domain);
293: if ($login eq '') {
294: $login = $iconpath.'/'.&mt('userauthentication.gif');
295: }
296: my $showbanner = 1;
297: my $showmainlogo = 1;
298: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
299: $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
300: }
301: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
302: $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
303: }
304: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
305: my $showcoursecat =
306: &Apache::loncommon::designparm('login.coursecatalog',$domain);
307: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
308: my $shownewuserlink =
309: &Apache::loncommon::designparm('login.newuser',$domain);
310: my $now=time;
311: my $js = (<<ENDSCRIPT);
312:
1.2 gci 313: <script type="text/javascript" language="JavaScript">
1.4 gci 314: // <![CDATA[
315:
1.1 gci 316: function send(caller)
317: {
318:
319: if (caller == "newaccount") {
320: this.document.signup.submit();
321: return false;
322: }
323: if (document.client.uname.value == "" || !document.client.uname.value) {
324: alert("You must provide a username ");
325: return false;
326: }
327: if (document.client.upass$now.value == "" || !document.client.upass$now.value) {
328: alert("You must provide a password");
329: return false;
330: }
331:
332: this.document.server.elements.uname.value
333: =this.document.client.elements.uname.value;
334:
335: this.document.server.elements.udom.value
336: =this.document.client.elements.udom.value;
337:
338: this.document.server.elements.imagesuppress.value
339: =this.document.client.elements.imagesuppress.checked;
340:
341: this.document.server.elements.embedsuppress.value
342: =this.document.client.elements.embedsuppress.checked;
343:
344: this.document.server.elements.appletsuppress.value
345: =this.document.client.elements.appletsuppress.checked;
346:
347: this.document.server.elements.fontenhance.value
348: =this.document.client.elements.fontenhance.checked;
349:
350: this.document.server.elements.blackwhite.value
351: =this.document.client.elements.blackwhite.checked;
352:
353: this.document.server.elements.remember.value
354: =this.document.client.elements.remember.checked;
355:
356: uextkey=this.document.client.elements.uextkey.value;
357: lextkey=this.document.client.elements.lextkey.value;
358: initkeys();
359:
360: this.document.server.elements.upass0.value
361: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
362: this.document.server.elements.upass1.value
363: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
364: this.document.server.elements.upass2.value
365: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
366:
367: this.document.client.elements.uname.value='';
368: this.document.client.elements.upass$now.value='';
369:
370: this.document.server.submit();
371: return false;
372: }
1.4 gci 373: // ]]>
1.1 gci 374: </script>
1.4 gci 375:
1.1 gci 376: ENDSCRIPT
377:
378: # --------------------------------------------------- Print login screen header
379:
380: my %add_entries = (topmargin => "0",
381: leftmargin => "0",
382: marginheight => "0",
383: marginwidth => "0",
384: bgcolor => "$pgbg",
385: text => "$font",
386: link => "$link",
387: vlink => "$vlink",
388: alink => "$alink",
389: onload => "if ( document.client.uname ) { document.client.uname.focus(); }",
390: marginheight => "0",);
391:
1.4 gci 392: my $css_url = "/css/$domain/login.css";
393: $js .= "\n".'<link type="text/css" rel="stylesheet" href="'.$css_url.'">'."\n";
1.1 gci 394: $r->print(&Apache::loncommon::start_page('GCI WebCenter Login',$js,
395: { 'redirect' => [$expire,'/adm/roles'],
396: 'add_entries' => \%add_entries,
397: 'only_body' => 1,}));
398:
399: # ----------------------------------------------------------------------- Texts
400:
401: my %lt=&Apache::lonlocal::texthash(
402: 'un' => 'Username',
403: 'pw' => 'Password',
404: 'dom' => 'Domain',
405: 'load' => 'Server Load',
406: 'userload' => 'User Load',
407: 'about' => 'About LON-CAPA',
408: 'access' => 'Accessibility Options',
409: 'catalog' => 'Course Catalog',
410: 'log' => 'Log in',
411: 'help' => 'Log-in Help',
412: 'serv' => 'Server',
413: 'servadm' => 'Server Administration',
414: 'helpdesk' => 'Contact Helpdesk',
415: 'forgotpw' => 'Forgot password?',
416: 'newuser' => 'New User?',
417: 'options_headline' => 'Select Accessibility Options',
418: 'sprs_img' => 'Suppress rendering of images',
419: 'sprs_applet' => 'Suppress Java applets',
420: 'sprs_embed' => 'Suppress rendering of embedded multimedia',
421: 'sprs_font' => 'Increase font size',
422: 'sprs_blackwhite' => 'Switch to black and white mode',
423: 'remember' => 'Remember these settings for next login',
424: 'tbli' => 'Text-based Interface Login');
425: # -------------------------------------------------- Change password field name
426: my $forgotpw = &forgotpwdisplay(%lt);
427: my $loginhelp = &loginhelpdisplay(%lt);
428:
429: # ---------------------------------------------------- Serve out DES JavaScript
430: {
431: my $jsh=Apache::File->new($include."/londes.js");
432: $r->print(<$jsh>);
433: }
434: # ---------------------------------------------------------- Serve rest of page
435:
436: my $coursecatalog;
437: if (($showcoursecat eq '') || ($showcoursecat)) {
438: $coursecatalog = &coursecatalog_link($lt{'catalog'},$fullgraph);
439: }
440: my $newuserlink;
441: if ($shownewuserlink) {
442: $newuserlink = &newuser_link($lt{'newuser'});
443: }
444: if ($fullgraph) {
1.4 gci 445: $r->print(<<"END_OF_BLOCK1");
1.1 gci 446: <br />
447: <div align="center">
448: <table class="LC_loginbox">
449: <tr>
1.4 gci 450: <td align="left" valign="top" width="11">
451: <img name="login_r1_c1" src="/images/login/$domain/r1_c1.png" width="11" height="11" border="0" alt="">
1.1 gci 452: </td>
453: <td width="450" valign="top">
454: <table class="LC_loginbox_left">
455: <tr>
1.4 gci 456: <td width="411" align="left"><br /><img src="/images/login/$domain/logo_smrnd.png" width="411" height="51" alt="GCI" align="left"></td>
1.1 gci 457: </tr>
458: <tr>
459: <td>
460: <div align="left" style="display:block; margin-top:5px; margin-bottom:5px; margin-left:0px; margin-right:0px; width:440px; height:5px;">
1.4 gci 461: <div class="divider">
1.1 gci 462: </div>
463: </div>
464: </td>
465: </tr>
466: </table>
467: <table class="LC_loginbox_left">
468: <tr>
469: <td height="10" colspan="4"> </td>
470: </tr>
471: <tr>
472: <td width="10"> </td>
473: <td valign="top" class="bodyblue" width="430" align="left">
1.4 gci 474: <span style="font-size: 18px; line-height: 22px; "><font style="font-size: 18px; line-height: 22px;"><br />New to the $sitename?</font></span><br />
475: <font class="bodyblue">$sitedesc<br /><br />The $shortsitename runs on <a href="http://loncapa.org/">LON-CAPA</a> - an open source freeware distributed learning content management and assessment system.</font><br /><br />
476: END_OF_BLOCK1
477: if ($domain eq 'gci') {
478: $r->print(<<"END_OF_BLOCK2");
479: <font class="bodyblue"><b>Create a GCI WebCenter ID</b> – use your ID to submit comments or new content, or to create a new test. If you are already a GCI WebCenter user, please log-in.</font><br /><br /><br />
1.1 gci 480: <form name="signup" method="post" action="/adm/createaccount?courseid=gci_9615072b469884921gcil1"><input type="hidden" name="process" value="signup"/>
481: <table class="LC_signup">
482: <tr>
1.4 gci 483: <td align="left" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 484: <td> </td>
1.4 gci 485: <td align="right" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 486: </tr>
487: <tr>
488: <td align="center" valign="top" colspan="3">New to GCI WebCenter: <a href="javascript:send('newaccount')" style="color: #ffffff">Click here to sign up</a><br /></td>
489: </tr>
490: <tr>
1.4 gci 491: <td align="left" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 492: <td> </td>
1.4 gci 493: <td align="right" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 494: </tr>
495: </table>
496: </form>
1.4 gci 497: END_OF_BLOCK2
498: } else {
499: $r->print('<font class="bodyblue">'.
500: &mt("If you are already a $sitename user, please log-in.").' '.&mt('If not, contact your instructor to request a username and password.').
501: '</font><br /><br /><br />');
502: }
503: $r->print(<<"END_OF_BLOCK3");
1.1 gci 504: </td>
505: </tr>
506: </table>
507: </td>
508: <td width="10"> </td>
509: <td valign="top">
1.4 gci 510: <form name="client" method="post" onsubmit="return(send());">
1.1 gci 511: <table class="LC_loginbox_right">
512: <tr>
513: <td colspan="3" height="23" class="LC_loginbox_strip"> </td>
514: </tr>
515: <tr>
1.4 gci 516: <td align="left" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 517: <td> </td>
1.4 gci 518: <td align="right" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 519: </tr>
520: <tr>
521: <td width="10"> </td>
522: <td>
523: <table border="0" cellspacing="0" cellpadding="0">
524: <tr>
525: <td align="right" class="bodywhite" height=50><br>
526: <span style="font-size: 15px; line-height: 17px; font-weight: bold;">
1.4 gci 527: $existing</span>
1.1 gci 528: <br />Please log-in.<br>
1.4 gci 529: <hr class="login"><br /><br />
1.1 gci 530: </td>
531: </tr>
532: <tr>
533: <td>
534: <table border="0" cellpadding="2" cellspacing="0">
535: <tr>
536: <td align="right" class="bodywhite"><label for="uname">$lt{'un'}</label>:</td>
537: <td align="right"><input type="text" name="uname" size="17" value="$authusername" /></td>
538: </tr>
539: <tr>
540: <td align="right" class="bodywhite"><label for="upass$now">$lt{'pw'}</label>:</td>
1.4 gci 541: <td align="right"><input name="upass$now" size="17" value="" type="password"><input type="hidden" name="udom" value="$domain" /></td>
1.1 gci 542: </tr>
543: <tr><td> </td></tr>
544: <tr>
545: <td colspan="2" align="right"><input name="signin" type="submit" value="Log-in" class=buttonwhite /></td>
546: </tr>
547: </table>
548: </td>
549: </tr>
550: <tr>
551: <td align="right" valign="top" class="bodywhite">
552: <br />
553: <br /><br />
1.4 gci 554: <hr class="login" />
1.1 gci 555: <br />
556: <a href="/adm/resetpw" style="color: #ffffff">Forgot your password?</a><br>
557: <br />
558: </td>
559: </tr>
560: </table>
561: </td>
562: <td width="9"> </td>
563: </tr>
564: <tr>
1.4 gci 565: <td align="left" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 566: <td> </td>
1.4 gci 567: <td align="right" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 568: </tr>
569: <tr>
570: <td colspan="3" height="10" class="LC_loginbox_strip"> </td>
571: </tr>
572: </table>
573: </td>
1.4 gci 574: <td align="right" valign="top" width="11"><img src="/images/login/$domain/r1_c7.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 575: </tr>
576: <tr>
577: <td colspan="4">
578: <table border="0" cellspacing="0" cellpadding="0">
579: <tr>
580: <td width="10"> </td>
581: <td><font size="-1">
582: <b>Note</b>:<br>
583: If log-in fails, it may be because your browser is not accepting session cookies, or javascript is disabled. <a href="http://loncapa.msu.edu/student/cookies.html">Learn more</a>.
584: </font>
585: </td>
586: <td width="10"> </td>
587: </tr>
588: </table>
589: </td>
590: </tr>
591: <tr>
1.4 gci 592: <td align="left" valign="bottom" width="11"><img src="/images/login/$domain/r9_c1.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 593: <td colspan="3" width="698"> </td>
1.4 gci 594: <td align="right" valign="bottom" width="11"><img src="/images/login/$domain/r9_c7.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 595: </tr>
596: </table>
597: </div>
598: <p> </p>
599: <noscript><font size='3'> <b>Please Note:</b>
600: Javascript must be enabled in your web browser in order to use this web site.
601: </font></noscript>
602: <p> </p>
603: <input type="hidden" name="imagesuppress" value="" />
604: <input type="hidden" name="embedsuppress" value="" />
605: <input type="hidden" name="appletsuppress" value="" />
606: <input type="hidden" name="fontenhance" value="" />
607: <input type="hidden" name="blackwhite" value="" />
608: <input type="hidden" name="remember" value="" />
1.4 gci 609: END_OF_BLOCK3
1.1 gci 610: } else {
611: $r->print(<<ENDACCESSOPTIONS);
612: <h1>The Learning<i>Online</i> Network with CAPA</h1>
613: <h2>$lt{'tbli'}</h2>$announcements
614: <h3>$lt{'options_headline'}</h3>
1.2 gci 615: <form name="client" action="" onsubmit="return(send())">
1.1 gci 616: <label><input type="checkbox" name="imagesuppress" /> $lt{'sprs_img'}</label><br />
617: <label><input type="checkbox" name="appletsuppress" /> $lt{'sprs_applet'}</label><br />
618: <label><input type="checkbox" name="embedsuppress" /> $lt{'sprs_embed'}</label><br />
619: <label><input type="checkbox" name="fontenhance" /> $lt{'sprs_font'}</label><br />
620: <label><input type="checkbox" name="blackwhite" /> $lt{'sprs_blackwhite'}</label><br />
621: <br />
622: <input type="checkbox" name="remember" /> $lt{'remember'}
623: ENDACCESSOPTIONS
624: }
625: $r->print('
1.2 gci 626: <input type="hidden" name="lextkey" value="'.$lextkey.'" />
627: <input type="hidden" name="uextkey" value="'.$uextkey.'" />
1.1 gci 628: ');
629: unless ($fullgraph) {
630: my $logintitle;
631: if ($loginheader eq 'text') {
632: $logintitle = '<td bgcolor="'.$bgcol.'" colspan="2"> <b><font size="+1" color="'.$textcol.'">'.$lt{'log'}.'</font></b></td>';
633: } else {
634: $logintitle = '<td bgcolor="'.$sidebg.'" colspan="2"><img src="'.$login.'" alt="'.
635: &mt('User Authentication').'" /></td>';
636: }
637: my $noscript_warning='<td colspan="2" bgcolor="'.$mainbg.'">'
638: .'<noscript><div class="LC_warning"><font size="-1">'
639: .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
640: .'</font></div></noscript></td>';
641: $r->print(<<ENDTEXTUAL);
642: <hr />
1.4 gci 643: <table border="0" cellspacing="0" cellpadding="0">
1.1 gci 644: <tr>$logintitle</tr>
645: <tr>$noscript_warning</tr>
646: <tr>
647: <td bgcolor="$mainbg"><br /><font size=-1><b> <label for="uname">$lt{'un'}</label>:</b></font></td>
648: <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
649: </tr>
650: <tr>
651: <td bgcolor="$mainbg"><font size=-1><b> <label for="upass$now">$lt{'pw'}</label>:</b></font></td>
652: <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
653: </tr>
654: <tr>
655: <td bgcolor="$mainbg"> </td>
656: <td bgcolor="$mainbg" valign="bottom" align="center">
657: <br />
658: <input type="submit" value="$lt{'log'}" />
1.4 gci 659: <input type="hidden" name="udom" value="$domain" />
1.1 gci 660: </td>
661: </tr>
662: <tr>
663: <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
664: $loginhelp
665: $forgotpw
666: $newuserlink
667: $coursecatalog
668: <br />
669: </td>
670: </tr>
671: </table>
672: ENDTEXTUAL
673: }
674: $r->print(<<"ENDLOGIN");
675: </form>
676: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
677: <input type="hidden" name="logtoken" value="$logtoken" />
678: <input type="hidden" name="serverid" value="$lonhost" />
679: <input type="hidden" name="interface" value="$env{'form.interface'}" />
680: <input type="hidden" name="uname" value="" />
681: <input type="hidden" name="upass0" value="" />
682: <input type="hidden" name="upass1" value="" />
683: <input type="hidden" name="upass2" value="" />
684: <input type="hidden" name="udom" value="" />
685: <input type="hidden" name="imagesuppress" value="" />
686: <input type="hidden" name="appletsuppress" value="" />
687: <input type="hidden" name="embedsuppress" value="" />
688: <input type="hidden" name="fontenhance" value="" />
689: <input type="hidden" name="blackwhite" value="" />
690: <input type="hidden" name="remember" value="" />
691: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
692: <input type="hidden" name="localres" value="$env{'form.localres'}" />
693: </form>
694: ENDLOGIN
695: if ($fullgraph) {
696: my $helpdeskscript;
697: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
698: $version,$authdomain,\$helpdeskscript);
699: }
700: my %endargs = ( 'noredirectlink' => 1, );
701: $r->print(&Apache::loncommon::end_page(\%endargs));
702: return OK;
703: }
704:
705: sub contactdisplay {
706: my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
707: my $contactblock;
708: my $showhelpdesk = 0;
709: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
710: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
711: $showhelpdesk = 1;
712: }
713: if ($servadm && $showadminmail) {
714: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
715: '<tt> '.$servadm.'</tt><br /> <br />';
716: }
717: if ($showhelpdesk) {
718: $contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
719: my $thisurl = &escape('/adm/login');
720: $$helpdeskscript = <<"ENDSCRIPT";
721: <script type="text/javascript">
1.2 gci 722: // <![CDATA[
1.1 gci 723: function helpdesk() {
724: var codedom = document.client.udom.value;
725: if (codedom == '') {
726: codedom = "$authdomain";
727: }
728: var querystr = "origurl=$thisurl&codedom="+codedom;
729: document.location.href = "/adm/helpdesk?"+querystr;
730: return;
731: }
1.2 gci 732: // ]]>
1.1 gci 733: </script>
734: ENDSCRIPT
735: }
736: $contactblock .= <<"ENDBLOCK";
737: $version
738: ENDBLOCK
739: return $contactblock;
740: }
741:
742: sub forgotpwdisplay {
743: my (%lt) = @_;
744: my $prompt_for_resetpw = 1;
745: if ($prompt_for_resetpw) {
746: return '<br /> <a href="/adm/resetpw"><b>'.$lt{'forgotpw'}.'</b></a><br />';
747: }
748: return;
749: }
750:
751: sub loginhelpdisplay {
752: my (%lt) = @_;
753: my $login_help = 1;
754: if ($login_help) {
755: return ' <a href="/adm/loginproblems.html"><b>'.$lt{'help'}.'</b></a>';
756: }
757: return;
758: }
759:
760: sub coursecatalog_link {
761: my ($linkname,$fullgraph) = @_;
762: my $link = '/adm/coursecatalog';
763: if (!$fullgraph) {
764: $link.= '?interface=textual';
765: }
766: return ' <a href="/adm/coursecatalog"><b>'.$linkname.'</b></a><br />';
767: END
768: }
769:
770: sub newuser_link {
771: my ($linkname) = @_;
772: return ' <a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
773: }
774:
775: 1;
776: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>