--- loncom/interface/lonmsgdisplay.pm 2006/12/23 18:27:28 1.58 +++ loncom/interface/lonmsgdisplay.pm 2007/01/17 18:05:57 1.64 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.58 2006/12/23 18:27:28 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.64 2007/01/17 18:05:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -774,7 +774,6 @@ sub sortedmessages { my ($blocked,$startblock,$endblock,$numblocked,$folder,$msgstatus) = @_; my $suffix=&Apache::lonmsg::foldersuffix($folder); my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix); - #unpack the varibles and repack into temp for sorting my @temp; my %descriptions; @@ -789,7 +788,7 @@ sub sortedmessages { foreach my $msgid (@messages) { my $esc_msgid=&escape($msgid); - my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)= + my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,$processid,$symb,$error) = &Apache::lonmsg::unpackmsgid($esc_msgid,$folder,undef, \%status_cache); next if ($msgstatus ne '' && $msgstatus ne $status); @@ -925,19 +924,11 @@ sub disfolder { nome => 'No messages have been selected to apply ths action to.', chec => 'Check the checkbox for at least one message.', ); + my $jscript = &Apache::loncommon::check_uncheck_jscript(); $r->print(< - function checkall() { - for (i=0; i 0) { + for (var i=0; i'); foreach my $item ($localsenttime,$dis_name,$dis_domain,$shortsubj) { $r->print(''.(($status eq 'new')?'':''). - ''. + ''. $item.(($status eq 'new')?'':'').''); } my $showstatus; @@ -1098,8 +1095,8 @@ ENDDISHEADER $r->print(''."\n". ''); } $r->print('
'. - '
'."\n". - ''."\n". + '
'."\n". + ''."\n". '
 '.&mt('Action').'
'."\n". '
'); + my $symb; + if (defined($content{'symb'})) { + $symb = $content{'symb'}; + } elsif (defined($content{'baseurl'})) { + $symb=&Apache::lonnet::symbread($content{'baseurl'}); + } if ($env{'user.adv'}) { $r->print(''); - my $symb=&Apache::lonnet::symbread($content{'baseurl'}); if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { $r->print(''); } @@ -2013,6 +2017,17 @@ sub displaymessage { ' ('.$content{'recuser'}[$i].' at '.$content{'recdomain'}[$i].') '; } $tolist = join(', ',@recipients); + my ($restitle,$baseurl,$refers_to); + if (defined($content{'resource_title'})) { + $restitle = $content{'resource_title'}; + } else { + if (defined($content{'baseurl'})) { + $restitle = &Apache::lonnet::gettitle($content{'baseurl'}); + } + } + if (defined($content{'baseurl'})) { + $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'}); + } $r->print('
'.&mt('Subject').': '.$content{'subject'}. ($folder ne 'sent'?'
'.&mt('From').': '. &Apache::loncommon::aboutmewrapper( @@ -2023,13 +2038,57 @@ sub displaymessage { $tolist). ($content{'courseid'}?'
'.&mt($crstype).': '.$courseinfo{'description'}. ($content{'coursesec'}?' ('.&mt('Section').': '.$content{'coursesec'}.')':''):''). - '
'.&mt('Time').': '.$content{'time'}. - ($content{'baseurl'}?'
'.&mt('Refers to').':'. - $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')':''). - '

'.
+	      '
'.&mt('Time').': '.$content{'time'}); + if ($baseurl) { + if (defined($content{'courseid'}) && defined($env{'request.course.id'})) { + if ($content{'courseid'} eq $env{'request.course.id'}) { + my $symblink; + my $showsymb = &Apache::lonenc::check_decrypt($symb); + my $showurl = &Apache::lonenc::check_decrypt($baseurl); + my $encrypturl = &Apache::lonnet::EXT('resource.0.encrypturl', + $showsymb,$env{'user.domain'},$env{'user.name'}); + if ($symb) { + if ($encrypturl =~ /^yes$/i && !$env{'request.role.adv'}) { + $showsymb = &Apache::lonenc::check_encrypt($symb); + } + $symblink = '?symb='.$showsymb; + } + if ($encrypturl =~ /^yes$/i && !$env{'request.role.adv'}) { + $showurl = $baseurl; + } + $r->print('
'.&mt('Refers to').': '.$restitle.''); + $refers_to = 1; + } + } + if (!$refers_to) { + if ($baseurl =~ m-^/enc/-) { + if (defined($content{'courseid'})) { + if (!$env{'request.course.id'}) { + my $unencurl = + &Apache::lonenc::unencrypted($baseurl, + $content{'courseid'}); + if ($unencurl ne '') { + if (&Apache::lonnet::allowed('bre',$unencurl)) { + $r->print('
'.&mt('Refers to'). + ': '. + $restitle.''); + } + } + } + } + } else { + if (&Apache::lonnet::allowed('bre',$baseurl)) { + $r->print('
'.&mt('Refers to'). + ': '.$restitle.''); + } + } + } + } + $r->print('

'.
 	      &Apache::lontexconvert::msgtexconverted($content{'message'},1).
 	      '

'.&displayresource(%content).'

'); - return; + return; } # =========================================================== Show the citation @@ -2042,7 +2101,12 @@ sub displayresource { # if (($env{'request.course.id'} eq $content{'courseid'}) && (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) { - my $symb=&Apache::lonnet::symbread($content{'baseurl'}); + my $symb; + if (defined($content{'symb'})) { + $symb = $content{'symb'}; + } else { + $symb=&Apache::lonnet::symbread($content{'baseurl'}); + } # Could not get a symb, give up unless ($symb) { return $content{'citation'}; } # Have a symb, can render @@ -2234,11 +2298,9 @@ sub sendoffmail { my $msgtxt = $savemsg; if ($toaddr{$address}) { $msgtxt.='
'.$toaddr{$address}; } my @thismsg; - if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && - (&Apache::lonnet::allowed('srm',$env{'request.course.id'}) - || &Apache::lonnet::allowed('srm',$env{'request.course.id'}. - '/'.$env{'request.course.sec'}))) { - $r->print(&mt('Sending critical message').' '.$recuname.':'.$recdomain.': '); + if ($msgtype eq 'critical') { + $r->print(&mt('Sending critical message').' '. + $recuname.':'.$recdomain.': '); @thismsg= &Apache::lonmsg::user_crit_msg($recuname,$recdomain, $msgsubj,$msgtxt, @@ -2260,7 +2322,7 @@ sub sendoffmail { $specialmsg_status{$recuname.':'.$recdomain} = join(' ',@thismsg); foreach my $result (@thismsg) { - if ($result eq 'ok') { + if ($result eq 'ok' || $result eq 'con_delayed') { $numspecial++; } }
'.&mt('Currently available actions (will open extra window)').':'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').'