--- loncom/interface/lonfeedback.pm 2003/09/03 18:09:50 1.51
+++ loncom/interface/lonfeedback.pm 2003/11/04 03:32:55 1.67
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.51 2003/09/03 18:09:50 albertel Exp $
+# $Id: lonfeedback.pm,v 1.67 2003/11/04 03:32:55 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,6 +51,134 @@ use Apache::Constants qw(:common);
use Apache::lonmsg();
use Apache::loncommon();
use Apache::lontexconvert();
+use Apache::lonlocal;
+
+sub list_discussion {
+ my ($mode,$status,$symb)=@_;
+ my $discussiononly=0;
+ if ($mode eq 'board') { $discussiononly=1; }
+ 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 %discussionitems=();
+ my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ my $visible=0;
+ if ($contrib{'version'}) {
+ for (my $id=1;$id<=$contrib{'version'};$id++) {
+ my $idx=$id;
+ my $hidden=($contrib{'hidden'}=~/\.$idx\./);
+ my $deleted=($contrib{'deleted'}=~/\.$idx\./);
+ unless ((($hidden) && (!$seeid)) || ($deleted)) {
+ $visible++;
+ my $message=$contrib{$idx.':message'};
+ $message=~s/\n/\
/g;
+ $message=&Apache::lontexconvert::msgtexconverted($message);
+ if ($contrib{$idx.':attachmenturl'}) {
+ my ($fname,$ft)
+ =($contrib{$idx.':attachmenturl'}=~/\/(\w+)\.(\w+)$/);
+ $message.='
'.&mt('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=&mt('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.=' ['.&mt('anonymous').'] '. + $screenname; + } + if ($seeid) { + if ($hidden) { + $sender.=' '.&mt('Make Visible').''; + } else { + $sender.=' '.&mt('Hide').''; + } + $sender.=' '.&mt('Delete').''; + } + if (&Apache::lonnet::allowed('pch', + $ENV{'request.course.id'}. + ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { + $sender.=' '.&mt('Reply').''; + } + } else { + if ($screenname) { + $sender=''.$screenname.''; + } + } + my $vgrlink; + if ($viewgrades) { + $vgrlink=&Apache::loncommon::submlink('Submissions', + $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb); + } + $discussionitems{$idx}=''.$sender.' '.$vgrlink.' ('. + localtime($contrib{$idx.':timestamp'}). + '):
'.$message. + ''; + } + } + } + } + my $discussion=''; + if ($visible) { + $discussion.='
".$discussionitems{$_}. + " |
+Attachment (128 KB max size): +
+ +ENDDISCUSS + $discussion.=&generate_preview_button(); + } + return $discussion; +} sub mail_screen { my ($r,$feedurl,$options) = @_; @@ -64,7 +192,8 @@ sub mail_screen { Feedback to resource author';
- }
- if (&feedback_available(1)) {
- $msgoptions.=
- '
Question about resource content';
- }
- if (&feedback_available(0,1)) {
- $msgoptions.=
- '
'.
- 'Question/Comment/Feedback about course content';
- }
- if (&feedback_available(0,0,1)) {
- $msgoptions.=
- '
'.
- 'Question/Comment/Feedback about course policy';
- }
-
- if ($ENV{'request.course.id'}) {
- if (&Apache::lonnet::allowed('pch',
- $ENV{'request.course.id'}.
- ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
- $discussoptions=' '.
- 'Contribution to course discussion of resource';
- $discussoptions.='
'.
- 'Anonymous contribution to course discussion of resource'.
- ' (name only visible to course faculty)';
+ my ($feedurl) = @_;
+ my $msgoptions='';
+ my $discussoptions='';
+ unless ($ENV{'form.replydisc'}) {
+ if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/)) {
+ $msgoptions=
+ '
'. + &mt('Feedback to resource author').'
'; + } + if (&feedback_available(1)) { + $msgoptions.= + '