--- loncom/interface/createaccount.pm 2008/07/04 19:32:56 1.9 +++ loncom/interface/createaccount.pm 2008/07/08 17:47:57 1.12 @@ -3,7 +3,7 @@ # institutional log-in ID (institutional authentication required - localauth # or kerberos) or an e-mail address. # -# $Id: createaccount.pm,v 1.9 2008/07/04 19:32:56 raeburn Exp $ +# $Id: createaccount.pm,v 1.12 2008/07/08 17:47:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,6 +35,7 @@ use Apache::Constants qw(:common); use Apache::lonacc; use Apache::lonnet; use Apache::loncommon; +use Apache::lonhtmlcommon; use Apache::lonlocal; use Apache::lonauth; use Apache::resetpw; @@ -195,6 +196,9 @@ sub handler { $r->print(<$jsh>); $r->print(&javascript_setforms($now)); } + if (grep(/^email$/,@cancreate)) { + $r->print(&javascript_validmail()); + } $output = &print_username_form($domain,$domdesc,\@cancreate,$now,$lonhost, $courseid); } @@ -277,6 +281,27 @@ ENDSCRIPT return $js; } +sub javascript_validmail { + my %lt = &Apache::lonlocal::texthash ( + email => 'The e-mail address you entered', + notv => 'is not a valid e-mail address', + ); + my $output = "\n".''."\n"; + return $output; +} + sub print_username_form { my ($domain,$domdesc,$cancreate,$now,$lonhost,$courseid) = @_; my %lt = &Apache::lonlocal::texthash( @@ -290,7 +315,7 @@ sub print_username_form { my %domdefaults = &Apache::lonnet::get_domain_defaults($domain); if ((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) { $output = '

'.&mt('Create account with a username provided by your institution').'

'; - $output .= &mt('If you already have a log-in ID at your institution, you may be able to use it for LON-CAPA.').'
'.&mt('Type in your log-in ID and password to find out.').'

'; + $output .= &mt('If you already have a log-in ID at your institution,[_1] you may be able to use it for LON-CAPA.','
').'

'.&mt('Type in your log-in ID and password to find out.').'

'; my ($lkey,$ukey) = &Apache::lonpreferences::des_keys(); my ($lextkey,$uextkey) = &getkeys($lkey,$ukey); my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount', @@ -327,7 +352,7 @@ sub print_username_form { my $emailform = ''; my $captchaform = &create_captcha(); my $submit_text = &mt('Request LON-CAPA account'); - $output .= '
'. + $output .= ''. &Apache::lonhtmlcommon::start_pick_box()."\n". &Apache::lonhtmlcommon::row_title(&mt('E-mail address'), 'LC_pick_box_title')."\n". @@ -914,7 +939,7 @@ sub create_captcha { sub captcha_settings { my %captcha_params = ( - output_dir => "/home/httpd/html/captcha", + output_dir => $Apache::lonnet::perlvar{'lonDocRoot'}.'/captcha', www_output_dir => "/captcha", db_dir => "/home/www/captchadb", numchars => '5',