--- loncom/interface/loncreateuser.pm 2008/05/12 17:52:09 1.239 +++ loncom/interface/loncreateuser.pm 2008/06/04 21:24:20 1.242 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.239 2008/05/12 17:52:09 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.242 2008/06/04 21:24:20 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2146,7 +2146,7 @@ sub update_roles { $rolename,$rnam,$rdom,$url).': '. &Apache::lonnet::assigncustomrole($env{'form.ccdomain'}, $env{'form.ccuname'},$url,$rdom,$rnam,$rolename,$now, - 0,1).'
'); + 0,1,$context).'
'); if (!grep(/^cr$/,@rolechanges)) { push(@rolechanges,'cr'); } @@ -2193,7 +2193,7 @@ sub update_roles { my ($url,$rdom,$rnam,$rolename) = ($1,$2,$3,$4); my $result = &Apache::lonnet::assigncustomrole( $env{'form.ccdomain'}, $env{'form.ccuname'}, - $url,$rdom,$rnam,$rolename,0,$now); + $url,$rdom,$rnam,$rolename,0,$now,undef,$context); $r->print(&mt('Re-enabling custom role [_1] by [_2]@[_3] in [_4] : [_5]', $rolename,$rnam,$rdom,$url,$result).'
'); if (!grep(/^cr$/,@rolechanges)) { @@ -2220,7 +2220,7 @@ sub update_roles { my %sections = (); my $num_sections = &build_roles($env{'form.sec_'.$full},\%sections,$5); if ($num_sections == 0) { - $r->print(&Apache::loncommon::commit_customrole($udom,$uname,$url,$three,$four,$five,$start,$end)); + $r->print(&Apache::loncommon::commit_customrole($udom,$uname,$url,$three,$four,$five,$start,$end,$context)); } else { my %curr_groups = &Apache::longroup::coursegroups($one,$two); @@ -2231,7 +2231,7 @@ sub update_roles { next; } my $securl = $url.'/'.$sec; - $r->print(&Apache::loncommon::commit_customrole($udom,$uname,$securl,$three,$four,$five,$start,$end)); + $r->print(&Apache::loncommon::commit_customrole($udom,$uname,$securl,$three,$four,$five,$start,$end,$context)); } } if (!grep(/^cr$/,@rolechanges)) { @@ -2253,7 +2253,7 @@ sub update_roles { my %sections = (); my $num_sections = &build_roles($env{'form.sec_'.$one.'_'.$two.'_'.$three},\%sections,$three); if ($num_sections == 0) { - $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'')); + $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'',$context)); } else { my %curr_groups = &Apache::longroup::coursegroups($one,$two); @@ -2267,13 +2267,13 @@ sub update_roles { next; } my $securl = $url.'/'.$sec; - $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$three,$start,$end,$one,$two,$sec)); + $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$three,$start,$end,$one,$two,$sec,$context)); } else { $emptysec = 1; } } if ($emptysec) { - $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'')); + $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'',$context)); } } if (!grep(/^\Q$three\E$/,@rolechanges)) { @@ -2295,19 +2295,19 @@ sub update_roles { my %sections = (); my $num_sections = &build_roles($env{'form.sec_'.$one.'_'.$two},\%sections,$two); if ($num_sections == 0) { - $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$two,$start,$end,$one,undef,'')); + $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) { if ($sec ne '') { my $securl = $url.'/'.$sec; - $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$two,$start,$end,$one,undef,$sec)); + $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$two,$start,$end,$one,undef,$sec,$context)); } else { $emptysec = 1; } } if ($emptysec) { - $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$two,$start,$end,$one,undef,'')); + $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$two,$start,$end,$one,undef,'',$context)); } } if (!grep(/^\Q$two\E$/,@rolechanges)) { @@ -2670,7 +2670,7 @@ sub make_button_code { } # ---------------------------------------------------------- Call to definerole sub set_custom_role { - my ($r) = @_; + my ($r,$context) = @_; my $rolename=$env{'form.rolename'}; $rolename=~s/[^A-Za-z0-9]//gs; if (!$rolename) { @@ -2745,7 +2745,7 @@ sub set_custom_role { $url, $env{'user.domain'}, $env{'user.name'}, - $rolename)); + $rolename,undef,undef,undef,$context)); } $r->print('

'.&mt('Create or edit another custom role').'

'); $r->print(&Apache::lonhtmlcommon::echo_form_input([]).'
'); @@ -2889,7 +2889,7 @@ sub handler { } } elsif ($env{'form.action'} eq 'custom' && $permission->{'custom'}) { if ($env{'form.phase'} eq 'set_custom_roles') { - &set_custom_role($r); + &set_custom_role($r,$context); } else { &custom_role_editor($r); } @@ -2981,7 +2981,7 @@ sub handler { if (!exists($env{'form.state'})) { $r->print(&Apache::lonhtmlcommon::breadcrumbs('Configure Self-enrollment', 'Course_Self_Enrollment')); - + $r->print('

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

'."\n"); &print_selfenroll_menu($r,$context,$permission); } elsif ($env{'form.state'} eq 'done') { &Apache::lonhtmlcommon::add_breadcrumb @@ -2989,7 +2989,8 @@ sub handler { text=>"Result"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Self-enrollment result', 'Course_Self_Enrollment')); - &update_selfenroll_config($r,$context); + $r->print('

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

'."\n"); + &update_selfenroll_config($r,$context,$permission); } $r->print(&Apache::loncommon::end_page()); } elsif ($env{'form.action'} eq 'changelogs') { @@ -3104,7 +3105,7 @@ sub print_main_menu { }); if (!exists($permission->{'cusr_section'})) { push(@courselinks, - { text => 'Automated Student Enrollment Manager', + { text => 'Automated Enrollment Manager', help => 'Course_Automated_Enrollment', permission => (&Apache::lonnet::auto_run($cnum,$cdom) && $permission->{'cusr'}), @@ -3122,15 +3123,15 @@ sub print_main_menu { permission => $permission->{'grp_manage'}, url => '/adm/coursegroups?refpage=cusr', }, - { text => 'View Log-in History', - help => 'Course_User_Logins', - action => 'logins', - permission => $permission->{'cusr'}, - }, { text => 'View Change Logs', help => 'Course_User_Logs', action => 'changelogs', permission => $permission->{'cusr'}, + }, + { text => 'View Log-in History', + help => 'Course_User_Logins', + action => 'logins', + permission => $permission->{'cusr'}, }); push(@menu,@courselinks); } @@ -3178,8 +3179,10 @@ sub print_selfenroll_menu { $setsec_js."\n". ''."\n". '

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

'."\n". - '
'."\n". + ''."\n". &Apache::lonhtmlcommon::start_pick_box(); + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'},'.num'}; if (ref($row) eq 'ARRAY') { foreach my $item (@{$row}) { my $title = $item; @@ -3191,7 +3194,68 @@ sub print_selfenroll_menu { 'LC_selfenroll_pick_box_title','LC_oddrow_value')."\n"; if ($item eq 'types') { my $curr_types = $env{'course.'.$env{'request.course.id'}.'.internal.selfenroll_types'}; - $output .= ''; + my $showdomdesc = 1; + my $includeempty = 1; + my $num = 0; + $output .= &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_row() + .'