--- loncom/interface/loncreateuser.pm 2008/06/27 16:31:16 1.245 +++ loncom/interface/loncreateuser.pm 2008/08/27 21:55:32 1.261 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.245 2008/06/27 16:31:16 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.261 2008/08/27 21:55:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -967,7 +967,7 @@ sub display_existing_roles { if (defined($coursedata{'description'})) { $carea=$coursedata{'description'}. '
'.&mt('Domain').': '.$coursedom.(' 'x8). - &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom); + &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom); $sortkey.="\0".$coursedata{'description'}; $class=$coursedata{'type'}; } else { @@ -1396,10 +1396,12 @@ sub modify_login_block { } sub personal_data_display { - my ($ccuname,$ccdomain,$newuser,$context,$inst_results) = @_; + my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_; my ($output,$showforceid,%userenv,%canmodify); my @userinfo = ('firstname','middlename','lastname','generation', 'permanentemail','id'); + my $rowcount = 0; + my $editable = 0; if (!$newuser) { # Get the users information %userenv = &Apache::lonnet::get('environment', @@ -1407,7 +1409,10 @@ sub personal_data_display { 'permanentemail','id'],$ccdomain,$ccuname); %canmodify = &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain, - \@userinfo); + \@userinfo,$rolesarray); + } elsif ($context eq 'selfcreate') { + %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo, + $inst_results,$rolesarray); } my %lt=&Apache::lonlocal::texthash( 'pd' => "Personal Data", @@ -1416,7 +1421,7 @@ sub personal_data_display { 'lastname' => "Last Name", 'generation' => "Generation", 'permanentemail' => "Permanent e-mail address", - 'id' => "ID/Student Number", + 'id' => "Student/Employee ID", 'lg' => "Login Data" ); my %textboxsize = ( @@ -1432,40 +1437,93 @@ sub personal_data_display { &Apache::lonhtmlcommon::start_pick_box(); foreach my $item (@userinfo) { my $rowtitle = $lt{$item}; + my $hiderow = 0; if ($item eq 'generation') { $rowtitle = $genhelp.$rowtitle; } - $output .= &Apache::lonhtmlcommon::row_title($rowtitle,undef,'LC_oddrow_value')."\n"; + my $row = &Apache::lonhtmlcommon::row_title($rowtitle,undef,'LC_oddrow_value')."\n"; if ($newuser) { if (ref($inst_results) eq 'HASH') { if ($inst_results->{$item} ne '') { - $output .= ''.$inst_results->{$item}; + $row .= ''.$inst_results->{$item}; } else { - $output .= ''; + if ($context eq 'selfcreate') { + if ($canmodify{$item}) { + $row .= ''; + $editable ++; + } else { + $hiderow = 1; + } + } else { + $row .= ''; + } } } else { - $output .= ''; + if ($context eq 'selfcreate') { + if ($canmodify{$item}) { + $row .= ''; + $editable ++; + } else { + $hiderow = 1; + } + } else { + $row .= ''; + } } } else { if ($canmodify{$item}) { - $output .= ''; + $row .= ''; } else { - $output .= $userenv{$item}; + $row .= $userenv{$item}; } if ($item eq 'id') { $showforceid = $canmodify{$item}; } } - $output .= &Apache::lonhtmlcommon::row_closure(1); + $row .= &Apache::lonhtmlcommon::row_closure(1); + if (!$hiderow) { + $output .= $row; + $rowcount ++; + } } $output .= &Apache::lonhtmlcommon::end_pick_box(); if (wantarray) { - return ($output,$showforceid); + if ($context eq 'selfcreate') { + return($output,$rowcount,$editable); + } else { + return ($output,$showforceid); + } } else { return $output; } } +sub selfcreate_canmodify { + my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_; + if (ref($inst_results) eq 'HASH') { + my @inststatuses = &get_inststatuses($inst_results); + if (@inststatuses == 0) { + @inststatuses = ('default'); + } + $rolesarray = \@inststatuses; + } + my %canmodify = + &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo, + $rolesarray); + return %canmodify; +} + +sub get_inststatuses { + my ($insthashref) = @_; + my @inststatuses = (); + if (ref($insthashref) eq 'HASH') { + if (ref($insthashref->{'inststatus'}) eq 'ARRAY') { + @inststatuses = @{$insthashref->{'inststatus'}}; + } + } + return @inststatuses; +} + # ================================================================= Phase Three sub update_user_data { my ($r,$context) = @_; @@ -1789,7 +1847,7 @@ sub update_user_data { $env{'form.c'.$item} = $userenv{$item}; } } - # Check to see if we can change the ID/student number + # Check to see if we can change the Student/Employee ID my $forceid = $env{'form.forceid'}; my $recurseid = $env{'form.recurseid'}; my (%alerts,%rulematch,%idinst_results,%curr_rules,%got_rules); @@ -1800,7 +1858,10 @@ sub update_user_data { (!$forceid)) { if ($env{'form.cid'} ne $uidhash{$env{'form.ccuname'}}) { $env{'form.cid'} = $userenv{'id'}; - $no_forceid_alert = &mt('New student/employeeID does not match existing ID for this user.').'
'.&mt('Change is not permitted without checking the \'Force ID change\' checkbox on the previous page.').'
'."\n"; + $no_forceid_alert = &mt('New Student/Employee ID does not match existing ID for this user.') + .'
' + .&mt("Change is not permitted without checking the 'Force ID change' checkbox on the previous page.") + .'
'."\n"; } } if ($env{'form.cid'} ne $userenv{'id'}) { @@ -1914,7 +1975,7 @@ sub update_user_data { 'mddl' => "middle", 'lst' => "last", 'gen' => "generation", - 'id' => "ID/Student number", + 'id' => "Student/Employee ID", 'mail' => "permanent e-mail", 'disk' => "disk space allocated to portfolio files", 'prvs' => "Previous", @@ -1997,7 +2058,7 @@ END # They did not want to change the users name or quota but we can # still tell them what the name and quota are my %lt=&Apache::lonlocal::texthash( - 'id' => "ID/Student number", + 'id' => "Student/Employee ID", 'mail' => "Permanent e-mail", 'disk' => "Disk space allocated to user's portfolio files", ); @@ -2040,8 +2101,10 @@ END $r->print(''.$rolestr.'
'. &mt('Contact your helpdesk for more information.',"javascript:helpMenu('display')").'
'); } - $r->print($no_forceid_alert. - &Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules)); + $r->print('' + .$no_forceid_alert + .&Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules) + .''); } if ($env{'form.action'} eq 'singlestudent') { &enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context); @@ -2069,7 +2132,10 @@ END if ($env{'form.popup'}) { $r->print('

'.&mt('Close window').'

'); } else { - $r->print('

'.&mt('Modify this user: ([_1])',$userinfo).''.(' 'x5).''.&mt('Create/Modify Another User').'

'); + $r->print('

' + .&mt('Modify this user: [_1]',''.$env{'form.ccuname'}.':'.$env{'form.ccdomain'}.' ('.$userinfo.')').'' + .(' 'x5).'' + .&mt('Create/Modify Another User').'

'); } } $r->print(&Apache::loncommon::end_page()); @@ -3127,12 +3193,12 @@ sub print_main_menu { help => 'Course_User_Logs', action => 'changelogs', permission => $permission->{'cusr'}, - }, - { text => 'View Log-in History', - help => 'Course_User_Logins', - action => 'logins', - permission => $permission->{'cusr'}, - }); + },); +# { text => 'View Log-in History', +# help => 'Course_User_Logins', +# action => 'logins', +# permission => $permission->{'cusr'}, +# }); push(@menu,@courselinks); } my $menu_html = ''; @@ -3175,14 +3241,203 @@ sub print_selfenroll_menu { my $groupslist = &Apache::lonuserutils::get_groupslist(); my $setsec_js = &Apache::lonuserutils::setsections_javascript($formname,$groupslist); + my %alerts = &Apache::lonlocal::texthash( + acto => 'Activation of self-enrollment was selected for the following domain(s)', + butn => 'but no user types have been checked.', + wilf => "Please uncheck 'activate' or check at least one type.", + ); + my $selfenroll_js = <<"ENDSCRIPT"; +function update_types(caller,num) { + var delidx = getIndexByName('selfenroll_delete'); + var actidx = getIndexByName('selfenroll_activate'); + if (caller == 'selfenroll_all') { + var selall; + for (var i=0; i 0) { + var msg = "$alerts{'acto'}\\n"; + var loopend = needaction.length -1; + if (loopend > 0) { + for (var m=0; m'."\n". - '

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

'."\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'}; + '

'.$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'}.'

    '; + foreach my $item (@{$vismsgs}) { + $output .= '
  • '.$visactions->{$item}.'
  • '; + } + $output .= '
'; + } + $output .= '

'; + } + } + $output .= ''."\n". + &Apache::lonhtmlcommon::start_pick_box(); if (ref($row) eq 'ARRAY') { foreach my $item (@{$row}) { my $title = $item; @@ -3205,14 +3460,20 @@ sub print_selfenroll_menu { if ($curr_types eq '*') { $output .= ' checked="checked" '; } - $output .= '/>'.&mt('Yes').'  '.&mt('Yes').''. + '  ' - .&Apache::loncommon::end_data_table_row(); + $output .= ' onchange="javascript:update_types('. + "'selfenroll_all'".');"/>'.&mt('No').''. + &Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(). + &mt('Or').'
'. + &Apache::loncommon::start_data_table(); my %currdoms; - if (($curr_types eq '') && ($env{'form.selfenroll_newdom'} eq '')) { + if ($curr_types eq '') { $output .= &new_selfenroll_dom_row($cdom,'0'); } elsif ($curr_types ne '*') { my @entries = split(/;/,$curr_types); @@ -3221,33 +3482,27 @@ sub print_selfenroll_menu { my ($currdom,$typestr) = split(/:/,$entry); $currdoms{$currdom} = 1; my $domdesc = &Apache::lonnet::domain($currdom); - my @currinsttypes = split(/,/,$typestr); + my @currinsttypes = split(',',$typestr); $output .= &Apache::loncommon::start_data_table_row() .''.&mt('Domain:').'' .' '.$domdesc.' ('.$currdom.')' .'
' .''; - $output .= ''.&mt('User types:').'
' + $output .= '  '.&mt('User types:').'
' .&selfenroll_inst_types($num,$currdom,\@currinsttypes).'' .&Apache::loncommon::end_data_table_row(); $num ++; } } } - if ($env{'form.selfenroll_newdom'} ne '') { - if (!defined($currdoms{$env{'form.selfenroll_newdom'}})) { - $output .= &new_selfenroll_dom_row($env{'form.selfenroll_newdom'},$num); - $num ++; - } - } - my $add_domtitle = &mt('Additional domain:'); + my $add_domtitle = &mt('Users in additional domain:'); if ($curr_types eq '*') { - $add_domtitle = &mt('Specific domain:'); + $add_domtitle = &mt('Users in specific domain:'); } elsif ($curr_types eq '') { - $add_domtitle = &mt('Other domain:'); + $add_domtitle = &mt('Users in other domain:'); } $output .= &Apache::loncommon::start_data_table_row() .''.$add_domtitle.'
' @@ -3328,12 +3583,134 @@ sub print_selfenroll_menu { } $output .= &Apache::lonhtmlcommon::end_pick_box(). '
' + .&mt('Save changes').'" onclick="validate_types(this.form);" />' .'
'; $r->print($output); return; } +sub visible_in_cat { + my ($cdom,$cnum) = @_; + my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); + my ($cathash,%settable,@vismsgs,$cansetvis); + my %visactions = &Apache::lonlocal::texthash( + vis => 'Your course currently appears in the Course Catalog for this domain.', + gen => 'Courses can be both self-cataloging, based on an institutional code (e.g., fs08phy231), or can be assigned categories from a hierarchy defined for the domain.', + miss => 'Your course does not currently appear in the Course Catalog for this domain.', + yous => 'You should remedy this if you plan to allow self-enrollment, otherwise students will have difficulty finding your course.', + coca => 'Courses can be absent from the Catalog, because they do not have an institutional code, have no assigned category, or have been specifically excluded.', + make => 'Make any changes to self-enrollment settings below, click "Save changes", then take action to include the course in the Catalog:', + take => 'Take the following action to ensure the course appears in the Catalog:', + dc_unhide => 'Ask a domain coordinator to change the "Exclude from course catalog" setting.', + dc_addinst => 'Ask a domain coordinator to enable display the catalog of "Official courses (with institutional codes)".', + dc_instcode => 'Ask a domain coordinator to assign an institutional code (if this is an official course).', + dc_catalog => 'Ask a domain coordinator to enable or create at least one course category in the domain.', + dc_categories => 'Ask a domain coordinator to create a hierarchy of categories and sub categories for courses in the domain.', + dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain', + dc_addcat => 'Ask a domain coordinator to assign a category to the course.', + ); + $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','"','"'); + $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"','"'); + $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','"','"'); + if (ref($domconf{'coursecategories'}) eq 'HASH') { + if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { + $settable{'togglecats'} = 1; + } + if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { + $settable{'categorize'} = 1; + } + $cathash = $domconf{'coursecategories'}{'cats'}; + } + if ($settable{'togglecats'} && $settable{'categorize'}) { + $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.'); + } elsif ($settable{'togglecats'}) { + $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.'); + } elsif ($settable{'categorize'}) { + $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.'); + } else { + $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.'); + } + + my %currsettings = + &Apache::lonnet::get('environment',['hidefromcat','categories','internal.coursecode'], + $cdom,$cnum); + my $visible = 0; + if ($currsettings{'internal.coursecode'} ne '') { + if (ref($domconf{'coursecategories'}) eq 'HASH') { + $cathash = $domconf{'coursecategories'}{'cats'}; + if (ref($cathash) eq 'HASH') { + if ($cathash->{'instcode::0'} eq '') { + push(@vismsgs,'dc_addinst'); + } else { + $visible = 1; + } + } else { + $visible = 1; + } + } else { + $visible = 1; + } + } else { + if (ref($cathash) eq 'HASH') { + if ($cathash->{'instcode::0'} ne '') { + push(@vismsgs,'dc_instcode'); + } + } else { + push(@vismsgs,'dc_instcode'); + } + } + if ($currsettings{'categories'} ne '') { + my $cathash; + if (ref($domconf{'coursecategories'}) eq 'HASH') { + $cathash = $domconf{'coursecategories'}{'cats'}; + if (ref($cathash) eq 'HASH') { + if (keys(%{$cathash}) == 0) { + push(@vismsgs,'dc_catalog'); + } elsif ((keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} ne '')) { + push(@vismsgs,'dc_categories'); + } else { + my @currcategories = split('&',$currsettings{'categories'}); + my $matched = 0; + foreach my $cat (@currcategories) { + if ($cathash->{$cat} ne '') { + $visible = 1; + $matched = 1; + last; + } + } + if (!$matched) { + if ($settable{'categorize'}) { + push(@vismsgs,'chgcat'); + } else { + push(@vismsgs,'dc_chgcat'); + } + } + } + } + } + } else { + if (ref($cathash) eq 'HASH') { + if ((keys(%{$cathash}) > 1) || + (keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) { + if ($settable{'categorize'}) { + push(@vismsgs,'addcat'); + } else { + push(@vismsgs,'dc_addcat'); + } + } + } + } + if ($currsettings{'hidefromcat'} eq 'yes') { + $visible = 0; + if ($settable{'togglecats'}) { + unshift(@vismsgs,'unhide'); + } else { + unshift(@vismsgs,'dc_unhide') + } + } + return ($visible,$cansetvis,\@vismsgs,\%visactions); +} + sub new_selfenroll_dom_row { my ($newdom,$num) = @_; my $domdesc = &Apache::lonnet::domain($newdom); @@ -3342,7 +3719,12 @@ sub new_selfenroll_dom_row { $output .= &Apache::loncommon::start_data_table_row() .''.&mt('Domain:').' '.$domdesc .' ('.$newdom.')'; + .'" value="'.$newdom.'" />
' + .''; my @currinsttypes; $output .= ''.&mt('User types:').'
' .&selfenroll_inst_types($num,$newdom,\@currinsttypes).'' @@ -3357,20 +3739,29 @@ sub selfenroll_inst_types { my $numinrow = 4; my $count = 0; my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($currdom); + my $othervalue = 'any'; if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { + if (keys(%{$usertypes}) > 0) { + $othervalue = 'other'; + } $output .= ''; foreach my $type (@{$types}) { if (($count > 0) && ($count%$numinrow == 0)) { $output .= ''; } if (defined($usertypes->{$type})) { + my $esc_type = &escape($type); $output .= ''; @@ -3380,13 +3771,21 @@ sub selfenroll_inst_types { if (($count > 0) && ($count%$numinrow == 0)) { $output .= ''; } - $output .= '
'; } @@ -3449,8 +3848,9 @@ sub print_userchangelogs_display { $curr{$key} = $defaults{$key}; } } - my (%whodunit,%changed); - $r->print(&role_display_filter($formname,$cdom,$cnum,\%curr)); + my (%whodunit,%changed,$version); + ($version) = ($r->dir_config('lonVersion') =~ /^([\d\.]+)\-/); + $r->print(&role_display_filter($formname,$cdom,$cnum,\%curr,$version)); my $showntablehdr = 0; my $tablehdr = &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(). @@ -3459,7 +3859,7 @@ sub print_userchangelogs_display { &mt('Context').''.&mt('Start').''.&mt('End').''. &Apache::loncommon::end_data_table_header_row(); my ($minshown,$maxshown); - my $minshown = 1; + $minshown = 1; my $count = 0; if ($curr{'show'} ne &mt('all')) { $maxshown = $curr{'page'} * $curr{'show'}; @@ -3567,7 +3967,7 @@ ENDSCRIPT } sub role_display_filter { - my ($formname,$cdom,$cnum,$curr) = @_; + my ($formname,$cdom,$cnum,$curr,$version) = @_; my $context = 'course'; my $nolink = 1; my $output = '
'. @@ -3618,9 +4018,14 @@ sub role_display_filter { next if (!&Apache::lonnet::auto_run($cnum,$cdom)); } $output .= ''."\n"; - } + } $output .= '  


'; + &mt('Update Display').'" />'. + ''. + &mt('[_1]Note:[_2] Only changes made from servers running LON-CAPA 2.6.99.0 or later are displayed.'); + if ($version) { + $output .= ' '.&mt('This server is version [_3].','','',$version); } + $output .= '

'; return $output; } @@ -4302,26 +4707,58 @@ sub update_selfenroll_config { } else { next; } - } elsif ($curr_types eq '') { - my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_0'); - if (@types > 0) { - $changes{'internal.selfenroll_types'} = $env{'form.selfenroll_dom_0'}.':'.join(',',@types); - } } else { + my %currdoms; my @entries = split(/;/,$curr_types); - my $num = 0; - my @latesttypes; my @deletedoms = &Apache::loncommon::get_env_multiple('form.selfenroll_delete'); + my @activations = &Apache::loncommon::get_env_multiple('form.selfenroll_activate'); my $newnum = 0; - for (my $j=0; $j<$env{'form.selfenroll_types_total'}; $j++) { - if (!grep(/^$j$/,@deletedoms)) { - my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_'.$j); + my @latesttypes; + foreach my $num (@activations) { + my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_'.$num); + if (@types > 0) { @types = sort(@types); my $typestr = join(',',@types); - $latesttypes[$newnum] = $env{'form.selfenroll_dom_'.$j}.':'.$typestr; + my $typedom = $env{'form.selfenroll_dom_'.$num}; + $latesttypes[$newnum] = $typedom.':'.$typestr; + $currdoms{$typedom} = 1; $newnum ++; } } + for (my $j=0; $j<$env{'form.selfenroll_types_total'}; $j++) { if ((!grep(/^$j$/,@deletedoms)) && (!grep(/^$j$/,@activations))) { + my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_'.$j); + if (@types > 0) { + @types = sort(@types); + my $typestr = join(',',@types); + my $typedom = $env{'form.selfenroll_dom_'.$j}; + $latesttypes[$newnum] = $typedom.':'.$typestr; + $currdoms{$typedom} = 1; + $newnum ++; + } + } + } + if ($env{'form.selfenroll_newdom'} ne '') { + my $typedom = $env{'form.selfenroll_newdom'}; + if ((!defined($currdoms{$typedom})) && + (&Apache::lonnet::domain($typedom) ne '')) { + my $typestr; + my ($othertitle,$usertypes,$types) = + &Apache::loncommon::sorted_inst_types($typedom); + my $othervalue = 'any'; + if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { + if (@{$types} > 0) { + my @esc_types = map { &escape($_); } @{$types}; + $othervalue = 'other'; + $typestr = join(',',(@esc_types,$othervalue)); + } + $typestr = $othervalue; + } else { + $typestr = $othervalue; + } + $latesttypes[$newnum] = $typedom.':'.$typestr; + $newnum ++ ; + } + } my $selfenroll_types = join(';',@latesttypes); if ($selfenroll_types ne $curr_types) { $changes{'internal.selfenroll_types'} = $selfenroll_types; @@ -4429,14 +4866,26 @@ sub update_selfenroll_config { $r->print(&mt('An error occurred when saving changes to self-enrollment settings in this course.').'
'.&mt('The error was: [_1].',$putresult)); } } else { - $r->print(&mt('No changes were needed to the existing self-enrollment settings in this course.')); + $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.')); } } else { - $r->print(&mt('No changes were needed to the existing self-enrollment settings in this course.')); - } - if ($env{'form.selfenroll_newdom'} ne '') { - &print_selfenroll_menu($r,$context,$permission); + $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.')); } + my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum); + if (ref($visactions) eq 'HASH') { + if (!$visible) { + $r->print('
'.$visactions->{'miss'}.'
'.$visactions->{'yous'}. + '
'); + if (ref($vismsgs) eq 'ARRAY') { + $r->print('
'.$visactions->{'take'}.''); + } + $r->print($cansetvis); + } + } return; } @@ -4446,8 +4895,8 @@ sub get_selfenroll_titles { types => 'Users allowed to self-enroll in this course', registered => 'Restrict self-enrollment to students officially registered for the course', enroll_dates => 'Dates self-enrollment available', - access_dates => 'Course access dates for self-enrolled users', - section => 'Section assigned to self-enrolled users', + access_dates => 'Course access dates assigned to self-enrolling users', + section => 'Section assigned to self-enrolling users', ); return (\@row,\%lt); }