version 1.49, 2003/07/05 10:07:11
|
version 1.56, 2003/09/15 18:43:54
|
Line 52 use Apache::lonmsg();
|
Line 52 use Apache::lonmsg();
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lontexconvert(); |
use Apache::lontexconvert(); |
|
|
|
sub list_discussion { |
|
my ($discussiononly,$symb)=@_; |
|
unless ($ENV{'request.course.id'}) { return ''; } |
|
my $crs='/'.$ENV{'request.course.id'}; |
|
if ($ENV{'request.course.sec'}) { |
|
$crs.='_'.$ENV{'request.course.sec'}; |
|
} |
|
$crs=~s/\_/\//g; |
|
unless ($symb) { |
|
$symb=&Apache::lonnet::symbread(); |
|
} |
|
unless ($symb) { return ''; } |
|
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
|
my $viewgrades=&Apache::lonnet::allowed('vgr',$crs); |
|
my $discussion=''; |
|
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
if ($contrib{'version'}) { |
|
unless ($discussiononly) { |
|
$discussion.= |
|
'<address><hr />'; |
|
} |
|
my $idx; |
|
for ($idx=1;$idx<=$contrib{'version'};$idx++) { |
|
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
|
my $deleted=($contrib{'deleted'}=~/\.$idx\./); |
|
unless ((($hidden) && (!$seeid)) || ($deleted)) { |
|
my $message=$contrib{$idx.':message'}; |
|
$message=~s/\n/\<br \/\>/g; |
|
$message=&Apache::lontexconvert::msgtexconverted($message); |
|
if ($contrib{$idx.':attachmenturl'}) { |
|
my ($fname,$ft) |
|
=($contrib{$idx.':attachmenturl'}=~/\/(\w+)\.(\w+)$/); |
|
$message.='<p>Attachment: <a href="'. |
|
&Apache::lonnet::tokenwrapper( |
|
$contrib{$idx.':attachmenturl'}). |
|
'"><tt>'.$fname.'.'.$ft.'</tt></a>'; |
|
} |
|
if ($message) { |
|
if ($hidden) { |
|
$message='<font color="#888888">'.$message.'</font>'; |
|
} |
|
my $screenname=&Apache::loncommon::screenname( |
|
$contrib{$idx.':sendername'}, |
|
$contrib{$idx.':senderdomain'}); |
|
my $plainname=&Apache::loncommon::nickname( |
|
$contrib{$idx.':sendername'}, |
|
$contrib{$idx.':senderdomain'}); |
|
|
|
my $sender='Anonymous'; |
|
if ((!$contrib{$idx.':anonymous'}) || ($seeid)) { |
|
$sender=&Apache::loncommon::aboutmewrapper( |
|
$plainname, |
|
$contrib{$idx.':sendername'}, |
|
$contrib{$idx.':senderdomain'}).' ('. |
|
$contrib{$idx.':sendername'}.' at '. |
|
$contrib{$idx.':senderdomain'}.')'; |
|
if ($contrib{$idx.':anonymous'}) { |
|
$sender.=' [anonymous] '. |
|
$screenname; |
|
} |
|
if ($seeid) { |
|
if ($hidden) { |
|
$sender.=' <a href="/adm/feedback?unhide='. |
|
$symb.':::'.$idx.'">Make Visible</a>'; |
|
} else { |
|
$sender.=' <a href="/adm/feedback?hide='. |
|
$symb.':::'.$idx.'">Hide</a>'; |
|
} |
|
$sender.=' <a href="/adm/feedback?deldisc='. |
|
$symb.':::'.$idx.'">Delete</a>'; |
|
} |
|
} else { |
|
if ($screenname) { |
|
$sender='<i>'.$screenname.'</i>'; |
|
} |
|
} |
|
my $vgrlink; |
|
if ($viewgrades) { |
|
$vgrlink=&Apache::loncommon::submlink('Submissions', |
|
$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb); |
|
} |
|
$discussion.='<p><b>'.$sender.'</b> '.$vgrlink.' ('. |
|
localtime($contrib{$idx.':timestamp'}). |
|
'):<blockquote>'.$message. |
|
'</blockquote></p>'; |
|
} |
|
} |
|
} |
|
unless ($discussiononly) { |
|
$discussion.='</address>'; |
|
} |
|
} |
|
if ($discussiononly) { |
|
$discussion.=(<<ENDDISCUSS); |
|
<form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> |
|
<input type="submit" name="discuss" value="Post Discussion" /> |
|
<input type="submit" name="anondiscuss" value="Post Anonymous Discussion" /> |
|
<input type="hidden" name="symb" value="$symb" /> |
|
<input type="hidden" name="sendit" value="true" /> |
|
<br /> |
|
<font size="1">Note: in anonymous discussion, your name is visible only to |
|
course faculty</font><br /> |
|
<textarea name=comment cols=60 rows=10 wrap=hard></textarea> |
|
<p> |
|
Attachment (128 KB max size): <input type="file" name="attachment" /> |
|
</p> |
|
</form> |
|
ENDDISCUSS |
|
$discussion.=&generate_preview_button(); |
|
} |
|
return $discussion; |
|
} |
|
|
sub mail_screen { |
sub mail_screen { |
my ($r,$feedurl,$options) = @_; |
my ($r,$feedurl,$options) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', |
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', |
'','onLoad="window.focus();"'); |
'','onLoad="window.focus();"'); |
|
my $title=&Apache::lonnet::gettitle($feedurl); |
|
if (!$title) { $title = $feedurl; } |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
Line 105 sub mail_screen {
|
Line 222 sub mail_screen {
|
</script> |
</script> |
</head> |
</head> |
$bodytag |
$bodytag |
<h2><tt>$feedurl</tt></h2> |
<h2><tt>$title</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"> |
<input type=hidden name=postdata value="$feedurl"> |
<input type=hidden name=postdata value="$feedurl"> |
Line 463 sub handler {
|
Line 580 sub handler {
|
my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; |
my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; |
|
|
my ($symb,$idx)=split(/\:\:\:/,$entry); |
my ($symb,$idx)=split(/\:\:\:/,$entry); |
my ($map,$ind,$url)=split(/\_\_\_/,$symb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
|
|
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
Line 493 sub handler {
|
Line 610 sub handler {
|
my $entry=$ENV{'form.deldisc'}; |
my $entry=$ENV{'form.deldisc'}; |
|
|
my ($symb,$idx)=split(/\:\:\:/,$entry); |
my ($symb,$idx)=split(/\:\:\:/,$entry); |
my ($map,$ind,$url)=split(/\_\_\_/,$symb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
|
|
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
Line 526 sub handler {
|
Line 643 sub handler {
|
unless ($symb) { |
unless ($symb) { |
$symb=$ENV{'form.symb'}; |
$symb=$ENV{'form.symb'}; |
if ($symb) { |
if ($symb) { |
my ($map,$id,$url)=split(/\_\_\_/,$symb); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
$feedurl=&Apache::lonnet::clutter($url); |
$feedurl=&Apache::lonnet::clutter($url); |
} |
} |
} |
} |
Line 567 sub handler {
|
Line 684 sub handler {
|
# Get output from resource |
# Get output from resource |
my $usersaw=&resource_output($feedurl); |
my $usersaw=&resource_output($feedurl); |
|
|
# Get resource answer |
# Get resource answer (need to allow student to view grades for this to work) |
|
&Apache::lonnet::appenv(('allowed.vgr'=>'F')); |
my $useranswer=&Apache::loncommon::get_student_answers( |
my $useranswer=&Apache::loncommon::get_student_answers( |
$symb,$ENV{'user.name'},$ENV{'user.domain'}, |
$symb,$ENV{'user.name'},$ENV{'user.domain'}, |
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
|
&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=''; |
if ($ENV{'form.attachment.filename'}) { |
if ($ENV{'form.attachment.filename'}) { |
Line 616 sub handler {
|
Line 735 sub handler {
|
} |
} |
} else { |
} else { |
# Ambiguous Problem Resource |
# Ambiguous Problem Resource |
$r->internal_redirect('/adm/ambiguous'); |
|
|
&Apache::lonnet::cleanenv(); |
|
|
|
$r->internal_redirect('/adm/ambiguous'); |
} |
} |
} |
} |
return OK; |
return OK; |