Diff for /loncom/interface/lonmodifycourse.pm between versions 1.82 and 1.85

version 1.82, 2016/04/04 01:12:11 version 1.85, 2016/08/15 18:01:08
Line 41  use LONCAPA qw(:DEFAULT :match); Line 41  use LONCAPA qw(:DEFAULT :match);
   
 sub get_dc_settable {  sub get_dc_settable {
     my ($type,$cdom) = @_;      my ($type,$cdom) = @_;
     if (($type eq 'Community') || ($type eq 'Placement')) {      if ($type eq 'Community') {
         return ('courseowner','selfenrollmgrdc','selfenrollmgrcc');          return ('courseowner','selfenrollmgrdc','selfenrollmgrcc');
     } else {      } else {
         my @items = ('courseowner','coursecode','authtype','autharg','selfenrollmgrdc','selfenrollmgrcc');          my @items = ('courseowner','coursecode','authtype','autharg','selfenrollmgrdc',
                        'selfenrollmgrcc','mysqltables');
         if (&showcredits($cdom)) {          if (&showcredits($cdom)) {
             push(@items,'defaultcredits');              push(@items,'defaultcredits');
         }          }
Line 55  sub get_dc_settable { Line 56  sub get_dc_settable {
 sub autoenroll_keys {  sub autoenroll_keys {
     my $internals = ['coursecode','courseowner','authtype','autharg','defaultcredits',      my $internals = ['coursecode','courseowner','authtype','autharg','defaultcredits',
                      'autoadds','autodrops','autostart','autoend','sectionnums',                       'autoadds','autodrops','autostart','autoend','sectionnums',
                      'crosslistings','co-owners'];                       'crosslistings','co-owners','autodropfailsafe'];
     my $accessdates = ['default_enrollment_start_date','default_enrollment_end_date'];      my $accessdates = ['default_enrollment_start_date','default_enrollment_end_date'];
     return ($internals,$accessdates);      return ($internals,$accessdates);
 }  }
Line 124  sub get_enrollment_settings { Line 125  sub get_enrollment_settings {
                 $enrollvar{$type} =~ s/,/, /g;                  $enrollvar{$type} =~ s/,/, /g;
             } elsif ($type eq "authtype"              } elsif ($type eq "authtype"
                      || $type eq "autharg"    || $type eq "coursecode"                       || $type eq "autharg"    || $type eq "coursecode"
                      || $type eq "crosslistings") {                       || $type eq "crosslistings" || $type eq "selfenrollmgr"
                        || $type eq "autodropfailsafe") {
                 $enrollvar{$type} = $settings{$item};                  $enrollvar{$type} = $settings{$item};
             } elsif ($type eq 'defaultcredits') {              } elsif ($type eq 'defaultcredits') {
                 if (&showcredits($cdom)) {                  if (&showcredits($cdom)) {
                     $enrollvar{$type} = $settings{$item};                      $enrollvar{$type} = $settings{$item};
                 }                  }
             } elsif ($type eq 'selfenrollmgr') {  
                 $enrollvar{$type} = $settings{$item};      
             } elsif ($type eq 'courseowner') {              } elsif ($type eq 'courseowner') {
                 if ($settings{$item} =~ /^[^:]+:[^:]+$/) {                  if ($settings{$item} =~ /^[^:]+:[^:]+$/) {
                     $enrollvar{$type} = $settings{$item};                      $enrollvar{$type} = $settings{$item};
Line 268  sub print_modification_menu { Line 268  sub print_modification_menu {
         $categorytitle = 'View/Modify Course Settings';          $categorytitle = 'View/Modify Course Settings';
         $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.');          $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.');          $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a course via Content Editor.');
         if ($type eq 'Placement') {          if (($type ne 'Placement') && (&showcredits($dom))) {
             $setparams_text = 'View/Modify course owner and self-enrollment';              $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, self-enrollment and table lifetime';
         } elsif (&showcredits($dom)) {  
             $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, and self-enrollment';  
         } else {          } 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';          $cat_text = 'View/Modify catalog settings for course';
     }      }
     my $anon_text = &mt('Responder threshold required to display anonymous survey submissions.');      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 $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 %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
     my @additional_params = &catalog_settable($domconf{'coursecategories'},$type);      my @additional_params = &catalog_settable($domconf{'coursecategories'},$type);
Line 375  sub print_modification_menu { Line 374  sub print_modification_menu {
     if ($type eq 'Community') {      if ($type eq 'Community') {
         $menu_html .= '<li>'.&mt('Community owner (permitted to assign Coordinator roles in the community).').'</li>'."\n".          $menu_html .= '<li>'.&mt('Community owner (permitted to assign Coordinator roles in the community).').'</li>'."\n".
                       '<li>'.&mt('Override defaults for who configures self-enrollment for this specific community').'</li>'."\n";                        '<li>'.&mt('Override defaults for who configures self-enrollment for this specific community').'</li>'."\n";
     } elsif ($type eq 'Placement') {  
         $menu_html .= '<li>'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'</li>'."\n".  
                       '<li>'.&mt('Override defaults for who configures self-enrollment for this specific course.').'</li>'."\n";  
   
     } else {      } else {
         $menu_html .=  '<li>'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'</li>'."\n".          $menu_html .=  '<li>'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'</li>'."\n".
                        '<li>'.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").'</li>'."\n";                         '<li>'.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").'</li>'."\n";
Line 387  sub print_modification_menu { Line 382  sub print_modification_menu {
         }          }
         $menu_html .= ' <li>'.&mt('Override defaults for who configures self-enrollment for this specific course.').'</li>'."\n";          $menu_html .= ' <li>'.&mt('Override defaults for who configures self-enrollment for this specific course.').'</li>'."\n";
     }      }
     $menu_html .= '<li>'.$setquota_text.'</li>'."\n".      $menu_html .= '<li>'.$mysqltables_text.'</li>'."\n".
                     '<li>'.$setquota_text.'</li>'."\n".
                   '<li>'.$setuploadquota_text.'</li>'."\n".                    '<li>'.$setuploadquota_text.'</li>'."\n".
                   '<li>'.$anon_text.'</li>'."\n".                    '<li>'.$anon_text.'</li>'."\n".
                   '<li>'.$postsubmit_text.'</li>'."\n";                    '<li>'.$postsubmit_text.'</li>'."\n";
Line 775  sub print_course_modification_page { Line 771  sub print_course_modification_page {
     my ($ownertable,$ccrole,$javascript_validations,$authenitems,$ccname);      my ($ownertable,$ccrole,$javascript_validations,$authenitems,$ccname);
     my %enrollvar = &get_enrollment_settings($cdom,$cnum);      my %enrollvar = &get_enrollment_settings($cdom,$cnum);
     my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.textbook',      my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.textbook',
                                                        'internal.selfenrollmgrdc','internal.selfenrollmgrcc'],                                                         'internal.selfenrollmgrdc','internal.selfenrollmgrcc',
                                                          'internal.mysqltables'],
                                         $cdom,$cnum);                                          $cdom,$cnum);
     my $type = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$crstype,\%settings);      my $type = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$crstype,\%settings);
     my @specific_managebydc = split(/,/,$settings{'internal.selfenrollmgrdc'});      my @specific_managebydc = split(/,/,$settings{'internal.selfenrollmgrdc'});
Line 853  sub print_course_modification_page { Line 850  sub print_course_modification_page {
         $r->print(&Apache::lonhtmlcommon::row_title(          $r->print(&Apache::lonhtmlcommon::row_title(
                   &Apache::loncommon::help_open_topic('Modify_Community_Owner').                    &Apache::loncommon::help_open_topic('Modify_Community_Owner').
                   '&nbsp;'.&mt('Community Owner'))."\n");                    '&nbsp;'.&mt('Community Owner'))."\n");
     } elsif ($crstype eq 'Placement') {  
          $r->print(&Apache::lonhtmlcommon::row_title(  
                    &Apache::loncommon::help_open_topic('Modify_Course_Owner').  
                       '&nbsp;'.&mt('Course Owner'))."\n");  
     } else {      } else {
         $r->print(&Apache::lonhtmlcommon::row_title(          $r->print(&Apache::lonhtmlcommon::row_title(
                       &Apache::loncommon::help_open_topic('Modify_Course_Instcode').                        &Apache::loncommon::help_open_topic('Modify_Course_Instcode').
                       '&nbsp;'.&mt('Course Code'))."\n".                        '&nbsp;'.&mt('Course Code'))."\n".
                   '<input type="text" size="15" name="coursecode" value="'.$enrollvar{'coursecode'}.'" />'.                    '<input type="text" size="15" name="coursecode" value="'.$enrollvar{'coursecode'}.'" />'.
                   &Apache::lonhtmlcommon::row_closure());                    &Apache::lonhtmlcommon::row_closure());
         if (&showcredits($cdom)) {          if (($crstype eq 'Course') && (&showcredits($cdom))) {
             $r->print(&Apache::lonhtmlcommon::row_title(              $r->print(&Apache::lonhtmlcommon::row_title(
                           &Apache::loncommon::help_open_topic('Modify_Course_Credithours').                            &Apache::loncommon::help_open_topic('Modify_Course_Credithours').
                       '&nbsp;'.&mt('Credits (students)'))."\n".                        '&nbsp;'.&mt('Credits (students)'))."\n".
                       '<input type="text" size="3" name="defaultcredits" value="'.$enrollvar{'defaultcredits'}.'" />'.                        '<input type="text" size="3" name="defaultcredits" value="'.$enrollvar{'defaultcredits'}.'" />'.
                       &Apache::lonhtmlcommon::row_closure());                        &Apache::lonhtmlcommon::row_closure());
          }          }
          $r->print(&Apache::lonhtmlcommon::row_title(          $r->print(&Apache::lonhtmlcommon::row_title(
                        &Apache::loncommon::help_open_topic('Modify_Course_Defaultauth').                        &Apache::loncommon::help_open_topic('Modify_Course_Defaultauth').
                        '&nbsp;'.&mt('Default Authentication method'))."\n".                        '&nbsp;'.&mt('Default Authentication method'))."\n".
                    $authenitems."\n".                    $authenitems."\n".
                    &Apache::lonhtmlcommon::row_closure().                    &Apache::lonhtmlcommon::row_closure().
                    &Apache::lonhtmlcommon::row_title(                    &Apache::lonhtmlcommon::row_title(
                    &Apache::loncommon::help_open_topic('Modify_Course_Owner').                    &Apache::loncommon::help_open_topic('Modify_Course_Owner').
                       '&nbsp;'.&mt('Course Owner'))."\n");                       '&nbsp;'.&mt('Course Owner'))."\n");
     }      }
     my ($cctitle,$rolename,$currmanages,$ccchecked,$dcchecked,$defaultchecked);      my ($cctitle,$rolename,$currmanages,$ccchecked,$dcchecked,$defaultchecked);
     my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();      my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
Line 928  sub print_course_modification_page { Line 921  sub print_course_modification_page {
                   &Apache::loncommon::end_data_table_row()."\n");                    &Apache::loncommon::end_data_table_row()."\n");
     }      }
     $r->print(&Apache::loncommon::end_data_table()."\n".      $r->print(&Apache::loncommon::end_data_table()."\n".
               '<br />'.&Apache::lonhtmlcommon::row_closure(1).                '<br />'.&Apache::lonhtmlcommon::row_closure().
                 &Apache::lonhtmlcommon::row_title(
                 &Apache::loncommon::help_open_topic('Modify_Course_Table_Lifetime').
                 '&nbsp;'.&mt('"Temporary" Tables Lifetime (s)'))."\n".
                 '<input type="text" size="10" name="mysqltables" value="'.$settings{'internal.mysqltables'}.'" />'.
                 &Apache::lonhtmlcommon::row_closure(1).
               &Apache::lonhtmlcommon::end_pick_box().'</p><p>'.$hidden_elements.                &Apache::lonhtmlcommon::end_pick_box().'</p><p>'.$hidden_elements.
               '<input type="button" onclick="javascript:changePage(this.form,'."'processparms'".');');                '<input type="button" onclick="javascript:changePage(this.form,'."'processparms'".');');
     if (($crstype eq 'Community') || ($crstype eq 'Placement')) {      if ($crstype eq 'Community') {
         $r->print('this.form.submit();"');          $r->print('this.form.submit();"');
     } else {      } else {
         $r->print('javascript:verify_message(this.form);"');          $r->print('javascript:verify_message(this.form);"');
Line 1050  sub modify_course { Line 1048  sub modify_course {
     my %longtype = &course_settings_descrip($type);      my %longtype = &course_settings_descrip($type);
     my @items = ('internal.courseowner','description','internal.co-owners',      my @items = ('internal.courseowner','description','internal.co-owners',
                  'internal.pendingco-owners','internal.selfenrollmgrdc',                   'internal.pendingco-owners','internal.selfenrollmgrdc',
                  'internal.selfenrollmgrcc');                   'internal.selfenrollmgrcc','internal.mysqltables');
     my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();      my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
     unless (($type eq 'Community') || ($type eq 'Placement')) {      unless (($type eq 'Community') || ($type eq 'Placement')) {
         push(@items,('internal.coursecode','internal.authtype','internal.autharg',          push(@items,('internal.coursecode','internal.authtype','internal.autharg',
Line 1070  sub modify_course { Line 1068  sub modify_course {
     if ($type eq 'Community') {      if ($type eq 'Community') {
         %changed = ( owner  => 0 );          %changed = ( owner  => 0 );
         $ccrole = 'co';          $ccrole = 'co';
     } elsif ($type eq 'Placement') {  
         %changed = ( owner  => 0 );  
         $ccrole = 'cc';  
     } else {      } else {
         %changed = ( code  => 0,          %changed = ( code  => 0,
                      owner => 0,                       owner => 0,
Line 1124  sub modify_course { Line 1119  sub modify_course {
                 $changed{'code'} = 1;                  $changed{'code'} = 1;
             }              }
         }          }
           if ( exists($env{'form.mysqltables'}) ) {
         if (&showcredits($cdom) && exists($env{'form.defaultcredits'})) {              $newattr{'mysqltables'} = $env{'form.mysqltables'};
             $newattr{'defaultcredits'} =~ s/[^\d\.]//g;              $newattr{'mysqltables'} =~ s/\D+//g;
           }
           if (($type ne 'Placement') && (&showcredits($cdom) && exists($env{'form.defaultcredits'}))) {
             $newattr{'defaultcredits'}=$env{'form.defaultcredits'};              $newattr{'defaultcredits'}=$env{'form.defaultcredits'};
               $newattr{'defaultcredits'} =~ s/[^\d\.]//g;
         }          }
     }      }
   
Line 1219  sub modify_course { Line 1217  sub modify_course {
                         $shown = &selfenroll_config_status(\@newmgrcc,$selfenrolltitles);                          $shown = &selfenroll_config_status(\@newmgrcc,$selfenrolltitles);
                     } elsif (($attr eq 'defaultcredits') && ($shown eq '')) {                      } elsif (($attr eq 'defaultcredits') && ($shown eq '')) {
                         $shown = &mt('None');                          $shown = &mt('None');
                       } elsif (($attr eq 'mysqltables') && ($shown eq '')) {
                           $shown = &mt('domain default');
                     }                      }
                     $chgresponse .= '<li>'.&mt('[_1] now set to: [_2]',$longtype{$attr},$shown).'</li>';                      $chgresponse .= '<li>'.&mt('[_1] now set to: [_2]',$longtype{$attr},$shown).'</li>';
                 } else {                  } else {
Line 1229  sub modify_course { Line 1229  sub modify_course {
                         $shown = &selfenroll_config_status(\@currmgrcc,$selfenrolltitles);                          $shown = &selfenroll_config_status(\@currmgrcc,$selfenrolltitles);
                     } elsif (($attr eq 'defaultcredits') && ($shown eq '')) {                      } elsif (($attr eq 'defaultcredits') && ($shown eq '')) {
                         $shown = &mt('None');                          $shown = &mt('None');
                       } elsif (($attr eq 'mysqltables') && ($shown eq '')) {
                           $shown = &mt('domain default');
                     }                      }
                     $nochgresponse .= '<li>'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'</li>';                      $nochgresponse .= '<li>'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'</li>';
                 }                  }
Line 1300  sub modify_course { Line 1302  sub modify_course {
                 $shown = &selfenroll_config_status(\@currmgrcc,$selfenrolltitles);                  $shown = &selfenroll_config_status(\@currmgrcc,$selfenrolltitles);
             } elsif (($attr eq 'defaultcredits') && ($shown eq '')) {              } elsif (($attr eq 'defaultcredits') && ($shown eq '')) {
                 $shown = &mt('None');                  $shown = &mt('None');
               } elsif (($attr eq 'mysqltables') && ($shown eq '')) {
                   $shown = &mt('domain default');
             }              }
             $nochgresponse .= '<li>'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'</li>';              $nochgresponse .= '<li>'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'</li>';
         }          }
Line 2126  sub course_settings_descrip { Line 2130  sub course_settings_descrip {
                       'co-owners'        => "Username:domain of each co-owner",                        'co-owners'        => "Username:domain of each co-owner",
                       'selfenrollmgrdc'  => "Community-specific self-enrollment configuration by Domain Coordinator",                        'selfenrollmgrdc'  => "Community-specific self-enrollment configuration by Domain Coordinator",
                       'selfenrollmgrcc'  => "Community-specific self-enrollment configuration by Community personnel",                        'selfenrollmgrcc'  => "Community-specific self-enrollment configuration by Community personnel",
                         'mysqltables'      => '"Temporary" student performance tables lifetime (seconds)',
          );           );
     } else {      } else {
          %longtype = &Apache::lonlocal::texthash(           %longtype = &Apache::lonlocal::texthash(
Line 2144  sub course_settings_descrip { Line 2149  sub course_settings_descrip {
                       'sectionnums' => 'Course section number:LON-CAPA section',                        'sectionnums' => 'Course section number:LON-CAPA section',
                       'crosslistings' => 'Crosslisted class:LON-CAPA section',                        'crosslistings' => 'Crosslisted class:LON-CAPA section',
                       'defaultcredits' => 'Credits',                        'defaultcredits' => 'Credits',
                         'autodropfailsafe' => "Failsafe section enrollment count",
                       'selfenrollmgrdc'  => "Course-specific self-enrollment configuration by Domain Coordinator",                        'selfenrollmgrdc'  => "Course-specific self-enrollment configuration by Domain Coordinator",
                       'selfenrollmgrcc'  => "Course-specific self-enrollment configuration by Course personnel",                        'selfenrollmgrcc'  => "Course-specific self-enrollment configuration by Course personnel",
                         'mysqltables'      => '"Temporary" student performance tables lifetime (seconds)',
          );           );
     }      }
     return %longtype;      return %longtype;
Line 2159  sub hidden_form_elements { Line 2165  sub hidden_form_elements {
           'locarg','krbarg','krbver','counter','hidefromcat','usecategory',            'locarg','krbarg','krbver','counter','hidefromcat','usecategory',
           'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',            'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',
           'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',            'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',
           'sections','newsec'],['^selfenrollmgr_'])."\n".            'sections','newsec','mysqltables'],['^selfenrollmgr_','^selfenroll_'])."\n".
           '<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />';            '<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />';
     return $hidden_elements;      return $hidden_elements;
 }  }

Removed from v.1.82  
changed lines
  Added in v.1.85


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>