--- loncom/interface/lonmsg.pm 2004/09/28 14:38:50 1.110 +++ loncom/interface/lonmsg.pm 2004/10/26 19:50:15 1.111 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.110 2004/09/28 14:38:50 matthew Exp $ +# $Id: lonmsg.pm,v 1.111 2004/10/26 19:50:15 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -970,6 +970,7 @@ sub compout { $dismsg=~s/\f/\n/g; $dismsg=~s/\n+/\n\> /g; } + my $citation=&displayresource(%content); if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; } $r->print( '


$dispcrit - +
+$citation ENDCOMP } else { # $broadcast is 'upload' $r->print(<'.&mt('Time').': '.$content{'time'}. '

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

'.$content{'citation'}.'

'); + '
'.&displayresource(%content).'

'); return; } +# =========================================================== Show the citation + +sub displayresource { + my %content=@_; +# +# If the recipient is in the same course that the message was sent from and +# has sufficient privileges, show "all details," else show citation +# + if (($ENV{'request.course.id'} eq $content{'courseid'}) + && (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) { + my $symb=&Apache::lonnet::symbread($content{'baseurl'}); +# Could not get a symb, give up + unless ($symb) { return $content{'citation'}; } +# Have a symb, can render + return '

'.&mt('Current attempts of student (if applicable)').'

'. + &Apache::loncommon::get_previous_attempt($symb, + $content{'sendername'}, + $content{'senderdomain'}, + $content{'courseid'}). + '

'.&mt('Current screen output (if applicable)').'

'. + &Apache::loncommon::get_student_view($symb, + $content{'sendername'}, + $content{'senderdomain'}, + $content{'courseid'}). + '

'.&mt('Correct Answer(s) (if applicable)').'

'. + &Apache::loncommon::get_student_answers($symb, + $content{'sendername'}, + $content{'senderdomain'}, + $content{'courseid'}); + } else { + return $content{'citation'}; + } +} + # ================================================================== The Header sub header {