version 1.78, 2004/04/28 21:13:13
|
version 1.85, 2004/06/01 21:40:57
|
Line 43 sub list_discussion {
|
Line 43 sub list_discussion {
|
|| $status eq 'OPEN')) { |
|| $status eq 'OPEN')) { |
return ''; |
return ''; |
} |
} |
|
|
|
my @bgcols = ("#cccccc","#eeeeee"); |
my $discussiononly=0; |
my $discussiononly=0; |
if ($mode eq 'board') { $discussiononly=1; } |
if ($mode eq 'board') { $discussiononly=1; } |
unless ($ENV{'request.course.id'}) { return ''; } |
unless ($ENV{'request.course.id'}) { return ''; } |
Line 56 sub list_discussion {
|
Line 58 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 $ondispkey = $ressymb.'_markondisp'; |
|
my %dischash = &Apache::lonnet::get('nohist_'.$ENV{'request.course.id'}.'_discuss',[$lastkey,$showkey,$visitkey,$ondispkey],$ENV{'user.domain'},$ENV{'user.name'}); |
|
my %discinfo = (); |
|
my $showonlyunread = 0; |
|
my $markondisp = 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})) { |
|
unless ($dischash{$lastkey} eq '') { |
|
$prevread = $dischash{$lastkey}; |
|
} |
|
} |
|
|
|
# Get discussion display default settings for user |
|
my %userenv = &Apache::lonnet::get('environment',['discdisplay','discmarkread'],$ENV{'user.domain'},$ENV{'user.name'}); |
|
my $discdisplay=$userenv{'discdisplay'}; |
|
if ($discdisplay eq 'unread') { |
|
$showonlyunread = 1; |
|
} |
|
my $discmarkread=$userenv{'discmarkread'}; |
|
if ($discmarkread eq 'ondisp') { |
|
$markondisp = 1; |
|
} |
|
|
|
# Override user's default if user specified display setting for this discussion |
|
if (defined($dischash{$ondispkey})) { |
|
$markondisp = $dischash{$ondispkey}; |
|
} |
|
if ($markondisp) { |
|
$discinfo{$lastkey} = time; |
|
} |
|
|
|
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 132 sub list_discussion {
|
my @index=(); |
my @index=(); |
my @replies=(); |
my @replies=(); |
my %alldiscussion=(); |
my %alldiscussion=(); |
|
my %notshown = (); |
|
my %newitem = (); |
my $maxdepth=0; |
my $maxdepth=0; |
|
|
my $target=''; |
my $target=''; |
Line 94 sub list_discussion {
|
Line 141 sub list_discussion {
|
$ENV{'environment.remote'} eq 'off' ) { |
$ENV{'environment.remote'} eq 'off' ) { |
$target='target="LONcom"'; |
$target='target="LONcom"'; |
} |
} |
|
|
|
my $now = time; |
|
$discinfo{$visitkey} = $visit; |
|
|
|
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); |
|
|
if ($contrib{'version'}) { |
if ($contrib{'version'}) { |
|
my $oldest = $contrib{'1:timestamp'}; |
|
if ($prevread eq '0') { |
|
$prevread = $oldest-1; |
|
} |
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 <= $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 188 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 222 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 251 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 269 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>'; |
if ($prevread > 0 && $prevread <= $posttime) { |
|
$newitem{$idx} = 1; |
|
$discussionitems[$idx] .= ' |
|
<p><table border="0" width="100%"> |
|
<tr><td align="left"><font color="#FF0000"><b>NEW</b></font></td>'; |
|
} else { |
|
$newitem{$idx} = 0; |
|
$discussionitems[$idx] .= ' |
|
<p><table border="0" width="100%"> |
|
<tr><td align="left"> </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=''; |
|
|
|
my $function = &Apache::loncommon::get_users_function(); |
|
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
|
$ENV{'user.domain'}); |
|
my %lt = &Apache::lonlocal::texthash( |
|
'cuse' => 'Current settings for this discussion', |
|
'allposts' => 'All posts', |
|
'unread' => 'New posts only', |
|
'ondisp' => 'Once displayed', |
|
'onmark' => 'Once marked read', |
|
'disa' => 'Posts to be displayed', |
|
'npce' => 'Posts cease to be marked "NEW"', |
|
'chgt' => 'Change to ', |
|
); |
|
|
|
my $currdisp = $lt{'allposts'}; |
|
my $currmark = $lt{'onmark'}; |
|
my $dispchange = $lt{'unread'}; |
|
my $markchange = $lt{'ondisp'}; |
|
my $displink = '/adm/feedback?onlyunread='.$ressymb; |
|
my $marklink = '/adm/feedback?markondisp='.$ressymb; |
|
|
|
if ($markondisp) { |
|
$currmark = $lt{'ondisp'}; |
|
$markchange = $lt{'onmark'}; |
|
$marklink = '/adm/feedback?markonread='.$ressymb; |
|
if ($newpostsflag) { |
|
$marklink .= '&previous='.$prevread; |
|
} |
|
} |
|
|
|
if ($showonlyunread) { |
|
$currdisp = $lt{'unread'}; |
|
$dispchange = $lt{'allposts'}; |
|
$displink = '/adm/feedback?allposts='.$ressymb; |
|
} |
|
|
|
if ($newpostsflag) { |
|
$displink .= '&previous='.$prevread; |
|
} |
|
|
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) { |
my $colspan=$maxdepth+1; |
my $colspan=$maxdepth+1; |
$discussion .= '<tr bgcolor="#FFFFFF"><td colspan="'.$colspan.'" valign="top">'. |
my $showoption = '<tr><td align="right" bgcolor="#FFFFFF" colspan="'.$colspan.'">'; |
'<table border="0" bgcolor="#FFFFFF" width="100%" cellspacing="2" cellpadding="2">'. |
my $showflag = 'all'; |
'<tr><td align="left"><b>'.$lt{'cuse'}.'</b></td><td> </td><td align="right"><b>'.$lt{'chgt'}.'</b></td></tr>'. |
if ($showonlyunread) { |
'<tr><td>'.$lt{'disa'}.': <i>'.$currdisp.'</i></td><td> </td><td align="right"><a href="'.$displink.'">'.$dispchange.'</a></td></tr>'. |
$showoption .= '<b>Show all posts?</b><input type="checkbox" |
'<tr><td>'.$lt{'npce'}.': <i>'.$currmark.'</i></td><td> </td><td align="right"><a href="'.$marklink.'">'.$markchange.'</a></td></tr>'. |
name="allposts" value="1"></td></tr>'; |
'</table></td></tr>'. |
|
'<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'. |
|
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr>'; |
|
if ($visible>2) { |
|
$discussion.='<td align="left">'. |
|
'<a href="/adm/feedback?threadedon='.$ressymb; |
|
if ($newpostsflag) { |
|
$discussion .= '&previous='.$prevread; |
|
} |
|
$discussion .='">'.&mt('Threaded View').'</a> '. |
|
'<a href="/adm/feedback?threadedoff='.$ressymb; |
|
if ($newpostsflag) { |
|
$discussion .= '&previous='.$prevread; |
|
} |
|
$discussion .='">'.&mt('Chronological View').'</a> </td>'; |
|
} |
|
if ($newpostsflag) { |
|
if (!$markondisp) { |
|
$discussion .='<td align="right"><a href="/adm/feedback?markread='.$ressymb.'">'.&mt('Mark new posts as read').'</a> '; |
} else { |
} else { |
$showoption .= '<b>Show only unread posts?</b><input type="checkbox" name="onlyunread" value="1"></td></tr>'; |
$discussion .= '<td> </td>'; |
} |
} |
$discussion.=$showoption; |
} else { |
$discussion.='<tr><td bgcolor="DDDDBB" colspan="'.$colspan.'">'. |
$discussion .= '<td> </td>'; |
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr><td align="left">'. |
} |
'<a href="/adm/feedback?threadedon='.$symb.'">'.&mt('Threaded View').'</a> '. |
$discussion .= '</tr></table></td></tr>'; |
'<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="'.$bgcols[$newitem{$alldiscussion{$_}}].'" 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 439 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(); |
|
my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders(); |
my $send=&mt('Send'); |
my $send=&mt('Send'); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
<meta http-equiv="pragma" content="no-cache"></meta> |
<meta http-equiv="pragma" content="no-cache"></meta> |
|
$htmlheader |
<script type="text/javascript"> |
<script type="text/javascript"> |
//<!-- |
//<!-- |
function gosubmit() { |
function gosubmit() { |
Line 364 $bodytag
|
Line 514 $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 385 Attachment (128 KB max size): <input typ
|
Line 536 Attachment (128 KB max size): <input typ
|
</p> |
</p> |
</form> |
</form> |
ENDDOCUMENT |
ENDDOCUMENT |
$r->print(&generate_preview_button().'</body></html>'); |
$r->print(&generate_preview_button(). |
|
&Apache::lonhtmlcommon::htmlareaactive(). |
|
'</body></html>'); |
} |
} |
|
|
sub fail_redirect { |
sub fail_redirect { |
Line 406 ENDFAILREDIR
|
Line 559 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 585 $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 897 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','markread','markonread','markondisp']); |
['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','markread','markunread','storereads','onlyunread','allposts','chgreads']); |
|
|
if (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'})) { |
|
# ---------------------- Modify setting for identification of 'NEW' posts in this discussion |
|
|
if (($ENV{'form.markread'}) || ($ENV{'form.markunread'})) { |
|
# ----------------------------------------------------------------- Modify read/unread for all |
|
&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.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'}; |
my $ressymb = $symb; |
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|; |
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'}, |
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
} |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
my %readinghash = (); |
my %discinfo = (); |
|
my $lastkey = $ressymb.'_lastread'; |
if ($contrib{'version'}) { |
my $ondispkey = $ressymb.'_markondisp'; |
for (my $id=1;$id<=$contrib{'version'};$id++) { |
if ($ENV{'form.markondisp'}) { |
my $msgid = $id.':message'; |
$discinfo{$lastkey} = time; |
if (defined($contrib{$msgid})) { |
$discinfo{$ondispkey} = 1; |
if ($ENV{'form.markread'}) { |
} elsif ($ENV{'form.markonread'}) { |
$readinghash{$id} = 'read'; |
if ( defined($ENV{'previous'}) ) { |
} else { |
$discinfo{$lastkey} = $ENV{'previous'}; |
$readinghash{$id} = 'unread'; |
|
} |
|
} |
|
} |
|
if ($ENV{'form.allposts'}) { |
|
$readinghash{'showonlyunread'} = 0; |
|
} elsif ($ENV{'form.onlyunread'}) { |
|
$readinghash{'showonlyunread'} = 1; |
|
} |
} |
&Apache::lonnet::cstore(\%readinghash,$symb,$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'}); |
$discinfo{$ondispkey} = 0; |
|
} |
|
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); |
|
if ($ENV{'form.markondisp'}) { |
|
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'<br />','0','0'); |
|
} else { |
|
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display 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 { |
} elsif (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) { |
my $symb = $ENV{'form.discsymb'}; |
# ----------------------------------------------------------------- Modify display setting for this discussion |
my %readinghash = (); |
&Apache::loncommon::content_type($r,'text/html'); |
my $chgcount = 0; |
$r->send_http_header; |
foreach my $key (keys %ENV) { |
my $symb=$ENV{'form.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'}; |
if ($key =~ m/^form\.postunread_(\d+)/) { |
my $ressymb = $symb; |
$readinghash{$1} = 'unread'; |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
$chgcount ++; |
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
} elsif ($key =~ m/^form\.postread_(\d+)/) { |
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
$readinghash{$1} = 'read'; |
|
$chgcount ++; |
|
} |
|
} |
} |
|
my %discinfo = (); |
if ($ENV{'form.allposts'}) { |
if ($ENV{'form.allposts'}) { |
$readinghash{'showonlyunread'} = 0; |
$discinfo{$ressymb.'_showonlyunread'} = 0; |
$chgcount ++; |
|
} elsif ($ENV{'form.onlyunread'}) { |
} elsif ($ENV{'form.onlyunread'}) { |
$readinghash{'showonlyunread'} = 1; |
$discinfo{$ressymb.'_showonlyunread'} = 1; |
$chgcount ++; |
|
} |
} |
|
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); |
if ($chgcount > 0) { |
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'<br />','0','0','',$ENV{'form.previous'}); |
&Apache::lonnet::cstore(\%readinghash,$symb,$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'}); |
return OK; |
} |
} elsif ($ENV{'form.markread'}) { |
} |
# ----------------------------------------------------------------- Mark new posts as read |
|
|
if ($ENV{'form.chgreads'}) { |
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ENV{'form.chgreads'}); |
my $symb=$ENV{'form.markread'}; |
&redirect_back($r,&Apache::lonnet::clutter($url), |
my $ressymb = $symb; |
&mt('Changed read status').'<br />','0','0'); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
|
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
|
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
|
} |
|
my %discinfo = (); |
|
my $lastkey = $ressymb.'_lastread'; |
|
$discinfo{$lastkey} = time; |
|
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); |
|
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed reading status').'<br />','0','0'); |
|
return OK; |
} 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 994 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 1008 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 1035 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 1114 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 1148 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 { |