--- loncom/interface/lonmsgdisplay.pm 2006/05/30 20:09:25 1.30 +++ loncom/interface/lonmsgdisplay.pm 2006/06/27 18:34:43 1.33 @@ -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.33 2006/06/27 18:34:43 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.')); } @@ -976,10 +976,7 @@ $content{'sendername'}.':'. } # Check to see if there were any messages. if ($result eq '') { - my $lctype = 'course'; - if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { - $lctype = lc($env{'course.'.$env{'request.course.id'}.'.type'}); - } + my $lctype = lc(&Apache::loncommon::course_type()); if ($target ne 'tex') { $r->print("

".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."

"); } else { @@ -1012,12 +1009,9 @@ sub facetoface { $r->print('Not allowed'); return; } - my $crstype = 'Course'; - my $leaders = 'faculty and staff'; - if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { - $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; - $leaders = 'coordinators and leaders'; - } + my $crstype = &Apache::loncommon::course_type(); + my $leaders = ($crstype eq 'Group') ? 'coordinators and leaders' + : 'faculty and staff'; &printheader($r, '/adm/email?recordftf=query', "User Notes, Face-to-Face, Critical Messages, Broadcast Messages"); @@ -1058,13 +1052,9 @@ ENDTREC ($env{'form.recdomain'}) && ($env{'form.recuname'})) { chomp($env{'form.newrecord'}); if ($env{'form.newrecord'}) { - my $recordtxt = $env{'form.newrecord'}; - &Apache::lonmsg::user_normal_msg_raw( - $env{'course.'.$env{'request.course.id'}.'.num'}, - $env{'course.'.$env{'request.course.id'}.'.domain'}, - &mt('Record'). - ' ['.$env{'form.recuname'}.':'.$env{'form.recdomain'}.']', - $recordtxt); + &Apache::lonmsg::store_instructor_comment($env{'form.newrecord'}, + $env{'form.recuname'}, + $env{'form.recdomain'}); } $r->print('

'.&Apache::loncommon::plainname($env{'form.recuname'}, $env{'form.recdomain'}).'

'); @@ -1096,10 +1086,8 @@ sub examblock { $r->print('Not allowed'); return; } - my $usertype = 'students'; - if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Group') { - $usertype = 'members'; - } + my $usertype = (&Apache::loncommon::course_type() eq 'Group') ? 'members', + : 'students'; my %lt=&Apache::lonlocal::texthash( 'comb' => 'Communication Blocking', 'cbds' => 'Communication blocking during scheduled exams', @@ -1435,10 +1423,7 @@ sub displaymessage { my $startblock = 0; my $endblock = 0; my $numblocked = 0; - my $crstype = 'Course'; - if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { - $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; - } + my $crstype = &Apache::loncommon::course_type(); # info to generate "next" and "previous" buttons and check if message is blocked &blockcheck(\%setters,\$startblock,\$endblock);