--- loncom/interface/domainprefs.pm 2010/03/03 16:43:41 1.128
+++ loncom/interface/domainprefs.pm 2010/03/08 14:36:24 1.129
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.128 2010/03/03 16:43:41 raeburn Exp $
+# $Id: domainprefs.pm,v 1.129 2010/03/08 14:36:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1692,7 +1692,7 @@ sub print_courserequestmail {
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
- my ($defdom,$runon,$runoff);
+ my ($defdom,$runon,$runoff,$coownerson,$coownersoff);
if (ref($settings) eq 'HASH') {
if (exists($settings->{'run'})) {
if ($settings->{'run'} eq '0') {
@@ -1711,6 +1711,18 @@ sub print_autoenroll {
$runon = ' ';
}
}
+ if (exists($settings->{'co-owners'})) {
+ if ($settings->{'co-owners'} eq '0') {
+ $coownersoff = ' checked="checked" ';
+ $coownerson = ' ';
+ } else {
+ $coownerson = ' checked="checked" ';
+ $coownersoff = ' ';
+ }
+ } else {
+ $coownersoff = ' checked="checked" ';
+ $coownerson = ' ';
+ }
if (exists($settings->{'sender_domain'})) {
$defdom = $settings->{'sender_domain'};
}
@@ -1741,8 +1753,16 @@ sub print_autoenroll {
&mt('username').': '.
' '.&mt('domain').
- ': '.$domform.'';
- $$rowtotal += 2;
+ ': '.$domform.''.
+ '
'.
+ ''.&mt('Automatically assign co-ownership').' | '.
+ ' '.
+ ' | '.
+ '
';
+ $$rowtotal += 3;
return $datatable;
}
@@ -4635,7 +4655,8 @@ sub modify_autoenroll {
}
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
my %title = ( run => 'Auto-enrollment active',
- sender => 'Sender for notification messages');
+ sender => 'Sender for notification messages',
+ coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)');
my @offon = ('off','on');
my $sender_uname = $env{'form.sender_uname'};
my $sender_domain = $env{'form.sender_domain'};
@@ -4644,11 +4665,12 @@ sub modify_autoenroll {
} elsif ($sender_uname eq '') {
$sender_domain = '';
}
+ my $coowners = $env{'form.autoassign_coowners'};
my %autoenrollhash = (
- autoenroll => { run => $env{'form.autoenroll_run'},
- sender_uname => $sender_uname,
- sender_domain => $sender_domain,
-
+ autoenroll => { 'run' => $env{'form.autoenroll_run'},
+ 'sender_uname' => $sender_uname,
+ 'sender_domain' => $sender_domain,
+ 'co-owners' => $coowners,
}
);
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash,
@@ -4669,6 +4691,13 @@ sub modify_autoenroll {
if ($currautoenroll{'sender_domain'} ne $sender_domain) {
$changes{'sender'} = 1;
}
+ if ($currautoenroll{'co-owners'} ne '') {
+ if ($currautoenroll{'co-owners'} ne $coowners) {
+ $changes{'coowners'} = 1;
+ }
+ } elsif ($coowners) {
+ $changes{'coowners'} = 1;
+ }
if (keys(%changes) > 0) {
$resulttext = &mt('Changes made:').'';
if ($changes{'run'}) {
@@ -4681,6 +4710,10 @@ sub modify_autoenroll {
$resulttext .= '- '.&mt("$title{'sender'} set to [_1]",$sender_uname.':'.$sender_domain).'
';
}
}
+ if ($changes{'coowners'}) {
+ $resulttext .= '- '.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'
';
+ &Apache::loncommon::devalidate_domconfig_cache($dom);
+ }
$resulttext .= '
';
} else {
$resulttext = &mt('No changes made to auto-enrollment settings');