version 1.3, 2001/02/06 14:22:30
|
version 1.5, 2001/02/08 21:35:24
|
Line 9
|
Line 9
|
# |
# |
# 3/1/1 Gerd Kortemeyer) |
# 3/1/1 Gerd Kortemeyer) |
# |
# |
# 3/1,2/3,2/5,2/6 Gerd Kortemeyer |
# 3/1,2/3,2/5,2/6,2/8 Gerd Kortemeyer |
# |
# |
package Apache::lonfeedback; |
package Apache::lonfeedback; |
|
|
Line 28 sub handler {
|
Line 28 sub handler {
|
$feedurl=~s/^$ENV{'SERVER_NAME'}//; |
$feedurl=~s/^$ENV{'SERVER_NAME'}//; |
$feedurl=~s/^$ENV{'HTTP_HOST'}//; |
$feedurl=~s/^$ENV{'HTTP_HOST'}//; |
|
|
if (($feedurl=~/^\/res/) || ($ENV{'request.course.id'})) { |
if ((($feedurl=~/^\/res/) && ($feedurl!~/^\/res\/adm/)) |
|
|| ($ENV{'request.course.id'})) { |
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
unless ($ENV{'form.sendit'}) { |
unless ($ENV{'form.sendit'}) { |
my $options=''; |
my $options=''; |
if ($feedurl=~/^\/res/) { |
if (($feedurl=~/^\/res/) && ($feedurl!~/^\/res\/adm/)) { |
$options= |
$options= |
'<p><input type=checkbox name=author> Feedback to resource author'; |
'<p><input type=checkbox name=author> Feedback to resource author'; |
} |
} |
Line 42 sub handler {
|
Line 43 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=comment> '. |
'<br><input type=checkbox name=course> '. |
'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'}) { |
Line 50 sub handler {
|
Line 51 sub handler {
|
'<br><input type=checkbox name=policy> '. |
'<br><input type=checkbox name=policy> '. |
'Question/Comment/Feedback about course policy'; |
'Question/Comment/Feedback about course policy'; |
} |
} |
|
if ($options) { |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
|
<script> |
|
function gosubmit() { |
|
var rec=0; |
|
if (document.mailform.elements.author!=undefined) { |
|
if (document.mailform.elements.author.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (document.mailform.elements.question!=undefined) { |
|
if (document.mailform.elements.question.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (document.mailform.elements.course!=undefined) { |
|
if (document.mailform.elements.course.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (document.mailform.elements.policy!=undefined) { |
|
if (document.mailform.elements.policy.checked) { |
|
rec=1; |
|
} |
|
} |
|
|
|
if (rec) { |
|
document.mailform.submit(); |
|
} else { |
|
alert('Please check a feedback type.'); |
|
} |
|
} |
|
</script> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF" onLoad="window.focus();"> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<h1>Feedback</h1> |
<h1>Feedback</h1> |
<h2><tt>$feedurl</tt></h2> |
<h2><tt>$feedurl</tt></h2> |
<form action="/adm/feedback" method=post> |
<form action="/adm/feedback" method=post name=mailform> |
<input type=hidden name=postdata value="$feedurl"> |
<input type=hidden name=postdata value="$feedurl"> |
Please check at least one of the following: |
Please check at least one of the following feedback types: |
$options<hr> |
$options<hr> |
My question/comment/feedback:<p> |
My question/comment/feedback:<p> |
<textarea name=comment cols=60 rows=10> |
<textarea name=comment cols=60 rows=10> |
</textarea><p> |
</textarea><p> |
<input type=submit name=sendit value="Send Feedback"></input> |
<input type=hidden name=sendit value=1> |
|
<input type=button value="Send Feedback" onClick='gosubmit();'></input> |
</form> |
</form> |
</body> |
</body> |
</html> |
</html> |
ENDDOCUMENT |
ENDDOCUMENT |
} else { |
} else { |
|
print (<<ENDFAILREDIR); |
|
<head><title>Feedback not sent</title> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl"> |
|
</head> |
|
<html> |
|
<body bgcolor="#FFFFFF"> |
|
Sorry, no recipients ... |
|
</body> |
|
</html> |
|
ENDFAILREDIR |
|
|
|
} |
|
} else { |
# |
# |
# Get previous user input |
# Get previous user input |
# |
# |
Line 135 ENDDOCUMENT
|
Line 182 ENDDOCUMENT
|
# |
# |
my $email=<<"ENDEMAIL"; |
my $email=<<"ENDEMAIL"; |
Refers to <a href="$feedurl">$feedurl</a> |
Refers to <a href="$feedurl">$feedurl</a> |
<hr> |
|
<h2>Message</h2> |
|
<pre> |
|
$message |
$message |
</pre> |
ENDEMAIL |
<hr> |
my $citations=<<"ENDCITE"; |
<h2>Previous attempts of student (if applicable)</h2> |
<h2>Previous attempts of student (if applicable)</h2> |
$prevattempts |
$prevattempts |
<p><hr> |
<p><hr> |
<h2>Original screen output (if applicable)</h2> |
<h2>Original screen output (if applicable)</h2> |
$usersaw |
$usersaw |
ENDEMAIL |
ENDCITE |
# |
# |
# Who gets this? |
# Who gets this? |
# |
# |
|
my $typestyle=''; |
my %to=(); |
my %to=(); |
if ($ENV{'form.author'}) { |
if ($ENV{'form.author'}) { |
|
$typestyle.='Author Feedback<br>'; |
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
$to{$2.':'.$1}=1; |
$to{$2.':'.$1}=1; |
} |
} |
if ($ENV{'form.question'}) { |
if ($ENV{'form.question'}) { |
|
$typestyle.='Question<br>'; |
map { |
map { |
$to{$_}=1; |
$to{$_}=1; |
} split(/\,/, |
} split(/\,/, |
$ENV{'course.'.$ENV{'request.course.id'}.'.question.email'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.question.email'}); |
} |
} |
if ($ENV{'form.comment'}) { |
if ($ENV{'form.course'}) { |
|
$typestyle.='Comment<br>'; |
map { |
map { |
$to{$_}=1; |
$to{$_}=1; |
} split(/\,/, |
} split(/\,/, |
$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}); |
} |
} |
if ($ENV{'form.policy'}) { |
if ($ENV{'form.policy'}) { |
|
$typestyle.='Policy<br>'; |
map { |
map { |
$to{$_}=1; |
$to{$_}=1; |
} split(/\,/, |
} split(/\,/, |
Line 177 ENDEMAIL
|
Line 227 ENDEMAIL
|
# Actually send mail |
# Actually send mail |
# |
# |
my $status=''; |
my $status=''; |
|
my $sendsomething=0; |
map { |
map { |
if ($_) { |
if ($_) { |
unless ( |
unless ( |
&Apache::lonmsg::user_normal_msg(split(/\:/,$_),'Feedback '.$feedurl, |
&Apache::lonmsg::user_normal_msg(split(/\:/,$_),'Feedback '.$feedurl, |
$email) eq 'ok') { |
$email,$citations) eq 'ok') { |
$status.='<br>Error sending message to '.$_.'<br>'; |
$status.='<br>Error sending message to '.$_.'<br>'; |
} |
} else { |
|
$sendsomething++; |
|
} |
} |
} |
} keys %to; |
} keys %to; |
# |
# |
# Receipt screen and redirect back to where came from |
# Receipt screen and redirect back to where came from |
# |
# |
print (<<ENDREDIR); |
print (<<ENDREDIR); |
<head> |
<head> |
<title>Feedback sent</title> |
<title>Feedback sent</title> |
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=$feedurl"> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl"> |
</head> |
</head> |
<html> |
<html> |
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
<b>Feedback sent ...</b> |
$typestyle |
|
<b>Sent $sendsomething message(s).</b> |
<font color=red>$status</font> |
<font color=red>$status</font> |
</body> |
</body> |
</html> |
</html> |
Line 205 ENDREDIR
|
Line 259 ENDREDIR
|
} else { |
} else { |
print (<<ENDNOREDIR); |
print (<<ENDNOREDIR); |
<head><title>Feedback not sent</title> |
<head><title>Feedback not sent</title> |
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=$feedurl"> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl"> |
</head> |
</head> |
<html> |
<html> |
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |