--- loncom/interface/lonmodifycourse.pm 2014/03/13 14:46:46 1.69 +++ loncom/interface/lonmodifycourse.pm 2014/07/31 15:45:27 1.74 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # handler for DC-only modifiable course settings # -# $Id: lonmodifycourse.pm,v 1.69 2014/03/13 14:46:46 raeburn Exp $ +# $Id: lonmodifycourse.pm,v 1.74 2014/07/31 15:45:27 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -34,16 +34,17 @@ use Apache::loncommon; use Apache::lonhtmlcommon; use Apache::lonlocal; use Apache::lonuserutils; +use Apache::loncreateuser; use Apache::lonpickcourse; use lib '/home/httpd/lib/perl'; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); sub get_dc_settable { my ($type,$cdom) = @_; if ($type eq 'Community') { - return ('courseowner'); + return ('courseowner','selfenrollmgrdc','selfenrollmgrcc'); } else { - my @items = ('courseowner','coursecode','authtype','autharg'); + my @items = ('courseowner','coursecode','authtype','autharg','selfenrollmgrdc','selfenrollmgrcc'); if (&showcredits($cdom)) { push(@items,'defaultcredits'); } @@ -122,6 +123,8 @@ sub get_enrollment_settings { if (&showcredits($cdom)) { $enrollvar{$type} = $settings{$item}; } + } elsif ($type eq 'selfenrollmgr') { + $enrollvar{$type} = $settings{$item}; } elsif ($type eq 'courseowner') { if ($settings{$item} =~ /^[^:]+:[^:]+$/) { $enrollvar{$type} = $settings{$item}; @@ -153,7 +156,7 @@ sub print_course_search_page { $type = 'Course'; } &print_header($r,$type); - my ($filterlist,$filter) = &get_filters(); + my ($filterlist,$filter) = &get_filters($dom); my ($numtitles,$cctitle,$dctitle,@codetitles); my $ccrole = 'cc'; if ($type eq 'Community') { @@ -161,7 +164,7 @@ sub print_course_search_page { } $cctitle = &Apache::lonnet::plaintext($ccrole,$type); $dctitle = &Apache::lonnet::plaintext('dc'); - $r->print(&Apache::lonpickcourse::js_changer()); + $r->print(&Apache::loncommon::js_changer()); if ($type eq 'Community') { $r->print('
'.$lt{'cose'}.'
'.$lt{'cour'}.'
'.$disp_table.'
'. @@ -457,15 +485,8 @@ sub print_setquota { } if ($uploadquota eq '') { my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); - if ($type eq 'Community') { - $uploadquota = $domdefs{$lctype.'quota'}; - } elsif ($settings{'internal.coursecode'}) { - $uploadquota = $domdefs{'officialquota'}; - } elsif ($settings{'internal.textbook'}) { - $uploadquota = $domdefs{'textbookquota'}; - } else { - $uploadquota = $domdefs{'unofficialquota'}; - } + my $quotatype = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$type,\%settings); + $uploadquota = $domdefs{$quotatype.'quota'}; if ($uploadquota eq '') { $uploadquota = $staticdefaults{'uploadquota'}; } @@ -613,7 +634,7 @@ sub print_catsettings { } sub print_course_modification_page { - my ($r,$cdom,$cnum,$cdesc,$type) = @_; + my ($r,$cdom,$cnum,$cdesc,$crstype) = @_; my %lt=&Apache::lonlocal::texthash( 'actv' => "Active", 'inac' => "Inactive", @@ -623,17 +644,28 @@ sub print_course_modification_page { 'stus' => "Status", 'nocc' => 'There is currently no owner set for this course.', 'gobt' => "Save", + 'sett' => 'Setting', + 'domd' => 'Domain default', + 'whom' => 'Who configures', ); my ($ownertable,$ccrole,$javascript_validations,$authenitems,$ccname); my %enrollvar = &get_enrollment_settings($cdom,$cnum); - if ($type eq 'Community') { + my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.textbook', + 'internal.selfenrollmgrdc','internal.selfenrollmgrcc'], + $cdom,$cnum); + my $type = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$crstype,\%settings); + my @specific_managebydc = split(/,/,$settings{'internal.selfenrollmgrdc'}); + my @specific_managebycc = split(/,/,$settings{'internal.selfenrollmgrcc'}); + my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); + my @default_managebydc = split(/,/,$domdefaults{$type.'selfenrolladmdc'}); + if ($crstype eq 'Community') { $ccrole = 'co'; $lt{'nocc'} = &mt('There is currently no owner set for this community.'); } else { $ccrole ='cc'; ($javascript_validations,$authenitems) = &gather_authenitems($cdom,\%enrollvar); } - $ccname = &Apache::lonnet::plaintext($ccrole,$type); + $ccname = &Apache::lonnet::plaintext($ccrole,$crstype); my %roleshash = &Apache::lonnet::get_my_roles($cnum,$cdom,'','',[$ccrole]); my (@local_ccs,%cc_status,%pname); foreach my $item (keys(%roleshash)) { @@ -686,14 +718,14 @@ sub print_course_modification_page { } $ownertable .= &Apache::loncommon::end_data_table(); } - &print_header($r,$type,$javascript_validations); + &print_header($r,$crstype,$javascript_validations); my $dctitle = &Apache::lonnet::plaintext('dc'); - my $mainheader = &modifiable_only_title($type); + my $mainheader = &modifiable_only_title($crstype); my $hidden_elements = &hidden_form_elements(); $r->print('