--- loncom/interface/lonfeedback.pm 2003/08/06 17:00:30 1.50 +++ loncom/interface/lonfeedback.pm 2003/09/15 13:38:19 1.55 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.50 2003/08/06 17:00:30 albertel Exp $ +# $Id: lonfeedback.pm,v 1.55 2003/09/15 13:38:19 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,10 +52,127 @@ use Apache::lonmsg(); use Apache::loncommon(); use Apache::lontexconvert(); +sub list_discussion { + my ($discussiononly,$symb)=@_; + unless ($ENV{'request.course.id'}) { return ''; } + my $crs='/'.$ENV{'request.course.id'}; + if ($ENV{'request.course.sec'}) { + $crs.='_'.$ENV{'request.course.sec'}; + } + $crs=~s/\_/\//g; + unless ($symb) { + $symb=&Apache::lonnet::symbread(); + } + unless ($symb) { return ''; } + my $seeid=&Apache::lonnet::allowed('rin',$crs); + my $viewgrades=&Apache::lonnet::allowed('vgr',$crs); + my $discussion=''; + my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + if ($contrib{'version'}) { + unless ($discussiononly) { + $discussion.= + '
Attachment: '.$fname.'.'.$ft.''; + } + if ($message) { + if ($hidden) { + $message=''.$message.''; + } + my $screenname=&Apache::loncommon::screenname( + $contrib{$idx.':sendername'}, + $contrib{$idx.':senderdomain'}); + my $plainname=&Apache::loncommon::nickname( + $contrib{$idx.':sendername'}, + $contrib{$idx.':senderdomain'}); + + my $sender='Anonymous'; + if ((!$contrib{$idx.':anonymous'}) || ($seeid)) { + $sender=&Apache::loncommon::aboutmewrapper( + $plainname, + $contrib{$idx.':sendername'}, + $contrib{$idx.':senderdomain'}).' ('. + $contrib{$idx.':sendername'}.' at '. + $contrib{$idx.':senderdomain'}.')'; + if ($contrib{$idx.':anonymous'}) { + $sender.=' [anonymous] '. + $screenname; + } + if ($seeid) { + if ($hidden) { + $sender.=' Make Visible'; + } else { + $sender.=' Hide'; + } + $sender.=' Delete'; + } + } else { + if ($screenname) { + $sender=''.$screenname.''; + } + } + my $vgrlink; + if ($viewgrades) { + $vgrlink=&Apache::loncommon::submlink('Submissions', + $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb); + } + $discussion.='
'.$sender.' '.$vgrlink.' ('. + localtime($contrib{$idx.':timestamp'}). + '):
'.$message. + ''; + } + } + } + unless ($discussiononly) { + $discussion.=''; + } + } + if ($discussiononly) { + $discussion.=(<
+Attachment (128 KB max size): +
+ +ENDDISCUSS + $discussion.=&generate_preview_button(); + } + return $discussion; +} + sub mail_screen { my ($r,$feedurl,$options) = @_; my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', '','onLoad="window.focus();"'); + my $title=&Apache::lonnet::gettitle($feedurl); + if (!$title) { $title = $feedurl; } my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); $r->print(<