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

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

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