--- loncom/interface/lonmsgdisplay.pm 2006/04/25 23:12:34 1.16
+++ loncom/interface/lonmsgdisplay.pm 2006/05/01 05:57:26 1.20
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.16 2006/04/25 23:12:34 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.20 2006/05/01 05:57:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -261,13 +261,18 @@ sub movemsg {
sub discourse {
my $r=shift;
my $classlist = &Apache::loncoursedata::get_classlist();
- my $now=time;
+ my ($classgroups,$studentgroups) =
+ &Apache::loncoursedata::get_group_memberships($classlist);
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All',
'cfs' => 'Check Section/Group',
'cfn' => 'Uncheck All');
+ if (defined($env{'form.group'})) {
+ $r->print(' '."\n");
+ }
$r->print(<
-
-
+
ENDDISHEADER
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles();
- $r->print('
');
- my $sort = sub {
- my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]);
- if (!$aname) { $aname=$a; }
- my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]);
- if (!$bname) { $bname=$b; }
- return $aname cmp $bname;
- };
- foreach my $student (sort $sort (keys(%{$classlist}))) {
- my $info=$classlist->{$student};
- my ($sname,$sdom,$status,$fullname,$section) =
- (@{$info}[&Apache::loncoursedata::CL_SNAME(),
- &Apache::loncoursedata::CL_SDOM(),
- &Apache::loncoursedata::CL_STATUS(),
- &Apache::loncoursedata::CL_FULLNAME(),
- &Apache::loncoursedata::CL_SECTION()]);
- next if ($status ne 'Active');
- next if ($env{'request.course.sec'} &&
- $section ne $env{'request.course.sec'});
- my $key = 'send_to_&&&'.$section.'&&&_'.$student;
- if (! defined($fullname) || $fullname eq '') { $fullname = $sname; }
- $r->print(''.
- qq{ }.(' 'x2).
- $fullname.' '.$sname.':'.$sdom.' '.$section.
- ' ');
+ $r->print(&Apache::loncommon::start_data_table());
+ if (keys(%coursepersonnel) > 0) {
+ $r->print('Non-students ');
+ $r->print(&Apache::loncommon::start_data_table());
+ $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print('Name Username:Domain Role ');
+ $r->print(&Apache::loncommon::end_data_table_row());
+ foreach my $role (sort keys %coursepersonnel) {
+ foreach (split(/\,/,$coursepersonnel{$role})) {
+ my ($puname,$pudom)=split(/\:/,$_);
+ $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print(''.
+ ' '.
+ &Apache::loncommon::plainname($puname,$pudom).
+ ' '.
+ '('.$_.'), '.$role.' ');
+ $r->print(&Apache::loncommon::end_data_table_row());
+ }
+ }
+ $r->print(&Apache::loncommon::end_data_table());
+ }
+ if (keys(%{$classlist}) > 0) {
+ $r->print('Students ');
+ $r->print(&Apache::loncommon::start_data_table());
+ $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print('Name Username:Domain Section Groups ');
+ $r->print(&Apache::loncommon::end_data_table_row());
+ my $sort = sub {
+ my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]);
+ if (!$aname) { $aname=$a; }
+ my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]);
+ if (!$bname) { $bname=$b; }
+ return $aname cmp $bname;
+ };
+ foreach my $student (sort $sort (keys(%{$classlist}))) {
+ my $info=$classlist->{$student};
+ my ($sname,$sdom,$status,$fullname,$section) =
+ (@{$info}[&Apache::loncoursedata::CL_SNAME(),
+ &Apache::loncoursedata::CL_SDOM(),
+ &Apache::loncoursedata::CL_STATUS(),
+ &Apache::loncoursedata::CL_FULLNAME(),
+ &Apache::loncoursedata::CL_SECTION()]);
+ next if ($status ne 'Active');
+ next if ($env{'request.course.sec'} &&
+ $section ne $env{'request.course.sec'});
+ my @studentsgroups = &Apache::loncoursedata::get_students_groups(
+ $student,$status,$classgroups);
+ my $grouplist = join(', ',@studentsgroups);
+ my $key = 'send_to_&&&'.$section.'&&&_'.$student;
+ if (! defined($fullname) || $fullname eq '') {$fullname = $sname;}
+ my $checked = '';
+ my $groupcount = 0;
+ my $groupitems;
+ $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print('');
+ foreach my $group (@studentsgroups) {
+ $groupcount ++;
+ $groupitems .= (' ');
+ if (defined($env{'form.group'})) {
+ if ($env{'form.group'} eq $group) {
+ $checked = 'checked=checked';
+ }
+ }
+ }
+ $r->print(qq{ }.
+ (' 'x2).$fullname.' '.$groupitems.
+ ''.$sname.':'.$sdom.' '.$section.
+ ' '.$grouplist.' ');
+ $r->print(&Apache::loncommon::end_data_table_row());
+ }
+ $r->print(&Apache::loncommon::end_data_table());
}
- $r->print('
');
}
# ==================================================== Display Critical Message
@@ -1291,8 +1338,8 @@ sub display_blocker_status {
'modi' => 'Modify',
'canc' => 'Cancel',
);
+ $r->print(&Apache::loncommon::start_data_table());
$r->print(<<"END");
-
$$ltext{'dura'}
$$ltext{'setb'}
@@ -1300,26 +1347,27 @@ sub display_blocker_status {
$$ltext{'actn'}?
END
- foreach (sort keys %{$records}) {
- my $iter = $parmcount%2;
+ foreach my $record (sort(keys(%{$records}))) {
my $onchange = 'onFocus="javascript:window.document.forms['.
"'blockform'].elements['modify_".$parmcount."'].".
'checked=true;"';
- my ($start,$end) = split/____/,$_;
+ my ($start,$end) = split(/____/,$record);
my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
- my ($setuname,$setudom,$title) = &parse_block_record($$records{$_});
+ my ($setuname,$setudom,$title) =
+ &parse_block_record($$records{$record});
+ $title = &HTML::Entities::encode($title,'"<>');
my $settername = &Apache::loncommon::plainname($setuname,$setudom);
+ $r->print(&Apache::loncommon::start_data_table_row());
$r->print(<<"END");
-
$$ltext{'star'}: $startform $$ltext{'endd'}: $endform
$settername
-
+
$lt{'modi'}? $lt{'canc'}?
-
END
- $parmcount ++;
+ $r->print(&Apache::loncommon::end_data_table_row());
+ $parmcount++;
}
$r->print(<<"END");
@@ -1358,19 +1406,23 @@ sub display_addblocker_table {
);
$r->print(<<"END");
$lt{'addn'}
-
END
+ $r->print(&Apache::loncommon::end_data_table_row());
+ $r->print(&Apache::loncommon::end_data_table());
return;
}
@@ -1388,12 +1440,9 @@ sub blockcheck {
# for students.
return if (!%live_courses);
- &Apache::lonnet::logthis("hmm");
- &Apache::lonnet::logthis(join(" ",%live_courses));
- &Apache::lonnet::logthis(join(" ",%staff_of));
-
foreach my $course (keys(%live_courses)) {
- my ($cdom,$cnum) = split(/_/,$course);
+ my $cdom = $env{'course.'.$course.'.domain'};
+ my $cnum = $env{'course.'.$course.'.num'};
# if they are a staff member and are currently not playing student
next if ( $staff_of{$course}
@@ -1428,31 +1477,35 @@ sub build_block_table {
'cour' => 'Course',
'dura' => 'Duration',
'blse' => 'Block set by'
- );
+ );
+ $r->print(<<"END");
+ $lt{'cacb'}:
+END
+ $r->print(&Apache::loncommon::start_data_table());
$r->print(<<"END");
- $lt{'cacb'}:
-
$lt{'cour'}
$lt{'dura'}
$lt{'blse'}
END
- foreach (keys %{$setters}) {
- my %courseinfo=&Apache::lonnet::coursedescription($_);
- for (my $i=0; $i<@{$$setters{$_}{staff}}; $i++) {
- my ($uname,$udom) = @{$$setters{$_}{staff}[$i]};
+ foreach my $course (keys(%{$setters})) {
+ my %courseinfo=&Apache::lonnet::coursedescription($course);
+ for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
+ my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
my $fullname = &Apache::loncommon::plainname($uname,$udom);
- my ($openblock,$closeblock) = @{$$setters{$_}{times}[$i]};
+ my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
$openblock = &Apache::lonlocal::locallocaltime($openblock);
$closeblock= &Apache::lonlocal::locallocaltime($closeblock);
- $r->print(''.$courseinfo{'description'}.' '.
+ $r->print(&Apache::loncommon::start_data_table_row().
+ ''.$courseinfo{'description'}.' '.
''.$openblock.' to '.$closeblock.' '.
''.$fullname.' ('.$uname.':'.$udom.
- ') ');
+ ')'.
+ &Apache::loncommon::end_data_table_row());
}
}
- $r->print('
');
+ $r->print(&Apache::loncommon::end_data_table());
}
# ----------------------------------------------------------- Display a message
@@ -1852,7 +1905,7 @@ sub handler {
['display','replyto','forward','markread','markdel','markunread',
'sendreply','compose','sendmail','critical','recname','recdom',
'recordftf','sortedby','block','folder','startdis','interdis',
- 'showcommentbaseurl','dismode']);
+ 'showcommentbaseurl','dismode','group']);
$sqs='&sortedby='.$env{'form.sortedby'};
# ------------------------------------------------------ They checked for email