--- loncom/interface/lonconfigsettings.pm 2012/12/10 23:31:38 1.21.4.2
+++ loncom/interface/lonconfigsettings.pm 2016/08/04 17:34:35 1.21.4.8
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: lonconfigsettings.pm,v 1.21.4.2 2012/12/10 23:31:38 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.21.4.8 2016/08/04 17:34:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,15 +35,20 @@ use Apache::lonnet;
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
+use Apache::courseclassifier();
+use LONCAPA qw(:DEFAULT :match);
sub print_header {
my ($r,$phase,$context,$jscript,$container) = @_;
- my ($pagetitle,$brcrumtitle,$action,$call_category_check);
+ my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check,
+ $crstype,@actions,@code_order);
+ if ($phase eq 'display') {
+ @actions = &Apache::loncommon::get_env_multiple('form.actions');
+ }
if ($context eq 'domain') {
($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','View/Modify Domain Settings');
$action = '/adm/domainprefs';
if ($phase eq 'display') {
- my @actions = &Apache::loncommon::get_env_multiple('form.actions');
if (grep(/^coursecategories$/,@actions)) {
$call_category_check = qq|
if (formname == document.display) {
@@ -55,14 +60,65 @@ sub print_header {
}
}
} else {
- if (&Apache::loncommon::course_type() eq 'Community') {
+ $crstype = &Apache::loncommon::course_type();
+ if ($crstype eq 'Community') {
($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration');
} else {
($pagetitle,$brcrumtitle) = ('Course Configuration','Course Configuration');
}
$action = '/adm/courseprefs';
+ if ($phase eq 'display') {
+ if (grep(/^courseinfo$/,@actions)) {
+ my %codedefaults;
+ &Apache::lonnet::auto_instcode_defaults($env{'request.role.domain'},\%codedefaults,
+ \@code_order);
+ if (@code_order) {
+ my $noinstcodestr = &mt('You indicated cloning based on category, but did not select any categories.');
+ &js_escape(\$noinstcodestr);
+ $instcode_check = <<"ENDSCRIPT";
+ if (formname == document.display) {
+ if (formname.cloners_instcode.length) {
+ for (var j=0; j'.&mt($prefs->{$item}{'text'}).'
'.
&Apache::domainprefs::process_changes($r,$dom,
- $confname,$item,$roles,$values));
+ $confname,$item,$roles,$values,\%lastact));
} else {
$changes{$item} = {};
&Apache::courseprefs::process_changes($dom,$item,$values,
@@ -236,6 +311,7 @@ sub make_changes {
}
&print_footer($r,$phase,'display',$footer_text,\@actions,$container);
$r->print('