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

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

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