--- loncom/interface/lonmsgdisplay.pm 2006/05/30 20:09:25 1.30
+++ loncom/interface/lonmsgdisplay.pm 2006/07/19 16:01:45 1.35.2.4
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.30 2006/05/30 20:09:25 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.35.2.4 2006/07/19 16:01:45 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -217,7 +217,7 @@ sub movemsg {
# Copy message
my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]);
if (!exists($message{$msgid}) || $message{$msgid} eq '') {
- if (&Apache::slotrequest::network_error(%message)) {
+ if (&Apache::lonnet::error(%message)) {
return (0,&mt('Message not moved, A network error occurred.'));
} else {
return (0,&mt('Message not moved as the message is no longer in the source folder.'));
@@ -226,7 +226,7 @@ sub movemsg {
my $result =&Apache::lonnet::put('nohist_email'.$trgsuffix,
{$msgid => $message{$msgid}});
- if (&Apache::slotrequest::network_error($result)) {
+ if (&Apache::lonnet::error($result)) {
return (0,&mt('Message not moved, A network error occurred.'));
}
@@ -234,12 +234,12 @@ sub movemsg {
unless ($trgfolder eq 'trash') {
my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]);
# a non-existant status is the mark of an unread msg
- if (&Apache::slotrequest::network_error(%status)) {
+ if (&Apache::lonnet::error(%status)) {
return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));
}
my $result=&Apache::lonnet::put('email_status'.$trgsuffix,
{$msgid => $status{$msgid}});
- if (&Apache::slotrequest::network_error($result)) {
+ if (&Apache::lonnet::error($result)) {
return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));
}
}
@@ -249,10 +249,10 @@ sub movemsg {
&Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]);
my $result_del_stat =
&Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]);
- if (&Apache::slotrequest::network_error($result_del_msg)) {
+ if (&Apache::lonnet::error($result_del_msg)) {
return (0,&mt('Message copied, but unable to delete the original from the source folder.'));
}
- if (&Apache::slotrequest::network_error($result_del_stat)) {
+ if (&Apache::lonnet::error($result_del_stat)) {
return (0,&mt('Message copied, but unable to delete the original status from the source folder.'));
}
@@ -290,6 +290,191 @@ sub discourse {
return $result;
}
+sub disgroup {
+ my ($cdom,$cnum,$group,$viewgrps,$editgrps) = @_;
+ my $result;
+ # Needs to be in a course
+ if (!($env{'request.course.fn'})) {
+ $result = &mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.');
+ return $result;
+ }
+ if ($cdom eq '' || $cnum eq '') {
+ $result = &mt('Error: could not determine domain or number of course');
+ return $result;
+ }
+ my ($memberinfo,$numitems) =
+ &Apache::longroup::group_memberlist($cdom,$cnum,$group,{},[]);
+ my @statustypes = ('active');
+ if ($viewgrps || $editgrps) {
+ push(@statustypes,('future','previous'));
+ }
+ if (keys(%{$memberinfo}) == 0) {
+ $result = &mt('As this group has no members, there are no '.
+ 'recipients to select.');
+ return $result;
+ } else {
+ $result = &mt('Select message recipients from the group members listed below.
');
+ my %Sortby = (
+ active => {},
+ previous => {},
+ future => {},
+ );
+ my %lt = &Apache::lonlocal::texthash(
+ 'name' => 'Name',
+ 'usnm' => 'Username',
+ 'doma' => 'Domain',
+ 'active' => 'Active Members',
+ 'previous' => 'Former Members',
+ 'future' => 'Future Members',
+ );
+ foreach my $user (sort(keys(%{$memberinfo}))) {
+ my $status = $$memberinfo{$user}{status};
+ if ($env{'form.'.$status.'.sortby'} eq 'fullname') {
+ push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user);
+ } elsif ($env{'form.'.$status.'.sortby'} eq 'username') {
+ push(@{$Sortby{$status}{$$memberinfo{$user}{uname}}},$user);
+ } elsif ($env{'form.'.$status.'.sortby'} eq 'domain') {
+ push(@{$Sortby{$status}{$$memberinfo{$user}{udom}}},$user);
+ } else {
+ push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user);
+ }
+ }
+ $result .= &group_check_uncheck();
+ $result .= '
'.
+ ' '. + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(); + $result .= " | $lt{'name'} | ". + "$lt{'usnm'} | ". + "$lt{'doma'} | ". + &Apache::loncommon::end_data_table_header_row(); + foreach my $key (sort(keys(%{$Sortby{$status}}))) { + foreach my $user (@{$Sortby{$status}{$key}}) { + $result .= + &Apache::loncommon::start_data_table_row(). + ''. + $$memberinfo{$user}{'fullname'}.' | '. + ''.$$memberinfo{$user}{'uname'}.' | '. + ''.$$memberinfo{$user}{'udom'}.' | '. + &Apache::loncommon::end_data_table_row(); + } + } + $result .= &Apache::loncommon::end_data_table(); + } + } + $result .= ''; + } + $result .= ' |
---|