--- loncom/interface/lonmodifycourse.pm 2013/07/09 00:17:23 1.61
+++ loncom/interface/lonmodifycourse.pm 2014/03/17 02:45:25 1.70
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# handler for DC-only modifiable course settings
#
-# $Id: lonmodifycourse.pm,v 1.61 2013/07/09 00:17:23 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.70 2014/03/17 02:45:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -153,10 +153,7 @@ sub print_course_search_page {
$type = 'Course';
}
&print_header($r,$type);
- my $filterlist = ['descriptfilter',
- 'instcodefilter','ownerfilter',
- 'coursefilter'];
- my $filter = {};
+ my ($filterlist,$filter) = &get_filters($dom);
my ($numtitles,$cctitle,$dctitle,@codetitles);
my $ccrole = 'cc';
if ($type eq 'Community') {
@@ -164,15 +161,15 @@ sub print_course_search_page {
}
$cctitle = &Apache::lonnet::plaintext($ccrole,$type);
$dctitle = &Apache::lonnet::plaintext('dc');
- $r->print(&Apache::lonpickcourse::js_changer());
+ $r->print(&Apache::loncommon::js_changer());
if ($type eq 'Community') {
$r->print('
'.&mt('Search for a community 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".
@@ -184,6 +181,7 @@ sub print_course_search_page {
'- '.&mt('View or modify course settings which only a [_1] may modify.',$dctitle).
'
'."\n".'
');
}
+ return;
}
sub print_course_selection_page {
@@ -195,27 +193,38 @@ 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);
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) = @_;
&print_header($r,$type);
@@ -436,7 +445,7 @@ sub print_setquota {
coursequota => 20,
uploadquota => 500,
);
- my %settings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota','internal.instcode'],
+ my %settings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota','internal.coursecode'],
$cdom,$cnum);
my $coursequota = $settings{'internal.coursequota'};
my $uploadquota = $settings{'internal.uploadquota'};
@@ -447,8 +456,10 @@ sub print_setquota {
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
if ($type eq 'Community') {
$uploadquota = $domdefs{$lctype.'quota'};
- } elsif ($settings{'internal.instcode'}) {
+ } elsif ($settings{'internal.coursecode'}) {
$uploadquota = $domdefs{'officialquota'};
+ } elsif ($settings{'internal.textbook'}) {
+ $uploadquota = $domdefs{'textbookquota'};
} else {
$uploadquota = $domdefs{'unofficialquota'};
}
@@ -881,10 +892,10 @@ sub modify_course {
}
}
if (@changes > 0) {
- $chgresponse = &mt("The following settings have been changed:
");
+ $chgresponse = &mt('The following settings have been changed:').'
';
}
if (@nochanges > 0) {
- $nochgresponse = &mt("The following settings remain unchanged:
");
+ $nochgresponse = &mt('The following settings remain unchanged:').'
';
}
if (@changes > 0) {
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);
@@ -994,18 +1005,19 @@ sub modify_course {
$reply = ''.$mainheader.' '.$cdesc.'
'."\n".
''.$reply.'
'."\n".
'
';
+ $reply .= &Apache::lonhtmlcommon::actionbox(\@actions).'';
$r->print($reply);
return;
}
@@ -1238,10 +1250,10 @@ sub modify_quota {
}
$r->print('');
if ($type eq 'Community') {
- $r->print(&mt('Disk usage [_1] exceeds the quota for this community.',$newoverquota).' '.
+ $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 [_1] exceeds the quota for this course.',$newoverquota).' '.
+ $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('
');
@@ -1252,7 +1264,7 @@ sub modify_quota {
''.$updatedsettings{'internal.uploadquota'}.'').'
');
}
} else {
- $r->print(&mt('An error occurred storing the quota(s) for group portfolio files and/or uploaded content.').
+ $r->print(&mt('An error occurred storing the quota(s) for group portfolio files and/or uploaded content: ').
$putreply);
}
}
@@ -1636,7 +1648,7 @@ sub hidden_form_elements {
sub showcredits {
my ($dom) = @_;
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+ if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbokcredits'}) {
return 1;
}
}