version 1.82, 2004/05/07 12:03:53
|
version 1.92, 2004/06/04 19:27:33
|
Line 34 use Apache::Constants qw(:common);
|
Line 34 use Apache::Constants qw(:common);
|
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lontexconvert(); |
use Apache::lontexconvert(); |
use Apache::lonlocal; |
use Apache::lonlocal; # must not have () |
|
use Apache::lonhtmlcommon(); |
|
|
sub list_discussion { |
sub discussion_open { |
my ($mode,$status,$symb)=@_; |
my ($status)=@_; |
# &Apache::lonnet::logthis("status is $status"); |
if (defined($status) && |
if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' |
!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' |
|| $status eq 'OPEN')) { |
|| $status eq 'OPEN')) { |
return ''; |
&Apache::lonnet::logthis(" no open due to status $status"); |
|
return 0; |
|
} |
|
my $close=&Apache::lonnet::EXT('resource.0.discussend'); |
|
if (defined($close) && $close ne '' && $close < time) { |
|
&Apache::lonnet::logthis(" no open due to time "); |
|
return 0; |
|
} |
|
&Apache::lonnet::logthis(" open "); |
|
return 1; |
|
} |
|
|
|
sub discussion_visible { |
|
my ($status)=@_; |
|
if (not &discussion_open($status)) { |
|
my $hidden=&Apache::lonnet::EXT('resource.0.discusshide'); |
|
if (lc($hidden) eq 'yes' or $hidden eq '' or !defined($hidden)) { |
|
&Apache::lonnet::logthis(" hidden "); |
|
return 0; |
|
} |
} |
} |
|
&Apache::lonnet::logthis(" visible "); |
|
return 1; |
|
} |
|
|
|
sub list_discussion { |
|
my ($mode,$status,$symb)=@_; |
|
|
|
if (not &discussion_visible($status)) { 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 68 sub list_discussion {
|
Line 97 sub list_discussion {
|
my $lastkey = $ressymb.'_lastread'; |
my $lastkey = $ressymb.'_lastread'; |
my $showkey = $ressymb.'_showonlyunread'; |
my $showkey = $ressymb.'_showonlyunread'; |
my $visitkey = $ressymb.'_visit'; |
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 $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 $showonlyunread = 0; |
|
my $markondisp = 0; |
my $prevread = 0; |
my $prevread = 0; |
my $previous = 0; |
my $previous = 0; |
my $visit = 0; |
my $visit = 0; |
Line 81 sub list_discussion {
|
Line 113 sub list_discussion {
|
if ($previous > 0) { |
if ($previous > 0) { |
$prevread = $previous; |
$prevread = $previous; |
} elsif (defined($dischash{$lastkey})) { |
} elsif (defined($dischash{$lastkey})) { |
$prevread = $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})) { |
if (defined($dischash{$showkey})) { |
Line 107 sub list_discussion {
|
Line 160 sub list_discussion {
|
my @replies=(); |
my @replies=(); |
my %alldiscussion=(); |
my %alldiscussion=(); |
my %notshown = (); |
my %notshown = (); |
|
my %newitem = (); |
my $maxdepth=0; |
my $maxdepth=0; |
|
|
my $target=''; |
my $target=''; |
Line 116 sub list_discussion {
|
Line 170 sub list_discussion {
|
} |
} |
|
|
my $now = time; |
my $now = time; |
my %discinfo = (); |
|
$discinfo{$visitkey} = $visit; |
$discinfo{$visitkey} = $visit; |
$discinfo{$lastkey} = $now; |
|
|
|
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); |
&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'}; |
my $posttime = $contrib{$idx.':timestamp'}; |
if ($prevread > 0 && $prevread <= $posttime) { |
if ($prevread <= $posttime) { |
$newpostsflag = 1; |
$newpostsflag = 1; |
} |
} |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
Line 218 sub list_discussion {
|
Line 274 sub list_discussion {
|
$sender='<i>'.$screenname.'</i>'; |
$sender='<i>'.$screenname.'</i>'; |
} |
} |
} |
} |
if (&Apache::lonnet::allowed('pch', |
if (&discussion_open($status) && |
|
&Apache::lonnet::allowed('pch', |
$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='. |
Line 244 sub list_discussion {
|
Line 301 sub list_discussion {
|
if ($showonlyunread && $prevread > $posttime) { |
if ($showonlyunread && $prevread > $posttime) { |
$notshown{$idx} = 1; |
$notshown{$idx} = 1; |
} else { |
} else { |
$discussionitems[$idx]='<p><table border="0" width="100%"><tr>'; |
|
if ($prevread > 0 && $prevread <= $posttime) { |
if ($prevread > 0 && $prevread <= $posttime) { |
$discussionitems[$idx] .= '<td align="left" bgcolor="#FFFFFF"><font color="#FF0000">NEW</font></td>'; |
$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"> '. |
$discussionitems[$idx] .= '<td align ="left"> '. |
'<b>'.$subject.'</b> '. |
'<b>'.$subject.'</b> '. |
Line 260 sub list_discussion {
|
Line 324 sub list_discussion {
|
} |
} |
|
|
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 the discusssion |
# Print the discusssion |
$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">'. |
$discussion.='<tr><td bgcolor="DDDDBB" colspan="'.$colspan.'">'. |
'<table border="0" bgcolor="#FFFFFF" width="100%" cellspacing="2" cellpadding="2">'. |
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr><td align="left">'. |
'<tr><td align="left"><b>'.$lt{'cuse'}.'</b></td><td> </td><td align="right"><b>'.$lt{'chgt'}.'</b></td></tr>'. |
'<a href="/adm/feedback?threadedon='.$ressymb.'">'.&mt('Threaded View').'</a> '. |
'<tr><td>'.$lt{'disa'}.': <i>'.$currdisp.'</i></td><td> </td><td align="right"><a href="'.$displink.'">'.$dispchange.'</a></td></tr>'. |
'<a href="/adm/feedback?threadedoff='.$ressymb.'">'.&mt('Chronological View').'</a> </td>'. |
'<tr><td>'.$lt{'npce'}.': <i>'.$currmark.'</i></td><td> </td><td align="right"><a href="'.$marklink.'">'.$markchange.'</a></td></tr>'. |
'<td align="right"><a href="/adm/feedback?'; |
'</table></td></tr>'. |
if ($showonlyunread) { |
'<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'. |
$discussion .= 'allposts='.$ressymb; |
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr>'; |
if ($newpostsflag) { |
if ($visible>2) { |
$discussion .= '&previous='.$prevread; |
$discussion.='<td align="left">'. |
} |
'<a href="/adm/feedback?threadedon='.$ressymb; |
$discussion .='">'.&mt('Show all posts').'?'; |
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 { |
$discussion .= 'onlyunread='.$ressymb; |
$discussion .= '<td> </td>'; |
if ($newpostsflag) { |
|
$discussion .= '&previous='.$prevread; |
|
} |
|
$discussion .= '">'.&mt('Show only unread posts').'?'; |
|
} |
} |
$discussion .= '</a> </td></tr></table></td></tr>'; |
} else { |
} |
$discussion .= '<td> </td>'; |
|
} |
|
$discussion .= '</tr></table></td></tr>'; |
|
|
my $numhidden = keys %notshown; |
my $numhidden = keys %notshown; |
if ($numhidden > 0) { |
if ($numhidden > 0) { |
my $colspan = $maxdepth+1; |
my $colspan = $maxdepth+1; |
Line 305 sub list_discussion {
|
Line 421 sub list_discussion {
|
$discussion.='<td> </td>'; |
$discussion.='<td> </td>'; |
} |
} |
my $colspan=$maxdepth-$thisdepth+1; |
my $colspan=$maxdepth-$thisdepth+1; |
$discussion.='<td bgcolor="#CCCCCC" colspan="'.$colspan.'">'. |
$discussion.='<td bgcolor="'.$bgcols[$newitem{$alldiscussion{$_}}].'" colspan="'.$colspan.'">'. |
$discussionitems[$alldiscussion{$_}]. |
$discussionitems[$alldiscussion{$_}]. |
'</td></tr>'; |
'</td></tr>'; |
} |
} |
Line 323 sub list_discussion {
|
Line 439 sub list_discussion {
|
<font size="1">Note: in anonymous discussion, your name is visible only to |
<font size="1">Note: in anonymous discussion, your name is visible only to |
course faculty</font><br /> |
course faculty</font><br /> |
<b>Title:</b> <input type="text" name="subject" value="" size="30" /><br /><br /> |
<b>Title:</b> <input type="text" name="subject" value="" size="30" /><br /><br /> |
<textarea name="comment" cols="60" rows="10" wrap="hard"></textarea> |
<textarea name="comment" cols="60" rows="12" wrap="hard"></textarea> |
<p> |
<p> |
Attachment (128 KB max size): <input type="file" name="attachment" /> |
Attachment (128 KB max size): <input type="file" name="attachment" /> |
</p> |
</p> |
Line 331 Attachment (128 KB max size): <input typ
|
Line 447 Attachment (128 KB max size): <input typ
|
ENDDISCUSS |
ENDDISCUSS |
$discussion.=&generate_preview_button(); |
$discussion.=&generate_preview_button(); |
} else { |
} else { |
if (&Apache::lonnet::allowed('pch', |
if (&discussion_open($status) && |
|
&Apache::lonnet::allowed('pch', |
$ENV{'request.course.id'}. |
$ENV{'request.course.id'}. |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
Line 369 sub mail_screen {
|
Line 486 sub mail_screen {
|
$prevtag = '<input type="hidden" name="previous" value="'.$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 412 sub mail_screen {
|
Line 531 sub mail_screen {
|
} |
} |
|
|
if (rec) { |
if (rec) { |
|
document.mailform.onsubmit(); |
document.mailform.submit(); |
document.mailform.submit(); |
} else { |
} else { |
alert('Please check a feedback type.'); |
alert('Please check a feedback type.'); |
Line 446 Attachment (128 KB max size): <input typ
|
Line 566 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 549 sub screen_header {
|
Line 671 sub screen_header {
|
} |
} |
} |
} |
if ($ENV{'request.course.id'}) { |
if ($ENV{'request.course.id'}) { |
if (&Apache::lonnet::allowed('pch', |
if (&discussion_open() && |
|
&Apache::lonnet::allowed('pch', |
$ENV{'request.course.id'}. |
$ENV{'request.course.id'}. |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
$discussoptions='<input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" '. |
$discussoptions='<input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" '. |
Line 581 sub resource_output {
|
Line 704 sub resource_output {
|
|
|
sub clear_out_html { |
sub clear_out_html { |
my ($message,$override)=@_; |
my ($message,$override)=@_; |
|
unless (&Apache::lonhtmlcommon::htmlareablocked()) { return $message; } |
my $cid=$ENV{'request.course.id'}; |
my $cid=$ENV{'request.course.id'}; |
if (($ENV{"course.$cid.allow_limited_html_in_feedback"} =~ m/yes/i) || |
if (($ENV{"course.$cid.allow_limited_html_in_feedback"} =~ m/yes/i) || |
($override)) { |
($override)) { |
# allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG> |
# allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG> |
# <BLOCKQUOTE> <DIV .*> <DIV> <IMG> |
# <BLOCKQUOTE> <DIV .*> <DIV> <IMG> <M> <SPAN> <H1> <H2> <H3> <H4> <SUB> |
|
# <SUP> |
my %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, |
my %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, |
BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1, |
BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1, |
M=>1); |
M=>1, SUB=>1, SUP=>1, SPAN=>1, |
|
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); |
|
|
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ |
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ |
{($html{uc($2)}&&(length($1)<1000))?"\<$1":"\<$1"}/ge; |
{($html{uc($2)}&&(length($1)<1000))?"\<$1":"\<$1"}/ge; |
Line 722 sub send_msg {
|
Line 848 sub send_msg {
|
sub adddiscuss { |
sub adddiscuss { |
my ($symb,$email,$anon,$attachmenturl,$subject)=@_; |
my ($symb,$email,$anon,$attachmenturl,$subject)=@_; |
my $status=''; |
my $status=''; |
if (&Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. |
if (&discussion_open() && |
|
&Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
|
|
my %contrib=('message' => $email, |
my %contrib=('message' => $email, |
Line 789 sub generate_preview_button {
|
Line 916 sub generate_preview_button {
|
<input type="hidden" name="subject"> |
<input type="hidden" name="subject"> |
<input type="hidden" name="comment" /> |
<input type="hidden" name="comment" /> |
<input type="button" value="$pre" |
<input type="button" value="$pre" |
onClick="this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" /> |
onClick="document.mailform.onsubmit();this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" /> |
</form> |
</form> |
ENDPREVIEW |
ENDPREVIEW |
} |
} |
Line 805 sub handler {
|
Line 932 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','onlyunread','allposts','previous']); |
['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp']); |
|
|
if (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) { |
if (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'})) { |
|
# ---------------------- Modify setting for identification of 'NEW' posts in this discussion |
|
|
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'}; |
|
my $ressymb = $symb; |
|
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'; |
|
my $ondispkey = $ressymb.'_markondisp'; |
|
if ($ENV{'form.markondisp'}) { |
|
$discinfo{$lastkey} = time; |
|
$discinfo{$ondispkey} = 1; |
|
} elsif ($ENV{'form.markonread'}) { |
|
if ( defined($ENV{'previous'}) ) { |
|
$discinfo{$lastkey} = $ENV{'previous'}; |
|
} |
|
$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'}); |
|
} |
|
return OK; |
|
} elsif (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) { |
# ----------------------------------------------------------------- Modify display setting for this discussion |
# ----------------------------------------------------------------- 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.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'}; |
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); |
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
} |
my %readinghash = (); |
my %discinfo = (); |
|
if ($ENV{'form.allposts'}) { |
if ($contrib{'version'}) { |
$discinfo{$ressymb.'_showonlyunread'} = 0; |
if ($ENV{'form.allposts'}) { |
} elsif ($ENV{'form.onlyunread'}) { |
$readinghash{$symb.'_showonlyunread'} = 0; |
$discinfo{$ressymb.'_showonlyunread'} = 1; |
} elsif ($ENV{'form.onlyunread'}) { |
} |
$readinghash{$symb.'_showonlyunread'} = 1; |
&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 display status').'<br />','0','0','',$ENV{'form.previous'}); |
&Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%readinghash,$ENV{'user.domain'},$ENV{'user.name'}); |
return OK; |
|
} elsif ($ENV{'form.markread'}) { |
|
# ----------------------------------------------------------------- Mark new posts as read |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
my $symb=$ENV{'form.markread'}; |
|
my $ressymb = $symb; |
|
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
|
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
|
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
} |
} |
&redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed reading status').'<br />','0','0','',$ENV{'form.previous'}); |
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; |
return OK; |
} elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
} elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
# ----------------------------------------------------------------- Hide/unhide |
# ----------------------------------------------------------------- Hide/unhide |