--- loncom/interface/lonpopulate.pm 2009/03/25 15:49:47 1.58
+++ loncom/interface/lonpopulate.pm 2010/01/22 13:20:04 1.62.4.2
@@ -1,5 +1,5 @@
# automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.58 2009/03/25 15:49:47 bisitz Exp $
+# $Id: lonpopulate.pm,v 1.62.4.2 2010/01/22 13:20:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -370,13 +370,13 @@ ENDONE
ENDTWO
if ($enrollvar{autoadds}) {
$r->print("
- Enable
+ Enable
Disable
");
} else {
$r->print("
Enable
- Disable
+ Disable
");
}
$r->print("
@@ -387,12 +387,12 @@ ENDTWO
Removals based on classlist changes: ");
if ($enrollvar{autodrops}) {
$r->print("
- Enable
+ Enable
Disable ");
} else {
$r->print("
Enable
- Disable ");
+ Disable ");
}
$r->print("
@@ -508,8 +508,7 @@ ENDTWO
} elsif ($action eq "notify") {
my $notifycount = 0;
my @notified = split(/,/,$enrollvar{notifylist});
- my @domcoord;
- my @showdom;
+ my (@domcoord,@showdom,@olddomcoord,@futuredomcoord);
for (my $i=0; $i<@notified; $i++) {
if ($notified[$i] !~ /:/) {
$notified[$i] =~ s/\@/:/;
@@ -522,12 +521,26 @@ ENDTWO
} else {
$noteset = "OFF";
}
+ my $now = time;
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']);
foreach my $server (keys(%dompersonnel)) {
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) {
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);
- if (!grep(/^$uname:$udom$/,@domcoord)) {
- push(@domcoord,$uname.':'.$udom);
+ my ($end,$start) = split(':',$dompersonnel{$server}{$user});
+ if (($end eq '') || ($end == 0) || ($end > $now)) {
+ if ($start > $now) {
+ if (!grep(/^\Q$uname\E:\Q$udom\E$/,@futuredomcoord)) {
+ push(@futuredomcoord,$uname.':'.$udom);
+ }
+ } else {
+ if (!grep(/^\Q$uname\E:\Q$udom\E$/,@domcoord)) {
+ push(@domcoord,$uname.':'.$udom);
+ }
+ }
+ } else {
+ if (!grep(/^\Q$uname\E:\Q$udom\E$/,@olddomcoord)) {
+ push(@olddomcoord,$uname.':'.$udom);
+ }
}
}
}
@@ -547,13 +560,13 @@ ENDTWO
");
if ($notifycount) {
$r->print("
- Yes
+ Yes
No
");
} else {
$r->print("
Yes
- No
+ No
");
}
$r->print("
@@ -565,7 +578,6 @@ ENDTWO
my %pname;
my %notifystate;
my %status;
- my $now = time;
foreach my $person (sort(keys(%coursepersonnel))) {
my $match = 0;
my ($role,$user,$usec) = ($person =~ /^([^:]+):([^:]+:[^:]+):([^:]*)/);
@@ -601,6 +613,7 @@ ENDTWO
usnm => 'username:domain',
coac => 'Course Access',
curn => 'Current notification status',
+ doms => 'Domain Coordinator status',
notf => 'Notification?',
ntac => 'Notification active',
ntin => 'Notification inactive',
@@ -630,7 +643,7 @@ ENDTWO
if (grep(/^$viewer$/,@domcoord)) {
$showalldc = 1;
}
- foreach my $dc (@domcoord) {
+ foreach my $dc (@domcoord,@futuredomcoord) {
if (!grep(/^$dc$/,@ccs)) {
if (grep(/^$dc$/,@notified)) {
$notifystate{$dc} = 1;
@@ -645,6 +658,16 @@ ENDTWO
push(@showdom,$dc);
}
}
+ foreach my $olddc (@olddomcoord) {
+ if (grep(/^$olddc$/,@notified)) {
+ if (!grep(/^\Q$olddc\E$/,@ccs)) {
+ $notifystate{$olddc} = 1;
+ my ($dcname,$dcdom) = split(/:/,$olddc);
+ $pname{$olddc} = &Apache::loncommon::plainname($dcname,$dcdom);
+ push(@showdom,$olddc);
+ }
+ }
+ }
my $showdomnum = scalar(@showdom);
if ($showdomnum) {
$r->print("
@@ -662,8 +685,8 @@ ENDTWO
");
- $r->print(¬ifier_tables('dc',\%lt,\@showdom,\%status,\%notifystate,
- \%pname,\$notifyshow));
+ $r->print(¬ifier_tables('dc',\%lt,\@showdom,\%status,\%notifystate,\%pname,
+ \$notifyshow,\@olddomcoord,\@futuredomcoord));
$r->print("
");
@@ -734,9 +757,9 @@ ENDTWO
my $colflag = $i%2;
$r->print(&Apache::loncommon::start_data_table_row());
$r->print("
-
+
$xl
-
+
");
$r->print(&Apache::loncommon::end_data_table_row());
}
@@ -825,7 +848,7 @@ ENDTWO
$r->print("Enrollment inactive");
}
if ($shrflag) {
- $r->print(" ");
+ $r->print(" ");
} else {
$r->print(" ");
}
@@ -874,7 +897,7 @@ ENDTWO
my $colflag = $j%2;
$r->print(&Apache::loncommon::start_data_table_row());
$r->print("
-
+
$currsections[$j]
");
@@ -931,13 +954,13 @@ ENDTWO
");
if ($enrollvar{showphoto}) {
$r->print("
- Yes
+ Yes
No
");
} else {
$r->print("
Yes
- No
+ No
");
}
$r->print('
@@ -1088,14 +1111,14 @@ Note: Any students previously added manu
if ($update) {
$r->print(' '.$commentary.'
');
} else {
$r->print(&mt('Update of photos via the Automated Enrollment Manager is unavailable in this domain.')
- .' ');
+ .' ');
}
} else {
$r->print('Update of photos is unavailable, as import of student photos is currently disabled. Enable this first via: '.$$tasktitleref{'photos'}.' ');
@@ -1132,7 +1155,8 @@ onclick="javascript:document.photoupdate
my ($indexhash,$keylist) = &Apache::lonuserutils::make_keylist_array();
my $classlist = &Apache::loncoursedata::get_classlist();
my $secidx = &Apache::loncoursedata::CL_SECTION();
- my ($permission,$allowed) = &Apache::lonuserutils::get_permission();
+ my $crstype =&Apache::loncommon::course_type();
+ my ($permission,$allowed) = &Apache::lonuserutils::get_permission('course',$crstype);
foreach my $student (keys(%{$classlist})) {
if (exists($permission->{'view_section'})) {
if ($classlist->{$student}[$secidx] ne $permission->{'view_section'}) {
@@ -1230,14 +1254,17 @@ END
}
sub notifier_tables {
- my ($role,$lt,$users,$status,$notifystate,$pname,$notifyshow) = @_;
+ my ($role,$lt,$users,$status,$notifystate,$pname,$notifyshow,$olddomcoord,
+ $futuredomcoord) = @_;
my $output = &Apache::loncommon::start_data_table();
$output .= &Apache::loncommon::start_data_table_header_row();
$output .= "$$lt{name}
$$lt{usnm} ";
- if ($role eq 'cc') {
+ if ($role eq 'dc') {
+ $output .= "$$lt{doms} ";
+ } elsif ($role eq 'cc') {
$output .= "$$lt{coac} ";
- }
+ }
$output .= "$$lt{curn}
$$lt{notf} ";
$output .= &Apache::loncommon::end_data_table_header_row();
@@ -1246,7 +1273,19 @@ sub notifier_tables {
$output .= ''.$$pname{$$users[$i]}.' '.
' '.$$users[$i].' ';
- if ($role eq 'cc') {
+ if ($role eq 'dc') {
+ $output .= '';
+ if ((ref($olddomcoord) eq 'ARRAY') && (ref($futuredomcoord) eq 'ARRAY')) {
+ if (grep(/^\Q$users->[$i]\E$/,@{$olddomcoord})) {
+ $output .= &mt('expired');
+ } elsif (grep(/^\Q$users->[$i]\E$/,@{$futuredomcoord})) {
+ $output .= &mt('future');
+ } else {
+ $output .= &mt('active');
+ }
+ }
+ $output .= ' ';
+ } elsif ($role eq 'cc') {
$output .= ''.$$status{$$users[$i]}.' ';
}
$output .= '';
@@ -2413,10 +2452,10 @@ function agreement_result(caller) {
-
-
-
-
+
+
+
+
';
} else {
@@ -2471,10 +2510,10 @@ sub print_photos_response {
if ($update) {
$response .= ' '.$commentary.'
';
}
}