--- loncom/interface/lonmodifycourse.pm 2021/06/20 17:27:03 1.79.2.9 +++ loncom/interface/lonmodifycourse.pm 2018/03/23 01:01:21 1.93 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # handler for DC-only modifiable course settings # -# $Id: lonmodifycourse.pm,v 1.79.2.9 2021/06/20 17:27:03 raeburn Exp $ +# $Id: lonmodifycourse.pm,v 1.93 2018/03/23 01:01:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,9 +39,6 @@ use Apache::lonpickcourse; use lib '/home/httpd/lib/perl'; use LONCAPA qw(:DEFAULT :match); -my $registered_cleanup; -my $modified_dom; - sub get_dc_settable { my ($type,$cdom) = @_; if ($type eq 'Community') { @@ -52,10 +49,6 @@ sub get_dc_settable { if (&showcredits($cdom)) { push(@items,'defaultcredits'); } - my %passwdconf = &Apache::lonnet::get_passwdconf($cdom); - if (($passwdconf{'crsownerchg'}) && ($type ne 'Placement')) { - push(@items,'nopasswdchg'); - } return @items; } } @@ -79,6 +72,13 @@ sub catalog_settable { if ($confhash->{'categorizecomm'} ne 'comm') { push(@settable,'categorize'); } + } elsif ($type eq 'Placement') { + if ($confhash->{'togglecatsplace'} ne 'place') { + push(@settable,'togglecats'); + } + if ($confhash->{'categorizeplace'} ne 'place') { + push(@settable,'categorize'); + } } else { if ($confhash->{'togglecats'} ne 'crs') { push(@settable,'togglecats'); @@ -101,7 +101,6 @@ sub get_enrollment_settings { @items = map { 'internal.'.$_; } (@{$internals}); push(@items,@{$accessdates}); } - push(@items,'internal.nopasswdchg'); my %settings = &Apache::lonnet::get('environment',\@items,$cdom,$cnum); my %enrollvar; $enrollvar{'autharg'} = ''; @@ -127,7 +126,7 @@ sub get_enrollment_settings { } elsif ($type eq "authtype" || $type eq "autharg" || $type eq "coursecode" || $type eq "crosslistings" || $type eq "selfenrollmgr" - || $type eq "autodropfailsafe" || $type eq 'nopasswdchg') { + || $type eq "autodropfailsafe") { $enrollvar{$type} = $settings{$item}; } elsif ($type eq 'defaultcredits') { if (&showcredits($cdom)) { @@ -175,6 +174,8 @@ sub print_course_search_page { $r->print(&Apache::loncommon::js_changer()); if ($type eq 'Community') { $r->print('

'.&mt('Search for a community in the [_1] domain',$domdesc).'

'); + } elsif ($type eq 'Placement') { + $r->print('

'.&mt('Search for a placement test in the [_1] domain',$domdesc).'

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

'.&mt('Search for a course in the [_1] domain',$domdesc).'

'); } @@ -185,6 +186,8 @@ sub print_course_search_page { my ($actiontext,$roleoption,$settingsoption); if ($type eq 'Community') { $actiontext = &mt('Actions available after searching for a community:'); + } elsif ($type eq 'Placement') { + $actiontext = &mt('Actions available after searching for a placement test:') } else { $actiontext = &mt('Actions available after searching for a course:'); } @@ -192,6 +195,9 @@ sub print_course_search_page { if ($type eq 'Community') { $roleoption = &mt('Enter the community with the role of [_1]',$cctitle); $settingsoption = &mt('View or modify community settings which only a [_1] may modify.',$dctitle); + } elsif ($type eq 'Placement') { + $roleoption = &mt('Enter the placement test with the role of [_1]',$cctitle); + $settingsoption = &mt('View or modify placement test settings which only a [_1] may modify.',$dctitle); } else { $roleoption = &mt('Enter the course with the role of [_1]',$cctitle); $settingsoption = &mt('View or modify course settings which only a [_1] may modify.',$dctitle); @@ -202,6 +208,8 @@ sub print_course_search_page { if (@{$roles_by_num} > 1) { if ($type eq 'Community') { $roleoption = &mt('Enter the community with one of the available ad hoc roles'); + } elsif ($type eq 'Placement') { + $roleoption = &mt('Enter the placement test with one of the available ad hoc roles.'); } else { $roleoption = &mt('Enter the course with one of the available ad hoc roles.'); } @@ -209,6 +217,8 @@ sub print_course_search_page { my $rolename = $description->{$roles_by_num->[0]}; if ($type eq 'Community') { $roleoption = &mt('Enter the community with the ad hoc role of: [_1]',$rolename); + } elsif ($type eq 'Placement') { + $roleoption = &mt('Enter the placement test with the ad hoc role of: [_1]',$rolename); } else { $roleoption = &mt('Enter the course with the ad hoc role of: [_1]',$rolename); } @@ -216,6 +226,8 @@ sub print_course_search_page { } if ($type eq 'Community') { $settingsoption = &mt('View community settings which only a [_1] may modify.',$dctitle); + } elsif ($type eq 'Placement') { + $settingsoption = &mt('View placement test settings which only a [_1] may modify.',$dctitle); } else { $settingsoption = &mt('View course settings which only a [_1] may modify.',$dctitle); } @@ -420,7 +432,7 @@ sub print_modification_menu { ); } if ($type eq 'Community') { - if ($permission->{'setparms'} eq 'edit') { + if ($permission->{'setparms'} eq 'edit') { $categorytitle = 'View/Modify Community Settings'; $linktext{'setparms'} = 'View/Modify community owner'; $linktext{'catsettings'} = 'View/Modify catalog settings for community'; @@ -430,7 +442,7 @@ sub print_modification_menu { $linktext{'catsettings'} = 'View catalog settings for community'; } $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a community.'); - $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a community via Content Editor.'); + $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a community via Content Editor.'); } else { if ($permission->{'setparms'} eq 'edit') { $categorytitle = 'View/Modify Course Settings'; @@ -515,7 +527,7 @@ sub print_modification_menu { { linktext => $linktext{'viewparms'}, url => &phaseurl('viewparms'), - permission => ($permission->{'viewparms'} && ($type ne 'Community')), + permission => ($permission->{'viewparms'} && ($type ne 'Community') && ($type ne 'Placement')), #help => '', icon => 'roles.png', linktitle => '' @@ -557,7 +569,7 @@ sub print_modification_menu { } else { $menu_html .= '
  • '.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'
  • '."\n". '
  • '.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").'
  • '."\n"; - if (&showcredits($dom)) { + if (($type ne 'Placement') && &showcredits($dom)) { $menu_html .= '
  • '.&mt('Default credits earned by student on course completion.').'
  • '."\n"; } $menu_html .= '
  • '.&mt('Override defaults for who configures self-enrollment for this specific course.').'
  • '."\n"; @@ -612,9 +624,9 @@ sub print_adhocrole_selected { } $selectrole = 1; } elsif ($permission->{'adhocrole'} eq 'custom') { - my ($okroles,$description) = &Apache::lonnet::get_my_adhocroles($env{'form.pickedcourse'},1); + my ($okroles,$description) = &Apache::lonnet::get_my_adhocroles($env{'form.pickedcourse'},1); if (ref($okroles) eq 'ARRAY') { - my $possrole = $env{'form.adhocrole'}; + my $possrole = $env{'form.adhocrole'}; if (($possrole ne '') && (grep(/^\Q$possrole\E$/,@{$okroles}))) { my $confname = &Apache::lonnet::get_domainconfiguser($cdom); $newrole = "cr/$cdom/$confname/$possrole./$cdom/$cnum"; @@ -664,34 +676,9 @@ sub print_settings_display { "$lt{'dcon'}\n". &Apache::loncommon::end_data_table_header_row()."\n"; foreach my $item (@items) { - my $shown = $enrollvar{$item}; - if ($item eq 'crosslistings') { - my (@xlists,@lcsecs); - foreach my $entry (split(/,/,$enrollvar{$item})) { - my ($xlist,$lc_sec) = split(/:/,$entry); - push(@xlists,$xlist); - push(@lcsecs,$lc_sec); - } - if (@xlists) { - my $crskey = $cnum.':'.$enrollvar{'coursecode'}; - my %reformatted = - &Apache::lonnet::auto_instsec_reformat($cdom,'declutter', - {$crskey => \@xlists}); - if (ref($reformatted{$crskey}) eq 'ARRAY') { - my @show; - my @xlcodes = @{$reformatted{$crskey}}; - for (my $i=0; $i<@xlcodes; $i++) { - push(@show,$xlcodes[$i].':'.$lcsecs[$i]); - } - if (@show) { - $shown = join(',',@show); - } - } - } - } $disp_table .= &Apache::loncommon::start_data_table_row()."\n". "$longtype{$item}\n". - "$shown\n"; + "$enrollvar{$item}\n"; if (grep(/^\Q$item\E$/,@modifiable_params)) { $disp_table .= ''.&mt('Yes').''."\n"; } else { @@ -819,7 +806,7 @@ sub print_set_anonsurvey_threshold { my $hidden_elements = &hidden_form_elements(); my ($disabled,$submit); if ($readonly) { - $disabled = ' disabled="disabled"'; + $disabled = ' disabled="disabled"'; } else { $submit = ''; } @@ -913,7 +900,7 @@ sub domain_postsubtimeout { my ($cdom,$type,$settings) = @_; return unless (ref($settings) eq 'HASH'); my $lctype = lc($type); - unless ($type eq 'Community') { + unless (($type eq 'Community') || ($type eq 'Placement')) { $lctype = 'unofficial'; if ($settings->{'internal.coursecode'}) { $lctype = 'official'; @@ -976,6 +963,8 @@ sub print_catsettings { '    

    '); if ($type eq 'Community') { $r->print(&mt("If a community has been categorized using at least one of the categories defined for communities in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded.")); + } elsif ($type eq 'Placement') { + $r->print(&mt("If a placement test has been categorized using at least one of the categories defined for placement tests in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded.")); } else { $r->print(&mt("Unless excluded, a course will be listed in the domain's publicly accessible Course/Community Catalog, if at least one of the following applies").':