--- loncom/interface/domainprefs.pm 2010/03/10 17:26:05 1.102.2.10
+++ loncom/interface/domainprefs.pm 2010/03/11 02:51:44 1.102.2.11
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.102.2.10 2010/03/10 17:26:05 raeburn Exp $
+# $Id: domainprefs.pm,v 1.102.2.11 2010/03/11 02:51:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1642,7 +1642,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') {
@@ -1661,6 +1661,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'};
}
@@ -1691,8 +1703,16 @@ sub print_autoenroll {
&mt('username').': '.
' '.&mt('domain').
- ': '.$domform.'';
- $$rowtotal += 2;
+ ': '.$domform.''.
+ '
'.
+ ''.&mt('Automatically assign co-ownership').' | '.
+ ' '.
+ ' | '.
+ '
';
+ $$rowtotal += 3;
return $datatable;
}
@@ -4478,7 +4498,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'};
@@ -4487,11 +4508,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,
-
+ 'co-owners' => $coowners,
}
);
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash,
@@ -4512,6 +4534,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'}) {
@@ -4524,6 +4553,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');