--- loncom/interface/lonmsgdisplay.pm 2006/04/22 17:10:07 1.4
+++ loncom/interface/lonmsgdisplay.pm 2006/05/01 16:17:56 1.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.4 2006/04/22 17:10:07 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.21 2006/05/01 16:17:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -184,8 +184,9 @@ sub statuschange {
&Apache::lonnet::put('email_status'.$suffix,{$msgid => $newstatus});
}
if ($newstatus eq 'deleted') {
- &movemsg(&Apache::lonnet::unescape($msgid),$folder,'trash');
- }
+ return &movemsg($msgid,$folder,'trash');
+ }
+ return ;
}
# ============================================================= Make new folder
@@ -206,19 +207,53 @@ sub movemsg {
if ($srcfolder eq 'new') { $srcfolder=''; }
my $srcsuffix=&Apache::lonmsg::foldersuffix($srcfolder);
my $trgsuffix=&Apache::lonmsg::foldersuffix($trgfolder);
+ if ($srcsuffix eq $trgsuffix) {
+ return (0,&mt('Message not moved, Attempted to move message to the same folder as it already is in.'));
+ }
# Copy message
my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]);
- &Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}});
+ if (!exists($message{$msgid}) || $message{$msgid} eq '') {
+ if (&Apache::slotrequest::network_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.'));
+ }
+ }
+
+ my $result =&Apache::lonnet::put('nohist_email'.$trgsuffix,
+ {$msgid => $message{$msgid}});
+ if (&Apache::slotrequest::network_error($result)) {
+ return (0,&mt('Message not moved, A network error occurred.'));
+ }
# Copy status
unless ($trgfolder eq 'trash') {
- my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]);
- &Apache::lonnet::put('email_status'.$trgsuffix,{$msgid => $status{$msgid}});
+ 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)) {
+ 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)) {
+ return (0,&mt('Message copied to new folder but status was not, A network error occurred.'));
+ }
}
+
# Delete orginals
- &Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]);
- &Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]);
+ my $result_del_msg =
+ &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)) {
+ return (0,&mt('Message copied, but unable to delete the original from the source folder.'));
+ }
+ if (&Apache::slotrequest::network_error($result_del_stat)) {
+ return (0,&mt('Message copied, but unable to delete the original status from the source folder.'));
+ }
+
+ return (1);
}
# ======================================================= Display a course list
@@ -226,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('
'. - ' | ('.$_.'), | '.$role.' |
'.$sname.'@'.$sdom.' | '.$section. - ' | ||
Name | Username:Domain | Role | '. + ' | ('.$user.'), | '.$role.' | '); + $r->print(&Apache::loncommon::end_data_table_row()); + } + } + $r->print(&Apache::loncommon::end_data_table()); + } + if (keys(%{$classlist}) > 0) { + $r->print('
---|---|---|---|
Name | Username:Domain | Section | Groups | '.$groupitems. + ' | '.$sname.':'.$sdom.' | '.$section. + ' | '.$grouplist.' | '); + $r->print(&Apache::loncommon::end_data_table_row()); + } + $r->print(&Apache::loncommon::end_data_table()); } - $r->print('