--- loncom/interface/domainprefs.pm 2013/12/24 21:59:36 1.217
+++ loncom/interface/domainprefs.pm 2013/12/25 20:43:46 1.218
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.217 2013/12/24 21:59:36 raeburn Exp $
+# $Id: domainprefs.pm,v 1.218 2013/12/25 20:43:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2022,14 +2022,28 @@ sub print_requestmail {
sub print_studentcode {
my ($settings,$rowtotal) = @_;
my $rownum = 0;
- 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;
+ 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;
}
sub print_textbookcourses {
@@ -6109,10 +6123,12 @@ sub modify_quotas {
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify');
@approvalnotify = sort(@approvalnotify);
$confhash{'notify'}{'approval'} = join(',',@approvalnotify);
- if ($env{'form.uniquecode'}) {
- $confhash{'uniquecode'} = 1;
- } else {
- $confhash{'uniquecode'} = '';
+ 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;
+ }
}
my ($newbook,@allpos);
if ($context eq 'requestcourses') {
@@ -6147,14 +6163,25 @@ sub modify_quotas {
$changes{'notify'}{'approval'} = 1;
}
}
- if ($domconfig{$action}{'uniquecode'}) {
- unless ($confhash{'uniquecode'}) {
- $changes{'uniquecode'} = 1;
- }
- } else {
- if ($confhash{'uniquecode'}) {
- $changes{'uniquecode'} = 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 ($context eq 'requestcourses') {
if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') {
@@ -6216,7 +6243,7 @@ sub modify_quotas {
if ($confhash{'notify'}{'approval'}) {
$changes{'notify'}{'approval'} = 1;
}
- if ($confhash{'uniquecode'}) {
+ if (ref($confhash{'uniquecode'} eq 'HASH')) {
$changes{'uniquecode'} = 1;
}
}
@@ -6544,10 +6571,15 @@ sub modify_quotas {
if ($action eq 'requestcourses') {
my @offon = ('off','on');
if ($changes{'uniquecode'}) {
- $resulttext .= ''.
- &mt('Generation of six character code as course identifier for distribution to students set to '.
- $offon[$env{'form.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.').
+ '';
+ }
}
if (ref($changes{'textbooks'}) eq 'HASH') {
$resulttext .= ''.&mt('Available textbooks updated').'