--- loncom/interface/lonfeedback.pm 2003/09/19 16:12:50 1.61
+++ loncom/interface/lonfeedback.pm 2003/11/07 16:37:23 1.68
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.61 2003/09/19 16:12:50 www Exp $
+# $Id: lonfeedback.pm,v 1.68 2003/11/07 16:37:23 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,6 +51,7 @@ use Apache::Constants qw(:common);
use Apache::lonmsg();
use Apache::loncommon();
use Apache::lontexconvert();
+use Apache::lonlocal;
sub list_discussion {
my ($mode,$status,$symb)=@_;
@@ -68,30 +69,52 @@ sub list_discussion {
unless ($symb) { return ''; }
my $seeid=&Apache::lonnet::allowed('rin',$crs);
my $viewgrades=&Apache::lonnet::allowed('vgr',$crs);
- my $discussion='';
+ 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;
+ my @depth=();
+ my @original=();
+ my @index=();
+ my @replies=();
+ my %alldiscussion=();
+ my $maxdepth=0;
+
if ($contrib{'version'}) {
- unless ($discussiononly) {
- $discussion.=
- '
';
- }
- my $idx;
- for ($idx=1;$idx<=$contrib{'version'};$idx++) {
+ for (my $id=1;$id<=$contrib{'version'};$id++) {
+ my $idx=$id;
my $hidden=($contrib{'hidden'}=~/\.$idx\./);
my $deleted=($contrib{'deleted'}=~/\.$idx\./);
+ my $origindex='0.';
+ if ($contrib{$idx.':replyto'}) {
+# this is a follow-up message
+ $original[$idx]=$original[$contrib{$idx.':replyto'}];
+ $depth[$idx]=$depth[$contrib{$idx.':replyto'}]+1;
+ $origindex=$index[$contrib{$idx.':replyto'}];
+ if ($depth[$idx]>$maxdepth) { $maxdepth=$depth[$idx]; }
+ } else {
+# this is an original message
+ $original[$idx]=0;
+ $depth[$idx]=0;
+ }
+ if ($replies[$depth[$idx]]) {
+ $replies[$depth[$idx]]++;
+ } else {
+ $replies[$depth[$idx]]=1;
+ }
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.='
';
}
if ($message) {
if ($hidden) {
@@ -104,7 +127,7 @@ sub list_discussion {
$contrib{$idx.':sendername'},
$contrib{$idx.':senderdomain'});
- my $sender='Anonymous';
+ my $sender=&mt('Anonymous');
if ((!$contrib{$idx.':anonymous'}) || ($seeid)) {
$sender=&Apache::loncommon::aboutmewrapper(
$plainname,
@@ -113,19 +136,25 @@ sub list_discussion {
$contrib{$idx.':sendername'}.' at '.
$contrib{$idx.':senderdomain'}.')';
if ($contrib{$idx.':anonymous'}) {
- $sender.=' [anonymous] '.
+ $sender.=' ['.&mt('anonymous').'] '.
$screenname;
}
if ($seeid) {
if ($hidden) {
$sender.=' Make Visible';
+ $symb.':::'.$idx.'">'.&mt('Make Visible').'';
} else {
$sender.=' Hide';
+ $symb.':::'.$idx.'">'.&mt('Hide').'';
}
$sender.=' Delete';
+ $symb.':::'.$idx.'">'.&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) {
@@ -137,16 +166,30 @@ sub list_discussion {
$vgrlink=&Apache::loncommon::submlink('Submissions',
$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);
}
- $discussion.='
'.$sender.' '.$vgrlink.' ('.
+#figure out at what position this needs to print
+ my $thisindex=$idx;
+# if ($ENV{'request.discussions.threaded'}) {
+ if (1) {
+ $thisindex=$origindex.substr('00'.$replies[$depth[$idx]],-2,2);
+ }
+ $alldiscussion{$thisindex}=$idx;
+ $index[$idx]=$thisindex;
+ $discussionitems[$idx]='
';
}
if ($discussiononly) {
$discussion.=(<
Note: in anonymous discussion, your name is visible only to
course faculty
-
+
Attachment (128 KB max size):
@@ -181,7 +224,8 @@ sub mail_screen {
The LearningOnline Network with CAPA
-
$bodytag
$title
ENDDOCUMENT
@@ -249,12 +297,12 @@ sub fail_redirect {
my ($r,$feedurl) = @_;
$r->print (<Feedback not sent
-
-
+
+
-
+
Sorry, no recipients ...
@@ -266,15 +314,15 @@ sub redirect_back {
$r->print (<Feedback sent
-
+
-
+
$typestyle
Sent $sendsomething message(s), and $sendposts post(s).
-$status
+$status
@@ -286,7 +334,7 @@ sub no_redirect_back {
my ($r,$feedurl) = @_;
$r->print (<Feedback not sent
-
+
ENDNOREDIR
if ($feedurl!~/^\/adm\/feedback/) {
@@ -297,7 +345,7 @@ ENDNOREDIR
-
+
Sorry, no feedback possible on this resource ...
@@ -305,43 +353,46 @@ ENDNOREDIRTWO
}
sub screen_header {
- my ($feedurl) = @_;
- my $msgoptions='';
- my $discussoptions='';
- if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/)) {
- $msgoptions=
- '
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.=
+ ' '.
+ &mt('Question about resource content');
+ }
+ if (&feedback_available(0,1)) {
+ $msgoptions.=
+ ' '.
+ &mt('Question/Comment/Feedback about course content');
+ }
+ if (&feedback_available(0,0,1)) {
+ $msgoptions.=
+ ' '.
+ &mt('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=' '.
+ &mt('Contribution to course discussion of resource');
+ $discussoptions.=' '.
+ &mt('Anonymous contribution to course discussion of resource').
+ ' ('.&mt('name only visible to course faculty').')';
}
- }
- if ($msgoptions) { $msgoptions='
Sending Messages
'.$msgoptions; }
- if ($discussoptions) {
- $discussoptions='