version 1.28, 2002/07/24 19:57:38
|
version 1.35, 2002/10/25 13:57:28
|
Line 50 use strict;
|
Line 50 use strict;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
|
use Apache::lontexconvert(); |
|
|
sub mail_screen { |
sub mail_screen { |
my ($r,$feedurl,$options) = @_; |
my ($r,$feedurl,$options) = @_; |
|
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', |
|
'','onLoad="window.focus();"'); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
<head> |
<head> |
Line 100 sub mail_screen {
|
Line 103 sub mail_screen {
|
} |
} |
</script> |
</script> |
</head> |
</head> |
<body bgcolor="#FFFFFF" onLoad="window.focus();"> |
$bodytag |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>Resource Feedback and Discussion</h1> |
|
<h2><tt>$feedurl</tt></h2> |
<h2><tt>$feedurl</tt></h2> |
<form action="/adm/feedback" method=post name=mailform> |
<form action="/adm/feedback" method=post name=mailform> |
<input type=hidden name=postdata value="$feedurl"> |
<input type=hidden name=postdata value="$feedurl"> |
Line 114 My question/comment/feedback:<p>
|
Line 115 My question/comment/feedback:<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> |
</form> |
</form> |
</body> |
|
</html> |
|
ENDDOCUMENT |
ENDDOCUMENT |
|
$r->print(&generate_preview_button().'</body></html>'); |
} |
} |
|
|
sub fail_redirect { |
sub fail_redirect { |
Line 136 ENDFAILREDIR
|
Line 136 ENDFAILREDIR
|
} |
} |
|
|
sub redirect_back { |
sub redirect_back { |
my ($r,$feedurl,$typestyle,$sendsomething,$status) = @_; |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_; |
$r->print (<<ENDREDIR); |
$r->print (<<ENDREDIR); |
<head> |
<head> |
<title>Feedback sent</title> |
<title>Feedback sent</title> |
Line 147 sub redirect_back {
|
Line 147 sub redirect_back {
|
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
$typestyle |
$typestyle |
<b>Sent $sendsomething message(s).</b> |
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
<font color=red>$status</font> |
<font color=red>$status</font> |
</body> |
</body> |
</html> |
</html> |
Line 179 ENDNOREDIRTWO
|
Line 179 ENDNOREDIRTWO
|
sub screen_header { |
sub screen_header { |
my ($feedurl) = @_; |
my ($feedurl) = @_; |
my $options=''; |
my $options=''; |
if (($feedurl=~/^\/res/) && ($feedurl!~/^\/res\/adm/)) { |
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 227 sub resource_output {
|
Line 227 sub resource_output {
|
|
|
sub clear_out_html { |
sub clear_out_html { |
my $message=$ENV{'form.comment'}; |
my $message=$ENV{'form.comment'}; |
|
$message=~s/\<\/*m\s*\>//g; |
$message=~s/\</\<\;/g; |
$message=~s/\</\<\;/g; |
$message=~s/\>/\>\;/g; |
$message=~s/\>/\>\;/g; |
return $message; |
return $message; |
Line 249 ENDCITE
|
Line 250 ENDCITE
|
return ($email,$citations); |
return ($email,$citations); |
} |
} |
|
|
|
sub secapply { |
|
my $rec=shift; |
|
return $rec; |
|
} |
|
|
sub decide_receiver { |
sub decide_receiver { |
my ($feedurl) = @_; |
my ($feedurl) = @_; |
my $typestyle=''; |
my $typestyle=''; |
Line 263 sub decide_receiver {
|
Line 269 sub decide_receiver {
|
foreach (split(/\,/, |
foreach (split(/\,/, |
$ENV{'course.'.$ENV{'request.course.id'}.'.question.email'}) |
$ENV{'course.'.$ENV{'request.course.id'}.'.question.email'}) |
) { |
) { |
$to{$_}=1; |
if (my $rec=&secapply($_)) { $to{$rec}=1; } |
} |
} |
} |
} |
if ($ENV{'form.course'}) { |
if ($ENV{'form.course'}) { |
Line 271 sub decide_receiver {
|
Line 277 sub decide_receiver {
|
foreach (split(/\,/, |
foreach (split(/\,/, |
$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) |
$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) |
) { |
) { |
$to{$_}=1; |
if (my $rec=&secapply($_)) { $to{$rec}=1; } |
} |
} |
} |
} |
if ($ENV{'form.policy'}) { |
if ($ENV{'form.policy'}) { |
Line 279 sub decide_receiver {
|
Line 285 sub decide_receiver {
|
foreach (split(/\,/, |
foreach (split(/\,/, |
$ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) |
$ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) |
) { |
) { |
$to{$_}=1; |
if (my $rec=&secapply($_)) { $to{$rec}=1; } |
} |
} |
} |
} |
return ($typestyle,%to); |
return ($typestyle,%to); |
Line 293 sub send_msg {
|
Line 299 sub send_msg {
|
if ($_) { |
if ($_) { |
my $declutter=&Apache::lonnet::declutter($feedurl); |
my $declutter=&Apache::lonnet::declutter($feedurl); |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), |
'Feedback ['.$declutter.']',$email,$citations) eq 'ok') { |
'Feedback ['.$declutter.']',$email,$citations)=~/ok/) { |
$status.='<br>Error sending message to '.$_.'<br>'; |
$status.='<br>Error sending message to '.$_.'<br>'; |
} else { |
} else { |
$sendsomething++; |
$sendsomething++; |
Line 358 sub adddiscuss {
|
Line 364 sub adddiscuss {
|
return $status.'<br>'; |
return $status.'<br>'; |
} |
} |
|
|
|
# ----------------------------------------------------------- Preview function |
|
|
|
sub show_preview { |
|
my $r=shift; |
|
my $message=&clear_out_html($ENV{'form.comment'}); |
|
$message=~s/\n/\<br \/\>/g; |
|
$message=&Apache::lontexconvert::msgtexconverted($message); |
|
$r->print('<table border="2"><tr><td>'. |
|
$message.'</td></tr></table>'); |
|
} |
|
|
|
sub generate_preview_button { |
|
return(<<ENDPREVIEW); |
|
<form name="preview" action="/adm/feedback?preview=1" method="post" target="preview"> |
|
<input type="hidden" name="comment" /> |
|
<input type="button" value="Show Preview" |
|
onClick="this.form.comment.value=document.mailform.comment.value;this.form.submit();" /> |
|
</form> |
|
ENDPREVIEW |
|
} |
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
if ($r->header_only) { |
if ($r->header_only) { |
Line 369 sub handler {
|
Line 395 sub handler {
|
# --------------------------- Get query string for limited number of parameters |
# --------------------------- Get query string for limited number of parameters |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['hide','unhide','postdata']); |
['hide','unhide','postdata','preview']); |
|
|
if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
# ----------------------------------------------------------------- Hide/unhide |
# ----------------------------------------------------------------- Hide/unhide |
Line 399 sub handler {
|
Line 425 sub handler {
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
&redirect_back($r,'/res/'.$url,'Changed discussion status<p>','0'); |
&redirect_back($r,&Apache::lonnet::clutter($url), |
|
'Changed discussion status<p>','0','0'); |
|
} elsif ($ENV{'form.preview'}) { |
|
# -------------------------------------------------------- User wants a preview |
|
&show_preview($r); |
} else { |
} else { |
# ------------------------------------------------------------- Normal feedback |
# ------------------------------------------------------------- Normal feedback |
my $feedurl=$ENV{'form.postdata'}; |
my $feedurl=$ENV{'form.postdata'}; |
Line 410 sub handler {
|
Line 438 sub handler {
|
$feedurl=~s/^$ENV{'HTTP_HOST'}//; |
$feedurl=~s/^$ENV{'HTTP_HOST'}//; |
|
|
my $symb=&Apache::lonnet::symbread($feedurl); |
my $symb=&Apache::lonnet::symbread($feedurl); |
|
unless ($symb) { |
|
$symb=$ENV{'form.symb'}; |
|
if ($symb) { |
|
my ($map,$id,$url)=split(/\_\_\_/,$symb); |
|
$feedurl=&Apache::lonnet::clutter($url); |
|
} |
|
} |
my $goahead=1; |
my $goahead=1; |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { |
unless ($symb) { $goahead=0; } |
unless ($symb) { $goahead=0; } |
Line 426 sub handler {
|
Line 461 sub handler {
|
) |
) |
|| |
|| |
($ENV{'request.course.id'} && ($feedurl!~m:^/adm:)) |
($ENV{'request.course.id'} && ($feedurl!~m:^/adm:)) |
|
|| |
|
($ENV{'request.course.id'} && ($symb=~/^bulletin\_\_\_/)) |
) { |
) { |
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
unless ($ENV{'form.sendit'}) { |
unless ($ENV{'form.sendit'}) { |
Line 460 sub handler {
|
Line 497 sub handler {
|
|
|
# Discussion? Store that. |
# Discussion? Store that. |
|
|
|
my $numpost=0; |
if ($ENV{'form.discuss'}) { |
if ($ENV{'form.discuss'}) { |
$typestyle.=&adddiscuss($symb,$message); |
$typestyle.=&adddiscuss($symb,$message); |
|
$numpost++; |
} |
} |
|
|
if ($ENV{'form.anondiscuss'}) { |
if ($ENV{'form.anondiscuss'}) { |
$typestyle.=&adddiscuss($symb,$message,1); |
$typestyle.=&adddiscuss($symb,$message,1); |
|
$numpost++; |
} |
} |
|
|
|
|
# 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,$numpost,$status); |
|
|
} |
} |
} else { |
} else { |
Line 487 sub handler {
|
Line 527 sub handler {
|
|
|
1; |
1; |
__END__ |
__END__ |
|
|
|
|
|
|
|
|