--- loncom/interface/lonfeedback.pm 2001/07/26 20:19:12 1.12 +++ loncom/interface/lonfeedback.pm 2001/08/10 14:45:11 1.14 @@ -14,6 +14,9 @@ # 2/10 Gerd Kortemeyer # 2/13 Guy Albertelli # 7/25 Gerd Kortemeyer +# 7/26 Guy Albertelli +# 7/26,8/10 Gerd Kortemeyer + package Apache::lonfeedback; @@ -57,6 +60,11 @@ sub mail_screen { rec=1; } } + if (typeof(document.mailform.elements.anondiscuss)!="undefined") { + if (document.mailform.elements.anondiscuss.checked) { + rec=1; + } + } if (rec) { document.mailform.submit(); @@ -167,6 +175,11 @@ sub screen_header { $options.='
'. 'Contribution to course discussion of resource'; } + if ($ENV{'request.course.id'}) { + $options.='
'. + 'Anonymous contribution to course discussion of resource'. + ' (name only visible to course faculty)'; + } return $options; } @@ -258,6 +271,25 @@ sub send_msg { return ($status,$sendsomething); } +sub adddiscuss { + my ($symb,$email,$anon)=@_; + my $status=''; + my %contrib=('message' => $email, + 'sendername' => $ENV{'user.name'}, + 'senderdomain' => $ENV{'user.domain'}); + if ($anon) { + $contrib{'anonymous'}='true'; + } + if (($symb) && ($email)) { + $status='Adding to class discussion'.($anon?' (anonymous)':'').': '. + &Apache::lonnet::store(\%contrib,$symb,$ENV{'request.course.id'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}). + '
'; + } + return $status; +} + sub handler { my $r = shift; if ($r->header_only) { @@ -320,6 +352,17 @@ sub handler { # Actually send mail my ($status,$numsent)=&send_msg($feedurl,$email,$citations,%to); +# Discussion? Store that. + + if ($ENV{'form.discuss'}) { + $typestyle.=&adddiscuss($symb,$message); + } + + if ($ENV{'form.anondiscuss'}) { + $typestyle.=&adddiscuss($symb,$message,1); + } + + # Receipt screen and redirect back to where came from &redirect_back($r,$feedurl,$typestyle,$numsent,$status); @@ -340,3 +383,4 @@ __END__ +