Annotation of loncom/auth/lonlogin.pm, revision 1.74
1.1 albertel 1: # The LearningOnline Network
2: # Login Screen
1.11 www 3: #
1.74 ! albertel 4: # $Id: lonlogin.pm,v 1.73 2006/02/28 16:44:19 albertel 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);
1.55 www 33: use CGI::Cookie();
1.1 albertel 34: use Apache::File ();
1.63 albertel 35: use Apache::lonnet;
1.12 albertel 36: use Apache::loncommon();
1.49 www 37: use Apache::lonauth();
1.50 www 38: use Apache::lonlocal;
1.71 albertel 39: use Apache::migrateuser();
1.1 albertel 40:
41: sub handler {
42: my $r = shift;
1.71 albertel 43:
44: &Apache::loncommon::get_unprocessed_cgi
45: ($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'},
46: ['interface','username','domain','firsturl','localpath','localres',
47: 'token']);
48:
49: # -- check if they are a migrating user
50: if (defined($env{'form.token'})) {
51: return &Apache::migrateuser::handler($r);
52: }
53:
1.53 www 54: &Apache::loncommon::no_cache($r);
55: &Apache::lonlocal::get_language_handle($r);
1.54 www 56: &Apache::loncommon::content_type($r,'text/html');
1.1 albertel 57: $r->send_http_header;
58: return OK if $r->header_only;
59:
1.49 www 60:
61: # Are we re-routing?
62: if (-e '/home/httpd/html/lon-status/reroute.txt') {
63: &Apache::lonauth::reroute($r);
64: return OK;
65: }
1.55 www 66:
1.71 albertel 67:
1.55 www 68: # -------------------------------- Prevent users from attempting to login twice
69: my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
70: my $lonid=$cookies{'lonID'};
71: my $cookie;
72: if ($lonid) {
73: my $handle=$lonid->value;
74: $handle=~s/\W//g;
75: my $lonidsdir=$r->dir_config('lonIDsDir');
1.70 www 76: if (-e "$lonidsdir/$handle.id") {
77: # Is there an existing token file?
78: if ($handle=~/^publicuser\_/) {
79: # For "public user" - remove it, we apparently really want to login
80: unlink("$lonidsdir/$handle.id");
81: } elsif ($handle ne '') {
1.55 www 82: # Indeed, a valid token is found
1.74 ! albertel 83: my $start_page =
! 84: &Apache::loncommon::start_page('Already logged in');
! 85: my $end_page =
! 86: &Apache::loncommon::end_page();
1.70 www 87: $r->print(<<ENDFAILED);
1.74 ! albertel 88: $start_page
1.55 www 89: <h1>You are already logged in</h1>
90: <p>Please either <a href="/adm/roles">continue the current session</a> or
91: <a href="/adm/logout">logout</a>.</p>
92: <p>
93: <a href="/adm/loginproblems.html">Problems?</a></p>
1.74 ! albertel 94: $end_page
1.55 www 95: ENDFAILED
1.70 www 96: return OK;
97: }
1.55 www 98: }
99: }
100:
101: # ---------------------------------------------------- No valid token, continue
1.16 www 102:
1.70 www 103: # ---------------------------- Not possible to really login to domain "public"
104: if ($env{'form.domain'} eq 'public') {
105: $env{'form.domain'}='';
106: $env{'form.username'}='';
107: }
1.32 www 108: # ----------------------------------------------------------- Process Interface
1.63 albertel 109: $env{'form.interface'}=~s/\W//g;
1.16 www 110:
1.32 www 111: my $textbrowsers=$r->dir_config('lonTextBrowsers');
112: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
113:
114: foreach (split(/\:/,$textbrowsers)) {
115: if ($httpbrowser=~/$_/i) {
1.63 albertel 116: $env{'form.interface'}='textual';
1.32 www 117: }
118: }
119:
1.63 albertel 120: my $fullgraph=($env{'form.interface'} ne 'textual');
1.40 albertel 121: my $port_to_use=$r->dir_config('lonhttpdPort');
122: if (!defined($port_to_use)) {
123: $port_to_use='8080';
124: }
125: my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use.
1.26 www 126: $r->dir_config('lonIconsURL');
1.1 albertel 127: my $domain = $r->dir_config('lonDefDomain');
1.68 albertel 128: my $testdomain=(split(/\./,$ENV{'HTTP_HOST'}))[0];
129: foreach my $posdom (&Apache::lonnet::current_machine_domains()) {
1.73 albertel 130: if (lc($posdom) eq lc($testdomain)) { $domain=$posdom; }
1.68 albertel 131: }
1.63 albertel 132: if (($env{'form.domain'}) &&
133: ($Apache::lonnet::domaindescription{$env{'form.domain'}})) {
134: $domain=$env{'form.domain'};
1.46 www 135: }
1.1 albertel 136: my $role = $r->dir_config('lonRole');
137: my $loadlim = $r->dir_config('lonLoadLim');
138: my $servadm = $r->dir_config('lonAdmEMail');
139: my $sysadm = $r->dir_config('lonSysEMail');
140: my $lonhost = $r->dir_config('lonHostID');
141: my $tabdir = $r->dir_config('lonTabDir');
1.6 www 142: my $include = $r->dir_config('lonIncludes');
1.37 www 143: my $expire = $r->dir_config('lonExpire');
1.44 www 144: my $version = $r->dir_config('lonVersion');
1.1 albertel 145:
1.30 www 146: # --------------------------------------------- Default values for login fields
147:
1.63 albertel 148: my $authusername=($env{'form.username'}?$env{'form.username'}:'');
149: my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
1.30 www 150:
151: # ---------------------------------------------------------- Determine own load
1.1 albertel 152: my $loadavg;
1.41 albertel 153: {
154: my $loadfile=Apache::File->new('/proc/loadavg');
155: $loadavg=<$loadfile>;
156: }
1.1 albertel 157: $loadavg =~ s/\s.*//g;
1.57 matthew 158: my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
1.41 albertel 159: my $userloadpercent=&Apache::lonnet::userload();
1.1 albertel 160:
1.30 www 161: # ------------------------------------------------------- Do the load balancing
1.10 www 162: my $otherserver='http://'.$ENV{'SERVER_NAME'};
1.31 www 163: my $firsturl=
1.63 albertel 164: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
1.1 albertel 165: # ---------------------------------------- Are we access server and overloaded?
1.41 albertel 166: if (($role eq 'access') &&
167: (($userloadpercent>100.0)||($loadpercent>100.0))) {
1.47 albertel 168: my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
169: if ($unloaded) { $otherserver=$unloaded; }
1.1 albertel 170: }
1.6 www 171:
1.45 www 172: # ----------------------------------------------------------- Get announcements
173: my $announcements=&Apache::lonnet::getannounce();
1.6 www 174: # -------------------------------------------------------- Set login parameters
175:
176: my @hexstr=('0','1','2','3','4','5','6','7',
177: '8','9','a','b','c','d','e','f');
178: my $lkey='';
179: for (0..7) {
180: $lkey.=$hexstr[rand(15)];
181: }
182:
183: my $ukey='';
184: for (0..7) {
185: $ukey.=$hexstr[rand(15)];
186: }
187:
188: my $lextkey=hex($lkey);
1.15 www 189: if ($lextkey>2147483647) { $lextkey-=4294967296; }
190:
1.6 www 191: my $uextkey=hex($ukey);
1.15 www 192: if ($uextkey>2147483647) { $uextkey-=4294967296; }
193:
1.31 www 194: # -------------------------------------------------------- Store away log token
1.6 www 195: my $logtoken=Apache::lonnet::reply(
1.7 www 196: 'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6 www 197: $lonhost);
1.31 www 198:
199: # ------------------- If we cannot talk to ourselves, we are in serious trouble
200:
201: if ($logtoken eq 'con_lost') {
202: my $spares='';
1.64 albertel 203: my $last;
204: foreach my $hostid (sort
205: {
206: $Apache::lonnet::hostname{$a} cmp
207: $Apache::lonnet::hostname{$b};
208: }
209: keys(%Apache::lonnet::spareid)) {
1.58 matthew 210: next if ($hostid eq $lonhost);
1.64 albertel 211: next if ($last eq $Apache::lonnet::hostname{$hostid});
1.58 matthew 212: $spares.='<br /><font size="+1"><a href="http://'.
213: $Apache::lonnet::hostname{$hostid}.
214: '/adm/login?domain='.$authdomain.'">'.
215: $Apache::lonnet::hostname{$hostid}.'</a>'.
216: ' (preferred)</font>'.$/;
1.64 albertel 217: $last=$Apache::lonnet::hostname{$hostid};
1.58 matthew 218: }
219: $spares.= '<br />';
1.64 albertel 220: foreach my $hostid (sort
221: {
222: $Apache::lonnet::hostname{$a} cmp
223: $Apache::lonnet::hostname{$b};
224: }
225: keys(%Apache::lonnet::hostname)) {
1.58 matthew 226: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
1.64 albertel 227: next if ($last eq $Apache::lonnet::hostname{$hostid});
1.58 matthew 228: $spares.='<br /><a href="http://'.
229: $Apache::lonnet::hostname{$hostid}.
230: '/adm/login?domain='.$authdomain.'">'.
231: $Apache::lonnet::hostname{$hostid}.'</a>';
1.64 albertel 232: $last=$Apache::lonnet::hostname{$hostid};
1.31 www 233: }
234: $r->print(<<ENDTROUBLE);
235: <html>
236: <head><title>The LearningOnline Network with CAPA</title></head>
237: <body bgcolor="#FFFFFF">
238: <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
239: <h3>This LON-CAPA server is temporarily not available for login</h3>
240: <p>Please attempt to login to one of the following servers:</p>$spares
241: <p>If the problem persists, please contact <tt>$servadm</tt>.</p>
242: </body>
243: </html>
244: ENDTROUBLE
245: return OK;
246: }
247:
248: # ----------------------------------------------- Apparently we are in business
249:
1.48 albertel 250: my $domainlogo=&Apache::loncommon::domainlogo($domain);
1.38 www 251: $servadm=~s/\,/\<br \/\>/g;
252: $sysadm=~s/\,/\<br \/\>/g;
253:
1.6 www 254: # --------------------------------------------------- Print login screen header
255: $r->print(<<ENDHEADER);
1.1 albertel 256: <html>
257: <head>
1.37 www 258: <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />
1.2 www 259: <title>The LearningOnline Network with CAPA Login</title>
1.1 albertel 260: </head>
1.6 www 261: ENDHEADER
262: # ---------------------------------------------------- Serve out DES JavaScript
263: {
264: my $jsh=Apache::File->new($include."/londes.js");
265: $r->print(<$jsh>);
266: }
1.21 www 267:
268: # ----------------------------------------------------------- Front page design
1.35 www 269: my $pgbg=
1.46 www 270: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
1.35 www 271: my $font=
1.46 www 272: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
1.35 www 273: my $link=
1.46 www 274: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
1.35 www 275: my $vlink=
1.46 www 276: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
277: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
1.35 www 278: my $mainbg=
1.46 www 279: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
1.35 www 280: my $sidebg=
1.46 www 281: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
282: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
283: my $img=&Apache::loncommon::designparm('login.img',$domain);
1.21 www 284:
1.51 www 285: # ----------------------------------------------------------------------- Texts
286:
287: my %lt=&Apache::lonlocal::texthash(
288: 'un' => 'Username',
289: 'pw' => 'Password',
290: 'dom' => 'Domain',
291: 'perc' => 'percent',
1.52 www 292: 'load' => 'Load',
293: 'userload' => 'User Load',
294: 'about' => 'aboutlon.gif',
295: 'access' => 'accessbutton.gif',
296: 'auth' => 'userauthentication.gif',
1.51 www 297: 'log' => 'Log in',
298: 'help' => 'Help',
299: 'serv' => 'Server',
300: 'servadm' => 'Server Administration',
1.60 raeburn 301: 'sysadm' => 'System Administration',
302: 'helpdesk' => 'Contact Helpdesk');
1.66 www 303: # -------------------------------------------------- Change password field name
304: my $now=time;
1.6 www 305: # ---------------------------------------------------------- Serve rest of page
1.16 www 306: $r->print(<<ENDSCRIPT);
1.6 www 307:
1.21 www 308: <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"
1.27 albertel 309: topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
1.6 www 310:
1.14 albertel 311: <script language="JavaScript">
312: function send()
313: {
1.6 www 314: this.document.server.elements.uname.value
315: =this.document.client.elements.uname.value;
316:
317: this.document.server.elements.udom.value
318: =this.document.client.elements.udom.value;
319:
1.33 www 320: this.document.server.elements.imagesuppress.value
1.36 www 321: =this.document.client.elements.imagesuppress.checked;
1.33 www 322:
323: this.document.server.elements.embedsuppress.value
1.36 www 324: =this.document.client.elements.embedsuppress.checked;
1.33 www 325:
1.34 www 326: this.document.server.elements.appletsuppress.value
1.36 www 327: =this.document.client.elements.appletsuppress.checked;
1.34 www 328:
1.33 www 329: this.document.server.elements.fontenhance.value
1.36 www 330: =this.document.client.elements.fontenhance.checked;
1.33 www 331:
332: this.document.server.elements.blackwhite.value
1.36 www 333: =this.document.client.elements.blackwhite.checked;
1.33 www 334:
1.35 www 335: this.document.server.elements.remember.value
1.36 www 336: =this.document.client.elements.remember.checked;
1.35 www 337:
1.6 www 338: uextkey=this.document.client.elements.uextkey.value;
339: lextkey=this.document.client.elements.lextkey.value;
340: initkeys();
341:
1.65 www 342: this.document.server.elements.upass0.value
1.66 www 343: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
1.65 www 344: this.document.server.elements.upass1.value
1.66 www 345: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
1.65 www 346: this.document.server.elements.upass2.value
1.66 www 347: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
348:
349: this.document.client.elements.uname.value='';
350: this.document.client.elements.upass$now.value='';
1.6 www 351:
352: this.document.server.submit();
1.19 bowersj2 353: return false;
1.6 www 354: }
1.14 albertel 355: </script>
1.16 www 356: ENDSCRIPT
1.6 www 357:
1.16 www 358: if ($fullgraph) {
359: $r->print(
360: '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
361: }
1.6 www 362:
1.16 www 363: $r->print(<<ENDSERVERFORM);
1.14 albertel 364: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
1.33 www 365: <input type="hidden" name="logtoken" value="$logtoken" />
366: <input type="hidden" name="serverid" value="$lonhost" />
1.63 albertel 367: <input type="hidden" name="interface" value="$env{'form.interface'}" />
1.33 www 368: <input type="hidden" name="uname" value="" />
1.65 www 369: <input type="hidden" name="upass0" value="" />
370: <input type="hidden" name="upass1" value="" />
371: <input type="hidden" name="upass2" value="" />
1.33 www 372: <input type="hidden" name="udom" value="" />
373: <input type="hidden" name="imagesuppress" value="" />
1.34 www 374: <input type="hidden" name="appletsuppress" value="" />
1.33 www 375: <input type="hidden" name="embedsuppress" value="" />
376: <input type="hidden" name="fontenhance" value="" />
377: <input type="hidden" name="blackwhite" value="" />
1.35 www 378: <input type="hidden" name="remember" value="" />
1.63 albertel 379: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
380: <input type="hidden" name="localres" value="$env{'form.localres'}" />
1.14 albertel 381: </form>
1.16 www 382: ENDSERVERFORM
383: if ($fullgraph) { $r->print(<<ENDTOP);
1.14 albertel 384: <!-- The LON-CAPA Header -->
385: <tr>
386:
387: <!-- Row 1 Columns 2-4 -->
1.29 www 388: <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td>
1.14 albertel 389: </tr>
390:
391: <!-- The gray bar that starts the two table frames -->
392: <tr>
393:
394: <!-- Row 2 Column 1 -->
1.21 www 395: <td width=182 height=27 bgcolor="$sidebg"> </td>
1.14 albertel 396:
397: <!-- Row 2 Column 2 -->
1.19 bowersj2 398: <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
1.14 albertel 399:
400: <!-- Row 2 Column 3 -->
1.19 bowersj2 401: <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
1.14 albertel 402:
403: <!-- Row 2 Column 4 -->
1.19 bowersj2 404: <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
1.14 albertel 405: </tr>
406: <tr>
407:
408: <!-- A cell that will hold the 'access' and 'about' buttons -->
409: <!-- Row 3 Column 1 -->
1.21 www 410: <td valign="top" height=60 align="center" bgcolor="$sidebg">
1.52 www 411: <a href="/adm/login?interface=textual"><img src="$iconpath/$lt{'access'}" border=0 alt="Accessibility Options" /></a>
1.14 albertel 412: <br />
1.52 www 413: <a href="/adm/about.html"><img src="$iconpath/$lt{'about'}" border=0 alt="About LON-CAPA" /></a>
1.14 albertel 414: </td>
415:
416: <!-- The shaded space between the two main columns -->
417: <!-- Row 3 Column 2 -->
1.19 bowersj2 418: <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 419:
420: <!-- The right main column holding the large LON-CAPA logo-->
421: <!-- Rows 3-4 Column 3 -->
1.45 www 422: <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
1.14 albertel 423: <center>
1.21 www 424: <img src="$logo" alt="" />
1.14 albertel 425: </center>
426: </td>
427:
428: <!-- Row 3 Column 4 -->
1.19 bowersj2 429: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 430: </tr>
431: <tr>
432:
433: <!-- The entry form -->
434: <!-- Row 4 Column 1 -->
1.21 www 435: <td align="center" valign="middle" bgcolor="$sidebg">
1.16 www 436: ENDTOP
1.32 www 437: } else {
1.45 www 438: $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);
1.33 www 439: }
440: $r->print('<form name="client" onsubmit="return(send())">');
441: unless ($fullgraph) {
442: $r->print(<<ENDACCESSOPTIONS);
1.35 www 443: <h3>Select Accessibility Options</h3>
1.67 albertel 444: <label><input type="checkbox" name="imagesuppress" /> Suppress rendering of images</label><br />
445: <label><input type="checkbox" name="appletsuppress" /> Suppress Java applets</label><br />
446: <label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br />
447: <label><input type="checkbox" name="fontenhance" /> Increase font size</label><br />
448: <label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><br />
1.35 www 449: <p>If you have accessibility needs that are not addressed by this interface,
450: please
451: contact the system administrator at <tt>$sysadm</tt>.</p><br />
452: <input type="checkbox" name="remember" /> Remember these settings for next login<hr />
1.33 www 453: ENDACCESSOPTIONS
454: } else {
455: $r->print(<<ENDNOOPT);
456: <input type="hidden" name="imagesuppress" value="" />
457: <input type="hidden" name="embedsuppress" value="" />
1.34 www 458: <input type="hidden" name="appletsuppress" value="" />
1.33 www 459: <input type="hidden" name="fontenhance" value="" />
460: <input type="hidden" name="blackwhite" value="" />
1.35 www 461: <input type="hidden" name="remember" value="" />
1.33 www 462: ENDNOOPT
1.16 www 463: }
464: $r->print(<<ENDLOGIN);
1.14 albertel 465: <input type="hidden" name="lextkey" value="$lextkey">
466: <input type="hidden" name="uextkey" value="$uextkey">
467:
468: <!-- Start the sub-table for text and input alignment -->
469: <table border=0 cellspacing=0 cellpadding=0>
1.52 www 470: <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/$lt{'auth'}" alt="User Authentication" /></td></tr>
1.14 albertel 471: <tr>
1.51 www 472: <td bgcolor="$mainbg"><br /><font size=-1><b> $lt{'un'}:</b></font></td>
1.30 www 473: <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
1.14 albertel 474: </tr>
475: <tr>
1.51 www 476: <td bgcolor="$mainbg"><font size=-1><b> $lt{'pw'}:</b></font></td>
1.66 www 477: <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
1.14 albertel 478: </tr>
479: <tr>
1.51 www 480: <td bgcolor="$mainbg"><font size=-1><b> $lt{'dom'}:</b></font></td>
1.30 www 481: <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>
1.14 albertel 482: </tr>
483: <tr>
1.51 www 484: <td bgcolor="$mainbg"> <a href="/adm/loginproblems.html">$lt{'help'}</a></td>
1.28 www 485: <td bgcolor="$mainbg" valign="bottom" align="center">
1.14 albertel 486: <br />
1.51 www 487: <input type="submit" value="$lt{'log'}" />
1.14 albertel 488: </td>
489: </tr>
490: </table>
491: <!-- End sub-table -->
492: </form>
1.16 www 493: ENDLOGIN
494: if ($fullgraph) {
1.62 raeburn 495: my $helpdeskscript;
496: my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version,$authdomain,\$helpdeskscript);
1.16 www 497: $r->print(<<ENDDOCUMENT);
1.14 albertel 498: </td>
499:
500: <!-- Row 4 Column 2 -->
1.19 bowersj2 501: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.45 www 502:
503: <!-- Row 4 Column 3 -->
504: <td bgcolor="$mainbg">$announcements</td>
1.14 albertel 505:
506: <!-- Row 4 Column 4 -->
1.19 bowersj2 507: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 508: </tr>
509: <tr>
510:
511: <!-- Row 5 Column 1 -->
1.21 www 512: <td bgcolor="$sidebg" valign="middle" align="left">
1.14 albertel 513: <br />
514: <table border=0 cellspacing=0 cellpadding=0>
515: <tr>
1.21 www 516: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 517: <small><b> $lt{'dom'}: </b></small>
1.14 albertel 518: </td>
1.21 www 519: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 520: <small><tt> $domain</tt></small>
521: </td>
522: </tr>
523: <tr>
1.21 www 524: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 525: <small><b> $lt{'serv'}: </b></small>
1.14 albertel 526: </td>
1.21 www 527: <td bgcolor="$sidebg" align="left" valign="top">
1.14 albertel 528: <small><tt> $lonhost ($role)</tt></small>
529: </td>
530: </tr>
531: <tr>
1.21 www 532: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 533: <small><b> $lt{'load'}: </b></small>
1.14 albertel 534: </td>
1.21 www 535: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 536: <small><tt> $loadpercent $lt{'perc'}</tt></small>
1.42 albertel 537: </td>
538: </tr>
539: <tr>
540: <td bgcolor="$sidebg" align="left" valign="top">
1.52 www 541: <small><b> $lt{'userload'}: </b></small>
1.42 albertel 542: </td>
543: <td bgcolor="$sidebg" align="left" valign="top">
1.51 www 544: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
1.14 albertel 545: </td>
546: </tr>
547: </table>
548: <br />
1.60 raeburn 549: $contactblock
1.14 albertel 550: </td>
551:
552: <!-- Row 5 Column 2 -->
1.19 bowersj2 553: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 554:
555: <!-- Row 5 Column 3 -->
1.21 www 556: <td width="100%" valign="bottom" bgcolor="$mainbg">
1.20 www 557: $domainlogo
558: </td>
1.14 albertel 559:
560: <!-- Row 5 Column 4 -->
1.19 bowersj2 561: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 562: </tr>
563: <tr>
564:
565: <!-- Row 6 Column 1 -->
1.21 www 566: <td bgcolor="$sidebg"> </td>
1.14 albertel 567:
568: <!-- Row 6 Column 2 -->
1.19 bowersj2 569: <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
1.14 albertel 570:
571: <!-- Row 6 Column 3 -->
1.19 bowersj2 572: <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
1.14 albertel 573:
574: <!-- Row 6 Column 4 -->
1.19 bowersj2 575: <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
1.14 albertel 576: </tr>
1.1 albertel 577: </table>
1.25 bowersj2 578:
1.59 albertel 579: <script type="text/javascript">
580: // the if prevents the script error if the browser can not handle this
1.25 bowersj2 581: if ( document.client.uname ) { document.client.uname.focus(); }
582: </script>
1.62 raeburn 583: $helpdeskscript
1.14 albertel 584:
1.1 albertel 585: ENDDOCUMENT
1.16 www 586: }
587: $r->print('</body></html>');
1.1 albertel 588: return OK;
1.60 raeburn 589: }
590:
591: sub contactdisplay {
1.62 raeburn 592: my ($lt,$sysadm,$servadm,$version,$authdomain,$helpdeskscript) = @_;
1.60 raeburn 593: my $contactblock;
594: my $showsysadm = 1;
595: my $showservadm = 1;
1.62 raeburn 596: my $showhelpdesk = 0;
597: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
598: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
599: $showhelpdesk = 1;
600: }
1.60 raeburn 601: if ($showsysadm) {
602: $contactblock .= '<b> '.$$lt{'sysadm'}.':</b><br />'.
603: '<tt> '.$sysadm.'</tt><br />';
604: }
605: if ($showservadm) {
606: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
607: '<tt> '.$servadm.'</tt><br /> <br />';
608: }
609: if ($showhelpdesk) {
1.62 raeburn 610: $contactblock .= '<b> <a href="javascript:helpdesk()">'.$$lt{'helpdesk'}.'</a></b><br />';
611: my $thisurl = &Apache::lonnet::escape('/adm/login');
612: $$helpdeskscript = <<"ENDSCRIPT";
613: <script type="text/javascript">
614: function helpdesk() {
615: var codedom = document.client.udom.value;
616: if (codedom == '') {
617: codedom = "$authdomain";
618: }
619: var querystr = "origurl=$thisurl&codedom="+codedom;
620: document.location.href = "/adm/helpdesk?"+querystr;
621: return;
622: }
623: </script>
624: ENDSCRIPT
1.60 raeburn 625: }
626: $contactblock .= <<"ENDBLOCK";
627: $version
628: ENDBLOCK
629: return $contactblock;
630: }
631:
1.1 albertel 632:
633: 1;
634: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>