--- loncom/interface/lonmodifycourse.pm 2009/11/09 03:50:27 1.48 +++ loncom/interface/lonmodifycourse.pm 2010/05/18 16:13:31 1.54 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # handler for DC-only modifiable course settings # -# $Id: lonmodifycourse.pm,v 1.48 2009/11/09 03:50:27 raeburn Exp $ +# $Id: lonmodifycourse.pm,v 1.54 2010/05/18 16:13:31 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -49,20 +49,30 @@ sub get_dc_settable { sub autoenroll_keys { my $internals = ['coursecode','courseowner','authtype','autharg','autoadds','autodrops', - 'autostart','autoend','sectionnums','crosslistings']; + 'autostart','autoend','sectionnums','crosslistings', + 'co-owners']; my $accessdates = ['default_enrollment_start_date','default_enrollment_end_date']; return ($internals,$accessdates); } sub catalog_settable { - my ($confhash) = @_; + my ($confhash,$type) = @_; my @settable; if (ref($confhash) eq 'HASH') { - if ($confhash->{'togglecats'} ne 'crs') { - push(@settable,'togglecats'); - } - if ($confhash->{'categorize'} ne 'crs') { - push(@settable,'categorize'); + if ($type eq 'Community') { + if ($confhash->{'togglecatscomm'} ne 'comm') { + push(@settable,'togglecats'); + } + if ($confhash->{'categorizecomm'} ne 'comm') { + push(@settable,'categorize'); + } + } else { + if ($confhash->{'togglecats'} ne 'crs') { + push(@settable,'togglecats'); + } + if ($confhash->{'categorize'} ne 'crs') { + push(@settable,'categorize'); + } } } else { push(@settable,('togglecats','categorize')); @@ -97,7 +107,7 @@ sub get_enrollment_settings { } else { $enrollvar{$type} = &Apache::lonlocal::locallocaltime($settings{$item}); } - } elsif ($type eq "sectionnums") { + } elsif (($type eq 'sectionnums') || ($type eq 'co-owners')) { $enrollvar{$type} = $settings{$item}; $enrollvar{$type} =~ s/,/, /g; } elsif ($type eq "authtype" @@ -198,53 +208,81 @@ sub print_course_selection_page { sub print_modification_menu { my ($r,$cdesc,$domdesc,$dom,$type) = @_; &print_header($r,$type); - my ($ccrole,$setquota_text,$setparams_text,$cat_text); + my ($ccrole,$categorytitle,$setquota_text,$setparams_text,$cat_text); if ($type eq 'Community') { $ccrole = 'co'; } else { $ccrole = 'cc'; } - my $action = '/adm/modifycourse'; if ($type eq 'Community') { + $categorytitle = 'View/Modify Community Settings'; $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a community.'); $setparams_text = 'View/Modify community owner'; $cat_text = 'View/Modify catalog settings for community'; } else { + $categorytitle = 'View/Modify Course Settings'; $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.'); $setparams_text = 'View/Modify course owner, institutional code, and default authentication'; $cat_text = 'View/Modify catalog settings for course'; } - my @menu = - ( - { text => $setparams_text, - phase => 'setparms', - }, - { text => 'View/Modify quota for group portfolio files', - phase => 'setquota', - } - ); + my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); - my @additional_params = &catalog_settable($domconf{'coursecategories'}); - if (@additional_params > 0) { - push (@menu, { text => $cat_text, - phase => 'catsettings', - }); + my @additional_params = &catalog_settable($domconf{'coursecategories'},$type); + + sub phaseurl { + my $phase = shift; + return "javascript:changePage(document.menu,'$phase')" } - unless ($type eq 'Community') { - push(@menu, - { text => 'Display current settings for automated enrollment', - phase => 'viewparms', - } + my @menu = + ({ categorytitle => $categorytitle, + items => [ + { + linktext => $setparams_text, + url => &phaseurl('setparms'), + permission => 1, + #help => '', + icon => 'mcrs.png', + linktitle => '' + }, + { + linktext => 'View/Modify quota for group portfolio files', + url => &phaseurl('setquota'), + permission => 1, + #help => '', + icon => 'mcrs.png', + linktitle => '' + }, + { + linktext => $cat_text, + url => &phaseurl('catsettings'), + permission => (@additional_params > 0), + #help => '', + icon => 'mcrs.png', + linktitle => '' + }, + { + linktext => 'Display current settings for automated enrollment', + url => &phaseurl('viewparms'), + permission => ($type ne 'Community'), + #help => '', + icon => 'mcrs.png', + linktitle => '' + }, + ] + }, ); - } - my $menu_html = '
'; if ($type eq 'Community') { $menu_html .= &mt('Although almost all community settings can be modified by a Coordinator, the following may only be set or modified by a Domain Coordinator:'); } else { $menu_html .= &mt('Although almost all course settings can be modified by a Course Coordinator, the following may only be set or modified by a Domain Coordinator:'); } - $menu_html .= '