'.&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',
- undef,undef,undef,\@codetitles));
+ }
+ $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 {
@@ -187,51 +209,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,@codetitles);
- $r->print(&Apache::lonpickcourse::js_changer());
+ $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,
- undef,undef,undef,undef,\@codetitles));
- $filter{'domainfilter'} = $dom;
- my %courses = &Apache::lonpickcourse::search_courses($r,$type,0,
- \%filter,$numtitles,undef,
- undef,undef,\@codetitles);
+ $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')"
@@ -248,7 +307,7 @@ sub print_modification_menu {
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 => '',
@@ -256,6 +315,14 @@ sub print_modification_menu {
linktitle => ''
},
{
+ linktext => 'View/Modify responders threshold for anonymous survey submissions display',
+ url => &phaseurl('setanon'),
+ permission => 1,
+ #help => '',
+ icon => 'anonsurveythreshold.png',
+ linktitle => ''
+ },
+ {
linktext => $cat_text,
url => &phaseurl('catsettings'),
permission => (@additional_params > 0),
@@ -266,11 +333,27 @@ sub print_modification_menu {
{
linktext => 'Display current settings for automated enrollment',
url => &phaseurl('viewparms'),
- permission => ($type ne 'Community'),
+ permission => (($type ne 'Community') && ($type ne 'Placement')),
#help => '',
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 => '',
+ },
]
},
);
@@ -287,12 +370,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') {
@@ -347,7 +438,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')) {
@@ -379,9 +470,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);
@@ -458,6 +706,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.').'
'.
@@ -479,7 +729,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).').'
');
}
}
@@ -501,7 +751,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",
@@ -511,17 +761,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)) {
@@ -574,14 +835,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) {
@@ -804,7 +1234,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).' ');
@@ -821,7 +1251,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));
}
@@ -837,7 +1267,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));
}
@@ -849,7 +1279,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'));
@@ -991,7 +1447,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);
@@ -1040,63 +1496,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('