--- loncom/interface/domainprefs.pm 2013/12/27 16:40:08 1.160.6.30
+++ loncom/interface/domainprefs.pm 2013/12/24 21:59:36 1.217
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.30 2013/12/27 16:40:08 raeburn Exp $
+# $Id: domainprefs.pm,v 1.217 2013/12/24 21:59:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -211,13 +211,15 @@ sub handler {
'quotas','autoenroll','autoupdate','autocreate',
'directorysrch','usercreation','usermodification',
'contacts','defaults','scantron','coursecategories',
- 'serverstatuses','requestcourses','coursedefaults',
- 'usersessions','loadbalancing','requestauthor'],$dom);
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults','usersessions','loadbalancing',
+ 'requestauthor'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
- 'serverstatuses','coursedefaults','usersessions');
+ 'serverstatuses','helpsettings',
+ 'coursedefaults','usersessions');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -356,12 +358,26 @@ sub handler {
col3 => 'Specific IPs',
}],
},
- 'coursedefaults' =>
+ 'helpsettings' =>
+ {text => 'Help page settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Help Settings (logged-in users)',
+ col2 => 'Value'}],
+ },
+ 'coursedefaults' =>
{text => 'Course/Community defaults',
help => 'Domain_Configuration_Course_Defaults',
- header => [{col1 => 'Defaults which can be overridden for each course by a DC',
+ header => [{col1 => 'Defaults which can be overridden in each course by a CC',
+ col2 => 'Value',},
+ {col1 => 'Defaults which can be overridden for each course by a DC',
col2 => 'Value',},],
},
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -538,6 +554,8 @@ sub process_changes {
$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 'usersessions') {
@@ -609,6 +627,8 @@ sub print_config_box {
$output .= &print_usersessions('top',$dom,$settings,\$rowtotal);
} elsif ($action eq 'rolecolors') {
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
+ } elsif ($action eq 'coursedefaults') {
+ $output .= &print_coursedefaults('top',$dom,$settings,\$rowtotal);
}
$output .= '
@@ -709,6 +729,8 @@ sub print_config_box {
'.&mt($item->{'header'}->[2]->{'col2'}).' | '.
&print_usersessions('bottom',$dom,$settings,\$rowtotal);
$rowtotal ++;
+ } elsif ($action eq 'coursedefaults') {
+ $output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'rolecolors') {
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
@@ -805,8 +827,6 @@ sub print_config_box {
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'loadbalancing') {
$output .= &print_loadbalancing($dom,$settings,\$rowtotal);
- } elsif ($action eq 'coursedefaults') {
- $output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal);
}
}
$output .= '
@@ -2002,28 +2022,14 @@ sub print_requestmail {
sub print_studentcode {
my ($settings,$rowtotal) = @_;
my $rownum = 0;
- my ($output,%current);
- my @crstypes = ('official','unofficial','community','textbook');
- if (ref($settings->{'uniquecode'}) eq 'HASH') {
- foreach my $type (@crstypes) {
- $current{$type} = $settings->{'uniquecode'}{$type};
- }
- }
- $output .= ''.
- ''.&mt('Generate unique six character code as course identifier?').' | '.
- '';
- foreach my $type (@crstypes) {
- my $check = ' ';
- if ($current{$type}) {
- $check = ' checked="checked" ';
- }
- $output .= ''.(' 'x2).' ';
- }
- $output .= ' |
';
- $$rowtotal ++;
- return $output;
+ my %choices;
+ $choices{'uniquecode'} = &mt('Generate unique six character code as course identifier?');
+ my @toggles = ('uniquecode');
+ my %defaultchecked = ('uniquecode' => 'off');
+ (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$rownum);
+ $$rowtotal += $rownum;
+ return $reports;
}
sub print_textbookcourses {
@@ -6103,12 +6109,10 @@ sub modify_quotas {
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify');
@approvalnotify = sort(@approvalnotify);
$confhash{'notify'}{'approval'} = join(',',@approvalnotify);
- my @crstypes = ('official','unofficial','community','textbook');
- my @hasuniquecode = &Apache::loncommon::get_env_multiple('form.uniquecode');
- foreach my $type (@hasuniquecode) {
- if (grep(/^\Q$type\E$/,@crstypes)) {
- $confhash{'uniquecode'}{$type} = 1;
- }
+ if ($env{'form.uniquecode'}) {
+ $confhash{'uniquecode'} = 1;
+ } else {
+ $confhash{'uniquecode'} = '';
}
my ($newbook,@allpos);
if ($context eq 'requestcourses') {
@@ -6143,25 +6147,14 @@ sub modify_quotas {
$changes{'notify'}{'approval'} = 1;
}
}
- if (ref($domconfig{$action}{'uniquecode'}) eq 'HASH') {
- if (ref($confhash{'uniquecode'}) eq 'HASH') {
- foreach my $crstype (keys(%{$domconfig{$action}{'uniquecode'}})) {
- unless ($confhash{'uniquecode'}{$crstype}) {
- $changes{'uniquecode'} = 1;
- }
- }
- unless ($changes{'uniquecode'}) {
- foreach my $crstype (keys(%{$confhash{'uniquecode'}})) {
- unless ($domconfig{$action}{'uniquecode'}{$crstype}) {
- $changes{'uniquecode'} = 1;
- }
- }
- }
- } else {
- $changes{'uniquecode'} = 1;
- }
- } elsif (ref($confhash{'uniquecode'}) eq 'HASH') {
- $changes{'uniquecode'} = 1;
+ if ($domconfig{$action}{'uniquecode'}) {
+ unless ($confhash{'uniquecode'}) {
+ $changes{'uniquecode'} = 1;
+ }
+ } else {
+ if ($confhash{'uniquecode'}) {
+ $changes{'uniquecode'} = 1;
+ }
}
if ($context eq 'requestcourses') {
if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') {
@@ -6223,7 +6216,7 @@ sub modify_quotas {
if ($confhash{'notify'}{'approval'}) {
$changes{'notify'}{'approval'} = 1;
}
- if (ref($confhash{'uniquecode'} eq 'HASH')) {
+ if ($confhash{'uniquecode'}) {
$changes{'uniquecode'} = 1;
}
}
@@ -6551,15 +6544,10 @@ sub modify_quotas {
if ($action eq 'requestcourses') {
my @offon = ('off','on');
if ($changes{'uniquecode'}) {
- if (ref($confhash{'uniquecode'}) eq 'HASH') {
- my $codestr = join(' ',map{ &mt($_); } sort(keys(%{$confhash{'uniquecode'}})));
- $resulttext .= ''.
- &mt('Generation of six character code as course identifier for distribution to students set to on for: [_1].',''.$codestr.'').
- '';
- } else {
- $resulttext .= ''.&mt('Generation of six character code as course identifier for distribution to students set to off.').
- '';
- }
+ $resulttext .= ''.
+ &mt('Generation of six character code as course identifier for distribution to students set to '.
+ $offon[$env{'form.uniquecode'}]).
+ '';
}
if (ref($changes{'textbooks'}) eq 'HASH') {
$resulttext .= ''.&mt('Available textbooks updated').'