version 1.12, 2001/07/26 20:19:12
|
version 1.17, 2001/11/06 11:15:09
|
Line 14
|
Line 14
|
# 2/10 Gerd Kortemeyer |
# 2/10 Gerd Kortemeyer |
# 2/13 Guy Albertelli |
# 2/13 Guy Albertelli |
# 7/25 Gerd Kortemeyer |
# 7/25 Gerd Kortemeyer |
|
# 7/26 Guy Albertelli |
|
# 7/26,8/10,10/1,11/5 Gerd Kortemeyer |
|
|
|
|
package Apache::lonfeedback; |
package Apache::lonfeedback; |
|
|
Line 57 sub mail_screen {
|
Line 60 sub mail_screen {
|
rec=1; |
rec=1; |
} |
} |
} |
} |
|
if (typeof(document.mailform.elements.anondiscuss)!="undefined") { |
|
if (document.mailform.elements.anondiscuss.checked) { |
|
rec=1; |
|
} |
|
} |
|
|
if (rec) { |
if (rec) { |
document.mailform.submit(); |
document.mailform.submit(); |
Line 75 sub mail_screen {
|
Line 83 sub mail_screen {
|
Please check at least one of the following feedback types: |
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 wrap=hard> |
</textarea><p> |
</textarea><p> |
<input type=hidden name=sendit value=1> |
<input type=hidden name=sendit value=1> |
<input type=button value="Send Feedback" onClick='gosubmit();'></input> |
<input type=button value="Send Feedback" onClick='gosubmit();'></input> |
Line 167 sub screen_header {
|
Line 175 sub screen_header {
|
$options.='<br><input type=checkbox name=discuss> '. |
$options.='<br><input type=checkbox name=discuss> '. |
'<b>Contribution to course discussion of resource</b>'; |
'<b>Contribution to course discussion of resource</b>'; |
} |
} |
|
if ($ENV{'request.course.id'}) { |
|
$options.='<br><input type=checkbox name=anondiscuss> '. |
|
'<b>Anonymous contribution to course discussion of resource</b>'. |
|
' (name only visible to course faculty)'; |
|
} |
return $options; |
return $options; |
} |
} |
|
|
Line 258 sub send_msg {
|
Line 271 sub send_msg {
|
return ($status,$sendsomething); |
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'}); |
|
} |
|
my $now=time; |
|
my %record=&Apache::lonnet::restore('_discussion'); |
|
my ($temp)=keys %record; |
|
unless ($temp=~/^error\:/) { |
|
my %newrecord=(); |
|
$newrecord{'resource'}=$symb; |
|
$newrecord{'subnumber'}=$record{'subnumber'}+1; |
|
$status.=' '.&Apache::lonnet::cstore(\%newrecord,'_discussion'); |
|
} |
|
return $status.'<br>'; |
|
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
if ($r->header_only) { |
if ($r->header_only) { |
Line 265 sub handler {
|
Line 305 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
} |
} |
|
|
|
# --------------------------- Get query string for limited number of parameters |
|
|
|
map { |
|
my ($name, $value) = split(/=/,$_); |
|
$value =~ tr/+/ /; |
|
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
if (($name eq 'hide') || ($name eq 'unhide')) { |
|
unless ($ENV{'form.'.$name}) { |
|
$ENV{'form.'.$name}=$value; |
|
} |
|
} |
|
} (split(/&/,$ENV{'QUERY_STRING'})); |
|
|
|
if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
|
# ----------------------------------------------------------------- Hide/unhide |
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
|
|
my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; |
|
|
|
my ($symb,$idx)=split(/\:\:\:/,$entry); |
|
my ($map,$ind,$url)=split(/\_\_\_/,$symb); |
|
|
|
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 $currenthidden=$contrib{'hidden'}; |
|
|
|
if ($ENV{'form.hide'}) { |
|
$currenthidden.='.'.$idx.'.'; |
|
} else { |
|
$currenthidden=~s/\.$idx\.//g; |
|
} |
|
my %newhash=('hidden' => $currenthidden); |
|
|
|
&Apache::lonnet::store(\%newhash,$symb,$ENV{'request.course.id'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
|
&redirect_back($r,'/res/'.$url,'Changed discussion status<p>','0'); |
|
|
|
|
|
} else { |
|
# ------------------------------------------------------------- Normal feedback |
my $feedurl=$ENV{'form.postdata'}; |
my $feedurl=$ENV{'form.postdata'}; |
$feedurl=~s/^http\:\/\///; |
$feedurl=~s/^http\:\/\///; |
$feedurl=~s/^$ENV{'SERVER_NAME'}//; |
$feedurl=~s/^$ENV{'SERVER_NAME'}//; |
Line 320 sub handler {
|
Line 406 sub handler {
|
# Actually send mail |
# Actually send mail |
my ($status,$numsent)=&send_msg($feedurl,$email,$citations,%to); |
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 |
# Receipt screen and redirect back to where came from |
&redirect_back($r,$feedurl,$typestyle,$numsent,$status); |
&redirect_back($r,$feedurl,$typestyle,$numsent,$status); |
|
|
Line 332 sub handler {
|
Line 429 sub handler {
|
# Ambiguous Problem Resource |
# Ambiguous Problem Resource |
$r->internal_redirect('/adm/ambiguous'); |
$r->internal_redirect('/adm/ambiguous'); |
} |
} |
|
} |
return OK; |
return OK; |
} |
} |
|
|
Line 340 __END__
|
Line 438 __END__
|
|
|
|
|
|
|
|
|