--- loncom/interface/loncreateuser.pm 2014/04/25 17:56:42 1.399 +++ loncom/interface/loncreateuser.pm 2016/08/12 18:33:17 1.406.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.399 2014/04/25 17:56:42 bisitz Exp $ +# $Id: loncreateuser.pm,v 1.406.2.2 2016/08/12 18:33:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2244,8 +2244,8 @@ sub personal_data_display { ''; $rowcount ++; $output .= &Apache::lonhtmlcommon::row_closure(1); - my $upassone = ''; - my $upasstwo = ''; + my $upassone = ''; + my $upasstwo = ''; $output .= &Apache::lonhtmlcommon::row_title(&mt('Password').'*', 'LC_pick_box_title', 'LC_oddrow_value')."\n". @@ -2282,19 +2282,15 @@ sub personal_data_display { } } else { if ($context eq 'selfcreate') { - if (($item eq 'permanentemail') && ($newuser eq 'email')) { - $row .= $ccuname; - } else { - if ($canmodify{$item}) { - if ($newuser eq 'email') { - $row .= ''; - } else { - $row .= ''; - } - $editable ++; + if ($canmodify{$item}) { + if ($newuser eq 'email') { + $row .= ''; } else { - $hiderow = 1; + $row .= ''; } + $editable ++; + } else { + $hiderow = 1; } } else { $row .= ''; @@ -2355,7 +2351,7 @@ sub personal_data_display { } if (($context eq 'selfcreate') && ($newuser eq 'email')) { if ($captchaform) { - $output .= &Apache::lonhtmlcommon::row_title($lt{'valid'}, + $output .= &Apache::lonhtmlcommon::row_title($lt{'valid'}.'*', 'LC_pick_box_title')."\n". $captchaform."\n".'

'. &Apache::lonhtmlcommon::row_closure(1); @@ -3048,7 +3044,7 @@ sub update_user_data { my %newenvhash; foreach my $key (keys(%changed)) { if (($key eq 'official') || ($key eq 'unofficial') - || ($key eq 'community')) { + || ($key eq 'community') || ($key eq 'textbook')) { $newenvhash{'environment.requestcourses.'.$key} = $changeHash{'requestcourses.'.$key}; if ($changeHash{'requestcourses.'.$key}) { @@ -3629,7 +3625,7 @@ sub update_roles { my @rolechanges; my %disallowed; $r->print('

'.&mt('Modifying Roles').'

'); - foreach my $key (keys (%env)) { + foreach my $key (keys(%env)) { next if (! $env{$key}); next if ($key eq 'form.action'); # Revoke roles @@ -3811,7 +3807,7 @@ sub update_roles { } else { my %curr_groups = &Apache::longroup::coursegroups($one,$two); - foreach my $sec (sort {$a cmp $b} keys %sections) { + foreach my $sec (sort {$a cmp $b} keys(%sections)) { if (($sec eq 'none') || ($sec eq 'all') || exists($curr_groups{$sec})) { $disallowed{$sec} = $url; @@ -3857,7 +3853,7 @@ sub update_roles { my %curr_groups = &Apache::longroup::coursegroups($one,$two); my $emptysec = 0; - foreach my $sec (sort {$a cmp $b} keys %sections) { + foreach my $sec (sort {$a cmp $b} keys(%sections)) { $sec =~ s/\W//g; if ($sec ne '') { if (($sec eq 'none') || ($sec eq 'all') || @@ -3897,7 +3893,7 @@ sub update_roles { $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$two,$start,$end,$one,undef,'',$context)); } else { my $emptysec = 0; - foreach my $sec (sort {$a cmp $b} keys %sections) { + foreach my $sec (sort {$a cmp $b} keys(%sections)) { if ($sec ne '') { my $securl = $url.'/'.$sec; $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$two,$start,$end,$one,undef,$sec,$context)); @@ -4993,6 +4989,7 @@ sub handler { selfenroll_end_access => $env{'course.'.$cid.'.internal.selfenroll_end_access'}, default_enrollment_start_date => $env{'course.'.$cid.'.default_enrollment_start_date'}, default_enrollment_end_date => $env{'course.'.$cid.'.default_enrollment_end_date'}, + uniquecode => $env{'course.'.$cid.'.internal.uniquecode'}, ); push(@{$brcrum}, {href => '/adm/createuser?action=selfenroll', @@ -5012,7 +5009,7 @@ sub handler { bread_crumbs_component => 'Self-enrollment result'}; $r->print(&header(undef,$args)); $r->print('

'.&mt('Self-enrollment with a student role').'

'."\n"); - &update_selfenroll_config($r,$cid,$cdom,$cnum,\%currsettings); + &update_selfenroll_config($r,$cid,$cdom,$cnum,$context,$crstype,\%currsettings); } } else { $r->print(&header(undef,{'no_nav_bar' => 1}). @@ -5547,6 +5544,7 @@ sub print_selfenroll_menu { butn => 'but no user types have been checked.', wilf => "Please uncheck 'activate' or check at least one type.", ); + &js_escape(\%alerts); my $selfenroll_js = <<"ENDSCRIPT"; function update_types(caller,num) { var delidx = getIndexByName('selfenroll_delete'); @@ -5740,28 +5738,70 @@ ENDSCRIPT '// ]]>'."\n". ''."\n". '

'.$lt->{'selfenroll'}.'

'."\n"; - my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum); - if (ref($visactions) eq 'HASH') { - if ($visible) { - $output .= '

'.$visactions->{'vis'}.'

'; - } else { - $output .= '

'.$visactions->{'miss'}.'

' - .$visactions->{'yous'}. - '

'.$visactions->{'gen'}.'
'.$visactions->{'coca'}; - if (ref($vismsgs) eq 'ARRAY') { - $output .= '
'.$visactions->{'make'}.'

'; + $output .= '

'; } - $output .= '

'; } } my $actionhref = '/adm/createuser'; if ($context eq 'domain') { $actionhref = '/adm/modifycourse'; } + + my %noedit; + unless ($context eq 'domain') { + %noedit = &get_noedit_fields($cdom,$cnum,$crstype,$row); + } $output .= '
'."\n". &Apache::lonhtmlcommon::start_pick_box(); if (ref($row) eq 'ARRAY') { @@ -5776,6 +5816,37 @@ ENDSCRIPT if (ref($currsettings) eq 'HASH') { $curr_types = $currsettings->{'selfenroll_types'}; } + if ($noedit{$item}) { + if ($curr_types eq '*') { + $output .= &mt('Any user in any domain'); + } else { + my @entries = split(/;/,$curr_types); + if (@entries > 0) { + $output .= ''; + } else { + $output .= &mt('None'); + } + } + $output .= '
'.&mt('(Set by Domain Coordinator)'); + next; + } my $showdomdesc = 1; my $includeempty = 1; my $num = 0; @@ -5844,6 +5915,15 @@ ENDSCRIPT if (ref($currsettings) eq 'HASH') { $registered = $currsettings->{'selfenroll_registered'}; } + if ($noedit{$item}) { + if ($registered) { + $output .= &mt('Must be registered in course'); + } else { + $output .= &mt('No requirement'); + } + $output .= '
'.&mt('(Set by Domain Coordinator)'); + next; + } if ($registered) { $regon = ' checked="checked" '; $regoff = ' '; @@ -5868,6 +5948,12 @@ ENDSCRIPT $endtime = $currsettings->{'default_enrollment_end_date'}; } } + if ($noedit{$item}) { + $output .= &mt('From: [_1], to: [_2]',&Apache::lonlocal::locallocaltime($starttime), + &Apache::lonlocal::locallocaltime($endtime)); + $output .= '
'.&mt('(Set by Domain Coordinator)'); + next; + } my $startform = &Apache::lonhtmlcommon::date_setter($formname,'selfenroll_start_date',$starttime, undef,undef,undef,undef,undef,undef,undef,$nolink); @@ -5887,6 +5973,12 @@ ENDSCRIPT $endtime = $currsettings->{'default_enrollment_end_date'}; } } + if ($noedit{$item}) { + $output .= &mt('From: [_1], to: [_2]',&Apache::lonlocal::locallocaltime($starttime), + &Apache::lonlocal::locallocaltime($endtime)); + $output .= '
'.&mt('(Set by Domain Coordinator)'); + next; + } my $startform = &Apache::lonhtmlcommon::date_setter($formname,'selfenroll_start_access',$starttime, undef,undef,undef,undef,undef,undef,undef,$nolink); @@ -5906,6 +5998,15 @@ ENDSCRIPT $newsecval = $currsec; } } + if ($noedit{$item}) { + if ($currsec ne '') { + $output .= $currsec; + } else { + $output .= &mt('No specific section'); + } + $output .= '
'.&mt('(Set by Domain Coordinator)'); + next; + } my $sections_select = &Apache::lonuserutils::course_sections(\%sections_count,'st',$currsec); $output .= ''."\n". @@ -5915,7 +6016,6 @@ ENDSCRIPT &mt('New section').'
'."\n". ''."\n". ''."\n". - ''."\n". '
'."\n"; } elsif ($item eq 'approval') { my ($currnotified,$currapproval,%appchecked); @@ -5927,6 +6027,11 @@ ENDSCRIPT if ($currapproval !~ /^[012]$/) { $currapproval = 0; } + if ($noedit{$item}) { + $output .= $selfdescs{'approval'}{$currapproval}. + '
'.&mt('(Set by Domain Coordinator)'); + next; + } $appchecked{$currapproval} = ' checked="checked"'; for my $i (0..2) { $output .= '