version 1.64, 2009/07/17 22:24:08
|
version 1.65, 2009/09/05 17:20:58
|
Line 508 ENDTWO
|
Line 508 ENDTWO
|
} elsif ($action eq "notify") { |
} elsif ($action eq "notify") { |
my $notifycount = 0; |
my $notifycount = 0; |
my @notified = split(/,/,$enrollvar{notifylist}); |
my @notified = split(/,/,$enrollvar{notifylist}); |
my @domcoord; |
my (@domcoord,@showdom,@olddomcoord,@futuredomcoord); |
my @showdom; |
|
for (my $i=0; $i<@notified; $i++) { |
for (my $i=0; $i<@notified; $i++) { |
if ($notified[$i] !~ /:/) { |
if ($notified[$i] !~ /:/) { |
$notified[$i] =~ s/\@/:/; |
$notified[$i] =~ s/\@/:/; |
Line 522 ENDTWO
|
Line 521 ENDTWO
|
} else { |
} else { |
$noteset = "OFF"; |
$noteset = "OFF"; |
} |
} |
|
my $now = time; |
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']); |
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']); |
foreach my $server (keys(%dompersonnel)) { |
foreach my $server (keys(%dompersonnel)) { |
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user); |
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user); |
if (!grep(/^$uname:$udom$/,@domcoord)) { |
my ($end,$start) = split(':',$dompersonnel{$server}{$user}); |
push(@domcoord,$uname.':'.$udom); |
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); |
|
} |
} |
} |
} |
} |
} |
} |
Line 565 ENDTWO
|
Line 578 ENDTWO
|
my %pname; |
my %pname; |
my %notifystate; |
my %notifystate; |
my %status; |
my %status; |
my $now = time; |
|
foreach my $person (sort(keys(%coursepersonnel))) { |
foreach my $person (sort(keys(%coursepersonnel))) { |
my $match = 0; |
my $match = 0; |
my ($role,$user,$usec) = ($person =~ /^([^:]+):([^:]+:[^:]+):([^:]*)/); |
my ($role,$user,$usec) = ($person =~ /^([^:]+):([^:]+:[^:]+):([^:]*)/); |
Line 601 ENDTWO
|
Line 613 ENDTWO
|
usnm => 'username:domain', |
usnm => 'username:domain', |
coac => 'Course Access', |
coac => 'Course Access', |
curn => 'Current notification status', |
curn => 'Current notification status', |
|
doms => 'Domain Coordinator status', |
notf => 'Notification?', |
notf => 'Notification?', |
ntac => 'Notification active', |
ntac => 'Notification active', |
ntin => 'Notification inactive', |
ntin => 'Notification inactive', |
Line 630 ENDTWO
|
Line 643 ENDTWO
|
if (grep(/^$viewer$/,@domcoord)) { |
if (grep(/^$viewer$/,@domcoord)) { |
$showalldc = 1; |
$showalldc = 1; |
} |
} |
foreach my $dc (@domcoord) { |
foreach my $dc (@domcoord,@futuredomcoord) { |
if (!grep(/^$dc$/,@ccs)) { |
if (!grep(/^$dc$/,@ccs)) { |
if (grep(/^$dc$/,@notified)) { |
if (grep(/^$dc$/,@notified)) { |
$notifystate{$dc} = 1; |
$notifystate{$dc} = 1; |
Line 645 ENDTWO
|
Line 658 ENDTWO
|
push(@showdom,$dc); |
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); |
my $showdomnum = scalar(@showdom); |
if ($showdomnum) { |
if ($showdomnum) { |
$r->print(" |
$r->print(" |
Line 662 ENDTWO
|
Line 685 ENDTWO
|
</tr> |
</tr> |
<tr> |
<tr> |
<td>"); |
<td>"); |
$r->print(¬ifier_tables('dc',\%lt,\@showdom,\%status,\%notifystate, |
$r->print(¬ifier_tables('dc',\%lt,\@showdom,\%status,\%notifystate,\%pname, |
\%pname,\$notifyshow)); |
\$notifyshow,\@olddomcoord,\@futuredomcoord)); |
$r->print(" |
$r->print(" |
</td> |
</td> |
</tr>"); |
</tr>"); |
Line 1230 END
|
Line 1253 END
|
} |
} |
|
|
sub notifier_tables { |
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(); |
my $output = &Apache::loncommon::start_data_table(); |
$output .= &Apache::loncommon::start_data_table_header_row(); |
$output .= &Apache::loncommon::start_data_table_header_row(); |
$output .= "<th>$$lt{name}</th> |
$output .= "<th>$$lt{name}</th> |
<th>$$lt{usnm}</th>"; |
<th>$$lt{usnm}</th>"; |
if ($role eq 'cc') { |
if ($role eq 'dc') { |
|
$output .= "<th>$$lt{doms}</th>"; |
|
} elsif ($role eq 'cc') { |
$output .= "<th>$$lt{coac}</th>"; |
$output .= "<th>$$lt{coac}</th>"; |
} |
} |
$output .= "<th>$$lt{curn}</th> |
$output .= "<th>$$lt{curn}</th> |
Line 1246 sub notifier_tables {
|
Line 1272 sub notifier_tables {
|
$output .= '<td>'.$$pname{$$users[$i]}.'</td>'. |
$output .= '<td>'.$$pname{$$users[$i]}.'</td>'. |
'<td><input type="hidden" name="notifyname_'.$$notifyshow. |
'<td><input type="hidden" name="notifyname_'.$$notifyshow. |
'" value="'.$$users[$i].'" />'.$$users[$i].'</td>'; |
'" value="'.$$users[$i].'" />'.$$users[$i].'</td>'; |
if ($role eq 'cc') { |
if ($role eq 'dc') { |
|
$output .= '<td>'; |
|
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 .= '</td>'; |
|
} elsif ($role eq 'cc') { |
$output .= '<td>'.$$status{$$users[$i]}.'</td>'; |
$output .= '<td>'.$$status{$$users[$i]}.'</td>'; |
} |
} |
$output .= '<td>'; |
$output .= '<td>'; |