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

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

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