--- loncom/interface/domainprefs.pm 2014/05/04 22:19:29 1.160.6.43
+++ loncom/interface/domainprefs.pm 2014/04/25 17:56:43 1.237
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.43 2014/05/04 22:19:29 raeburn Exp $
+# $Id: domainprefs.pm,v 1.237 2014/04/25 17:56:43 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -213,15 +213,15 @@ sub handler {
'quotas','autoenroll','autoupdate','autocreate',
'directorysrch','usercreation','usermodification',
'contacts','defaults','scantron','coursecategories',
- 'serverstatuses','requestcourses','coursedefaults',
- 'usersessions','loadbalancing','requestauthor',
- 'selfenrollment','inststatus'],$dom);
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults','usersessions','loadbalancing',
+ 'requestauthor','selfenrollment','inststatus'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
- 'serverstatuses','coursedefaults','selfenrollment',
- 'usersessions');
+ 'serverstatuses','helpsettings',
+ 'coursedefaults','selfenrollment','usersessions');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -387,9 +387,7 @@ sub handler {
'coursecategories' =>
{ text => 'Cataloging of courses/communities',
help => 'Domain_Configuration_Cataloging_Courses',
- header => [{col1 => 'Catalog type/availability',
- col2 => '',},
- {col1 => 'Category settings for standard catalog',
+ header => [{col1 => 'Category settings',
col2 => '',},
{col1 => 'Categories',
col2 => '',
@@ -407,6 +405,14 @@ sub handler {
print => \&print_serverstatuses,
modify => \&modify_serverstatuses,
},
+ 'helpsettings' =>
+ {text => 'Help page settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Help Settings (logged-in users)',
+ col2 => 'Value'}],
+ print => \&print_helpsettings,
+ modify => \&modify_helpsettings,
+ },
'coursedefaults' =>
{text => 'Course/Community defaults',
help => 'Domain_Configuration_Course_Defaults',
@@ -429,6 +435,14 @@ sub handler {
print => \&print_selfenrollment,
modify => \&modify_selfenrollment,
},
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_privacy,
+ modify => \&modify_privacy,
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -606,13 +620,15 @@ sub process_changes {
} elsif ($action eq 'scantron') {
$output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'coursecategories') {
- $output = &modify_coursecategories($dom,$lastactref,%domconfig);
+ $output = &modify_coursecategories($dom,%domconfig);
} elsif ($action eq 'serverstatuses') {
$output = &modify_serverstatuses($dom,%domconfig);
} elsif ($action eq 'requestcourses') {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'requestauthor') {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
+ } elsif ($action eq 'helpsettings') {
+ $output = &modify_helpsettings($r,$dom,$confname,%domconfig);
} elsif ($action eq 'coursedefaults') {
$output = &modify_coursedefaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'selfenrollment') {
@@ -649,7 +665,7 @@ sub print_config_box {
if ($numheaders > 1) {
my $colspan = '';
my $rightcolspan = '';
- if (($action eq 'rolecolors') || ($action eq 'defaults') ||
+ if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'defaults') ||
(($action eq 'login') && ($numheaders < 3))) {
$colspan = ' colspan="2"';
}
@@ -666,7 +682,7 @@ sub print_config_box {
';
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||
- ($action eq 'usermodification') || ($action eq 'defaults') ||
+ ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') ||
($action eq 'selfenrollment') || ($action eq 'usersessions')) {
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);
} elsif ($action eq 'coursecategories') {
@@ -697,14 +713,8 @@ sub print_config_box {
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
- ($action eq 'usersessions') || ($action eq 'coursecategories')) {
- if ($action eq 'coursecategories') {
- $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
- $colspan = ' colspan="2"';
- } else {
- $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal);
- }
- $output .= '
+ ($action eq 'usersessions')) {
+ $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal).'
@@ -714,16 +724,14 @@ sub print_config_box {
'.&mt($item->{'header'}->[2]->{'col1'}).' |
'.&mt($item->{'header'}->[2]->{'col2'}).' |
-
'."\n";
- if ($action eq 'coursecategories') {
- $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
- } else {
- $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
- }
+ '."\n".
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
($action eq 'defaults')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ } elsif ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 3) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -4738,49 +4746,6 @@ sub print_coursecategories {
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_;
my $datatable;
if ($position eq 'top') {
- my (%checked);
- my @catitems = ('unauth','auth');
- my @cattypes = ('std','domonly','codesrch','none');
- $checked{'unauth'} = 'std';
- $checked{'auth'} = 'std';
- if (ref($settings) eq 'HASH') {
- foreach my $type (@cattypes) {
- if ($type eq $settings->{'unauth'}) {
- $checked{'unauth'} = $type;
- }
- if ($type eq $settings->{'auth'}) {
- $checked{'auth'} = $type;
- }
- }
- }
- my %lt = &Apache::lonlocal::texthash (
- unauth => 'Catalog type for unauthenticated users',
- auth => 'Catalog type for authenticated users',
- none => 'No catalog',
- std => 'Standard catalog',
- domonly => 'Domain-only catalog',
- codesrch => "Code search form",
- );
- my $itemcount = 0;
- foreach my $item (@catitems) {
- my $css_class = $itemcount%2? ' class="LC_odd_row"':'';
- $datatable .= ''.
- ''.$lt{$item}.' | '.
- '';
- foreach my $type (@cattypes) {
- my $ischecked;
- if ($checked{$item} eq $type) {
- $ischecked=' checked="checked"';
- }
- $datatable .= ' ';
- }
- $datatable .= ' |
';
- $itemcount ++;
- }
- $$rowtotal += $itemcount;
- } elsif ($position eq 'middle') {
my $toggle_cats_crs = ' ';
my $toggle_cats_dom = ' checked="checked" ';
my $can_cat_crs = ' ';
@@ -4987,7 +4952,7 @@ sub print_coursecategories {
$datatable .= &initialize_categories($itemcount);
}
} else {
- $datatable .= ''.$hdritem->{'header'}->[1]->{'col2'}.' | '
+ $datatable .= ''.$hdritem->{'header'}->[0]->{'col2'}.' | '
.&initialize_categories($itemcount);
}
$$rowtotal += $itemcount;
@@ -9346,12 +9311,10 @@ sub modify_scantron {
}
sub modify_coursecategories {
- my ($dom,$lastactref,%domconfig) = @_;
+ my ($dom,%domconfig) = @_;
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors,
$cathash);
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory');
- my @catitems = ('unauth','auth');
- my @cattypes = ('std','domonly','codesrch','none');
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
$cathash = $domconfig{'coursecategories'}{'cats'};
if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) {
@@ -9370,14 +9333,6 @@ sub modify_coursecategories {
$changes{'categorizecomm'} = 1;
$domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'};
}
- foreach my $item (@catitems) {
- if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/,@cattypes)) {
- if ($domconfig{'coursecategories'}{$item} ne $env{'form.coursecat_'.$item}) {
- $changes{$item} = 1;
- $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
- }
- }
- }
} else {
$changes{'togglecats'} = 1;
$changes{'categorize'} = 1;
@@ -9389,14 +9344,6 @@ sub modify_coursecategories {
togglecatscomm => $env{'form.togglecatscomm'},
categorizecomm => $env{'form.categorizecomm'},
};
- foreach my $item (@catitems) {
- if ($env{'form.coursecat_'.$item} ne 'std') {
- $changes{$item} = 1;
- }
- if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/,@cattypes)) {
- $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
- }
- }
}
if (ref($cathash) eq 'HASH') {
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) {
@@ -9519,10 +9466,6 @@ sub modify_coursecategories {
dom => 'set in Domain ("Modify Course/Community")',
crs => 'set in Course ("Course Configuration")',
comm => 'set in Community ("Community Configuration")',
- none => 'No catalog',
- std => 'Standard catalog',
- domonly => 'Domain-only catalog',
- codesrch => 'Code search form',
);
$resulttext = &mt('Changes made:').'';
if ($changes{'togglecats'}) {
@@ -9537,12 +9480,6 @@ sub modify_coursecategories {
if ($changes{'categorizecomm'}) {
$resulttext .= '- '.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'
';
}
- if ($changes{'unauth'}) {
- $resulttext .= '- '.&mt('Catalog type for unauthenticated users set to "'.$level{$env{'form.coursecat_unauth'}}.'"').'
';
- }
- if ($changes{'auth'}) {
- $resulttext .= '- '.&mt('Catalog type for authenticated users set to "'.$level{$env{'form.coursecat_auth'}}.'"').'
';
- }
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) {
my $cathash;
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
@@ -9587,12 +9524,6 @@ sub modify_coursecategories {
}
}
$resulttext .= '
';
- if ($changes{'unauth'} || $changes{'auth'}) {
- &Apache::loncommon::devalidate_domconfig_cache($dom);
- if (ref($lastactref) eq 'HASH') {
- $lastactref->{'domainconfig'} = 1;
- }
- }
} else {
$resulttext = ''.
&mt('An error occurred: [_1]',$putresult).'';