Annotation of modules/gci/lonlogin.pm, revision 1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>