version 1.78, 2004/04/28 21:13:13
|
version 1.82, 2004/05/07 12:03:53
|
Line 56 sub list_discussion {
|
Line 56 sub list_discussion {
|
} |
} |
unless ($symb) { return ''; } |
unless ($symb) { return ''; } |
|
|
my %dischash = &Apache::lonnet::restore($symb,$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'}); |
# backward compatibility (bulletin boards used to be 'wrapped') |
my %readids = (); |
my $ressymb=$symb; |
my $showonlyunread; |
if ($mode eq 'board') { |
foreach my $key (keys %dischash) { |
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
if ($key eq 'showonlyunread') { |
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
$showonlyunread = $dischash{$key}; |
|
} else { |
|
if ($dischash{$key} eq 'read') { |
|
$readids{$key} = 1; |
|
} |
|
} |
} |
} |
} |
|
|
|
# Get discussion display settings for this discussion |
|
my $lastkey = $ressymb.'_lastread'; |
|
my $showkey = $ressymb.'_showonlyunread'; |
|
my $visitkey = $ressymb.'_visit'; |
|
my %dischash = &Apache::lonnet::get('nohist_'.$ENV{'request.course.id'}.'_discuss',[$lastkey,$showkey,$visitkey],$ENV{'user.domain'},$ENV{'user.name'}); |
|
my $showonlyunread = 0; |
|
my $prevread = 0; |
|
my $previous = 0; |
|
my $visit = 0; |
|
my $newpostsflag = 0; |
|
|
|
# Retain identification of "NEW" posts identified in last display, if continuing 'previous' browsing of posts. |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['previous']); |
|
$previous = $ENV{'form.previous'}; |
|
if ($previous > 0) { |
|
$prevread = $previous; |
|
} elsif (defined($dischash{$lastkey})) { |
|
$prevread = $dischash{$lastkey}; |
|
} |
|
|
|
if (defined($dischash{$showkey})) { |
|
$showonlyunread = $dischash{$showkey}; |
|
} |
|
|
|
if (defined($dischash{$visitkey})) { |
|
$visit = $dischash{$visitkey}; |
|
} |
|
$visit ++; |
|
|
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
&& ($symb=~/\.(problem|exam|quiz|assess|survey|form)$/)); |
&& ($symb=~/\.(problem|exam|quiz|assess|survey|form)$/)); |
my @discussionitems=(); |
my @discussionitems=(); |
# backward compatibility (bulletin boards used to be 'wrapped') |
|
my $ressymb=$symb; |
|
if ($mode eq 'board') { |
|
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
|
} |
|
my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'}, |
my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'}, |
$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'}); |
Line 87 sub list_discussion {
|
Line 106 sub list_discussion {
|
my @index=(); |
my @index=(); |
my @replies=(); |
my @replies=(); |
my %alldiscussion=(); |
my %alldiscussion=(); |
|
my %notshown = (); |
my $maxdepth=0; |
my $maxdepth=0; |
|
|
my $target=''; |
my $target=''; |
Line 94 sub list_discussion {
|
Line 114 sub list_discussion {
|
$ENV{'environment.remote'} eq 'off' ) { |
$ENV{'environment.remote'} eq 'off' ) { |
$target='target="LONcom"'; |
$target='target="LONcom"'; |
} |
} |
|
|
|
my $now = time; |
|
my %discinfo = (); |
|
$discinfo{$visitkey} = $visit; |
|
$discinfo{$lastkey} = $now; |
|
|
|
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); |
|
|
if ($contrib{'version'}) { |
if ($contrib{'version'}) { |
for (my $id=1;$id<=$contrib{'version'};$id++) { |
for (my $id=1;$id<=$contrib{'version'};$id++) { |
my $idx=$id; |
my $idx=$id; |
|
my $posttime = $contrib{$idx.':timestamp'}; |
|
if ($prevread > 0 && $prevread <= $posttime) { |
|
$newpostsflag = 1; |
|
} |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
my $deleted=($contrib{'deleted'}=~/\.$idx\./); |
my $deleted=($contrib{'deleted'}=~/\.$idx\./); |
my $origindex='0.'; |
my $origindex='0.'; |
Line 127 sub list_discussion {
|
Line 159 sub list_discussion {
|
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
} |
} |
if ($contrib{$idx.':attachmenturl'}) { |
if ($contrib{$idx.':attachmenturl'}) { |
my ($fname,$ft) |
my ($fname) |
=($contrib{$idx.':attachmenturl'}=~/\/(\w+)\.(\w+)$/); |
=($contrib{$idx.':attachmenturl'}=~m|/([^/]+)$|); |
$message.='<p>'.&mt('Attachment').': <a href="'. |
&Apache::lonnet::allowuploaded('/adm/feedback', |
&Apache::lonnet::tokenwrapper( |
$contrib{$idx.':attachmenturl'}); |
$contrib{$idx.':attachmenturl'}). |
$message.='<p>'.&mt('Attachment'). |
'"><tt>'.$fname.'.'.$ft.'</tt></a></p>'; |
': <a href="'.$contrib{$idx.':attachmenturl'}.'"><tt>'. |
|
$fname.'</tt></a></p>'; |
} |
} |
if ($message) { |
if ($message) { |
if ($hidden) { |
if ($hidden) { |
Line 160 sub list_discussion {
|
Line 193 sub list_discussion {
|
if ($seeid) { |
if ($seeid) { |
if ($hidden) { |
if ($hidden) { |
$sender.=' <a href="/adm/feedback?unhide='. |
$sender.=' <a href="/adm/feedback?unhide='. |
$ressymb.':::'.$idx.'">'.&mt('Make Visible').'</a>'; |
$ressymb.':::'.$idx; |
|
if ($newpostsflag) { |
|
$sender .= '&previous='.$prevread; |
|
} |
|
$sender .= '">'.&mt('Make Visible').'</a>'; |
} else { |
} else { |
$sender.=' <a href="/adm/feedback?hide='. |
$sender.=' <a href="/adm/feedback?hide='. |
$ressymb.':::'.$idx.'">'.&mt('Hide').'</a>'; |
$ressymb.':::'.$idx; |
|
if ($newpostsflag) { |
|
$sender .= '&previous='.$prevread; |
|
} |
|
$sender .= '">'.&mt('Hide').'</a>'; |
} |
} |
$sender.=' <a href="/adm/feedback?deldisc='. |
$sender.=' <a href="/adm/feedback?deldisc='. |
$ressymb.':::'.$idx.'">'.&mt('Delete').'</a>'; |
$ressymb.':::'.$idx; |
|
if ($newpostsflag) { |
|
$sender .= '&previous='.$prevread; |
|
} |
|
$sender .= '">'.&mt('Delete').'</a>'; |
} |
} |
} else { |
} else { |
if ($screenname) { |
if ($screenname) { |
Line 177 sub list_discussion {
|
Line 222 sub list_discussion {
|
$ENV{'request.course.id'}. |
$ENV{'request.course.id'}. |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
$sender.=' <a href="/adm/feedback?replydisc='. |
$sender.=' <a href="/adm/feedback?replydisc='. |
$ressymb.':::'.$idx.'" '.$target.'>'.&mt('Reply').'</a>'; |
$ressymb.':::'.$idx; |
|
if ($newpostsflag) { |
|
$sender .= '&previous='.$prevread; |
|
} |
|
$sender .= '" '.$target.'>'.&mt('Reply').'</a>'; |
} |
} |
my $vgrlink; |
my $vgrlink; |
my $ctlink; |
|
if ($readids{$idx} == 1) { |
|
$ctlink = '<b>'.&mt('Mark unread').'?</b> '. |
|
'<input type="checkbox" name="'. |
|
'postunread_'.$idx.'" />'; |
|
} else { |
|
$ctlink = '<b>'.&mt('Mark read').'?</b> '. |
|
'<input type="checkbox" name="'. |
|
'postread_'.$idx.'" />'; |
|
} |
|
if ($viewgrades) { |
if ($viewgrades) { |
$vgrlink=&Apache::loncommon::submlink('Submissions', |
$vgrlink=&Apache::loncommon::submlink('Submissions', |
$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb); |
$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb); |
Line 201 sub list_discussion {
|
Line 240 sub list_discussion {
|
} |
} |
$alldiscussion{$thisindex}=$idx; |
$alldiscussion{$thisindex}=$idx; |
$index[$idx]=$thisindex; |
$index[$idx]=$thisindex; |
$discussionitems[$idx]='<p><table border="0" width="100%">'. |
my $spansize = 2; |
'<tr><td align="left"><b>'.$subject.'</b> '. |
if ($showonlyunread && $prevread > $posttime) { |
$sender.'</b> '.$vgrlink.' ('. |
$notshown{$idx} = 1; |
localtime($contrib{$idx.':timestamp'}). |
|
')</td><td align="right"> '.$ctlink.'</td></tr>'; |
|
if ($showonlyunread && $readids{$idx}) { |
|
$discussionitems[$idx] .= '<tr><td colspan="2" align="right"><i><font size="-1">Check "Show all posts?" or "Mark unread?", then "Save read settings" to display message</font></i></td></tr></table>'; |
|
} else { |
} else { |
$discussionitems[$idx] .= '</table><blockquote>'.$message.'</blockquote></p>'; |
$discussionitems[$idx]='<p><table border="0" width="100%"><tr>'; |
|
if ($prevread > 0 && $prevread <= $posttime) { |
|
$discussionitems[$idx] .= '<td align="left" bgcolor="#FFFFFF"><font color="#FF0000">NEW</font></td>'; |
|
} |
|
$discussionitems[$idx] .= '<td align ="left"> '. |
|
'<b>'.$subject.'</b> '. |
|
$sender.'</b> '.$vgrlink.' ('. |
|
localtime($posttime).')</td></tr>'. |
|
'</table><blockquote>'.$message.'</blockquote></p>'; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
my $discussion=''; |
my $discussion=''; |
if ($visible) { |
if ($visible) { |
# Print a the discusssion |
# Print the discusssion |
$discussion .= '<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$symb.'">'; |
|
$discussion.='<table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">'; |
$discussion.='<table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">'; |
if ($visible>2) { |
if ($visible>2) { |
my $colspan=$maxdepth+1; |
my $colspan=$maxdepth+1; |
my $showoption = '<tr><td align="right" bgcolor="#FFFFFF" colspan="'.$colspan.'">'; |
$discussion.='<tr><td bgcolor="DDDDBB" colspan="'.$colspan.'">'. |
my $showflag = 'all'; |
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr><td align="left">'. |
|
'<a href="/adm/feedback?threadedon='.$ressymb.'">'.&mt('Threaded View').'</a> '. |
|
'<a href="/adm/feedback?threadedoff='.$ressymb.'">'.&mt('Chronological View').'</a> </td>'. |
|
'<td align="right"><a href="/adm/feedback?'; |
if ($showonlyunread) { |
if ($showonlyunread) { |
$showoption .= '<b>Show all posts?</b><input type="checkbox" |
$discussion .= 'allposts='.$ressymb; |
name="allposts" value="1"></td></tr>'; |
if ($newpostsflag) { |
|
$discussion .= '&previous='.$prevread; |
|
} |
|
$discussion .='">'.&mt('Show all posts').'?'; |
} else { |
} else { |
$showoption .= '<b>Show only unread posts?</b><input type="checkbox" name="onlyunread" value="1"></td></tr>'; |
$discussion .= 'onlyunread='.$ressymb; |
|
if ($newpostsflag) { |
|
$discussion .= '&previous='.$prevread; |
|
} |
|
$discussion .= '">'.&mt('Show only unread posts').'?'; |
} |
} |
$discussion.=$showoption; |
$discussion .= '</a> </td></tr></table></td></tr>'; |
$discussion.='<tr><td bgcolor="DDDDBB" colspan="'.$colspan.'">'. |
|
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr><td align="left">'. |
|
'<a href="/adm/feedback?threadedon='.$symb.'">'.&mt('Threaded View').'</a> '. |
|
'<a href="/adm/feedback?threadedoff='.$symb.'">'.&mt('Chronological View').'</a> </td>'. |
|
'<td align="right"><a href="/adm/feedback?markread='.$symb.'">'.&mt('Mark all read').'</a> '. |
|
'<a href="/adm/feedback?markunread='.$symb.'">'.&mt('Mark all unread').'</a> '. |
|
'</td></tr></table></td></tr>'; |
|
} |
} |
|
my $numhidden = keys %notshown; |
|
if ($numhidden > 0) { |
|
my $colspan = $maxdepth+1; |
|
$discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'. |
|
'<a href="/adm/feedback?allposts='.$ressymb; |
|
if ($newpostsflag) { |
|
$discussion .= '&previous='.$prevread; |
|
} |
|
$discussion .= '">'.&mt('Show all posts').'</a> '.&mt('to display').' '. |
|
$numhidden.' '.&mt('previously viewed posts'). |
|
'<br/></td></tr>'; |
|
} |
foreach (sort { $a <=> $b } keys %alldiscussion) { |
foreach (sort { $a <=> $b } keys %alldiscussion) { |
$discussion.="\n<tr>"; |
unless ($notshown{$alldiscussion{$_}} eq '1') { |
my $thisdepth=$depth[$alldiscussion{$_}]; |
$discussion.="\n<tr>"; |
for (1..$thisdepth) { |
my $thisdepth=$depth[$alldiscussion{$_}]; |
$discussion.='<td> </td>'; |
for (1..$thisdepth) { |
|
$discussion.='<td> </td>'; |
|
} |
|
my $colspan=$maxdepth-$thisdepth+1; |
|
$discussion.='<td bgcolor="#CCCCCC" colspan="'.$colspan.'">'. |
|
$discussionitems[$alldiscussion{$_}]. |
|
'</td></tr>'; |
} |
} |
my $colspan=$maxdepth-$thisdepth+1; |
} |
$discussion.='<td bgcolor="#CCCCCC" colspan="'.$colspan.'">'. |
$discussion.='</table><br /><br />'; |
$discussionitems[$alldiscussion{$_}]. |
|
'</td></tr>'; |
|
} |
|
my $colspan=$maxdepth+1; |
|
$discussion.='<tr><td bgcolor="#FFFFFF" align="right" colspan="'. |
|
$colspan.'"><br /><input type="hidden" name="storereads" value="0">'. '<input type="hidden" name="discsymb" value="'.$symb.'">'. |
|
'<input type="button" name="readoptions" '. |
|
'value="Save read settings" onClick="this.form.storereads.value=1;this.form.submit();"></td></tr>'; |
|
$discussion .= '</table><br /><br /></form>'; |
|
} |
} |
if ($discussiononly) { |
if ($discussiononly) { |
$discussion.=(<<ENDDISCUSS); |
$discussion.=(<<ENDDISCUSS); |
Line 297 sub mail_screen {
|
Line 351 sub mail_screen {
|
if (!$title) { $title = $feedurl; } |
if (!$title) { $title = $feedurl; } |
my $quote=''; |
my $quote=''; |
my $subject = ''; |
my $subject = ''; |
|
my $prevtag = ''; |
if ($ENV{'form.replydisc'}) { |
if ($ENV{'form.replydisc'}) { |
my ($symb,$idx)=split(/\:\:\:/,$ENV{'form.replydisc'}); |
my ($symb,$idx)=split(/\:\:\:/,$ENV{'form.replydisc'}); |
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'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
unless (($contrib{'hidden'}=~/\.$idx\./) || ($contrib{'deleted'}=~/\.$idx\./)) { |
unless (($contrib{'hidden'}=~/\.$idx\./) || ($contrib{'deleted'}=~/\.$idx\./)) { |
my $message=$contrib{$idx.':message'}; |
my $message=$contrib{$idx.':message'}; |
$message=~s/\n/\<br \/\>/g; |
$message=~s/\n/\<br \/\>/g; |
$quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>'; |
$quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>'; |
$subject = 'Re: '.$contrib{$idx.':subject'}; |
if ($idx > 0) { |
|
$subject = 'Re: '.$contrib{$idx.':subject'}; |
|
} |
|
} |
|
if ($ENV{'form.previous'}) { |
|
$prevtag = '<input type="hidden" name="previous" value="'.$ENV{'form.previous'}.'" />'; |
} |
} |
} |
} |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
Line 364 $bodytag
|
Line 424 $bodytag
|
<h2><tt>$title</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"> |
|
$prevtag |
<input type="hidden" name="postdata" value="$feedurl" /> |
<input type="hidden" name="postdata" value="$feedurl" /> |
<input type="hidden" name="replydisc" value="$ENV{'form.replydisc'}" /> |
<input type="hidden" name="replydisc" value="$ENV{'form.replydisc'}" /> |
Please check at least one of the following feedback types: |
Please check at least one of the following feedback types: |
Line 406 ENDFAILREDIR
|
Line 467 ENDFAILREDIR
|
} |
} |
|
|
sub redirect_back { |
sub redirect_back { |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_; |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status,$previous) = @_; |
|
my $prevtag = ''; |
|
my $qrystr = ''; |
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
|
if ($previous > 0) { |
|
$qrystr = 'previous='.$previous; |
|
if ($feedurl =~ /\?register=1/) { |
|
$feedurl .= '&'.$qrystr; |
|
} else { |
|
$feedurl .= '?'.$qrystr; |
|
} |
|
$prevtag = '<input type="hidden" name="previous" value="'.$previous.'" />'; |
|
} |
$r->print (<<ENDREDIR); |
$r->print (<<ENDREDIR); |
<html> |
<html> |
<head> |
<head> |
<title>Feedback sent</title> |
<title>Feedback sent</title> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl"> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
</head> |
</head> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
Line 421 $typestyle
|
Line 493 $typestyle
|
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
<font color="red">$status</font> |
<font color="red">$status</font> |
<form name="reldt" action="$feedurl" target="loncapaclient"> |
<form name="reldt" action="$feedurl" target="loncapaclient"> |
|
$prevtag |
</form> |
</form> |
</body> |
</body> |
</html> |
</html> |
Line 732 sub handler {
|
Line 805 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','deldisc','postdata','preview','replydisc','threadedon','threadedoff']); |
['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous']); |
['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','markread','markunread','storereads','onlyunread','allposts','chgreads']); |
|
|
|
if (($ENV{'form.markread'}) || ($ENV{'form.markunread'})) { |
if (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) { |
# ----------------------------------------------------------------- Modify read/unread for all |
# ----------------------------------------------------------------- Modify display setting for this discussion |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
my $symb=$ENV{'form.markread'}?$ENV{'form.markread'}:$ENV{'form.markunread'}; |
my $symb=$ENV{'form.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'}; |
my $ressymb = $symb; |
|
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'}, |
|
$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'}); |
my %readinghash = (); |
my %readinghash = (); |
|
|
if ($contrib{'version'}) { |
if ($contrib{'version'}) { |
for (my $id=1;$id<=$contrib{'version'};$id++) { |
|
my $msgid = $id.':message'; |
|
if (defined($contrib{$msgid})) { |
|
if ($ENV{'form.markread'}) { |
|
$readinghash{$id} = 'read'; |
|
} else { |
|
$readinghash{$id} = 'unread'; |
|
} |
|
} |
|
} |
|
if ($ENV{'form.allposts'}) { |
if ($ENV{'form.allposts'}) { |
$readinghash{'showonlyunread'} = 0; |
$readinghash{$symb.'_showonlyunread'} = 0; |
} elsif ($ENV{'form.onlyunread'}) { |
} elsif ($ENV{'form.onlyunread'}) { |
$readinghash{'showonlyunread'} = 1; |
$readinghash{$symb.'_showonlyunread'} = 1; |
} |
} |
&Apache::lonnet::cstore(\%readinghash,$symb,$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'}); |
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%readinghash,$ENV{'user.domain'},$ENV{'user.name'}); |
} |
} |
|
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed reading status').'<br />','0','0','',$ENV{'form.previous'}); |
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed reading status'),'0','0'); |
|
return OK; |
return OK; |
} else { |
|
my $symb = $ENV{'form.discsymb'}; |
|
my %readinghash = (); |
|
my $chgcount = 0; |
|
foreach my $key (keys %ENV) { |
|
if ($key =~ m/^form\.postunread_(\d+)/) { |
|
$readinghash{$1} = 'unread'; |
|
$chgcount ++; |
|
} elsif ($key =~ m/^form\.postread_(\d+)/) { |
|
$readinghash{$1} = 'read'; |
|
$chgcount ++; |
|
} |
|
} |
|
if ($ENV{'form.allposts'}) { |
|
$readinghash{'showonlyunread'} = 0; |
|
$chgcount ++; |
|
} elsif ($ENV{'form.onlyunread'}) { |
|
$readinghash{'showonlyunread'} = 1; |
|
$chgcount ++; |
|
} |
|
|
|
if ($chgcount > 0) { |
|
&Apache::lonnet::cstore(\%readinghash,$symb,$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'}); |
|
} |
|
} |
|
|
|
if ($ENV{'form.chgreads'}) { |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ENV{'form.chgreads'}); |
|
&redirect_back($r,&Apache::lonnet::clutter($url), |
|
&mt('Changed read status').'<br />','0','0'); |
|
} elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
} elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
# ----------------------------------------------------------------- Hide/unhide |
# ----------------------------------------------------------------- Hide/unhide |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 830 sub handler {
|
Line 857 sub handler {
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
&redirect_back($r,&Apache::lonnet::clutter($url), |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&mt('Changed read status').'<br />','0','0'); |
&mt('Changed discussion status').'<br />','0','0','',$ENV{'form.previous'}); |
} elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) { |
} elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
Line 844 sub handler {
|
Line 871 sub handler {
|
my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'}; |
my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'}; |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&mt('Changed discussion view mode').'<br />','0','0'); |
&mt('Changed discussion view mode').'<br />','0','0','',$ENV{'form.previous'}); |
} elsif ($ENV{'form.deldisc'}) { |
} elsif ($ENV{'form.deldisc'}) { |
# --------------------------------------------------------------- Hide for good |
# --------------------------------------------------------------- Hide for good |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 871 sub handler {
|
Line 898 sub handler {
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
&redirect_back($r,&Apache::lonnet::clutter($url), |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&mt('Changed discussion status').'<br />','0','0'); |
&mt('Changed discussion status').'<br />','0','0','',$ENV{'form.previous'}); |
} elsif ($ENV{'form.preview'}) { |
} elsif ($ENV{'form.preview'}) { |
# -------------------------------------------------------- User wants a preview |
# -------------------------------------------------------- User wants a preview |
$r->content_type('text/html'); |
$r->content_type('text/html'); |
Line 950 sub handler {
|
Line 977 sub handler {
|
my $attachmenturl=''; |
my $attachmenturl=''; |
if ($ENV{'form.attachment.filename'}) { |
if ($ENV{'form.attachment.filename'}) { |
unless (length($ENV{'form.attachment'})>131072) { |
unless (length($ENV{'form.attachment'})>131072) { |
$attachmenturl=&Apache::lonnet::userfileupload('attachment'); |
$attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback'); |
} |
} |
} |
} |
# Filter HTML out of message (could be nasty) |
# Filter HTML out of message (could be nasty) |
Line 984 sub handler {
|
Line 1011 sub handler {
|
|
|
|
|
# Receipt screen and redirect back to where came from |
# Receipt screen and redirect back to where came from |
&redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$status); |
&redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$status,$ENV{'form.previous'}); |
|
|
} |
} |
} else { |
} else { |