'.&mt('Search for a placement test in the [_1] domain',$domdesc).'
');
} else {
$r->print('
'.&mt('Search for a course in the [_1] domain',$domdesc).'
');
- }
- $r->print(&Apache::lonpickcourse::build_filters($filterlist,$type,
- undef,undef,$filter,$action,\$numtitles,'modifycourse'));
+ }
+ $r->print(&Apache::loncommon::build_filters($filterlist,$type,undef,undef,$filter,$action,
+ \$numtitles,'modifycourse',undef,undef,undef,
+ \@codetitles,$dom));
if ($type eq 'Community') {
$r->print(&mt('Actions available after searching for a community:').'
'.
'
'.&mt('Enter the community with the role of [_1]',$cctitle).'
'."\n".
'
'.&mt('View or modify community settings which only a [_1] may modify.',$dctitle).
'
'."\n".'
');
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('Actions available after searching for a placement test:').'
'.
+ '
'.&mt('Enter the placement test with the role of [_1]',$cctitle).'
'."\n".
+ '
'.&mt('View or modify placement test settings which only a [_1] may modify.',$dctitle).
+ '
'."\n".'
');
} else {
$r->print(&mt('Actions available after searching for a course:').'
'.
'
'.&mt('Enter the course with the role of [_1]',$cctitle).'
'."\n".
'
'.&mt('View or modify course settings which only a [_1] may modify.',$dctitle).
'
'."\n".'
');
}
+ return;
}
sub print_course_selection_page {
@@ -186,49 +210,88 @@ sub print_course_selection_page {
&print_header($r,$type);
# Criteria for course search
- my $filterlist = ['descriptfilter',
- 'instcodefilter','ownerfilter',
- 'ownerdomfilter','coursefilter'];
- my %filter;
+ my ($filterlist,$filter) = &get_filters();
my $action = '/adm/modifycourse';
my $dctitle = &Apache::lonnet::plaintext('dc');
- my $numtitles;
- $r->print(&Apache::lonpickcourse::js_changer());
+ my ($numtitles,@codetitles);
+ $r->print(&Apache::loncommon::js_changer());
$r->print(&mt('Revise your search criteria for this domain').' ('.$domdesc.'). ');
- $r->print(&Apache::lonpickcourse::build_filters($filterlist,$type,
- undef,undef,\%filter,$action,\$numtitles));
- $filter{'domainfilter'} = $dom;
- my %courses = &Apache::lonpickcourse::search_courses($r,$type,0,
- \%filter,$numtitles);
+ $r->print(&Apache::loncommon::build_filters($filterlist,$type,undef,undef,$filter,$action,
+ \$numtitles,'modifycourse',undef,undef,undef,
+ \@codetitles,$dom,$env{'form.form'}));
+ my %courses = &Apache::loncommon::search_courses($dom,$type,$filter,$numtitles,
+ undef,undef,undef,\@codetitles);
&Apache::lonpickcourse::display_matched_courses($r,$type,0,$action,undef,undef,undef,
- %courses);
+ undef,undef,%courses);
return;
}
+sub get_filters {
+ my ($dom) = @_;
+ my @filterlist = ('descriptfilter','instcodefilter','ownerfilter',
+ 'ownerdomfilter','coursefilter','sincefilter');
+ # created filter
+ my $loncaparev = &Apache::lonnet::get_server_loncaparev($dom);
+ if ($loncaparev ne 'unknown_cmd') {
+ push(@filterlist,'createdfilter');
+ }
+ my %filter;
+ foreach my $item (@filterlist) {
+ $filter{$item} = $env{'form.'.$item};
+ }
+ return (\@filterlist,\%filter);
+}
+
sub print_modification_menu {
- my ($r,$cdesc,$domdesc,$dom,$type) = @_;
+ my ($r,$cdesc,$domdesc,$dom,$type,$cid,$coursehash) = @_;
&print_header($r,$type);
- my ($ccrole,$categorytitle,$setquota_text,$setparams_text,$cat_text);
+ my ($ccrole,$categorytitle,$setquota_text,$setuploadquota_text,$setparams_text,$cat_text,
+ $cdom,$cnum);
+ if (ref($coursehash) eq 'HASH') {
+ $cdom = $coursehash->{'domain'};
+ $cnum = $coursehash->{'num'};
+ } else {
+ ($cdom,$cnum) = split(/_/,$cid);
+ }
if ($type eq 'Community') {
$ccrole = 'co';
} else {
$ccrole = 'cc';
- }
+ }
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.');
+ $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a community via Content Editor.');
$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';
+ $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a course via Content Editor.');
+ if (($type ne 'Placement') && (&showcredits($dom))) {
+ $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, and self-enrollment';
+ } else {
+ $setparams_text = 'View/Modify course owner, institutional code, default authentication, and self-enrollment';
+ }
+ $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 %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')"
@@ -241,15 +304,23 @@ sub print_modification_menu {
url => &phaseurl('setparms'),
permission => 1,
#help => '',
- icon => 'mcrs.png',
+ icon => 'crsconf.png',
linktitle => ''
},
{
- linktext => 'View/Modify quota for group portfolio files',
+ linktext => 'View/Modify quotas for group portfolio files, and for uploaded content.',
url => &phaseurl('setquota'),
permission => 1,
#help => '',
- icon => 'mcrs.png',
+ icon => 'groupportfolioquota.png',
+ linktitle => ''
+ },
+ {
+ linktext => 'View/Modify responders threshold for anonymous survey submissions display',
+ url => &phaseurl('setanon'),
+ permission => 1,
+ #help => '',
+ icon => 'anonsurveythreshold.png',
linktitle => ''
},
{
@@ -257,17 +328,33 @@ sub print_modification_menu {
url => &phaseurl('catsettings'),
permission => (@additional_params > 0),
#help => '',
- icon => 'mcrs.png',
+ icon => 'ccatconf.png',
linktitle => ''
},
{
linktext => 'Display current settings for automated enrollment',
url => &phaseurl('viewparms'),
- permission => ($type ne 'Community'),
+ permission => (($type ne 'Community') && ($type ne 'Placement')),
#help => '',
- icon => 'mcrs.png',
+ 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.',
+ },
+ {
+ linktext => 'View/Modify submit button behavior, post-submission',
+ icon => 'emblem-readonly.png',
+ #help => '',
+ url => &phaseurl('setpostsubmit'),
+ permission => 1,
+ linktitle => '',
+ },
]
},
);
@@ -284,12 +371,20 @@ sub print_modification_menu {
}
$menu_html .= ''."\n".'
';
if ($type eq 'Community') {
- $menu_html .= '
'.&mt('Community owner (permitted to assign Coordinator roles in the 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";
} else {
- $menu_html .= '
'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'
'.
- '
'.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").'
';
- }
- $menu_html .= '
'.$setquota_text.'
'."\n";
+ $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";
+ if (($type ne 'Placement') && &showcredits($dom)) {
+ $menu_html .= '
'.&mt('Default credits earned by student on course completion.').'
'."\n";
+ }
+ $menu_html .= '
'.&mt('Override defaults for who configures self-enrollment for this specific course.').'
'."\n";
+ }
+ $menu_html .= '
'.$setquota_text.'
'."\n".
+ '
'.$setuploadquota_text.'
'."\n".
+ '
'.$anon_text.'
'."\n".
+ '
'.$postsubmit_text.'
'."\n";
foreach my $item (@additional_params) {
if ($type eq 'Community') {
if ($item eq 'togglecats') {
@@ -344,7 +439,7 @@ sub print_settings_display {
}
my $cctitle = &Apache::lonnet::plaintext($ccrole,$type);
my $dctitle = &Apache::lonnet::plaintext('dc');
- my @modifiable_params = &get_dc_settable($type);
+ my @modifiable_params = &get_dc_settable($type,$cdom);
my ($internals,$accessdates) = &autoenroll_keys();
my @items;
if ((ref($internals) eq 'ARRAY') && (ref($accessdates) eq 'ARRAY')) {
@@ -376,9 +471,13 @@ sub print_settings_display {
' '.$cdesc.''.
'
+ENDDOCUMENT
+ return;
+}
+
+sub domain_postsubtimeout {
+ my ($cdom,$type,$settings) = @_;
+ return unless (ref($settings) eq 'HASH');
+ my $lctype = lc($type);
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
+ $lctype = 'unofficial';
+ if ($settings->{'internal.coursecode'}) {
+ $lctype = 'official';
+ } elsif ($settings->{'internal.textbook'}) {
+ $lctype = 'textbook';
+ }
+ }
+ my %domconfig =
+ &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
+ my $postsubtimeout = 60;
+ if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
+ if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') {
+ if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') {
+ if ($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}{$lctype} ne '') {
+ $postsubtimeout = $domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}{$lctype};
+ }
+ }
+ }
+ }
+ return $postsubtimeout;
+}
+
sub print_catsettings {
my ($r,$cdom,$cnum,$cdesc,$type) = @_;
&print_header($r,$type);
@@ -455,6 +707,8 @@ sub print_catsettings {
'
');
if ($type eq 'Community') {
$r->print(&mt("If a community has been categorized using at least one of the categories defined for communities in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt("If a placement test has been categorized using at least one of the categories defined for placement tests in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));
} else {
$r->print(&mt("Unless excluded, a course will be listed in the domain's publicly accessible Course/Community Catalog, if at least one of the following applies").':
'.
'
'.&mt('Auto-cataloging is enabled and the course is assigned an institutional code.').'
'.
@@ -476,7 +730,7 @@ sub print_catsettings {
} else {
$r->print(&mt('No categories defined for this domain'));
}
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$r->print('
'.&mt('If auto-cataloging based on institutional code is enabled in the domain, a course will continue to be listed in the catalog of official courses, in addition to receiving a listing under any manually assigned categor(ies).').'
');
}
}
@@ -498,7 +752,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",
@@ -508,17 +762,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)) {
@@ -571,14 +836,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('
'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'
';
}
}
- if (($type ne 'Community') && ($changed{'code'} || $changed{'owner'})) {
+ if (($type ne 'Community') && ($type ne 'Placement') && ($changed{'code'} || $changed{'owner'})) {
if ( $newattr{'courseowner'} eq '') {
push(@warnings,&mt('There is no owner associated with this LON-CAPA course.').
' '.&mt('If automated enrollment at your institution requires validation of course owners, automated enrollment will fail.'));
} else {
+ my %crsenv = &Apache::lonnet::get('environment',['internal.co-owners'],$cdom,$cnum);
+ my $coowners = $crsenv{'internal.co-owners'};
if (@sections > 0) {
if ($changed{'code'}) {
foreach my $sec (@sections) {
@@ -801,7 +1235,7 @@ sub modify_course {
my $inst_course_id = $newattr{'coursecode'}.$1;
my $course_check = &Apache::lonnet::auto_validate_courseID($cnum,$cdom,$inst_course_id);
if ($course_check eq 'ok') {
- my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'});
+ my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'},$coowners);
unless ($outcome eq 'ok') {
push(@warnings,&mt('If automatic enrollment is enabled for "[_1]", automated enrollment may fail for "[_2]" - section: [_3] for the following reason: "[_4]".',$description,$newattr{'coursecode'},$instsec,$outcome).' ');
@@ -818,7 +1252,7 @@ sub modify_course {
if ($sec =~ m/^(.+):/) {
my $instsec = $1;
my $inst_course_id = $newattr{'coursecode'}.$instsec;
- my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'});
+ my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'},$coowners);
unless ($outcome eq 'ok') {
push(@warnings,&mt('If automatic enrollment is enabled for "[_1]", automated enrollment may fail for "[_2]" - section: [_3] for the following reason: "[_4]".',$description,$newattr{'coursecode'},$instsec,$outcome));
}
@@ -834,7 +1268,7 @@ sub modify_course {
foreach my $xlist (@xlists) {
if ($xlist =~ m/^(.+):/) {
my $instxlist = $1;
- my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$instxlist,$newattr{'courseowner'});
+ my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$instxlist,$newattr{'courseowner'},$coowners);
unless ($outcome eq 'ok') {
push(@warnings,&mt('If automatic enrollment is enabled for "[_1]", automated enrollment may fail for crosslisted class "[_2]" for the following reason: "[_3]".',$description,$instxlist,$outcome));
}
@@ -846,7 +1280,15 @@ sub modify_course {
}
} else {
foreach my $attr (@modifiable_params) {
- $nochgresponse .= '
'.$longtype{$attr}.' '.&mt('still set to').' "'.$currattr{$attr}.'".
';
+ $reply .= &Apache::lonhtmlcommon::actionbox(\@actions).'';
$r->print($reply);
return;
}
+sub selfenroll_config_status {
+ my ($items,$selfenrolltitles) = @_;
+ my $shown;
+ if ((ref($items) eq 'ARRAY') && (ref($selfenrolltitles) eq 'HASH')) {
+ if (@{$items} > 0) {
+ $shown = '
';
+ foreach my $item (@{$items}) {
+ $shown .= '
'.$selfenrolltitles->{$item}.'
';
+ }
+ $shown .= '
';
+ } else {
+ $shown = &mt('None');
+ }
+ }
+ return $shown;
+}
+
sub update_coowners {
my ($cdom,$cnum,$chome,$settings,$newattr) = @_;
return unless ((ref($settings) eq 'HASH') && (ref($newattr) eq 'HASH'));
@@ -988,7 +1448,7 @@ sub update_coowners {
if ($designhash{$cdom.'.autoassign.co-owners'}) {
my @newcoowners = ();
if ($settings->{'internal.co-owners'}) {
- my @currcoown = split(',',$settings->{'internal.coowners'});
+ my @currcoown = split(',',$settings->{'internal.co-owners'});
my ($updatecoowners,$delcoowners);
foreach my $person (@currcoown) {
my ($result,$desc) = &Apache::lonnet::auto_validate_instcode($cnum,$cdom,$newattr->{'coursecode'},$person);
@@ -1037,63 +1497,247 @@ sub update_coowners {
sub modify_quota {
my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
&print_header($r,$type);
+ my $lctype = lc($type);
+ my $headline = &mt("Disk space quotas for $lctype: [_1]",
+ ''.$cdesc.'');
$r->print('
'."\n".
- '
'.&mt('Disk space for storage of group portfolio files for:').
+ '
'.$headline.'
');
+ my %oldsettings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota'],$cdom,$cnum);
+ my %staticdefaults = (
+ coursequota => 20,
+ uploadquota => 500,
+ );
+ my %default;
+ $default{'coursequota'} = $staticdefaults{'coursequota'};
+ my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
+ $default{'uploadquota'} = $domdefs{'uploadquota'};
+ if ($default{'uploadquota'} eq '') {
+ $default{'uploadquota'} = $staticdefaults{'uploadquota'};
+ }
+ my (%cenv,%showresult);
+ foreach my $item ('coursequota','uploadquota') {
+ if ($env{'form.'.$item} ne '') {
+ my $newquota = $env{'form.'.$item};
+ if ($newquota =~ /^\s*(\d+\.?\d*|\.\d+)\s*$/) {
+ $newquota = $1;
+ if ($oldsettings{'internal.'.$item} == $newquota) {
+ if ($item eq 'coursequota') {
+ $r->print(&mt('The disk space allocated for group portfolio files remains unchanged as [_1] MB.',$newquota).' ');
+ } else {
+ $r->print(&mt('The disk space allocated for files uploaded via the Content Editor remains unchanged as [_1] MB.',$newquota).' ');
+ }
+ } else {
+ $cenv{'internal.'.$item} = $newquota;
+ $showresult{$item} = 1;
+ }
+ } else {
+ if ($item eq 'coursequota') {
+ $r->print(&mt('The proposed group portfolio quota contained invalid characters, so the quota is unchanged.').' ');
+ } else {
+ $r->print(&mt('The proposed quota for content uploaded via the Content Editor contained invalid characters, so the quota is unchanged.').' ');
+
+ }
+ }
+ }
+ }
+ if (keys(%cenv)) {
+ my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,
+ $cnum);
+ foreach my $key (sort(keys(%showresult))) {
+ if (($oldsettings{'internal.'.$key} eq '') &&
+ ($env{'form.'.$key} == $default{$key})) {
+ if ($key eq 'uploadquota') {
+ if ($type eq 'Community') {
+ $r->print(&mt('The disk space allocated for files uploaded to this community via the Content Editor is the default quota for this domain: [_1] MB.',
+ $default{$key}).' ');
+ } else {
+ $r->print(&mt('The disk space allocated for files uploaded to this course via the Content Editor is the default quota for this domain: [_1] MB.',
+ $default{$key}).' ');
+ }
+ } else {
+ if ($type eq 'Community') {
+ $r->print(&mt('The disk space allocated for group portfolio files in this community is the default quota for this domain: [_1] MB.',
+ $default{$key}).' ');
+ } else {
+ $r->print(&mt('The disk space allocated for group portfolio files in this course is the default quota for this domain: [_1] MB.',
+ $default{$key}).' ');
+ }
+ }
+ delete($showresult{$key});
+ }
+ }
+ if ($putreply eq 'ok') {
+ my %updatedsettings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota'],$cdom,$cnum);
+ if ($showresult{'coursequota'}) {
+ $r->print(&mt('The disk space allocated for group portfolio files is now: [_1] MB.',
+ ''.$updatedsettings{'internal.coursequota'}.'').' ');
+ my $usage = &Apache::longroup::sum_quotas($cdom.'_'.$cnum);
+ if ($usage >= $updatedsettings{'internal.coursequota'}) {
+ my $newoverquota;
+ if ($usage < $oldsettings{'internal.coursequota'}) {
+ $newoverquota = 'now';
+ }
+ $r->print('
');
+ if ($type eq 'Community') {
+ $r->print(&mt("Disk usage $newoverquota exceeds the quota for this community.").' '.
+ &mt('Upload of new portfolio files and assignment of a non-zero MB quota to new groups in the community will not be possible until some files have been deleted, and total usage is below community quota.'));
+ } else {
+ $r->print(&mt("Disk usage $newoverquota exceeds the quota for this course.").' '.
+ &mt('Upload of new portfolio files and assignment of a non-zero MB quota to new groups in the course will not be possible until some files have been deleted, and total usage is below course quota.'));
+ }
+ $r->print('
');
+ }
+ }
+ if ($showresult{'uploadquota'}) {
+ $r->print(&mt('The disk space allocated for content uploaded directly via the Content Editor is now: [_1] MB.',
+ ''.$updatedsettings{'internal.uploadquota'}.'').' ');
+ }
+ } else {
+ $r->print(&mt('An error occurred storing the quota(s) for group portfolio files and/or uploaded content: ').
+ $putreply);
+ }
+ }
+ $r->print('
'.&mt('Responder threshold required for display of anonymous survey submissions:').
' '.$cdesc.'
');
- my %oldsettings = &Apache::lonnet::get('environment',['internal.coursequota'],$cdom,$cnum);
- my $defaultquota = 20;
- if ($env{'form.coursequota'} ne '') {
- my $newquota = $env{'form.coursequota'};
- if ($newquota =~ /^\s*(\d+\.?\d*|\.\d+)\s*$/) {
- $newquota = $1;
- if ($oldsettings{'internal.coursequota'} eq $env{'form.coursequota'}) {
- $r->print(&mt('The disk space allocated for group portfolio files remains unchanged as [_1] Mb.',$env{'form.coursequota'}));
+ my %oldsettings = &Apache::lonnet::get('environment',['internal.anonsurvey_threshold'],$cdom,$cnum);
+ my %domconfig =
+ &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
+ my $defaultthreshold;
+ if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
+ $defaultthreshold = $domconfig{'coursedefaults'}{'anonsurvey_threshold'};
+ if ($defaultthreshold eq '') {
+ $defaultthreshold = 10;
+ }
+ } else {
+ $defaultthreshold = 10;
+ }
+ if ($env{'form.threshold'} eq '') {
+ $r->print(&mt('The proposed responder threshold for display of anonymous survey submissions was blank, so the threshold is unchanged.'));
+ } else {
+ my $newthreshold = $env{'form.threshold'};
+ if ($newthreshold =~ /^\s*(\d+)\s*$/) {
+ $newthreshold = $1;
+ if ($oldsettings{'internal.anonsurvey_threshold'} eq $env{'form.threshold'}) {
+ $r->print(&mt('Responder threshold for anonymous survey submissions display remains unchanged: [_1].',$env{'form.threshold'}));
} else {
my %cenv = (
- 'internal.coursequota' => $env{'form.coursequota'},
+ 'internal.anonsurvey_threshold' => $env{'form.threshold'},
);
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,
$cnum);
- if (($oldsettings{'internal.coursequota'} eq '') &&
- ($env{'form.coursequota'} == $defaultquota)) {
- if ($type eq 'Community') {
- $r->print(&mt('The disk space allocated for group portfolio files in this community is the default quota for this domain: [_1] Mb.',$defaultquota));
- } else {
- $r->print(&mt('The disk space allocated for group portfolio files in this course is the default quota for this domain: [_1] Mb.',$defaultquota));
+ if ($putreply eq 'ok') {
+ if ($env{'course.'.$cdom.'_'.$cnum.'.description'} ne '') {
+ &Apache::lonnet::appenv(
+ {'course.'.$cdom.'_'.$cnum.'.internal.anonsurvey_threshold' => $env{'form.threshold'}});
}
+ }
+ if (($oldsettings{'internal.anonsurvey_threshold'} eq '') &&
+ ($env{'form.threshold'} == $defaultthreshold)) {
+ $r->print(&mt('The responder threshold for display of anonymous survey submissions is the default for this domain: [_1].',$defaultthreshold));
} else {
if ($putreply eq 'ok') {
- my %updatedsettings = &Apache::lonnet::get('environment',['internal.coursequota'],$cdom,$cnum);
- $r->print(&mt('The disk space allocated for group portfolio files is now: [_1] Mb.',$updatedsettings{'internal.coursequota'}));
- my $usage = &Apache::longroup::sum_quotas($cdom.'_'.$cnum);
- if ($usage >= $updatedsettings{'internal.coursequota'}) {
- my $newoverquota;
- if ($usage < $oldsettings{'internal.coursequota'}) {
- $newoverquota = 'now';
- }
- $r->print('
');
- if ($type eq 'Community') {
- $r->print(&mt('Disk usage [_1] exceeds the quota for this community.',$newoverquota).' '.
- &mt('Upload of new portfolio files and assignment of a non-zero Mb quota to new groups in the community will not be possible until some files have been deleted, and total usage is below community quota.'));
- } else {
- $r->print(&mt('Disk usage [_1] exceeds the quota for this course.',$newoverquota).' '.
- &mt('Upload of new portfolio files and assignment of a non-zero Mb quota to new groups in the course will not be possible until some files have been deleted, and total usage is below course quota.'));
- }
- $r->print('
');
- }
+ my %updatedsettings = &Apache::lonnet::get('environment',['internal.anonsurvey_threshold'],$cdom,$cnum);
+ $r->print(&mt('The responder threshold for display of anonymous survey submissions is now: [_1].',''.$updatedsettings{'internal.anonsurvey_threshold'}.''));
} else {
- $r->print(&mt('An error occurred storing the quota for group portfolio files: ').
+ $r->print(&mt('An error occurred storing the responder threshold for anonymous submissions display: ').
$putreply);
}
}
}
} else {
- $r->print(&mt('The new quota requested contained invalid characters, so the quota is unchanged.'));
+ $r->print(&mt('The proposed responder threshold for display of anonymous submissions contained invalid characters, so the threshold is unchanged.'));
}
}
$r->print('
');
return;
}
@@ -1184,6 +1828,13 @@ sub modify_catsettings {
if (@changes > 0) {
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);
if ($putreply eq 'ok') {
+ if ($env{'course.'.$cdom.'_'.$cnum.'.description'} ne '') {
+ my %newenvhash;
+ foreach my $item (@changes) {
+ $newenvhash{'course.'.$cdom.'_'.$cnum.'.'.$item} = $cenv{$item};
+ }
+ &Apache::lonnet::appenv(\%newenvhash);
+ }
my %crsinfo = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',
$cnum,undef,undef,'.');
if (ref($crsinfo{$env{'form.pickedcourse'}}) eq 'HASH') {
@@ -1235,7 +1886,7 @@ sub print_header {
$phase = $env{'form.phase'};
}
my $js = qq|
-
+
|;
if ($phase eq 'setparms') {
- $js .= qq|
-
-|;
+ $js .= $javascript_validations;
} elsif ($phase eq 'courselist') {
$js .= qq|
-
+
+function hide_searching() {
+ if (document.getElementById('searching')) {
+ document.getElementById('searching').style.display = 'none';
+ }
+ return;
+}
+
|;
} elsif ($phase eq 'setquota') {
- $js .= <<'ENDSCRIPT';
-
+
ENDSCRIPT
+
}
my $starthash;
if ($env{'form.phase'} eq 'ccrole') {
$starthash = {
add_entries => {'onload' => "javascript:document.ccrole.submit();"},
};
+ } elsif ($phase eq 'courselist') {
+ $starthash = {
+ add_entries => {'onload' => "hide_searching(); courseSet(document.filterpicker.official, 'load');"},
+ };
}
$r->print(&Apache::loncommon::start_page('View/Modify Course/Community Settings',
- $js,$starthash));
+ &Apache::lonhtmlcommon::scripttag($js),
+ $starthash));
my $bread_text = "View/Modify Courses/Communities";
if ($type eq 'Community') {
$bread_text = 'Community Settings';
+ } elsif ($type eq 'Placement') {
+ $bread_text = 'Placement Test Settings';
} else {
$bread_text = 'Course Settings';
}
@@ -1301,38 +2073,35 @@ sub print_footer {
}
sub check_course {
- my ($r,$dom,$domdesc) = @_;
- my ($ok_course,$description,$instcode,$owner);
- my %args = (
- one_time => 1,
- );
- my %coursehash =
- &Apache::lonnet::coursedescription($env{'form.pickedcourse'},\%args);
- my $cnum = $coursehash{'num'};
- my $cdom = $coursehash{'domain'};
- if ($cdom eq $dom) {
- my $description;
- my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',
- $cnum,undef,undef,'.');
- if (keys(%courseIDs) > 0) {
- $ok_course = 'ok';
- my ($instcode,$owner);
- if (ref($courseIDs{$cdom.'_'.$cnum}) eq 'HASH') {
- $description = $courseIDs{$cdom.'_'.$cnum}{'description'};
- $instcode = $courseIDs{$cdom.'_'.$cnum}{'inst_code'};
- $owner = $courseIDs{$cdom.'_'.$cnum}{'owner'};
- } else {
- ($description,$instcode,$owner) =
- split(/:/,$courseIDs{$cdom.'_'.$cnum});
- }
- $description = &unescape($description);
- $instcode = &unescape($instcode);
- if ($instcode) {
- $description .= " ($instcode)";
+ my ($dom,$domdesc) = @_;
+ my ($ok_course,$description,$instcode);
+ my %coursehash;
+ if ($env{'form.pickedcourse'} =~ /^$match_domain\_$match_courseid$/) {
+ my %args;
+ unless ($env{'course.'.$env{'form.pickedcourse'}.'.description'}) {
+ %args = (
+ 'one_time' => 1,
+ 'freshen_cache' => 1,
+ );
+ }
+ %coursehash =
+ &Apache::lonnet::coursedescription($env{'form.pickedcourse'},\%args);
+ my $cnum = $coursehash{'num'};
+ my $cdom = $coursehash{'domain'};
+ $description = $coursehash{'description'};
+ $instcode = $coursehash{'internal.coursecode'};
+ if ($instcode) {
+ $description .= " ($instcode)";
+ }
+ if (($cdom eq $dom) && ($cnum =~ /^$match_courseid$/)) {
+ my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',
+ $cnum,undef,undef,'.');
+ if ($courseIDs{$cdom.'_'.$cnum}) {
+ $ok_course = 'ok';
}
- return ($ok_course,$description);
}
}
+ return ($ok_course,$description,\%coursehash);
}
sub course_settings_descrip {
@@ -1340,8 +2109,10 @@ sub course_settings_descrip {
my %longtype;
if ($type eq 'Community') {
%longtype = &Apache::lonlocal::texthash(
- 'courseowner' => "Username:domain of community owner",
- 'co-owners' => "Username:domain of each co-owner",
+ 'courseowner' => "Username:domain of community owner",
+ '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",
);
} else {
%longtype = &Apache::lonlocal::texthash(
@@ -1359,6 +2130,10 @@ sub course_settings_descrip {
'notifylist' => 'Course Coordinators to be notified of enrollment changes',
'sectionnums' => 'Course section number:LON-CAPA section',
'crosslistings' => 'Crosslisted class:LON-CAPA section',
+ 'defaultcredits' => 'Credits',
+ 'selfenrollmgrdc' => "Course-specific self-enrollment configuration by Domain Coordinator",
+ 'selfenrollmgrcc' => "Course-specific self-enrollment configuration by Course personnel",
+
);
}
return %longtype;
@@ -1368,11 +2143,22 @@ sub hidden_form_elements {
my $hidden_elements =
&Apache::lonhtmlcommon::echo_form_input(['gosearch','updater','coursecode',
'prevphase','numlocalcc','courseowner','login','coursequota','intarg',
- 'locarg','krbarg','krbver','counter','hidefromcat','usecategory'])."\n".
+ 'locarg','krbarg','krbver','counter','hidefromcat','usecategory',
+ 'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',
+ 'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',
+ 'sections','newsec'],['^selfenrollmgr_'])."\n".
'';
return $hidden_elements;
}
+sub showcredits {
+ my ($dom) = @_;
+ my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
+ if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
+ return 1;
+ }
+}
+
sub handler {
my $r = shift;
if ($r->header_only) {
@@ -1380,8 +2166,10 @@ sub handler {
$r->send_http_header;
return OK;
}
+
my $dom = $env{'request.role.domain'};
my $domdesc = &Apache::lonnet::domain($dom,'description');
+
if (&Apache::lonnet::allowed('ccc',$dom)) {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
@@ -1409,6 +2197,8 @@ sub handler {
}
if ($type eq 'Community') {
$choose_text = "Choose a community";
+ } elsif ($type eq 'Placement') {
+ $choose_text = "Choose a placement test";
} else {
$choose_text = "Choose a course";
}
@@ -1420,11 +2210,13 @@ sub handler {
if ($phase eq 'courselist') {
&print_course_selection_page($r,$dom,$domdesc);
} else {
- my ($checked,$cdesc) = &check_course($r,$dom,$domdesc);
+ my ($checked,$cdesc,$coursehash) = &check_course($dom,$domdesc);
if ($checked eq 'ok') {
my $enter_text;
if ($type eq 'Community') {
$enter_text = 'Enter community';
+ } elsif ($type eq 'Placement') {
+ $enter_text = 'Enter placement test';
} else {
$enter_text = 'Enter course';
}
@@ -1432,7 +2224,8 @@ sub handler {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'menu')",
text=>"Pick action"});
- &print_modification_menu($r,$cdesc,$domdesc,$dom,$type);
+ &print_modification_menu($r,$cdesc,$domdesc,$dom,$type,
+ $env{'form.pickedcourse'},$coursehash);
} elsif ($phase eq 'ccrole') {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'ccrole')",
@@ -1456,7 +2249,30 @@ sub handler {
({href=>"javascript:changePage(document.$phase,'$phase')",
text=>"Result"});
&modify_quota($r,$cdom,$cnum,$cdesc,$domdesc,$type);
- } elsif ($phase eq 'viewparms') {
+ } elsif ($phase eq 'setanon') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Threshold for anonymous submissions display"});
+ &print_set_anonsurvey_threshold($r,$cdom,$cnum,$cdesc,$type);
+ } elsif ($phase eq 'processthreshold') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'setanon')",
+ text=>"Threshold for anonymous submissions display"});
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Result"});
+ &modify_anonsurvey_threshold($r,$cdom,$cnum,$cdesc,$domdesc,$type);
+ } elsif ($phase eq 'setpostsubmit') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Configure submit button behavior post-submission"});
+ &print_postsubmit_config($r,$cdom,$cnum,$cdesc,$type);
+ } elsif ($phase eq 'processpostsubmit') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Result"});
+ &modify_postsubmit_config($r,$cdom,$cnum,$cdesc,$domdesc,$type);
+ } elsif ($phase eq 'viewparms') {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'viewparms')",
text=>"Display settings"});
@@ -1487,14 +2303,28 @@ sub handler {
({href=>"javascript:changePage(document.$phase,'$phase')",
text=>"Result"});
&modify_catsettings($r,$cdom,$cnum,$cdesc,$domdesc,$type);
+ } elsif ($phase eq 'selfenroll') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href => "javascript:changePage(document.$phase,'$phase')",
+ text => "Self-enrollment settings"});
+ if (!exists($env{'form.state'})) {
+ &print_selfenrollconfig($r,$type,$cdesc,$coursehash);
+ } elsif ($env{'form.state'} eq 'done') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Result"});
+ &modify_selfenrollconfig($r,$type,$cdesc,$coursehash);
+ }
}
}
} else {
$r->print('');
if ($type eq 'Community') {
- $r->print(&mt('The course you selected is not a valid course in this domain'));
- } else {
$r->print(&mt('The community you selected is not a valid community in this domain'));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('The course you selected is not a valid placement test in this domain'));
+ } else {
+ $r->print(&mt('The course you selected is not a valid course in this domain'));
}
$r->print(" ($domdesc)");
}
500 Internal Server Error
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available
in the server error log.