version 1.179, 2006/02/09 20:30:47
|
version 1.185, 2006/03/15 22:06:08
|
Line 906 sub build_posting_display {
|
Line 906 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='. |
$escsymb.':::'.$idx; |
$escsymb.':::'.$idx; |
Line 2224 $html
|
Line 2224 $html
|
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
</head> |
</head> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.window.close(); }'> |
<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> |
Line 2264 ENDNOREDIR
|
Line 2264 ENDNOREDIR
|
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> |
</head> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.window.close(); }'> |
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
<b>$nofeed</b> |
<b>$nofeed</b> |
<br /><a href="$feedurl">$continue</a> |
<br /><a href="$feedurl">$continue</a> |
Line 2314 sub screen_header {
|
Line 2314 sub screen_header {
|
' <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>'; |
'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>'; |
} |
} |
#$discussoptions.='<br /><label><input type="checkbox" name="blog" /> '. |
$discussoptions.='<br /><label><input type="checkbox" name="blog" /> '. |
# &mt('Add to my public course blog').'</label>'; |
&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 2478 sub feedback_available {
|
Line 2478 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 2539 sub adddiscuss {
|
Line 2541 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 2582 sub adddiscuss {
|
Line 2583 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 2992 sub handler {
|
Line 2989 sub handler {
|
|
|
&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']); |
|
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 3128 $html
|
Line 3133 $html
|
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
</head> |
</head> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.window.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"> |
Line 3187 ENDREDIR
|
Line 3192 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 3194 ENDREDIR
|
Line 3211 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 3411 ENDREDIR
|
Line 3421 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'}),$feedurl,$email,$citations, |
$attachmenturl,%to); |
$attachmenturl,%to); |
|
|
# Discussion? Store that. |
# Discussion? Store that. |
Line 3477 sub get_feedurl_and_clean_symb {
|
Line 3487 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__ |