--- loncom/interface/loncreateuser.pm 2008/06/03 01:13:27 1.241 +++ loncom/interface/loncreateuser.pm 2008/07/18 02:15:32 1.249.2.5 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.241 2008/06/03 01:13:27 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.249.2.5 2008/07/18 02:15:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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", @@ -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) = @_; @@ -2069,7 +2127,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()); @@ -3105,7 +3166,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'}), @@ -3127,12 +3188,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 +3236,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 +3455,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 +3477,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.'
' @@ -3266,10 +3516,10 @@ sub print_selfenroll_menu { $regoff = ' checked="checked" '; } $output .= '  '; + ''. + &mt('Yes').'  '; } elsif ($item eq 'enroll_dates') { my $starttime = $env{'course.'.$env{'request.course.id'}.'.internal.selfenroll_start_date'}; my $endtime = $env{'course.'.$env{'request.course.id'}.'.internal.selfenroll_end_date'}; @@ -3328,12 +3578,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{'categories'}) { + $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{'categories'}) { + $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{'categories'}) { + 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{'categories'}) { + 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 +3714,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 +3734,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 +3766,21 @@ sub selfenroll_inst_types { if (($count > 0) && ($count%$numinrow == 0)) { $output .= ''; } - $output .= '
'; } @@ -3396,11 +3790,11 @@ sub selfenroll_inst_types { sub selfenroll_date_forms { my ($startform,$endform) = @_; my $output .= &Apache::lonhtmlcommon::start_pick_box()."\n". - &Apache::lonhtmlcommon::row_title(&mt('Starts'), + &Apache::lonhtmlcommon::row_title(&mt('Start date'), 'LC_oddrow_value')."\n". $startform."\n". &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::row_title(&mt('Ends'), + &Apache::lonhtmlcommon::row_title(&mt('End date'), 'LC_oddrow_value')."\n". $endform."\n". &Apache::lonhtmlcommon::row_closure(1). @@ -3449,8 +3843,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 +3854,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 +3962,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 +4013,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; } @@ -3669,7 +4069,13 @@ sub user_search_result { if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || ($srch->{'srchin'} eq 'alc')) { if ($srch->{'srchby'} eq 'uname') { - if ($srch->{'srchterm'} !~ /^$match_username$/) { + my $unamecheck = $srch->{'srchterm'}; + if ($srch->{'srchtype'} eq 'contains') { + if ($unamecheck !~ /^\w/) { + $unamecheck = 'a'.$unamecheck; + } + } + if ($unamecheck !~ /^$match_username$/) { $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); } } @@ -4296,26 +4702,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; @@ -4381,7 +4819,7 @@ sub update_selfenroll_config { foreach my $type ('start','end') { if (exists($changes{'internal.selfenroll_'.$type.'_date'})) { my $newdate = &Apache::lonlocal::locallocaltime($changes{'internal.selfenroll_'.$type.'_date'}); - $r->print('
  • '.&mt('[_1]: [_2] set to "[_3]".', + $r->print('
  • '.&mt('[_1]: "[_2]" set to "[_3]".', $title,$type,$newdate).'
  • '); } } @@ -4389,7 +4827,7 @@ sub update_selfenroll_config { foreach my $type ('start','end') { if (exists($changes{'internal.selfenroll_'.$type.'_access'})) { my $newdate = &Apache::lonlocal::locallocaltime($changes{'internal.selfenroll_'.$type.'_access'}); - $r->print('
  • '.&mt('[_1]: [_2] set to "[_3]".', + $r->print('
  • '.&mt('[_1]: "[_2]" set to "[_3]".', $title,$type,$newdate).'
  • '); } } @@ -4402,8 +4840,14 @@ sub update_selfenroll_config { } elsif ($newval eq '*') { $newval = &mt('Any user in any domain'); } + } elsif ($item eq 'registered') { + if ($newval eq '1') { + $newval = &mt('Yes'); + } elsif ($newval eq '0') { + $newval = &mt('No'); + } } - $r->print('
  • '.&mt('[_1] set to "[_2]".',$title,$newval).'
  • '."\n"); + $r->print('
  • '.&mt('"[_1]" set to "[_2]".',$title,$newval).'
  • '."\n"); } } } @@ -4417,13 +4861,25 @@ 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.')); + $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.')); } - if ($env{'form.selfenroll_newdom'} ne '') { - &print_selfenroll_menu($r,$context,$permission); + 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; } @@ -4432,10 +4888,10 @@ sub get_selfenroll_titles { my @row = ('types','registered','enroll_dates','access_dates','section'); my %lt = &Apache::lonlocal::texthash ( types => 'Users allowed to self-enroll in this course', - registered => 'Restrict self-enrollment to registered students?', + registered => 'Restrict self-enrollment to students officially registered for the course', enroll_dates => 'Dates self-enrollment available', - access_dates => '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); }