--- loncom/interface/lonmodifycourse.pm 2016/04/04 01:09:48 1.81 +++ loncom/interface/lonmodifycourse.pm 2016/08/15 18:01:08 1.85 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # handler for DC-only modifiable course settings # -# $Id: lonmodifycourse.pm,v 1.81 2016/04/04 01:09:48 raeburn Exp $ +# $Id: lonmodifycourse.pm,v 1.85 2016/08/15 18:01:08 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,10 +41,11 @@ use LONCAPA qw(:DEFAULT :match); sub get_dc_settable { my ($type,$cdom) = @_; - if (($type eq 'Community') || ($type eq 'Placement')) { + if ($type eq 'Community') { return ('courseowner','selfenrollmgrdc','selfenrollmgrcc'); } else { - my @items = ('courseowner','coursecode','authtype','autharg','selfenrollmgrdc','selfenrollmgrcc'); + my @items = ('courseowner','coursecode','authtype','autharg','selfenrollmgrdc', + 'selfenrollmgrcc','mysqltables'); if (&showcredits($cdom)) { push(@items,'defaultcredits'); } @@ -55,7 +56,7 @@ sub get_dc_settable { sub autoenroll_keys { my $internals = ['coursecode','courseowner','authtype','autharg','defaultcredits', 'autoadds','autodrops','autostart','autoend','sectionnums', - 'crosslistings','co-owners']; + 'crosslistings','co-owners','autodropfailsafe']; my $accessdates = ['default_enrollment_start_date','default_enrollment_end_date']; return ($internals,$accessdates); } @@ -124,14 +125,13 @@ sub get_enrollment_settings { $enrollvar{$type} =~ s/,/, /g; } elsif ($type eq "authtype" || $type eq "autharg" || $type eq "coursecode" - || $type eq "crosslistings") { + || $type eq "crosslistings" || $type eq "selfenrollmgr" + || $type eq "autodropfailsafe") { $enrollvar{$type} = $settings{$item}; } elsif ($type eq 'defaultcredits') { 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}; @@ -268,17 +268,16 @@ sub print_modification_menu { $categorytitle = 'View/Modify Course Settings'; $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 ($type eq 'Placement') { - $setparams_text = 'View/Modify course owner and self-enrollment'; - } elsif (&showcredits($dom)) { - $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, and self-enrollment'; + if (($type ne 'Placement') && (&showcredits($dom))) { + $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, self-enrollment and table lifetime'; } else { - $setparams_text = 'View/Modify course owner, institutional code, default authentication, and self-enrollment'; + $setparams_text = 'View/Modify course owner, institutional code, default authentication, self-enrollment and table lifetime'; } $cat_text = 'View/Modify catalog settings for course'; } my $anon_text = &mt('Responder threshold required to display anonymous survey submissions.'); my $postsubmit_text = &mt('Override defaults for submit button behavior post-submission for this specific course.'); + my $mysqltables_text = &mt('Override default for lifetime of "temporary" MySQL tables containing student performance data.'); my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); my @additional_params = &catalog_settable($domconf{'coursecategories'},$type); @@ -375,10 +374,6 @@ sub print_modification_menu { if ($type eq 'Community') { $menu_html .= '
  • '.&mt('Community owner (permitted to assign Coordinator roles in the community).').'
  • '."\n". '
  • '.&mt('Override defaults for who configures self-enrollment for this specific community').'
  • '."\n"; - } elsif ($type eq 'Placement') { - $menu_html .= '
  • '.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'
  • '."\n". - '
  • '.&mt('Override defaults for who configures self-enrollment for this specific course.').'
  • '."\n"; - } 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"; @@ -387,7 +382,8 @@ sub print_modification_menu { } $menu_html .= '
  • '.&mt('Override defaults for who configures self-enrollment for this specific course.').'
  • '."\n"; } - $menu_html .= '
  • '.$setquota_text.'
  • '."\n". + $menu_html .= '
  • '.$mysqltables_text.'
  • '."\n". + '
  • '.$setquota_text.'
  • '."\n". '
  • '.$setuploadquota_text.'
  • '."\n". '
  • '.$anon_text.'
  • '."\n". '
  • '.$postsubmit_text.'
  • '."\n"; @@ -775,7 +771,8 @@ sub print_course_modification_page { my ($ownertable,$ccrole,$javascript_validations,$authenitems,$ccname); my %enrollvar = &get_enrollment_settings($cdom,$cnum); my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.textbook', - 'internal.selfenrollmgrdc','internal.selfenrollmgrcc'], + 'internal.selfenrollmgrdc','internal.selfenrollmgrcc', + 'internal.mysqltables'], $cdom,$cnum); my $type = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$crstype,\%settings); my @specific_managebydc = split(/,/,$settings{'internal.selfenrollmgrdc'}); @@ -853,31 +850,27 @@ sub print_course_modification_page { $r->print(&Apache::lonhtmlcommon::row_title( &Apache::loncommon::help_open_topic('Modify_Community_Owner'). ' '.&mt('Community Owner'))."\n"); - } elsif ($crstype eq 'Placement') { - $r->print(&Apache::lonhtmlcommon::row_title( - &Apache::loncommon::help_open_topic('Modify_Course_Owner'). - ' '.&mt('Course Owner'))."\n"); } else { $r->print(&Apache::lonhtmlcommon::row_title( &Apache::loncommon::help_open_topic('Modify_Course_Instcode'). ' '.&mt('Course Code'))."\n". ''. &Apache::lonhtmlcommon::row_closure()); - if (&showcredits($cdom)) { + if (($crstype eq 'Course') && (&showcredits($cdom))) { $r->print(&Apache::lonhtmlcommon::row_title( &Apache::loncommon::help_open_topic('Modify_Course_Credithours'). ' '.&mt('Credits (students)'))."\n". ''. &Apache::lonhtmlcommon::row_closure()); - } - $r->print(&Apache::lonhtmlcommon::row_title( - &Apache::loncommon::help_open_topic('Modify_Course_Defaultauth'). - ' '.&mt('Default Authentication method'))."\n". - $authenitems."\n". - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title( - &Apache::loncommon::help_open_topic('Modify_Course_Owner'). - ' '.&mt('Course Owner'))."\n"); + } + $r->print(&Apache::lonhtmlcommon::row_title( + &Apache::loncommon::help_open_topic('Modify_Course_Defaultauth'). + ' '.&mt('Default Authentication method'))."\n". + $authenitems."\n". + &Apache::lonhtmlcommon::row_closure(). + &Apache::lonhtmlcommon::row_title( + &Apache::loncommon::help_open_topic('Modify_Course_Owner'). + ' '.&mt('Course Owner'))."\n"); } my ($cctitle,$rolename,$currmanages,$ccchecked,$dcchecked,$defaultchecked); my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles(); @@ -928,10 +921,15 @@ sub print_course_modification_page { &Apache::loncommon::end_data_table_row()."\n"); } $r->print(&Apache::loncommon::end_data_table()."\n". - '
    '.&Apache::lonhtmlcommon::row_closure(1). + '
    '.&Apache::lonhtmlcommon::row_closure(). + &Apache::lonhtmlcommon::row_title( + &Apache::loncommon::help_open_topic('Modify_Course_Table_Lifetime'). + ' '.&mt('"Temporary" Tables Lifetime (s)'))."\n". + ''. + &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::end_pick_box().'

    '.$hidden_elements. 'print('this.form.submit();"'); } else { $r->print('javascript:verify_message(this.form);"'); @@ -1050,7 +1048,7 @@ sub modify_course { my %longtype = &course_settings_descrip($type); my @items = ('internal.courseowner','description','internal.co-owners', 'internal.pendingco-owners','internal.selfenrollmgrdc', - 'internal.selfenrollmgrcc'); + 'internal.selfenrollmgrcc','internal.mysqltables'); my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles(); unless (($type eq 'Community') || ($type eq 'Placement')) { push(@items,('internal.coursecode','internal.authtype','internal.autharg', @@ -1070,9 +1068,6 @@ sub modify_course { if ($type eq 'Community') { %changed = ( owner => 0 ); $ccrole = 'co'; - } elsif ($type eq 'Placement') { - %changed = ( owner => 0 ); - $ccrole = 'cc'; } else { %changed = ( code => 0, owner => 0, @@ -1124,10 +1119,13 @@ sub modify_course { $changed{'code'} = 1; } } - - if (&showcredits($cdom) && exists($env{'form.defaultcredits'})) { - $newattr{'defaultcredits'} =~ s/[^\d\.]//g; + if ( exists($env{'form.mysqltables'}) ) { + $newattr{'mysqltables'} = $env{'form.mysqltables'}; + $newattr{'mysqltables'} =~ s/\D+//g; + } + if (($type ne 'Placement') && (&showcredits($cdom) && exists($env{'form.defaultcredits'}))) { $newattr{'defaultcredits'}=$env{'form.defaultcredits'}; + $newattr{'defaultcredits'} =~ s/[^\d\.]//g; } } @@ -1219,6 +1217,8 @@ sub modify_course { $shown = &selfenroll_config_status(\@newmgrcc,$selfenrolltitles); } elsif (($attr eq 'defaultcredits') && ($shown eq '')) { $shown = &mt('None'); + } elsif (($attr eq 'mysqltables') && ($shown eq '')) { + $shown = &mt('domain default'); } $chgresponse .= '

  • '.&mt('[_1] now set to: [_2]',$longtype{$attr},$shown).'
  • '; } else { @@ -1229,6 +1229,8 @@ sub modify_course { $shown = &selfenroll_config_status(\@currmgrcc,$selfenrolltitles); } elsif (($attr eq 'defaultcredits') && ($shown eq '')) { $shown = &mt('None'); + } elsif (($attr eq 'mysqltables') && ($shown eq '')) { + $shown = &mt('domain default'); } $nochgresponse .= '
  • '.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'
  • '; } @@ -1300,6 +1302,8 @@ sub modify_course { $shown = &selfenroll_config_status(\@currmgrcc,$selfenrolltitles); } elsif (($attr eq 'defaultcredits') && ($shown eq '')) { $shown = &mt('None'); + } elsif (($attr eq 'mysqltables') && ($shown eq '')) { + $shown = &mt('domain default'); } $nochgresponse .= '
  • '.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'
  • '; } @@ -2126,6 +2130,7 @@ sub course_settings_descrip { 'co-owners' => "Username:domain of each co-owner", 'selfenrollmgrdc' => "Community-specific self-enrollment configuration by Domain Coordinator", 'selfenrollmgrcc' => "Community-specific self-enrollment configuration by Community personnel", + 'mysqltables' => '"Temporary" student performance tables lifetime (seconds)', ); } else { %longtype = &Apache::lonlocal::texthash( @@ -2144,9 +2149,10 @@ sub course_settings_descrip { 'sectionnums' => 'Course section number:LON-CAPA section', 'crosslistings' => 'Crosslisted class:LON-CAPA section', 'defaultcredits' => 'Credits', + 'autodropfailsafe' => "Failsafe section enrollment count", 'selfenrollmgrdc' => "Course-specific self-enrollment configuration by Domain Coordinator", 'selfenrollmgrcc' => "Course-specific self-enrollment configuration by Course personnel", - + 'mysqltables' => '"Temporary" student performance tables lifetime (seconds)', ); } return %longtype; @@ -2159,7 +2165,7 @@ sub hidden_form_elements { 'locarg','krbarg','krbver','counter','hidefromcat','usecategory', 'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota', 'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st', - 'sections','newsec'],['^selfenrollmgr_'])."\n". + 'sections','newsec','mysqltables'],['^selfenrollmgr_','^selfenroll_'])."\n". ''; return $hidden_elements; } @@ -2205,7 +2211,6 @@ sub handler { } my $choose_text; my $type = $env{'form.type'}; -print STDERR "type is ||$type||\n"; if ($type eq '') { $type = 'Course'; }