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