version 1.236, 2006/12/11 18:50:40
|
version 1.237, 2006/12/24 22:13:19
|
Line 1468 sub replicate_attachments {
|
Line 1468 sub replicate_attachments {
|
} |
} |
|
|
sub mail_screen { |
sub mail_screen { |
my ($r,$feedurl,$options) = @_; |
my ($r,$feedurl,$options,$symb) = @_; |
if (exists($env{'form.origpage'})) { |
if (exists($env{'form.origpage'})) { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']); |
} |
} |
Line 1479 sub mail_screen {
|
Line 1479 sub mail_screen {
|
'title' => 'Title', |
'title' => 'Title', |
'reta' => 'Retained attachments', |
'reta' => 'Retained attachments', |
'atta' => 'Attachment (128 KB max size)', |
'atta' => 'Attachment (128 KB max size)', |
); |
); |
my $title=&Apache::lonnet::gettitle($feedurl); |
my $restitle = &get_resource_title($symb,$feedurl); |
if (!$title) { $title = $feedurl; } |
|
my $quote=''; |
my $quote=''; |
my $subject = ''; |
my $subject = ''; |
my $comment = ''; |
my $comment = ''; |
Line 1669 END
|
Line 1668 END
|
|
|
$r->print(<<END); |
$r->print(<<END); |
$start_page |
$start_page |
<h2><tt>$title</tt></h2> |
<h2><tt>$restitle</tt></h2> |
<form action="/adm/feedback" method="post" name="mailform" |
<form action="/adm/feedback" method="post" name="mailform" |
enctype="multipart/form-data"> |
enctype="multipart/form-data"> |
$prevtag |
$prevtag |
Line 2641 sub clear_out_html {
|
Line 2640 sub clear_out_html {
|
} |
} |
|
|
sub assemble_email { |
sub assemble_email { |
my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_; |
my ($message,$prevattempts,$usersaw,$useranswer)=@_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'prev' => 'Previous attempts of student (if applicable)', |
'prev' => 'Previous attempts of student (if applicable)', |
'orig' => 'Original screen output (if applicable)', |
'orig' => 'Original screen output (if applicable)', |
Line 2719 Returns
|
Line 2718 Returns
|
|
|
sub decide_receiver { |
sub decide_receiver { |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
|
&Apache::lonenc::check_decrypt(\$feedurl); |
my $typestyle=''; |
my $typestyle=''; |
my %to=(); |
my %to=(); |
if ($env{'form.discuss'} eq 'author' ||$author) { |
if ($env{'form.discuss'} eq 'author' ||$author) { |
Line 2767 sub feedback_available {
|
Line 2767 sub feedback_available {
|
} |
} |
|
|
sub send_msg { |
sub send_msg { |
my ($title,$feedurl,$email,$citations,$attachmenturl,%to)=@_; |
my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_; |
my $status=''; |
my $status=''; |
my $sendsomething=0; |
my $sendsomething=0; |
|
my $restitle = &get_resource_title($symb,$feedurl); |
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } |
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } |
unless ($title=~/\w/) { $title=&mt('Feedback'); } |
unless ($title=~/\w/) { $title=&mt('Feedback'); } |
foreach my $key (keys(%to)) { |
foreach my $key (keys(%to)) { |
if ($key) { |
if ($key) { |
my $declutter=&Apache::lonnet::declutter($feedurl); |
|
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$key), |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$key), |
$title.' ['.$declutter.']',$email,$citations,$feedurl, |
$title.' ['.$restitle.']',$email,$citations,$feedurl, |
$attachmenturl)=~/ok/) { |
$attachmenturl,undef,undef,$symb,$restitle)=~/ok/) { |
$status.='<br />'.&mt('Error sending message to').' '.$key.'<br />'; |
$status.='<br />'.&mt('Error sending message to').' '.$key.'<br />'; |
} else { |
} else { |
$sendsomething++; |
$sendsomething++; |
Line 3725 ENDREDIR
|
Line 3725 ENDREDIR
|
my $symb; |
my $symb; |
if ($env{'form.replydisc'}) { |
if ($env{'form.replydisc'}) { |
$symb=(split(/\:\:\:/,$env{'form.replydisc'}))[0]; |
$symb=(split(/\:\:\:/,$env{'form.replydisc'}))[0]; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
$feedurl=&Apache::lonnet::clutter($url); |
|
} elsif ($env{'form.editdisc'}) { |
} elsif ($env{'form.editdisc'}) { |
$symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; |
$symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
$feedurl=&Apache::lonnet::clutter($url); |
|
} elsif ($env{'form.origpage'}) { |
} elsif ($env{'form.origpage'}) { |
$symb=""; |
$symb=""; |
} else { |
} else { |
Line 3738 ENDREDIR
|
Line 3734 ENDREDIR
|
} |
} |
unless ($symb) { |
unless ($symb) { |
$symb=$env{'form.symb'}; |
$symb=$env{'form.symb'}; |
if ($symb) { |
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
$feedurl=&Apache::lonnet::clutter($url); |
|
} |
|
} |
} |
&Apache::lonenc::check_decrypt(\$symb); |
if (defined($symb)) { |
|
($symb,$feedurl)=&get_feedurl_and_clean_symb($symb); |
|
} else { |
|
# backward compatibility (bulletin boards used to be 'wrapped') |
|
&Apache::lonenc::check_decrypt(\$feedurl); |
|
&dewrapper(\$feedurl); |
|
} |
my $goahead=1; |
my $goahead=1; |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) { |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) { |
unless ($symb) { $goahead=0; } |
unless ($symb) { $goahead=0; } |
} |
} |
# backward compatibility (bulletin boards used to be 'wrapped') |
|
&dewrapper(\$feedurl); |
|
if (!$goahead) { |
if (!$goahead) { |
# Ambiguous Problem Resource |
# Ambiguous Problem Resource |
$r->internal_redirect('/adm/ambiguous'); |
$r->internal_redirect('/adm/ambiguous'); |
Line 3787 ENDREDIR
|
Line 3783 ENDREDIR
|
} |
} |
my $options=&screen_header($feedurl,$symb); |
my $options=&screen_header($feedurl,$symb); |
if ($options) { |
if ($options) { |
&mail_screen($r,$feedurl,$options); |
&mail_screen($r,$feedurl,$options,$symb); |
} else { |
} else { |
&fail_redirect($r,$feedurl); |
&fail_redirect($r,$feedurl); |
} |
} |
Line 3800 ENDREDIR
|
Line 3796 ENDREDIR
|
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
|
# Get output from resource |
# Get output from resource |
|
&Apache::lonenc::check_encrypt(\$feedurl); |
my $usersaw=&resource_output($feedurl); |
my $usersaw=&resource_output($feedurl); |
|
|
# Get resource answer (need to allow student to view grades for this to work) |
# Get resource answer (need to allow student to view grades for this to work) |
&Apache::lonnet::appenv(('allowed.vgr'=>'F')); |
&Apache::lonnet::appenv(('allowed.vgr'=>'F')); |
my $useranswer=&Apache::loncommon::get_student_answers( |
my $usersymmb = &Apache::lonenc::check_encrypt($symb); |
$symb,$env{'user.name'},$env{'user.domain'}, |
my $useranswer= |
$env{'request.course.id'}); |
&Apache::loncommon::get_student_answers( |
|
$usersymb),$env{'user.name'},$env{'user.domain'}, |
|
$env{'request.course.id'}); |
&Apache::lonnet::delenv('allowed.vgr'); |
&Apache::lonnet::delenv('allowed.vgr'); |
# Get attachments, if any, and not too large |
# Get attachments, if any, and not too large |
my $attachmenturl=''; |
my $attachmenturl=''; |
Line 3836 ENDREDIR
|
Line 3835 ENDREDIR
|
my $message=&clear_out_html($env{'form.comment'}); |
my $message=&clear_out_html($env{'form.comment'}); |
|
|
# Assemble email |
# Assemble email |
my ($email,$citations)=&assemble_email($feedurl,$message,$prevattempts, |
my ($email,$citations)=&assemble_email($message,$prevattempts, |
$usersaw,$useranswer); |
$usersaw,$useranswer); |
|
|
# Who gets this? |
# Who gets this? |
Line 3846 ENDREDIR
|
Line 3845 ENDREDIR
|
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, |
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, |
undef,1), |
undef,1), |
$feedurl,$email,$citations, |
$feedurl,$email,$citations, |
$attachmenturl,%to); |
$attachmenturl,$symb,%to); |
|
|
# Discussion? Store that. |
# Discussion? Store that. |
my $numpost=0; |
my $numpost=0; |
Line 3989 sub group_args {
|
Line 3988 sub group_args {
|
return $extra_args; |
return $extra_args; |
} |
} |
|
|
|
sub get_resource_title { |
|
my ($symb,$feedurl) = @_; |
|
my ($restitle,$plainurl); |
|
if (defined($symb)) { |
|
my $plain_symb = &Apache::lonenc::check_decrypt($symb); |
|
$restitle = &Apache::lonnet::gettitle($plain_symb); |
|
} |
|
if (defined($feedurl)) { |
|
$plainurl = &Apache::lonenc::check_decrypt($feedurl); |
|
} |
|
if (!defined($restitle)) { |
|
if (defined($feedurl)) { |
|
$restitle = &Apache::lonnet::gettitle($plainurl); |
|
} |
|
} |
|
if ($plainurl ne $feedurl) { |
|
my ($plain_filename) = ($plainurl =~ m-/([^/]+)$-); |
|
if ($plain_filename eq $restitle) { |
|
$restitle = &mt('Untitled resource'); |
|
} |
|
} |
|
if ($restitle eq '') { |
|
$restitle = &mt('Untitled resource'); |
|
} |
|
return $restitle; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |