--- loncom/interface/lonmodifycourse.pm 2014/03/31 01:37:28 1.71 +++ loncom/interface/lonmodifycourse.pm 2014/03/31 02:31:05 1.72 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # handler for DC-only modifiable course settings # -# $Id: lonmodifycourse.pm,v 1.71 2014/03/31 01:37:28 raeburn Exp $ +# $Id: lonmodifycourse.pm,v 1.72 2014/03/31 02:31:05 raeburn 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}; @@ -252,9 +255,9 @@ sub print_modification_menu { $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.'); $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a course via Content Editor.'); if (&showcredits($dom)) { - $setparams_text = 'View/Modify course owner, institutional code, and default authentication and credits'; + $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, and self-enrollment'; } else { - $setparams_text = 'View/Modify course owner, institutional code, and default authentication'; + $setparams_text = 'View/Modify course owner, institutional code, default authentication, and self-enrollment'; } $cat_text = 'View/Modify catalog settings for course'; } @@ -263,6 +266,17 @@ sub print_modification_menu { my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); my @additional_params = &catalog_settable($domconf{'coursecategories'},$type); + sub manage_selfenrollment { + my ($cdom,$cnum,$type,$coursehash) = @_; + my ($managed_by_cc,$managed_by_dc) = &Apache::lonuserutils::selfenrollment_administration($cdom,$cnum,$type,$coursehash); + if (ref($managed_by_dc) eq 'ARRAY') { + if (@{$managed_by_dc}) { + return 1; + } + } + return 0; + } + sub phaseurl { my $phase = shift; return "javascript:changePage(document.menu,'$phase')" @@ -310,6 +324,14 @@ sub print_modification_menu { icon => 'roles.png', linktitle => '' }, + { + linktext => 'View/Modify Self-Enrollment configuration', + icon => 'self_enroll.png', + #help => 'Course_Self_Enrollment', + url => &phaseurl('selfenroll'), + permission => &manage_selfenrollment($cdom,$cnum,$type,$coursehash), + linktitle => 'Configure user self-enrollment.', + }, ] }, ); @@ -326,16 +348,18 @@ sub print_modification_menu { } $menu_html .= '

'."\n".'