version 1.2, 2001/02/05 17:38:17
|
version 1.4, 2001/02/06 18:17:34
|
Line 9
|
Line 9
|
# |
# |
# 3/1/1 Gerd Kortemeyer) |
# 3/1/1 Gerd Kortemeyer) |
# |
# |
# 3/1,2/3,2/5 Gerd Kortemeyer |
# 3/1,2/3,2/5,2/6 Gerd Kortemeyer |
# |
# |
package Apache::lonfeedback; |
package Apache::lonfeedback; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
use Apache::lonmsg(); |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 41 sub handler {
|
Line 42 sub handler {
|
} |
} |
if ($ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) { |
if ($ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) { |
$options.= |
$options.= |
'<br><input type=checkbox name=question> '. |
'<br><input type=checkbox name=comment> '. |
'Question/Comment/Feedback about course content'; |
'Question/Comment/Feedback about course content'; |
} |
} |
if ($ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) { |
if ($ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) { |
$options.= |
$options.= |
'<br><input type=checkbox name=question> '. |
'<br><input type=checkbox name=policy> '. |
'Question/Comment/Feedback about course policy'; |
'Question/Comment/Feedback about course policy'; |
} |
} |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
Line 71 My question/comment/feedback:<p>
|
Line 72 My question/comment/feedback:<p>
|
</html> |
</html> |
ENDDOCUMENT |
ENDDOCUMENT |
} else { |
} else { |
|
# |
|
# Get previous user input |
|
# |
my $symb=&Apache::lonnet::symbread($feedurl); |
my $symb=&Apache::lonnet::symbread($feedurl); |
my $prevattempts=''; |
my $prevattempts=''; |
if ($symb) { |
if ($symb) { |
Line 108 ENDDOCUMENT
|
Line 112 ENDDOCUMENT
|
} keys %lasthash; |
} keys %lasthash; |
$prevattempts.='</tr></table>'; |
$prevattempts.='</tr></table>'; |
} |
} |
|
# |
|
# Get output from resource |
|
# |
my $usersaw=&Apache::lonnet::ssi($feedurl); |
my $usersaw=&Apache::lonnet::ssi($feedurl); |
$usersaw=~s/\<body[^\>]*\>//gi; |
$usersaw=~s/\<body[^\>]*\>//gi; |
$usersaw=~s/\<\/body\>//gi; |
$usersaw=~s/\<\/body\>//gi; |
Line 116 ENDDOCUMENT
|
Line 123 ENDDOCUMENT
|
$usersaw=~s/\<head\>//gi; |
$usersaw=~s/\<head\>//gi; |
$usersaw=~s/\<\/head\>//gi; |
$usersaw=~s/\<\/head\>//gi; |
$usersaw=~s/action\s*\=/would_be_action\=/gi; |
$usersaw=~s/action\s*\=/would_be_action\=/gi; |
# <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$feedurl"> |
# |
|
# Filter HTML out of message (could be nasty) |
|
# |
|
my $message=$ENV{'form.comment'}; |
|
$message=~s/\</\<\;/g; |
|
$message=~s/\>/\>\;/g; |
|
|
|
# |
|
# Assemble email |
|
# |
|
my $email=<<"ENDEMAIL"; |
|
Refers to <a href="$feedurl">$feedurl</a> |
|
|
|
$message |
|
ENDEMAIL |
|
my $citations=<<"ENDCITE"; |
|
<h2>Previous attempts of student (if applicable)</h2> |
|
$prevattempts |
|
<p><hr> |
|
<h2>Original screen output (if applicable)</h2> |
|
$usersaw |
|
ENDCITE |
|
# |
|
# Who gets this? |
|
# |
|
my %to=(); |
|
if ($ENV{'form.author'}) { |
|
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
|
$to{$2.':'.$1}=1; |
|
} |
|
if ($ENV{'form.question'}) { |
|
map { |
|
$to{$_}=1; |
|
} split(/\,/, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.question.email'}); |
|
} |
|
if ($ENV{'form.comment'}) { |
|
map { |
|
$to{$_}=1; |
|
} split(/\,/, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}); |
|
} |
|
if ($ENV{'form.policy'}) { |
|
map { |
|
$to{$_}=1; |
|
} split(/\,/, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}); |
|
} |
|
# |
|
# Actually send mail |
|
# |
|
my $status=''; |
|
map { |
|
if ($_) { |
|
unless ( |
|
&Apache::lonmsg::user_normal_msg(split(/\:/,$_),'Feedback '.$feedurl, |
|
$email,$citations) eq 'ok') { |
|
$status.='<br>Error sending message to '.$_.'<br>'; |
|
} |
|
} |
|
} keys %to; |
|
# |
|
# Receipt screen and redirect back to where came from |
|
# |
print (<<ENDREDIR); |
print (<<ENDREDIR); |
<head><title>Feedback sent</title> |
<head> |
|
<title>Feedback sent</title> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=$feedurl"> |
</head> |
</head> |
<html> |
<html> |
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
<b>Feedback sent ...</b> |
<b>Feedback sent ...</b> |
$prevattempts |
<font color=red>$status</font> |
<hr> |
|
$usersaw |
|
</body> |
</body> |
</html> |
</html> |
ENDREDIR |
ENDREDIR |