version 1.160, 2005/04/11 12:20:22
|
version 1.205, 2006/06/29 21:22:09
|
Line 39 use Apache::lonnet;
|
Line 39 use Apache::lonnet;
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::lonenc(); |
use Apache::lonenc(); |
|
use Apache::lonrss(); |
use HTML::LCParser(); |
use HTML::LCParser(); |
use Apache::lonspeller(); |
use Apache::lonspeller(); |
use Cwd; |
use Cwd; |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
sub discussion_open { |
sub discussion_open { |
my ($status,$symb)=@_; |
my ($status,$symb)=@_; |
|
if ($env{'request.role.adv'}) { return 1; } |
if (defined($status) && |
if (defined($status) && |
!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' |
!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' |
|| $status eq 'OPEN')) { |
|| $status eq 'OPEN')) { |
Line 97 sub list_discussion {
|
Line 101 sub list_discussion {
|
$ressymb=&wrap_symb($ressymb); |
$ressymb=&wrap_symb($ressymb); |
my $encsymb=&Apache::lonenc::check_encrypt($ressymb); |
my $encsymb=&Apache::lonenc::check_encrypt($ressymb); |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
&& ($ressymb=~/\.(problem|exam|quiz|assess|survey|form)$/)); |
&& ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/)); |
|
|
my %usernamesort = (); |
my %usernamesort = (); |
my %namesort =(); |
my %namesort =(); |
Line 113 sub list_discussion {
|
Line 117 sub list_discussion {
|
my $toggkey = $ressymb.'_readtoggle'; |
my $toggkey = $ressymb.'_readtoggle'; |
my $readkey = $ressymb.'_read'; |
my $readkey = $ressymb.'_read'; |
$ressymb=$encsymb; |
$ressymb=$encsymb; |
my %dischash = &Apache::lonnet::get('nohist_'.$env{'request.course.id'}.'_discuss',[$lastkey,$showkey,$markkey,$visitkey,$ondispkey,$userpickkey,$toggkey,$readkey],$env{'user.domain'},$env{'user.name'}); |
my %dischash = &Apache::lonnet::get('nohist_'.$cid.'_discuss',[$lastkey,$showkey,$markkey,$visitkey,$ondispkey,$userpickkey,$toggkey,$readkey],$env{'user.domain'},$env{'user.name'}); |
my %discinfo = (); |
my %discinfo = (); |
my $showonlyunread = 0; |
my $showonlyunread = 0; |
my $showunmark = 0; |
my $showunmark = 0; |
Line 154 sub list_discussion {
|
Line 158 sub list_discussion {
|
my %roleshash = (); |
my %roleshash = (); |
my %roleinfo = (); |
my %roleinfo = (); |
if ($env{'form.rolefilter'}) { |
if ($env{'form.rolefilter'}) { |
%roleshash = &Apache::lonnet::dump('nohist_userroles',$env{'course.'.$env{'request.course.id'}.'.domain'},$env{'course.'.$env{'request.course.id'}.'.num'}); |
%roleshash = &Apache::lonnet::dump('nohist_userroles', |
|
$env{'course.'.$cid.'.domain'}, |
|
$env{'course.'.$cid.'.num'}); |
foreach (keys %roleshash) { |
foreach (keys %roleshash) { |
my ($role,$uname,$udom,$sec) = split/:/,$_; |
my ($role,$uname,$udom,$sec) = split/:/,$_; |
if ($role =~ /^cr/) { |
if ($role =~ /^cr/) { |
Line 171 sub list_discussion {
|
Line 177 sub list_discussion {
|
} |
} |
} |
} |
my ($classlist) = &Apache::loncoursedata::get_classlist( |
my ($classlist) = &Apache::loncoursedata::get_classlist( |
$env{'request.course.id'}, |
$env{'course.'.$cid.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$cid.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
my $sec_index = &Apache::loncoursedata::CL_SECTION(); |
my $sec_index = &Apache::loncoursedata::CL_SECTION(); |
my $status_index = &Apache::loncoursedata::CL_STATUS(); |
my $status_index = &Apache::loncoursedata::CL_STATUS(); |
while (my ($student,$data) = each %$classlist) { |
while (my ($student,$data) = each %$classlist) { |
Line 235 sub list_discussion {
|
Line 240 sub list_discussion {
|
my %notshown = (); |
my %notshown = (); |
my %newitem = (); |
my %newitem = (); |
my $maxdepth=0; |
my $maxdepth=0; |
|
my %anonhash=(); |
|
my $anoncnt=0; |
my $target=''; |
my $target=''; |
unless ($env{'browser.interface'} eq 'textual' || |
unless ($env{'browser.interface'} eq 'textual' || |
$env{'environment.remote'} eq 'off' ) { |
$env{'environment.remote'} eq 'off' ) { |
Line 245 sub list_discussion {
|
Line 251 sub list_discussion {
|
my $now = time; |
my $now = time; |
$discinfo{$visitkey} = $visit; |
$discinfo{$visitkey} = $visit; |
|
|
&Apache::lonnet::put('nohist_'.$env{'request.course.id'}.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'}); |
&Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'}); |
&build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,$statusfilter,$toggkey,$outputtarget); |
&build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt); |
|
|
my $discussion=''; |
my $discussion=''; |
my $manifestfile; |
my $manifestfile; |
Line 390 imscp_v1p1.xsd http://www.imsglobal.org/
|
Line 396 imscp_v1p1.xsd http://www.imsglobal.org/
|
$discussion.='<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$ressymb.'" ><table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">'; |
$discussion.='<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$ressymb.'" ><table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">'; |
$discussion .='<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'. |
$discussion .='<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'. |
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr>'; |
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr>'; |
|
my $escsymb=&escape($ressymb); |
if ($visible>2) { |
if ($visible>2) { |
$discussion.='<td align="left">'. |
$discussion.='<td align="left">'. |
'<a href="/adm/feedback?cmd=threadedon&symb='.$ressymb; |
'<a href="/adm/feedback?cmd=threadedon&symb='.$escsymb; |
if ($newpostsflag) { |
if ($newpostsflag) { |
$discussion .= '&previous='.$prevread; |
$discussion .= '&previous='.$prevread; |
} |
} |
$discussion .='">'.&mt('Threaded View').'</a> '. |
$discussion .='">'.&mt('Threaded View').'</a> '. |
'<a href="/adm/feedback?cmd=threadedoff&symb='.$ressymb; |
'<a href="/adm/feedback?cmd=threadedoff&symb='.$escsymb; |
if ($newpostsflag) { |
if ($newpostsflag) { |
$discussion .= '&previous='.$prevread; |
$discussion .= '&previous='.$prevread; |
} |
} |
$discussion .='">'.&mt('Chronological View').'</a> |
$discussion .='">'.&mt('Chronological View').'</a> |
<a href= "/adm/feedback?cmd=sortfilter&symb='.$ressymb; |
<a href= "/adm/feedback?cmd=sortfilter&symb='.$escsymb; |
if ($newpostsflag) { |
if ($newpostsflag) { |
$discussion .= '&previous='.$prevread; |
$discussion .= '&previous='.$prevread; |
} |
} |
Line 410 imscp_v1p1.xsd http://www.imsglobal.org/
|
Line 417 imscp_v1p1.xsd http://www.imsglobal.org/
|
} else { |
} else { |
$discussion .= '<td align="left">'; |
$discussion .= '<td align="left">'; |
} |
} |
$discussion .='<a href= "/adm/feedback?export='.$ressymb; |
$discussion .='<a href= "/adm/feedback?export='.$escsymb; |
if ($newpostsflag) { |
if ($newpostsflag) { |
$discussion .= '&previous='.$prevread; |
$discussion .= '&previous='.$prevread; |
} |
} |
$discussion .= '">'.&mt('Export').'?</a> </td>'; |
$discussion .= '">'.&mt('Export').'?</a> </td>'; |
if ($newpostsflag) { |
if ($newpostsflag) { |
if (!$markondisp) { |
if (!$markondisp) { |
$discussion .='<td align="right"><a href="/adm/feedback?markread=1&symb='.$ressymb.'">'.&mt('Mark NEW posts no longer new').'</a> '; |
$discussion .='<td align="right"><a href="/adm/preferences?action=changediscussions">'. |
|
&mt('Preferences on what is marked as NEW'). |
|
'</a><br /><a href="/adm/feedback?markread=1&symb='.$escsymb.'">'.&mt('Mark NEW posts no longer new').'</a>'; |
} else { |
} else { |
$discussion .= '<td> </td>'; |
$discussion .= '<td> </td>'; |
} |
} |
Line 430 imscp_v1p1.xsd http://www.imsglobal.org/
|
Line 439 imscp_v1p1.xsd http://www.imsglobal.org/
|
if ($numhidden > 0) { |
if ($numhidden > 0) { |
my $colspan = $maxdepth+1; |
my $colspan = $maxdepth+1; |
$discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'. |
$discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'. |
'<a href="/adm/feedback?allposts=1&symb='.$ressymb; |
'<a href="/adm/feedback?allposts=1&symb='.$escsymb; |
if ($newpostsflag) { |
if ($newpostsflag) { |
$discussion .= '&previous='.$prevread; |
$discussion .= '&previous='.$prevread; |
} |
} |
Line 687 END
|
Line 696 END
|
my $subject = ''; |
my $subject = ''; |
if ($env{'form.origpage'}) { |
if ($env{'form.origpage'}) { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['addnewattach','deloldattach','delnewattach','timestamp','idx','subject','comment']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['addnewattach','deloldattach','delnewattach','timestamp','idx','subject','comment']); |
$subject = &Apache::lonnet::unescape($env{'form.subject'}); |
$subject = &unescape($env{'form.subject'}); |
$comment = &Apache::lonnet::unescape($env{'form.comment'}); |
$comment = &unescape($env{'form.comment'}); |
my @keepold = (); |
my @keepold = (); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
Line 719 ENDDISCUSS
|
Line 728 ENDDISCUSS
|
if ($outputtarget ne 'tex') { |
if ($outputtarget ne 'tex') { |
$discussion.=&generate_attachments_button('',$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,'',$mode); |
$discussion.=&generate_attachments_button('',$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,'',$mode); |
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
$newattachmsg .= '<b>New attachments</b><br />'; |
$newattachmsg .= '<br /><b>New attachments</b><br />'; |
if (@currnewattach > 1) { |
if (@currnewattach > 1) { |
$newattachmsg .= '<ol>'; |
$newattachmsg .= '<ol>'; |
foreach my $item (@currnewattach) { |
foreach my $item (@currnewattach) { |
Line 737 ENDDISCUSS
|
Line 746 ENDDISCUSS
|
} |
} |
} |
} |
} else { |
} else { |
|
$discussion.='<table bgcolor="#BBBBBB"><tr><td>'; |
if (&discussion_open($status) && |
if (&discussion_open($status) && |
&Apache::lonnet::allowed('pch', |
&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'}:''))) { |
if ($outputtarget ne 'tex') { |
if ($outputtarget ne 'tex') { |
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
$discussion.='<a href="/adm/feedback?replydisc='. |
$ressymb.':::" '.$target.'>'. |
&escape($ressymb).':::" '.$target.'>'. |
'<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'. |
'<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'. |
&mt('Post Discussion').'</a></td></tr></table>'; |
&mt('Post Discussion').'</a><br />'; |
} |
} |
} |
} |
|
$discussion.='<a href="/adm/feedback?sendmessageonly=1&symb='. |
|
&escape($ressymb). |
|
'"><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" border="0" />'. |
|
&mt('Send Message').'</td></tr></table>'; |
} |
} |
return $discussion; |
return $discussion; |
} |
} |
|
|
sub build_posting_display { |
sub build_posting_display { |
my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$statusfilter,$toggkey,$outputtarget) = @_; |
my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt) = @_; |
my @original=(); |
my @original=(); |
my @index=(); |
my @index=(); |
my $symb=&Apache::lonenc::check_decrypt($ressymb); |
my $symb=&Apache::lonenc::check_decrypt($ressymb); |
|
my $escsymb=&escape($ressymb); |
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'}); |
Line 820 sub build_posting_display {
|
Line 835 sub build_posting_display {
|
my %allattachments = (); |
my %allattachments = (); |
my ($screenname,$plainname); |
my ($screenname,$plainname); |
my $sender = &mt('Anonymous'); |
my $sender = &mt('Anonymous'); |
|
# Anonymous users getting number within a discussion |
|
# Since idx is in static order, this should give the same sequence every time. |
|
my $key=$contrib{$idx.':sendername'}.'@'.$contrib{$idx.':senderdomain'}; |
|
unless ($$anonhash{$key}) { |
|
$anoncnt++; |
|
$$anonhash{$key}=&mt('Anonymous').' '.$anoncnt; |
|
} |
my ($message,$subject,$vgrlink,$ctlink); |
my ($message,$subject,$vgrlink,$ctlink); |
&get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver); |
&get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver); |
|
|
Line 858 sub build_posting_display {
|
Line 880 sub build_posting_display {
|
$contrib{$idx.':sendername'}.' at '. |
$contrib{$idx.':sendername'}.' at '. |
$contrib{$idx.':senderdomain'}.')'; |
$contrib{$idx.':senderdomain'}.')'; |
if ($contrib{$idx.':anonymous'}) { |
if ($contrib{$idx.':anonymous'}) { |
$sender.=' ['.&mt('anonymous').'] '. |
$sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '. |
$screenname; |
$screenname; |
} |
} |
|
|
Line 891 sub build_posting_display {
|
Line 913 sub build_posting_display {
|
} else { |
} else { |
@{$$namesort{$lastname}{$firstname}} = ("$idx"); |
@{$$namesort{$lastname}{$firstname}} = ("$idx"); |
} |
} |
if ($env{'course.'.$env{'request.course.id'}.'.allow_discussion_post_editing'} =~ m/yes/i) { |
if (&editing_allowed()) { |
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { |
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { |
$sender.=' <a href="/adm/feedback?editdisc='. |
$sender.=' <a href="/adm/feedback?editdisc='. |
$ressymb.':::'.$idx; |
$escsymb.':::'.$idx; |
if ($newpostsflag) { |
if ($$newpostsflag) { |
$sender .= '&previous='.$prevread; |
$sender .= '&previous='.$prevread; |
} |
} |
$sender .= '" '.$target.'>'.&mt('Edit').'</a>'; |
$sender .= '" '.$target.'>'.&mt('Edit').'</a>'; |
unless ($seeid) { |
unless ($seeid) { |
$sender.=" <a href=\"javascript:studentdelete('$ressymb','$idx','$newpostsflag','$prevread')"; |
$sender.=" <a href=\"javascript:studentdelete('$escsymb','$idx','$$newpostsflag','$prevread')"; |
$sender .= '">'.&mt('Delete').'</a>'; |
$sender .= '">'.&mt('Delete').'</a>'; |
} |
} |
} |
} |
Line 909 sub build_posting_display {
|
Line 931 sub build_posting_display {
|
if ($hidden) { |
if ($hidden) { |
unless ($studenthidden) { |
unless ($studenthidden) { |
$sender.=' <a href="/adm/feedback?unhide='. |
$sender.=' <a href="/adm/feedback?unhide='. |
$ressymb.':::'.$idx; |
$escsymb.':::'.$idx; |
if ($newpostsflag) { |
if ($$newpostsflag) { |
$sender .= '&previous='.$prevread; |
$sender .= '&previous='.$prevread; |
} |
} |
$sender .= '">'.&mt('Make Visible').'</a>'; |
$sender .= '">'.&mt('Make Visible').'</a>'; |
} |
} |
} else { |
} else { |
$sender.=' <a href="/adm/feedback?hide='. |
$sender.=' <a href="/adm/feedback?hide='. |
$ressymb.':::'.$idx; |
$escsymb.':::'.$idx; |
if ($newpostsflag) { |
if ($$newpostsflag) { |
$sender .= '&previous='.$prevread; |
$sender .= '&previous='.$prevread; |
} |
} |
$sender .= '">'.&mt('Hide').'</a>'; |
$sender .= '">'.&mt('Hide').'</a>'; |
} |
} |
$sender.=' <a href="/adm/feedback?deldisc='. |
$sender.=' <a href="/adm/feedback?deldisc='. |
$ressymb.':::'.$idx; |
$escsymb.':::'.$idx; |
if ($newpostsflag) { |
if ($$newpostsflag) { |
$sender .= '&previous='.$prevread; |
$sender .= '&previous='.$prevread; |
} |
} |
$sender .= '">'.&mt('Delete').'</a>'; |
$sender .= '">'.&mt('Delete').'</a>'; |
Line 933 sub build_posting_display {
|
Line 955 sub build_posting_display {
|
} else { |
} else { |
if ($screenname) { |
if ($screenname) { |
$sender='<i>'.$screenname.'</i>'; |
$sender='<i>'.$screenname.'</i>'; |
|
} else { |
|
$sender='<i>'.$$anonhash{$key}.'</i>'; |
} |
} |
# Set up for sorting by domain, then username for anonymous |
# Set up for sorting by domain, then username for anonymous |
unless (defined($$usernamesort{'__anon'})) { |
unless (defined($$usernamesort{'__anon'})) { |
Line 958 sub build_posting_display {
|
Line 982 sub build_posting_display {
|
$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; |
$escsymb.':::'.$idx; |
if ($newpostsflag) { |
if ($$newpostsflag) { |
$sender .= '&previous='.$prevread; |
$sender .= '&previous='.$prevread; |
} |
} |
$sender .= '" '.$target.'>'.&mt('Reply').'</a>'; |
$sender .= '" '.$target.'>'.&mt('Reply').'</a>'; |
} |
} |
Line 1074 sub build_posting_display {
|
Line 1098 sub build_posting_display {
|
my @postversions = (); |
my @postversions = (); |
$$discussionitems[$idx] .= &mt('This post has been edited by the author.'); |
$$discussionitems[$idx] .= &mt('This post has been edited by the author.'); |
if ($seeid) { |
if ($seeid) { |
$$discussionitems[$idx] .= ' <a href="/adm/feedback?allversions='.$ressymb.':::'.$idx.'">'.&mt('Display all versions').'</a>'; |
$$discussionitems[$idx] .= ' <a href="/adm/feedback?allversions='.$escsymb.':::'.$idx.'">'.&mt('Display all versions').'</a>'; |
} |
} |
$$discussionitems[$idx].='<br/>'.&mt('Earlier version(s) were posted on: '); |
$$discussionitems[$idx].='<br/>'.&mt('Earlier version(s) were posted on: '); |
if ($contrib{$idx.':history'} =~ m/:/) { |
if ($contrib{$idx.':history'} =~ m/:/) { |
Line 1164 sub get_post_contents {
|
Line 1188 sub get_post_contents {
|
# $$screenname=&Apache::loncommon::screenname( |
# $$screenname=&Apache::loncommon::screenname( |
# $$contrib{$idx.':sendername'}, |
# $$contrib{$idx.':sendername'}, |
# $$contrib{$idx.':senderdomain'}); |
# $$contrib{$idx.':senderdomain'}); |
# $$plainname=&Apache::loncommon::nickname( |
$$plainname=&Apache::loncommon::nickname( |
# $$contrib{$idx.':sendername'}, |
$$contrib{$idx.':sendername'}, |
# $$contrib{$idx.':senderdomain'}); |
$$contrib{$idx.':senderdomain'}); |
($$screenname,$$plainname)=($$contrib{$idx.':screenname'}, |
$$screenname=$$contrib{$idx.':screenname'}; |
$$contrib{$idx.':plainname'}); |
|
my $sender=&Apache::loncommon::aboutmewrapper( |
my $sender=&Apache::loncommon::aboutmewrapper( |
$$plainname, |
$$plainname, |
$$contrib{$idx.':sendername'}, |
$$contrib{$idx.':sendername'}, |
Line 1180 sub get_post_contents {
|
Line 1204 sub get_post_contents {
|
if ($type eq 'allversions' || $type eq 'export') { |
if ($type eq 'allversions' || $type eq 'export') { |
$start = 0; |
$start = 0; |
if ($$contrib{$idx.':history'}) { |
if ($$contrib{$idx.':history'}) { |
if ($$contrib{$idx.':history'} =~ m/:/) { |
@postversions = split(/:/,$$contrib{$idx.':history'}); |
@postversions = split/:/,$$contrib{$idx.':history'}; |
|
} else { |
|
@postversions = ("$$contrib{$idx.':history'}"); |
|
} |
|
} |
} |
&get_post_versions($messages,$$contrib{$idx.':message'},1); |
&get_post_versions($messages,$$contrib{$idx.':message'},1); |
&get_post_versions($subjects,$$contrib{$idx.':subject'},1); |
&get_post_versions($subjects,$$contrib{$idx.':subject'},1); |
Line 1205 sub get_post_contents {
|
Line 1225 sub get_post_contents {
|
my ($timesent,$attachmsg); |
my ($timesent,$attachmsg); |
my %currattach = (); |
my %currattach = (); |
$timesent = &Apache::lonlocal::locallocaltime($postversions[$i]); |
$timesent = &Apache::lonlocal::locallocaltime($postversions[$i]); |
$$messages{$i}=~s/\n/\<br \/\>/g; |
&newline_to_br(\$messages->{$i}); |
$$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i}); |
$$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i}); |
$$subjects{$i}=~s/\n/\<br \/\>/g; |
$$subjects{$i}=~s/\n/\<br \/\>/g; |
$$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i}); |
$$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i}); |
Line 1240 END
|
Line 1260 END
|
} |
} |
} |
} |
if ($type eq 'allversions') { |
if ($type eq 'allversions') { |
$discussion.=('</ul></body></html>'); |
$discussion.='</ul>'; |
return $discussion; |
return $discussion; |
} else { |
} else { |
return; |
return; |
Line 1288 sub replicate_attachments {
|
Line 1308 sub replicate_attachments {
|
sub mail_screen { |
sub mail_screen { |
my ($r,$feedurl,$options) = @_; |
my ($r,$feedurl,$options) = @_; |
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']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']); |
} |
} |
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', |
|
'','onLoad="window.focus();setposttype();"'); |
|
my $title=&Apache::lonnet::gettitle($feedurl); |
my $title=&Apache::lonnet::gettitle($feedurl); |
if (!$title) { $title = $feedurl; } |
if (!$title) { $title = $feedurl; } |
my $quote=''; |
my $quote=''; |
Line 1311 sub mail_screen {
|
Line 1330 sub mail_screen {
|
my $attachnum = 0; |
my $attachnum = 0; |
my $anonchk = (<<END); |
my $anonchk = (<<END); |
function anonchk() { |
function anonchk() { |
if (document.mailform.anondiscuss.checked == true) { |
for (var i=0; i < document.mailform.discuss.length; i++) { |
document.attachment.anondiscuss.value = '1' |
if (document.mailform.discuss[i].checked) { |
} |
document.attachment.discuss.value = |
if (document.mailform.discuss.checked == true) { |
document.mailform.discuss[i].value; |
document.attachment.discuss.value = '1' |
} |
} |
} |
|
if (document.mailform.blog.checked) { |
|
document.attachment.blog.value = 1; |
|
} |
return |
return |
} |
} |
END |
END |
Line 1324 END
|
Line 1346 END
|
if (exists($env{'form.origpage'})) { |
if (exists($env{'form.origpage'})) { |
$anonscript = (<<END); |
$anonscript = (<<END); |
function setposttype() { |
function setposttype() { |
var anondisc = $env{'form.anondiscuss'}; |
var disc = "$env{'form.discuss'}"; |
var disc = $env{'form.discuss'}; |
for (var i=0; i < document.mailform.discuss.length; i++) { |
if (anondisc == 1) { |
if (disc == document.mailform.discuss[i].value) { |
document.mailform.anondiscuss.checked = true |
document.mailform.discuss[i].checked = 1; |
|
} |
} |
} |
if (disc == 1) { |
var blog = "$env{'form.blog'}"; |
document.mailform.discuss.checked = true |
if (blog == 1) { |
|
document.mailform.blog.checked=1; |
} |
} |
return |
return |
} |
} |
Line 1375 END
|
Line 1399 END
|
&get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver); |
&get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver); |
$message = $msgversions{$numoldver}; |
$message = $msgversions{$numoldver}; |
} |
} |
$message=~s/\n/\<br \/\>/g; |
&newline_to_br(\$message); |
$quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>'; |
$quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>'; |
if ($idx > 0) { |
if ($idx > 0) { |
my %subversions = (); |
my %subversions = (); |
Line 1397 END
|
Line 1421 END
|
$parentmsg = $contrib{$idx.':replyto'}; |
$parentmsg = $contrib{$idx.':replyto'}; |
} |
} |
unless (exists($env{'form.origpage'})) { |
unless (exists($env{'form.origpage'})) { |
my $anonflag = 0; |
my $anonflag = 'nonanon'; |
if ($contrib{$idx.':anonymous'}) { |
if ($contrib{$idx.':anonymous'}) { |
$anonflag = 1; |
$anonflag = 'anon'; |
} |
} |
$anonscript = (<<END); |
$anonscript = (<<END); |
function setposttype () { |
function setposttype () { |
var currtype = $anonflag |
var currtype = "$anonflag"; |
if (currtype == 1) { |
for (var i=0; i<document.mailform.discuss.length; i++) { |
document.mailform.elements.discuss.checked = false |
if (document.mailform.elements.discuss[i].value == currtype ) { |
document.mailform.elements.anondiscuss.checked = true |
document.mailform.elements.discuss[i].checked=1; |
} |
} |
if (currtype == 0) { |
|
document.mailform.elements.anondiscuss.checked = false |
|
document.mailform.elements.discuss.checked = true |
|
} |
} |
return |
return |
} |
} |
Line 1424 END
|
Line 1445 END
|
} |
} |
|
|
if ($env{'form.origpage'}) { |
if ($env{'form.origpage'}) { |
$subject = &Apache::lonnet::unescape($env{'form.subject'}); |
$subject = &unescape($env{'form.subject'}); |
$comment = &Apache::lonnet::unescape($env{'form.comment'}); |
$comment = &unescape($env{'form.comment'}); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
} |
} |
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); |
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); |
my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders(); |
|
my $send=&mt('Send'); |
my $send=&mt('Send'); |
my $html=&Apache::lonxml::xmlbegin(); |
my $js= <<END; |
$r->print(<<END); |
|
$html |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
<meta http-equiv="pragma" content="no-cache"></meta> |
|
$htmlheader |
|
<script type="text/javascript"> |
<script type="text/javascript"> |
//<!-- |
//<!-- |
function gosubmit() { |
function gosubmit() { |
var rec=0; |
var rec=0; |
if (typeof(document.mailform.elements.author)!="undefined") { |
|
if (document.mailform.elements.author.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.question)!="undefined") { |
|
if (document.mailform.elements.question.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.course)!="undefined") { |
|
if (document.mailform.elements.course.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.policy)!="undefined") { |
|
if (document.mailform.elements.policy.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.discuss)!="undefined") { |
if (typeof(document.mailform.elements.discuss)!="undefined") { |
if (document.mailform.elements.discuss.checked) { |
if (typeof(document.mailform.elements.discuss.length) == "undefined") { |
rec=1; |
if (document.mailform.elements.discuss.checked ) { |
} |
rec=1; |
} |
} |
if (typeof(document.mailform.elements.anondiscuss)!="undefined") { |
} else { |
if (document.mailform.elements.anondiscuss.checked) { |
for (var i=0; i<document.mailform.elements.discuss.length; i++) { |
|
if (document.mailform.elements.discuss[i].checked ) { |
|
rec=1; |
|
} |
|
} |
|
} |
|
} |
|
if (typeof(document.mailform.elements.blog)!="undefined") { |
|
if (document.mailform.elements.blog.checked) { |
rec=1; |
rec=1; |
} |
} |
} |
} |
Line 1479 $htmlheader
|
Line 1481 $htmlheader
|
} |
} |
document.mailform.submit(); |
document.mailform.submit(); |
} else { |
} else { |
alert('Please check a feedback type.'); |
alert('Please select a feedback type.'); |
} |
} |
} |
} |
$anonchk |
$anonchk |
$anonscript |
$anonscript |
//--> |
//--> |
</script> |
</script> |
</head> |
END |
$bodytag |
|
|
my %onload = ('onload' => 'window.focus();setposttype();'); |
|
my $start_page= |
|
&Apache::loncommon::start_page('Resource Feedback and Discussion',$js, |
|
{'add_entries' => \%onload}); |
|
|
|
$r->print(<<END); |
|
$start_page |
<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"> |
Line 1561 END
|
Line 1570 END
|
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver)); |
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver)); |
if ($attachnum > 0) { |
if ($attachnum > 0) { |
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
$newattachmsg .= '<b>New attachments</b><br />'; |
$newattachmsg .= '<br /><b>New attachments</b><br />'; |
if (@currnewattach > 1) { |
if (@currnewattach > 1) { |
$newattachmsg .= '<ol>'; |
$newattachmsg .= '<ol>'; |
foreach my $item (@currnewattach) { |
foreach my $item (@currnewattach) { |
Line 1584 END
|
Line 1593 END
|
} |
} |
$r->print(&generate_preview_button(). |
$r->print(&generate_preview_button(). |
&Apache::lonhtmlcommon::htmlareaselectactive('comment'). |
&Apache::lonhtmlcommon::htmlareaselectactive('comment'). |
'</body></html>'); |
&Apache::loncommon::end_page()); |
|
|
} |
} |
|
|
sub print_display_options { |
sub print_display_options { |
Line 1595 sub print_display_options {
|
Line 1605 sub print_display_options {
|
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
$env{'user.domain'}); |
$env{'user.domain'}); |
my $bodytag=&Apache::loncommon::bodytag('Discussion options', |
|
'',''); |
|
|
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'dido' => 'Discussion display options', |
|
'pref' => 'Display Preference', |
'pref' => 'Display Preference', |
'curr' => 'Current setting ', |
'curr' => 'Current setting ', |
'actn' => 'Action', |
'actn' => 'Action', |
Line 1657 sub print_display_options {
|
Line 1664 sub print_display_options {
|
$currtogg = $lt{'toggon'}; |
$currtogg = $lt{'toggon'}; |
$disctogg = 'toggon'; |
$disctogg = 'toggon'; |
} |
} |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<END); |
my $js = <<END; |
$html |
<script type="text/javascript"> |
<head> |
|
<title>$lt{'dido'}</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<script> |
|
function discdispChk(caller) { |
function discdispChk(caller) { |
var disctogg = '$toggchg' |
var disctogg = '$toggchg' |
if (caller == 0) { |
if (caller == 0) { |
Line 1730 function setDisp() {
|
Line 1733 function setDisp() {
|
} |
} |
} |
} |
</script> |
</script> |
</head> |
END |
$bodytag |
|
<form name="modifydisp" method="post" action="/adm/feedback"> |
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Discussion display options',$js); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
$r->print(<<END); |
|
$start_page |
|
<form name="modifydisp" method="POST" action="/adm/feedback"> |
$lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol> |
$lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol> |
<br /> |
<br /> |
<table border="0" cellpadding="0" cellspacing="0"> |
END |
<tr> |
$r->print(&Apache::loncommon::start_data_table()); |
<td width="100%" bgcolor="#000000"> |
$r->print(<<END); |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<tr> |
<tr> |
<th>$lt{'pref'}</td> |
<td width="100%" bgcolor="#000000"> |
<th>$lt{'curr'}</td> |
<table border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> |
<th>$lt{'actn'}?</td> |
<tr bgcolor="$tabcolor"> |
|
<td><b>$lt{'pref'}</b></td> |
|
<td><b>$lt{'curr'}</b></td> |
|
<td><b>$lt{'actn'}?</b></td> |
|
</tr> |
</tr> |
<tr bgcolor="#dddddd"> |
END |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<END); |
<td>$lt{'disa'}</td> |
<td>$lt{'disa'}</td> |
<td>$lt{$discdisp}</td> |
<td>$lt{$discdisp}</td> |
<td><label><input type="checkbox" name="discdisp" onClick="discdispChk('0')" /> $lt{'chgt'} "$dispchangeA"</label> |
<td><label><input type="checkbox" name="discdisp" onClick="discdispChk('0')" /> $lt{'chgt'} "$dispchangeA"</label> |
<br /> |
<br /> |
<label><input type="checkbox" name="discdisp" onClick="discdispChk('1')" /> $lt{'chgt'} "$dispchangeB"</label> |
<label><input type="checkbox" name="discdisp" onClick="discdispChk('1')" /> $lt{'chgt'} "$dispchangeB"</label> |
</td> |
</td> |
</tr><tr bgcolor="#eeeeee"> |
END |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<END); |
<td>$lt{'npmr'}</td> |
<td>$lt{'npmr'}</td> |
<td>$lt{$discmark}</td> |
<td>$lt{$discmark}</td> |
<td><label><input type="checkbox" name="discmark" />$lt{'chgt'} "$markchange"</label></td> |
<td><label><input type="checkbox" name="discmark" />$lt{'chgt'} "$markchange"</label></td> |
</tr><tr bgcolor="#dddddd"> |
END |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<END); |
<td>$lt{'dotm'}</td> |
<td>$lt{'dotm'}</td> |
<td>$lt{$disctogg}</td> |
<td>$lt{$disctogg}</td> |
<td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td> |
<td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td> |
</tr> |
END |
</table> |
$r->print(&Apache::loncommon::end_data_table_row()); |
</td> |
$r->print(&Apache::loncommon::end_data_table()); |
</tr> |
$r->print(<<END); |
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
<br /> |
<br /> |
<br /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
Line 1782 $lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$l
|
Line 1792 $lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$l
|
<br /> |
<br /> |
<br /> |
<br /> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
return; |
return; |
} |
} |
Line 1795 sub print_sortfilter_options {
|
Line 1804 sub print_sortfilter_options {
|
$r->send_http_header; |
$r->send_http_header; |
|
|
&Apache::lonenc::check_encrypt(\$symb); |
&Apache::lonenc::check_encrypt(\$symb); |
my @sections = (); |
my @sections; |
my $section_sel = ''; |
my $section_sel = ''; |
my $numsections = 0; |
|
my $numvisible = 5; |
my $numvisible = 5; |
my %sectioncount = (); |
my %sectioncount = &Apache::loncommon::get_sections(); |
|
|
$numsections = &Apache::loncommon::get_sections($env{'course.'.$env{'request.course.id'}.'.domain'},$env{'course.'.$env{'request.course.id'}.'.num'},\%sectioncount); |
|
|
|
if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section |
if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section |
@sections = ('all',$env{'request.course.sec'}); |
@sections = ('all',$env{'request.course.sec'}); |
$numvisible = 2; |
$numvisible = 2; |
} else { |
} else { |
@sections = sort {$a cmp $b} keys(%sectioncount); |
@sections = sort {$a cmp $b} keys(%sectioncount); |
unshift(@sections,'all'); # Put 'all' at the front of the list |
if (scalar(@sections) < 4) { |
if ($numsections < 4) { |
$numvisible = scalar(@sections) + 1; |
$numvisible = $numsections + 1; |
|
} |
} |
|
unshift(@sections,'all'); # Put 'all' at the front of the list |
|
|
} |
} |
foreach (@sections) { |
foreach (@sections) { |
$section_sel .= " <option value=\"$_\" />$_\n"; |
$section_sel .= " <option value=\"$_\" />$_\n"; |
Line 1820 sub print_sortfilter_options {
|
Line 1827 sub print_sortfilter_options {
|
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
$env{'user.domain'}); |
$env{'user.domain'}); |
my $bodytag=&Apache::loncommon::bodytag('Discussion options', |
|
'',''); |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'diso' => 'Discussion sorting and filtering options', |
|
'diop' => 'Display Options', |
'diop' => 'Display Options', |
'curr' => 'Current setting ', |
'curr' => 'Current setting ', |
'actn' => 'Action', |
'actn' => 'Action', |
Line 1840 sub print_sortfilter_options {
|
Line 1844 sub print_sortfilter_options {
|
my %role_types = (); |
my %role_types = (); |
my %status_types = (); |
my %status_types = (); |
&sort_filter_names(\%sort_types,\%role_types,\%status_types); |
&sort_filter_names(\%sort_types,\%role_types,\%status_types); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<END); |
my $js = <<END; |
$html |
|
<head> |
|
<title>$lt{'diso'}</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<script type="text/javascript"> |
<script type="text/javascript"> |
function verifyFilter() { |
function verifyFilter() { |
var rolenum = 0 |
var rolenum = 0 |
Line 1870 function verifyFilter() {
|
Line 1870 function verifyFilter() {
|
document.modifyshown.submit(); |
document.modifyshown.submit(); |
} |
} |
</script> |
</script> |
</head> |
END |
$bodytag |
|
<form name="modifyshown" method="post" action="/adm/feedback"> |
my $start_page= |
|
&Apache::loncommon::start_page('Discussion options',$js); |
|
my $end_page= |
|
&Apache::loncommon::end_page(); |
|
|
|
$r->print(<<END); |
|
$start_page |
|
<form name="modifyshown" method="POST" action="/adm/feedback"> |
<b>$lt{'diso'}</b><br/> $lt{'prca'} |
<b>$lt{'diso'}</b><br/> $lt{'prca'} |
<br /><br /> |
<br /><br /> |
<table border="0"> |
<table border="0"> |
Line 1937 $bodytag
|
Line 1944 $bodytag
|
<br /> |
<br /> |
<br /> |
<br /> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
} |
} |
|
|
Line 1960 sub print_showposters {
|
Line 1966 sub print_showposters {
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
my %namesort = (); |
my %namesort = (); |
my %postcounts = (); |
my %postcounts = (); |
my %lt=&Apache::lonlocal::texthash( |
|
'diso' => 'Discussion filtering options', |
|
); |
|
my $bodytag=&Apache::loncommon::bodytag('Discussion options', |
|
'',''); |
|
if ($contrib{'version'}) { |
if ($contrib{'version'}) { |
for (my $idx=1;$idx<=$contrib{'version'};$idx++) { |
for (my $idx=1;$idx<=$contrib{'version'};$idx++) { |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
Line 1996 sub print_showposters {
|
Line 1998 sub print_showposters {
|
} |
} |
} |
} |
} |
} |
my $html=&Apache::lonxml::xmlbegin(); |
|
|
my $start_page = &Apache::loncommon::start_page('Discussion options'); |
|
my $table_start =&Apache::loncommon::start_data_table(); |
$r->print(<<END); |
$r->print(<<END); |
$html |
$start_page |
<head> |
|
<title>$lt{'diso'}</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
</head> |
|
$bodytag |
|
<form name="pickpostersform" method="post"> |
<form name="pickpostersform" method="post"> |
<table border="0"> |
<br /> |
<tr> |
$table_start |
<td bgcolor="#777777"> |
<tr> |
<table border="0" cellpadding="3"> |
<th>No.</th> |
<tr bgcolor="#e6ffff"> |
<th>Select</th> |
<td><b>No.</b></td> |
<th>Fullname<font color="#999999">(Username/domain)</font></th> |
<td><b>Select</b></td> |
<th>Posts</th> |
<td><b>Fullname</b><font color="#999999">(Username/domain)</font></td> |
|
<td><b>Posts</td> |
|
</tr> |
</tr> |
END |
END |
my $count = 0; |
my $count = 0; |
Line 2025 END
|
Line 2022 END
|
next; |
next; |
} else { |
} else { |
$count ++; |
$count ++; |
$r->print('<tr bgcolor="#ffffe6"><td align="right">'.$count.'</td><td align="center"><label><input name="stuinfo" type="checkbox" value="'.$_.'" /></td><td>'.$last.', '.$first.' ('.$uname.','.$udom.')</label></td><td>'.$postcounts{$_}.'</td></tr>'); |
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<td align="right">'.$count.'</td> |
|
<td align="center"><label><input name="stuinfo" type="checkbox" value="'.$_.'" /></td> |
|
<td>'.$last.', '.$first.' ('.$uname.','.$udom.')</label></td> |
|
<td>'.$postcounts{$_}.'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
} |
} |
} |
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
my $end_page = &Apache::loncommon::end_page(); |
$r->print(<<END); |
$r->print(<<END); |
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
<br /> |
<input type="hidden" name="sortposts" value="$sortposts" /> |
<input type="hidden" name="sortposts" value="$sortposts" /> |
<input type="hidden" name="userpick" value="$symb" /> |
<input type="hidden" name="userpick" value="$symb" /> |
<input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" /> |
<input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" /> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
} |
} |
|
|
Line 2049 sub get_post_versions {
|
Line 2048 sub get_post_versions {
|
my ($versions,$incoming,$htmldecode,$numver) = @_; |
my ($versions,$incoming,$htmldecode,$numver) = @_; |
if ($incoming =~ /^<version num="0">/) { |
if ($incoming =~ /^<version num="0">/) { |
my $p = HTML::LCParser->new(\$incoming); |
my $p = HTML::LCParser->new(\$incoming); |
my $done = 0; |
my $done = 0; |
|
|
while ( (my $token = $p->get_tag("version")) && (!$done)) { |
while ( (my $token = $p->get_tag("version")) && (!$done)) { |
my $num = $token->[1]{num}; |
my $num = $token->[1]{num}; |
my $text = $p->get_text("/version"); |
my $text = $p->get_text("/version"); |
Line 2110 sub fail_redirect {
|
Line 2110 sub fail_redirect {
|
my ($r,$feedurl) = @_; |
my ($r,$feedurl) = @_; |
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(&Apache::loncommon::start_page('Feedback not sent',undef, |
$r->print (<<ENDFAILREDIR); |
{'redirect' => [2,$feedurl], |
$html |
'only_body' => 1,})); |
<head> |
$r->print(<<ENDFAILREDIR); |
<title>Feedback not sent</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
|
</head> |
|
<body bgcolor="#FFFFFF"> |
|
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
<b>Sorry, no recipients ...</b> |
<b>Sorry, no recipients ...</b> |
<br /><a href="$feedurl">Continue</a> |
|
</body> |
|
</html> |
|
ENDFAILREDIR |
ENDFAILREDIR |
|
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
sub redirect_back { |
sub redirect_back { |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$numpicks) = @_; |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$numpicks) = @_; |
my $sorttag = ''; |
my $sorttag = ''; |
my $roletag = ''; |
my $roletag = ''; |
my $statustag = ''; |
my $statustag = ''; |
Line 2198 sub redirect_back {
|
Line 2191 sub redirect_back {
|
} |
} |
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $html=&Apache::lonxml::xmlbegin(); |
my %onload; |
$r->print (<<ENDREDIR); |
if ($env{'environment.remote'} ne 'off') { |
$html |
$onload{'onload'} = |
<head> |
"if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"; |
<title>Feedback sent</title> |
} |
<meta http-equiv="pragma" content="no-cache" /> |
my $start_page= |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
&Apache::loncommon::start_page('New posts marked as read',undef, |
</head> |
{'redirect' => [2,$feedurl], |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
'only_body' => 1, |
|
'add_entries' => \%onload}); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
|
$r->print(<<ENDREDIR); |
|
$start_page |
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
$typestyle |
$typestyle |
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
|
$blog |
<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 |
$prevtag |
Line 2219 $roletag
|
Line 2218 $roletag
|
$sectag |
$sectag |
$userpicktag |
$userpicktag |
</form> |
</form> |
<br /><a href="$feedurl">Continue</a> |
$end_page |
</body> |
|
</html> |
|
ENDREDIR |
ENDREDIR |
} |
} |
|
|
sub no_redirect_back { |
sub no_redirect_back { |
my ($r,$feedurl) = @_; |
my ($r,$feedurl) = @_; |
my $nofeed=&mt('Sorry, no feedback possible on this resource ...'); |
my $nofeed=&mt('Sorry, no feedback possible on this resource ...'); |
my $continue=&mt('Continue'); |
|
my $html=&Apache::lonxml::xmlbegin(); |
my %onload; |
$r->print (<<ENDNOREDIR); |
if ($env{'environment.remote'} ne 'off') { |
$html |
$onload{'onload'} = |
<head> |
"if (window.name!='loncapaclient') { self.window.close(); }"; |
<title>Feedback not sent</title> |
} |
<meta http-equiv="pragma" content="no-cache" /> |
|
ENDNOREDIR |
my %body_options = ('only_body' => 1, |
|
'bgcolor' => '#FFFFFF', |
if ($feedurl!~/^\/adm\/feedback/) { |
'add_entries' => \%onload,); |
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2; url='. |
|
&Apache::lonenc::check_encrypt($feedurl).'">'); |
if ($feedurl !~ m{^/adm/feedback}) { |
} |
$body_options{'rediect'} = [2,$feedurl]; |
|
} |
|
my $start_page= |
|
&Apache::loncommon::start_page('Feedback not sent',undef, |
|
\%body_options); |
|
|
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
$r->print (<<ENDNOREDIRTWO); |
$r->print (<<ENDNOREDIRTWO); |
</head> |
$start_page |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'> |
|
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
<b>$nofeed</b> |
<b>$nofeed</b> |
<br /><a href="$feedurl">$continue</a> |
<br /> |
</body> |
$end_page |
</html> |
|
ENDNOREDIRTWO |
ENDNOREDIRTWO |
} |
} |
|
|
Line 2259 sub screen_header {
|
Line 2261 sub screen_header {
|
my $msgoptions=''; |
my $msgoptions=''; |
my $discussoptions=''; |
my $discussoptions=''; |
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) { |
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) { |
if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/)) { |
if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/) && ($env{'user.adv'})) { |
$msgoptions= |
$msgoptions= |
'<p><label><input type="checkbox" name="author" /> '. |
'<p><label><input type="radio" name="discuss" value="author" /> '. |
&mt('Feedback to resource author').'</label></p>'; |
&mt('Feedback to resource author').'</label></p>'; |
} |
} |
if (&feedback_available(1)) { |
if (&feedback_available(1)) { |
$msgoptions.= |
$msgoptions.= |
'<p><label><input type="checkbox" name="question" /> '. |
'<p><label><input type="radio" name="discuss" value="question" /> '. |
&mt('Question about resource content').'</label></p>'; |
&mt('Question about resource content').'</label></p>'; |
} |
} |
if (&feedback_available(0,1)) { |
if (&feedback_available(0,1)) { |
$msgoptions.= |
$msgoptions.= |
'<p><label><input type="checkbox" name="course" /> '. |
'<p><label><input type="radio" name="discuss" value="course" /> '. |
&mt('Question/Comment/Feedback about course content'). |
&mt('Question/Comment/Feedback about course content'). |
'</label></p>'; |
'</label></p>'; |
} |
} |
if (&feedback_available(0,0,1)) { |
if (&feedback_available(0,0,1)) { |
$msgoptions.= |
$msgoptions.= |
'<p><label><input type="checkbox" name="policy" /> '. |
'<p><label><input type="radio" name="discuss" value="policy" /> '. |
&mt('Question/Comment/Feedback about course policy'). |
&mt('Question/Comment/Feedback about course policy'). |
'</label></p>'; |
'</label></p>'; |
} |
} |
} |
} |
if ($env{'request.course.id'}) { |
if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) { |
if (&discussion_open(undef,$symb) && |
if (&discussion_open(undef,$symb) && |
&Apache::lonnet::allowed('pch', |
&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='<label><input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" '. |
$discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '. |
($env{'form.replydisc'}?' checked="1"':'').' /> '. |
|
&mt('Contribution to course discussion of resource'); |
&mt('Contribution to course discussion of resource'); |
$discussoptions.='</label><br /><label><input type="checkbox" name="anondiscuss" onClick="this.form.discuss.checked=false;" /> '. |
$discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '. |
&mt('Anonymous contribution to course discussion of resource'). |
&mt('Anonymous contribution to course discussion of resource'). |
' <i>('.&mt('name only visible to course faculty').')</i></label>'; |
' <i>('.&mt('name only visible to course faculty').')</i></label> '. |
|
'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>'; |
} |
} |
|
$discussoptions.='<br /><label><input type="checkbox" name="blog" /> '. |
|
&mt('Add to my public course blog').'</label>'; |
} |
} |
if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; } |
if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; } |
if ($discussoptions) { |
if ($discussoptions) { |
Line 2315 sub resource_output {
|
Line 2319 sub resource_output {
|
} |
} |
|
|
sub clear_out_html { |
sub clear_out_html { |
my ($message,$override)=@_; |
my ($message,$override,$ignore_htmlarea)=@_; |
unless (&Apache::lonhtmlcommon::htmlareablocked()) { return $message; } |
if (!$ignore_htmlarea |
|
&& !&Apache::lonhtmlcommon::htmlareablocked()) { return $message; } |
# Always allow the <m>-tag |
# Always allow the <m>-tag |
my %html=(M=>1); |
my %html=(M=>1); |
# Check if more is allowed |
# Check if more is allowed |
Line 2332 sub clear_out_html {
|
Line 2337 sub clear_out_html {
|
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); |
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); |
} |
} |
# Do the substitution of everything that is not explicitly allowed |
# Do the substitution of everything that is not explicitly allowed |
$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; |
$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; |
return $message; |
return $message; |
} |
} |
Line 2375 sub secapply {
|
Line 2380 sub secapply {
|
return ''; |
return ''; |
} |
} |
|
|
|
=pod |
|
|
|
=over 4 |
|
|
|
=item * |
|
|
|
decide_receiver($feedurl,$author,$question,$course,$policy,$defaultflag); |
|
|
|
Arguments |
|
$feedurl - /res/ url of resource (only need if $author is true) |
|
$author,$question,$course,$policy - all true/false parameters |
|
if true will attempt to find the addresses of user that should receive |
|
this type of feedback (author - feedback to author of resource $feedurl, |
|
$question 'Resource Content Questions', $course 'Course Content Question', |
|
$policy 'Course Policy') |
|
(Additionally it also checks $env for whether the corresponding form.<name> |
|
element exists, for ease of use in a html response context) |
|
|
|
$defaultflag - (internal should be left blank) if true gather addresses |
|
that aren't for a section even if I have a section |
|
(used for reccursion internally, first we look for |
|
addresses for our specific section then we recurse |
|
and look for non section addresses) |
|
|
|
Returns |
|
$typestyle - string of html text, describing what addresses were found |
|
%to - a hash, which keys are addresses of users to send messages to |
|
the keys will look like name:domain |
|
|
|
=cut |
|
|
sub decide_receiver { |
sub decide_receiver { |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
my $typestyle=''; |
my $typestyle=''; |
my %to=(); |
my %to=(); |
if ($env{'form.author'}||$author) { |
if ($env{'form.discuss'} eq 'author' ||$author) { |
$typestyle.='Submitting as Author Feedback<br>'; |
$typestyle.='Submitting as Author Feedback<br />'; |
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
$to{$2.':'.$1}=1; |
$to{$2.':'.$1}=1; |
} |
} |
if ($env{'form.question'}||$question) { |
if ($env{'form.discuss'} eq 'question' ||$question) { |
$typestyle.='Submitting as Question<br>'; |
$typestyle.=&mt('Submitting as Question').'<br />'; |
foreach (split(/\,/, |
foreach (split(/\,/, |
$env{'course.'.$env{'request.course.id'}.'.question.email'}) |
$env{'course.'.$env{'request.course.id'}.'.question.email'}) |
) { |
) { |
Line 2393 sub decide_receiver {
|
Line 2429 sub decide_receiver {
|
if ($rec) { $to{$rec}=1; } |
if ($rec) { $to{$rec}=1; } |
} |
} |
} |
} |
if ($env{'form.course'}||$course) { |
if ($env{'form.discuss'} eq 'course' ||$course) { |
$typestyle.='Submitting as Comment<br />'; |
$typestyle.=&mt('Submitting as Comment').'<br />'; |
foreach (split(/\,/, |
foreach (split(/\,/, |
$env{'course.'.$env{'request.course.id'}.'.comment.email'}) |
$env{'course.'.$env{'request.course.id'}.'.comment.email'}) |
) { |
) { |
Line 2402 sub decide_receiver {
|
Line 2438 sub decide_receiver {
|
if ($rec) { $to{$rec}=1; } |
if ($rec) { $to{$rec}=1; } |
} |
} |
} |
} |
if ($env{'form.policy'}||$policy) { |
if ($env{'form.discuss'} eq 'policy' ||$policy) { |
$typestyle.='Submitting as Policy Feedback<br />'; |
$typestyle.=&mt('Submitting as Policy Feedback').'<br />'; |
foreach (split(/\,/, |
foreach (split(/\,/, |
$env{'course.'.$env{'request.course.id'}.'.policy.email'}) |
$env{'course.'.$env{'request.course.id'}.'.policy.email'}) |
) { |
) { |
Line 2425 sub feedback_available {
|
Line 2461 sub feedback_available {
|
} |
} |
|
|
sub send_msg { |
sub send_msg { |
my ($feedurl,$email,$citations,$attachmenturl,%to)=@_; |
my ($title,$feedurl,$email,$citations,$attachmenturl,%to)=@_; |
my $status=''; |
my $status=''; |
my $sendsomething=0; |
my $sendsomething=0; |
|
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } |
|
unless ($title=~/\w/) { $title=&mt('Feedback'); } |
foreach (keys %to) { |
foreach (keys %to) { |
if ($_) { |
if ($_) { |
my $declutter=&Apache::lonnet::declutter($feedurl); |
my $declutter=&Apache::lonnet::declutter($feedurl); |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), |
'Feedback ['.$declutter.']',$email,$citations,$feedurl, |
$title.' ['.$declutter.']',$email,$citations,$feedurl, |
$attachmenturl)=~/ok/) { |
$attachmenturl)=~/ok/) { |
$status.='<br />'.&mt('Error sending message to').' '.$_.'<br />'; |
$status.='<br />'.&mt('Error sending message to').' '.$_.'<br />'; |
} else { |
} else { |
Line 2486 sub adddiscuss {
|
Line 2524 sub adddiscuss {
|
} |
} |
if (($symb) && ($email)) { |
if (($symb) && ($email)) { |
if ($env{'form.editdisc'}) { |
if ($env{'form.editdisc'}) { |
my %newcontrib = (); |
|
$contrib{'ip'}=$ENV{'REMOTE_ADDR'}; |
$contrib{'ip'}=$ENV{'REMOTE_ADDR'}; |
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; |
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; |
$contrib{'timestamp'} = time; |
$contrib{'timestamp'} = time; |
Line 2529 sub adddiscuss {
|
Line 2566 sub adddiscuss {
|
} |
} |
} |
} |
$contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'}; |
$contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'}; |
foreach (keys %contrib) { |
|
my $key = $oldidx.':'.&Apache::lonnet::escape($oldsymb).':'.$_; |
|
$newcontrib{$key} = $contrib{$_}; |
|
} |
|
my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'}, |
my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'}, |
\%newcontrib, |
$oldsymb,$oldidx,\%contrib, |
$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'}); |
$status='Editing class discussion'.($anon?' (anonymous)':''); |
$status='Editing class discussion'.($anon?' (anonymous)':''); |
Line 2568 sub adddiscuss {
|
Line 2601 sub adddiscuss {
|
# ----------------------------------------------------------- Preview function |
# ----------------------------------------------------------- Preview function |
|
|
sub show_preview { |
sub show_preview { |
my $r=shift; |
my ($r) = @_; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
my $message=&clear_out_html($env{'form.comment'}); |
my $message=&clear_out_html($env{'form.comment'}); |
$message=~s/\n/\<br \/\>/g; |
&newline_to_br(\$message); |
$message=&Apache::lonspeller::markeduptext($message); |
$message=&Apache::lonspeller::markeduptext($message); |
$message=&Apache::lontexconvert::msgtexconverted($message); |
$message=&Apache::lontexconvert::msgtexconverted($message); |
my $subject=&clear_out_html($env{'form.subject'}); |
my $subject=&clear_out_html($env{'form.subject'},undef,1); |
$subject=~s/\n/\<br \/\>/g; |
$subject=~s/\n/\<br \/\>/g; |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page= |
$r->print($html.'<head>'. |
&Apache::loncommon::start_page('Preview',undef, |
'</head><body><table border="2"><tr><td>'. |
{'only_body' => 1,}); |
|
|
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
|
$r->print($start_page.'<table border="2"><tr><td>'. |
'<b>Subject:</b> '.$subject.'<br /><br />'. |
'<b>Subject:</b> '.$subject.'<br /><br />'. |
$message.'</td></tr></table></body></html>'); |
$message.'</td></tr></table>'.$end_page); |
|
} |
|
|
|
|
|
sub newline_to_br { |
|
my ($message)=@_; |
|
my $newmessage; |
|
my $parser=HTML::LCParser->new($message); |
|
while (my $token=$parser->get_token()) { |
|
if ($token->[0] eq 'T') { |
|
my $text=$token->[1]; |
|
$text=~s/\n/\<br \/\>/g; |
|
$newmessage.=$text; |
|
} elsif ($token->[0] eq 'D' || $token->[0] eq 'C') { |
|
$newmessage.=$token->[1]; |
|
} elsif ($token->[0] eq 'PI' || $token->[0] eq 'E') { |
|
$newmessage.=$token->[2]; |
|
} elsif ($token->[0] eq 'S') { |
|
$newmessage.=$token->[4]; |
|
} |
|
|
|
} |
|
$$message=$newmessage; |
} |
} |
|
|
sub generate_preview_button { |
sub generate_preview_button { |
|
my ($formname,$fieldname)=@_; |
|
unless ($formname) { $formname='mailform'; } |
|
unless ($fieldname) { $fieldname='comment'; } |
my $pre=&mt("Show Preview and Check Spelling"); |
my $pre=&mt("Show Preview and Check Spelling"); |
return(<<ENDPREVIEW); |
return(<<ENDPREVIEW); |
|
<br /> |
<form name="preview" action="/adm/feedback?preview=1" method="post" target="preview"> |
<form name="preview" action="/adm/feedback?preview=1" method="post" target="preview"> |
<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="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" /> |
onClick="if (typeof(document.$formname.onsubmit)=='function') {document.$formname.onsubmit();};this.form.comment.value=document.$formname.$fieldname.value;this.form.subject.value=document.$formname.subject.value;this.form.submit();" /> |
</form> |
</form> |
ENDPREVIEW |
ENDPREVIEW |
} |
} |
|
|
sub modify_attachments { |
sub modify_attachments { |
my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_; |
my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_; |
my $orig_subject = &Apache::lonnet::unescape($env{'form.subject'}); |
my $orig_subject = &unescape($env{'form.subject'}); |
my $subject=&clear_out_html($orig_subject); |
my $subject=&clear_out_html($orig_subject,undef,1); |
$subject=~s/\n/\<br \/\>/g; |
$subject=~s/\n/\<br \/\>/g; |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
my $timestamp=$env{'form.timestamp'}; |
my $timestamp=$env{'form.timestamp'}; |
my $numoldver=$env{'form.numoldver'}; |
my $numoldver=$env{'form.numoldver'}; |
my $bodytag=&Apache::loncommon::bodytag('Discussion Post Attachments', |
|
'',''); |
|
my $msg = ''; |
my $msg = ''; |
my %attachments = (); |
my %attachments = (); |
my %currattach = (); |
my %currattach = (); |
Line 2614 sub modify_attachments {
|
Line 2676 sub modify_attachments {
|
&extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold); |
&extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold); |
} |
} |
&Apache::lonenc::check_encrypt(\$symb); |
&Apache::lonenc::check_encrypt(\$symb); |
my $html=&Apache::lonxml::xmlbegin(); |
my $js = <<END; |
$r->print(<<END); |
<script type="text/javascript"> |
$html |
|
<head> |
|
<title>Managing Attachments</title> |
|
<script> |
|
function setAction () { |
function setAction () { |
document.modattachments.action = document.modattachments.origpage.value; |
document.modattachments.action = document.modattachments.origpage.value; |
document.modattachments.submit(); |
document.modattachments.submit(); |
} |
} |
</script> |
</script> |
</head> |
END |
$bodytag |
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Discussion Post Attachments',$js); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
|
|
$r->print(<<END); |
|
$start_page |
<form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb"> |
<form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb"> |
<table border="2"> |
<table border="2"> |
<tr> |
<tr> |
Line 2666 END
|
Line 2731 END
|
<input type="hidden" name="idx" value="$env{'form.idx'}" /> |
<input type="hidden" name="idx" value="$env{'form.idx'}" /> |
<input type="hidden" name="numoldver" value="$env{'form.numoldver'}" /> |
<input type="hidden" name="numoldver" value="$env{'form.numoldver'}" /> |
<input type="hidden" name="origpage" value="$env{'form.origpage'}" /> |
<input type="hidden" name="origpage" value="$env{'form.origpage'}" /> |
<input type="hidden" name="anondiscuss" value="$env{'form.anondiscuss'}" /> |
<input type="hidden" name="blog" value="$env{'form.blog'}" /> |
<input type="hidden" name="discuss" value="$env{'form.discuss'}" /> |
<input type="hidden" name="discuss" value="$env{'form.discuss'}" /> |
END |
END |
foreach (@{$currnewattach}) { |
foreach (@{$currnewattach}) { |
Line 2678 END
|
Line 2743 END
|
$r->print(<<END); |
$r->print(<<END); |
<input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/> |
<input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
return; |
return; |
} |
} |
Line 2717 sub generate_attachments_button {
|
Line 2781 sub generate_attachments_button {
|
my $origpage = $ENV{'REQUEST_URI'}; |
my $origpage = $ENV{'REQUEST_URI'}; |
my $att=$attachnum.' '.&mt("attachments"); |
my $att=$attachnum.' '.&mt("attachments"); |
my $response = (<<END); |
my $response = (<<END); |
|
<br /> |
<form name="attachment" action="/adm/feedback?attach=$ressymb" method="post"> |
<form name="attachment" action="/adm/feedback?attach=$ressymb" method="post"> |
Click to add/remove attachments: <input type="button" value="$att" |
Click to add/remove attachments: <input type="button" value="$att" |
onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value); |
onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value); |
Line 2731 this.form.submit();" />
|
Line 2796 this.form.submit();" />
|
<input type="hidden" name="timestamp" value="$now" /> |
<input type="hidden" name="timestamp" value="$now" /> |
<input type="hidden" name="subject" /> |
<input type="hidden" name="subject" /> |
<input type="hidden" name="comment" /> |
<input type="hidden" name="comment" /> |
<input type="hidden" name="anondiscuss" value = "0"; |
<input type="hidden" name="blog" value = "0" /> |
<input type="hidden" name="discuss" value = "0"; |
<input type="hidden" name="discuss" value = "0" /> |
<input type="hidden" name="numoldver" value="$numoldver" /> |
<input type="hidden" name="numoldver" value="$numoldver" /> |
ENDATTACH |
ENDATTACH |
if (defined($deloldattach)) { |
if (defined($deloldattach)) { |
Line 2866 sub has_discussion {
|
Line 2931 sub has_discussion {
|
my @allres=$navmap->retrieveResources(); |
my @allres=$navmap->retrieveResources(); |
foreach my $resource (@allres) { |
foreach my $resource (@allres) { |
if ($resource->hasDiscussion()) { |
if ($resource->hasDiscussion()) { |
my $ressymb = $resource->symb(); |
my $ressymb = $resource->wrap_symb(); |
if ($ressymb =~ m-___adm/\w+/\w+/\d+/bulletinboard$-) { |
|
$ressymb = $resource->ressymb(); |
|
} |
|
push @{$resourcesref}, $ressymb; |
push @{$resourcesref}, $ressymb; |
} |
} |
} |
} |
Line 2914 sub handler {
|
Line 2976 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','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']); |
['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly']); |
|
if ($env{'form.editdisc'}) { |
|
if (!(&editing_allowed())) { |
|
my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; |
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
my $feedurl=&Apache::lonnet::clutter($url); |
|
&redirect_back($r,$feedurl,&mt('Editing not permitted').'<br />', '0','0','','',$env{'form.previous'},'','','',); |
|
return OK; |
|
} |
|
} |
if ($env{'form.discsymb'}) { |
if ($env{'form.discsymb'}) { |
my ($symb,$feedurl) = &get_feedurl_and_clean_symb($env{'form.discsymb'}); |
my ($symb,$feedurl) = &get_feedurl_and_clean_symb($env{'form.discsymb'}); |
my $readkey = $symb.'_read'; |
my $readkey = $symb.'_read'; |
Line 2939 sub handler {
|
Line 3009 sub handler {
|
\%readinghash,$env{'user.domain'},$env{'user.name'}); |
\%readinghash,$env{'user.domain'},$env{'user.name'}); |
} |
} |
&redirect_back($r,$feedurl,&mt('Marked postings read/unread').'<br />', |
&redirect_back($r,$feedurl,&mt('Marked postings read/unread').'<br />', |
'0','0','',$env{'form.previous'},'','','',); |
'0','0','','',$env{'form.previous'},'','','',); |
return OK; |
return OK; |
} |
} |
if ($env{'form.allversions'}) { |
if ($env{'form.allversions'}) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
|
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
my $html=&Apache::lonxml::xmlbegin(); |
|
my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions'); |
$r->print(&Apache::loncommon::start_page('Discussion Post Versions')); |
$r->print(<<END); |
|
$html |
|
<head> |
|
<title>Post Versions</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
</head> |
|
$bodytag |
|
END |
|
my $crs='/'.$env{'request.course.id'}; |
my $crs='/'.$env{'request.course.id'}; |
if ($env{'request.course.sec'}) { |
if ($env{'request.course.sec'}) { |
$crs.='_'.$env{'request.course.sec'}; |
$crs.='_'.$env{'request.course.sec'}; |
Line 2975 END
|
Line 3039 END
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname)); |
$r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname)); |
} |
} |
|
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
if ($env{'form.posterlist'}) { |
if ($env{'form.posterlist'}) { |
Line 2991 END
|
Line 3056 END
|
$discinfo{$symb.'_userpick'} = join('&',@posters); |
$discinfo{$symb.'_userpick'} = join('&',@posters); |
&Apache::lonnet::put('nohist_'.$env{'request.course.id'}.'_discuss', |
&Apache::lonnet::put('nohist_'.$env{'request.course.id'}.'_discuss', |
\%discinfo,$env{'user.domain'},$env{'user.name'}); |
\%discinfo,$env{'user.domain'},$env{'user.name'}); |
&redirect_back($r,$feedurl,&mt('Changed sort/filter').'<br />','0','0', |
&redirect_back($r,$feedurl,&mt('Changed sort/filter').'<br />','0','0','', |
'',$env{'form.previous'},$env{'form.sortposts'},'','','', |
'',$env{'form.previous'},$env{'form.sortposts'},'','','', |
$numpicks); |
$numpicks); |
return OK; |
return OK; |
} |
} |
if ($env{'form.applysort'}) { |
if ($env{'form.applysort'}) { |
my ($symb,$feedurl)=&get_feedurl_and_clean_symb($env{'form.applysort'}); |
my ($symb,$feedurl)=&get_feedurl_and_clean_symb($env{'form.applysort'}); |
&redirect_back($r,$feedurl,&mt('Changed sort/filter').'<br />','0','0', |
&redirect_back($r,$feedurl,&mt('Changed sort/filter').'<br />','0','0','', |
'',$env{'form.previous'},$env{'form.sortposts'}, |
'',$env{'form.previous'},$env{'form.sortposts'}, |
$env{'form.rolefilter'},$env{'form.statusfilter'}, |
$env{'form.rolefilter'},$env{'form.statusfilter'}, |
$env{'form.sectionpick'}); |
$env{'form.sectionpick'}); |
Line 3043 END
|
Line 3108 END
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $html=&Apache::lonxml::xmlbegin(); |
my %onload; |
|
if ($env{'environment.remote'} ne 'off') { |
|
$onload{'onload'} = |
|
"if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"; |
|
} |
|
|
|
my $start_page= |
|
&Apache::loncommon::start_page('New posts marked as read',undef, |
|
{'redirect' => [2,$feedurl], |
|
'only_body' => 1, |
|
'add_entries' => \%onload}); |
|
my $end_page = &Apache::loncommon::end_page(); |
$r->print (<<ENDREDIR); |
$r->print (<<ENDREDIR); |
$html |
$start_page |
<head> |
|
<title>New posts marked as read</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
|
</head> |
|
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
|
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
$textline |
$textline |
<form name="reldt" action="$feedurl" target="loncapaclient"> |
<form name="reldt" action="$feedurl" target="loncapaclient"> |
</form> |
</form> |
<br /><a href="$feedurl">Continue</a> |
<br /> |
</body> |
$end_page |
</html> |
|
ENDREDIR |
ENDREDIR |
return OK; |
return OK; |
} elsif ($env{'form.modifydisp'}) { |
} elsif ($env{'form.modifydisp'}) { |
Line 3102 ENDREDIR
|
Line 3171 ENDREDIR
|
my $previous=$env{'form.previous'}; |
my $previous=$env{'form.previous'}; |
if ($env{'form.markondisp'}) { $previous=undef; } |
if ($env{'form.markondisp'}) { $previous=undef; } |
&redirect_back($r,$feedurl,&mt('Changed display status').'<br />', |
&redirect_back($r,$feedurl,&mt('Changed display status').'<br />', |
'0','0','',$previous); |
'0','0','','',$previous); |
return OK; |
return OK; |
} elsif (($env{'form.hide'}) || ($env{'form.unhide'})) { |
} elsif (($env{'form.hide'}) || ($env{'form.unhide'})) { |
# ----------------------------------------------------------------- Hide/unhide |
# ----------------------------------------------------------------- Hide/unhide |
Line 3110 ENDREDIR
|
Line 3179 ENDREDIR
|
my ($symb,$idx)=split(/\:\:\:/,$entry); |
my ($symb,$idx)=split(/\:\:\:/,$entry); |
($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb); |
($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb); |
|
|
|
my $crs='/'.$env{'request.course.id'}; |
|
if ($env{'request.course.sec'}) { |
|
$crs.='_'.$env{'request.course.sec'}; |
|
} |
|
$crs=~s/\_/\//g; |
|
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
|
|
|
if ($env{'form.hide'} && !$seeid && !(&editing_allowed())) { |
|
&redirect_back($r,$feedurl,&mt('Deletion not permitted').'<br />', '0','0','','',$env{'form.previous'},'','','',); |
|
return OK; |
|
} |
|
|
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'}); |
Line 3117 ENDREDIR
|
Line 3198 ENDREDIR
|
my $currenthidden=$contrib{'hidden'}; |
my $currenthidden=$contrib{'hidden'}; |
my $currentstudenthidden=$contrib{'studenthidden'}; |
my $currentstudenthidden=$contrib{'studenthidden'}; |
|
|
my $crs='/'.$env{'request.course.id'}; |
|
if ($env{'request.course.sec'}) { |
|
$crs.='_'.$env{'request.course.sec'}; |
|
} |
|
$crs=~s/\_/\//g; |
|
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
|
|
|
if ($env{'form.hide'}) { |
if ($env{'form.hide'}) { |
$currenthidden.='.'.$idx.'.'; |
$currenthidden.='.'.$idx.'.'; |
unless ($seeid) { |
unless ($seeid) { |
Line 3142 ENDREDIR
|
Line 3216 ENDREDIR
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
|
&redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />', |
&redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />', |
'0','0','',$env{'form.previous'}); |
'0','0','','',$env{'form.previous'}); |
return OK; |
return OK; |
} elsif ($env{'form.cmd'}=~/^(threadedoff|threadedon)$/) { |
} elsif ($env{'form.cmd'}=~/^(threadedoff|threadedon)$/) { |
my ($symb,$feedurl)=&get_feedurl_and_clean_symb($env{'form.symb'}); |
my ($symb,$feedurl)=&get_feedurl_and_clean_symb($env{'form.symb'}); |
Line 3154 ENDREDIR
|
Line 3228 ENDREDIR
|
&Apache::lonnet::delenv('environment\.threadeddiscussion'); |
&Apache::lonnet::delenv('environment\.threadeddiscussion'); |
} |
} |
&redirect_back($r,$feedurl,&mt('Changed discussion view mode').'<br />', |
&redirect_back($r,$feedurl,&mt('Changed discussion view mode').'<br />', |
'0','0','',$env{'form.previous'}); |
'0','0','','',$env{'form.previous'}); |
return OK; |
return OK; |
} elsif ($env{'form.deldisc'}) { |
} elsif ($env{'form.deldisc'}) { |
# --------------------------------------------------------------- Hide for good |
# --------------------------------------------------------------- Hide for good |
Line 3168 ENDREDIR
|
Line 3242 ENDREDIR
|
$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'}); |
&redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />', |
&redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />', |
'0','0','',$env{'form.previous'}); |
'0','0','','',$env{'form.previous'}); |
return OK; |
return OK; |
} elsif ($env{'form.preview'}) { |
} elsif ($env{'form.preview'}) { |
# -------------------------------------------------------- User wants a preview |
# -------------------------------------------------------- User wants a preview |
Line 3178 ENDREDIR
|
Line 3252 ENDREDIR
|
# -------------------------------------------------------- Work on attachments |
# -------------------------------------------------------- Work on attachments |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','anondiscuss','discuss']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','discuss','blog']); |
my (@currnewattach,@currdelold,@keepold); |
my (@currnewattach,@currdelold,@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
if (exists($env{'form.addnewattach.filename'})) { |
if (exists($env{'form.addnewattach.filename'})) { |
Line 3207 ENDREDIR
|
Line 3281 ENDREDIR
|
my $mode='board'; |
my $mode='board'; |
my $status='OPEN'; |
my $status='OPEN'; |
my $previous=$env{'form.previous'}; |
my $previous=$env{'form.previous'}; |
if ($feedurl =~ /\.(problem|exam|quiz|assess|survey|form|library)$/) { |
if ($feedurl =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) { |
$mode='problem'; |
$mode='problem'; |
$status=$Apache::inputtags::status[-1]; |
$status=$Apache::inputtags::status[-1]; |
} |
} |
my $discussion = &list_discussion($mode,$status,$symb); |
my $discussion = &list_discussion($mode,$status,$symb); |
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion'); |
my $start_page = |
$r->print($bodytag.$discussion); |
&Apache::loncommon::start_page('Resource Feedback and Discussion'); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
$r->print($start_page.$discussion.$end_page); |
return OK; |
return OK; |
} else { |
} else { |
# ------------------------------------------------------------- Normal feedback |
# ------------------------------------------------------------- Normal feedback |
Line 3246 ENDREDIR
|
Line 3323 ENDREDIR
|
} |
} |
&Apache::lonenc::check_decrypt(\$symb); |
&Apache::lonenc::check_decrypt(\$symb); |
my $goahead=1; |
my $goahead=1; |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { |
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') |
# backward compatibility (bulletin boards used to be 'wrapped') |
Line 3270 ENDREDIR
|
Line 3347 ENDREDIR
|
$r->send_http_header; |
$r->send_http_header; |
# Unable to give feedback |
# Unable to give feedback |
&no_redirect_back($r,$feedurl); |
&no_redirect_back($r,$feedurl); |
|
return OK; |
} |
} |
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
unless ($env{'form.sendit'}) { |
unless ($env{'form.sendit'}) { |
Line 3333 ENDREDIR
|
Line 3411 ENDREDIR
|
my ($typestyle,%to) = &decide_receiver($feedurl); |
my ($typestyle,%to) = &decide_receiver($feedurl); |
|
|
# Actually send mail |
# Actually send mail |
my ($status,$numsent)=&send_msg($feedurl,$email,$citations, |
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, |
|
undef,1), |
|
$feedurl,$email,$citations, |
$attachmenturl,%to); |
$attachmenturl,%to); |
|
|
# Discussion? Store that. |
# Discussion? Store that. |
|
|
my $numpost=0; |
my $numpost=0; |
if ($env{'form.discuss'} || $env{'form.anondiscuss'}) { |
if ($env{'form.discuss'} =~/^(?:non|)anon$/ |
my $subject = &clear_out_html($env{'form.subject'}); |
|| $env{'form.anondiscuss'}) { |
my $anonmode=(defined($env{'form.anondiscuss'})); |
my $subject = &clear_out_html($env{'form.subject'},undef,1); |
|
my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} ); |
$typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl, |
$typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl, |
$subject); |
$subject); |
$numpost++; |
$numpost++; |
} |
} |
|
|
|
# Add to blog? |
|
|
|
my $blog=''; |
|
if ($env{'form.blog'}) { |
|
my $subject = &clear_out_html($env{'form.subject'},undef,1); |
|
$status.=&Apache::lonrss::addentry($env{'user.name'}, |
|
$env{'user.domain'}, |
|
'CourseBlog_'.$env{'request.course.id'}, |
|
$subject,$message,$feedurl,'public'); |
|
$blog='<br />'.&mt('Added to my course blog').'<br />'; |
|
} |
|
|
# 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,$env{'form.previous'}); |
&redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'}); |
} |
} |
return OK; |
return OK; |
} |
} |
Line 3387 sub get_feedurl_and_clean_symb {
|
Line 3480 sub get_feedurl_and_clean_symb {
|
my $feedurl = &get_feedurl($symb); |
my $feedurl = &get_feedurl($symb); |
return ($symb,$feedurl); |
return ($symb,$feedurl); |
} |
} |
|
|
|
sub editing_allowed { |
|
my $can_edit = 0; |
|
my $cid = $env{'request.course.id'}; |
|
my $role = (split(/\./,$env{'request.role'}))[0]; |
|
my $section = $env{'request.course.sec'}; |
|
my $allow_editing_config = |
|
$env{'course.'.$cid.'.allow_discussion_post_editing'}; |
|
if ($allow_editing_config =~ m/^\s*yes\s*$/i) { |
|
$can_edit = 1; |
|
} else { |
|
foreach my $editor (split(/,/,$allow_editing_config)) { |
|
my ($editor_role,$editor_sec) = split(/:/,$editor); |
|
if ($editor_role eq $role |
|
&& defined($editor_sec) |
|
&& defined($section) |
|
&& $editor_sec eq $section) { |
|
$can_edit = 1; |
|
last; |
|
} |
|
if ($editor_role eq $role |
|
&& !defined($editor_sec)) { |
|
$can_edit = 1; |
|
} |
|
} |
|
} |
|
return $can_edit; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |