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