--- loncom/interface/lonconfigsettings.pm 2024/07/14 23:48:58 1.21.4.17
+++ loncom/interface/lonconfigsettings.pm 2012/10/30 10:39:02 1.22
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: lonconfigsettings.pm,v 1.21.4.17 2024/07/14 23:48:58 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.22 2012/10/30 10:39:02 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,20 +35,16 @@ use Apache::lonnet;
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
-use Apache::courseclassifier();
-use LONCAPA qw(:DEFAULT :match);
+use Apache::lonparmset();
sub print_header {
- my ($r,$phase,$context,$jscript,$container,$instcode,$dom) = @_;
- 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');
- }
+ my ($r,$phase,$context,$jscript,$container) = @_;
+ my ($pagetitle,$brcrumtitle,$action,$call_category_check);
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) {
@@ -60,65 +56,14 @@ sub print_header {
}
}
} else {
- $crstype = &Apache::loncommon::course_type();
- if ($crstype eq 'Community') {
+ if (&Apache::loncommon::course_type() 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,\%lastact));
+ $confname,$item,$roles,$values));
} else {
$changes{$item} = {};
- $errors =
- &Apache::courseprefs::process_changes($dom,$confname,$item,$values,
- $prefs->{$item},$changes{$item},
- $allitems,\%disallowed,$crstype);
+ &Apache::courseprefs::process_changes($dom,$item,$values,
+ $prefs->{$item},$changes{$item},
+ $allitems,\%disallowed,$crstype);
if (keys(%{$changes{$item}}) > 0) {
$numchanged ++;
}
@@ -375,33 +233,25 @@ sub make_changes {
}
$r->print('
'.$errors.'
'); - } } $r->print(''); my $footer_text = 'Back to configuration display'; if ($context eq 'course') { $footer_text = 'Back to display/edit settings'; } + &print_footer($r,$phase,'display',$footer_text,\@actions,$container); $r->print('
'); - &print_footer($r,$phase,'display',$footer_text,\@actions,$container,$parm_permission); - return \%lastact; } sub display_settings { my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript, - $allitems,$crstype,$container,$parm_permission) = @_; + $allitems,$crstype,$container) = @_; my %brcrumtext = &get_crumb_text(); my @actions = &Apache::loncommon::get_env_multiple('form.actions'); &Apache::lonhtmlcommon::add_breadcrumb ({href=>"javascript:changePage(document.$phase,'display')", text=>"Display/Edit Settings"}); - my $instcode; - if (ref($values) eq 'HASH') { - $instcode = $values->{'internal.coursecode'}; - } - &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom); + &print_header($r,$phase,$context,$jscript,$container); my $divwidth = 900; if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { if (@actions > 0) { @@ -411,48 +261,20 @@ sub display_settings { if (grep(/^\Q$item\E$/,@actions)) { push(@items,$item); if ($context eq 'domain') { - my $settings; - if (ref($values) eq 'HASH') { - $settings = $values->{$item}; - } if ($item eq 'usersessions') { $r->print(''."\n"); - } elsif ($item eq 'selfcreation') { - if (ref($values) eq 'HASH') { - $settings = $values->{'usercreation'}; - } - } elsif ($item eq 'defaults') { - if (ref($values->{'inststatus'}) eq 'HASH') { - if (ref($values->{'defaults'}) eq 'HASH') { - $settings = {%{$values->{'inststatus'}},%{$values->{'defaults'}}}; - } else { - $settings = $values->{'inststatus'}; - } - } else { - my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); - my $inststatus = { - inststatustypes => $usertypes, - inststatusorder => $types, - inststatusguest => [], - }; - if (ref($values->{defaults}) eq 'HASH') { - $settings = {%{$inststatus},%{$values->{'defaults'}}}; - } else { - $settings = $inststatus; - } - } } ($output{$item},$rowtotal{$item}) = &Apache::domainprefs::print_config_box($r,$dom,$confname, - $phase,$item,$prefs->{$item},$settings); + $phase,$item,$prefs->{$item},$values->{$item}); } else { ($output{$item},$rowtotal{$item}) = - &Apache::courseprefs::print_config_box($r,$dom,$confname,$phase, - $item,$prefs->{$item},$values,$allitems,$crstype,$parm_permission); + &Apache::courseprefs::print_config_box($r,$dom,$phase, + $item,$prefs->{$item},$values,$allitems,$crstype); } $rowsum += $rowtotal{$item}; } @@ -462,7 +284,7 @@ sub display_settings { $r->print($output{$items[$i]}); } $r->print(''); - $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container,$parm_permission)); + $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container)); } else { $r->print(''. ''.&mt('No settings chosen'). @@ -475,7 +297,7 @@ sub display_settings { } sub display_choices { - my ($r,$phase,$context,$prefs_order,$prefs,$container,$parm_permission) = @_; + my ($r,$phase,$context,$prefs_order,$prefs,$container) = @_; if ($phase eq '') { $phase = 'pickactions'; } @@ -486,13 +308,7 @@ sub display_choices { &Apache::loncommon::check_uncheck_jscript()."\n". '// ]]>'."\n". ''."\n"); - my $heading = &mt('Settings to display/modify'); - if (ref($parm_permission) eq 'HASH') { - unless ($parm_permission->{'process'}) { - $heading = &mt('Settings to display'); - } - } - $r->print('