--- loncom/interface/lonfeedback.pm 2010/08/25 00:46:37 1.300
+++ loncom/interface/lonfeedback.pm 2011/12/10 22:54:34 1.307
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.300 2010/08/25 00:46:37 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.307 2011/12/10 22:54:34 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -135,7 +135,7 @@ sub list_discussion {
$crs=~s/\_/\//g;
my $encsymb=&Apache::lonenc::check_encrypt($ressymb);
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)
- && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/));
+ && ($ressymb=~/$LONCAPA::assess_re/));
my %usernamesort = ();
my %namesort =();
@@ -281,13 +281,12 @@ sub list_discussion {
my $maxdepth=0;
my %anonhash=();
my $anoncnt=0;
- my $target='';
my $now = time;
$discinfo{$visitkey} = $visit;
&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,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group);
+ &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,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group);
my $discussion='';
my $manifestfile;
@@ -724,7 +723,8 @@ END
}
if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {
if (($group ne '') && ($mode eq 'board')) {
- if (&check_group_priv($group,'pgd') eq 'ok') {
+ if ((&check_group_priv($group,'pgd') eq 'ok') &&
+ ($ressymb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$})) {
$discussion .=
&postingform_display($mode,$ressymb,$now,$subject,
$comment,$outputtarget,$attachnum,
@@ -732,19 +732,30 @@ END
$group,$crstype);
}
} else {
- $discussion.=
- &postingform_display($mode,$ressymb,$now,$subject,
- $comment,$outputtarget,$attachnum,
- $currnewattach,$currdelold,'',$crstype);
+ if (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
+
+ $discussion.=
+ &postingform_display($mode,$ressymb,$now,$subject,
+ $comment,$outputtarget,$attachnum,
+ $currnewattach,$currdelold,'',$crstype);
+ } else {
+ $discussion.= ''.
+ &mt('This discussion is closed.').'';
+ }
}
}
+ if (!(&discussion_open($status)) && ($outputtarget ne 'tex')) {
+ $discussion.= ''.
+ &mt('This discussion is closed.').'';
+ }
} elsif ($outputtarget ne 'tex') {
$discussion.='
';
if (&discussion_open($status) &&
&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- $discussion.= &send_feedback_link($ressymb,$target);
+ $discussion.= &send_feedback_link($ressymb);
if ($env{'request.role.adv'}) {
my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
if (defined($close) && $close ne '' && $close < time) {
@@ -760,15 +771,25 @@ END
return $discussion;
}
+
+sub discussion_link {
+ my ($ressymb,$linktext,$cmd,$item,$flag,$prev,$adds)=@_;
+ my $link='/adm/feedback?inhibitmenu=yes&modal=yes&'.$cmd.'='.&escape($ressymb).':::'.$item;
+ if ($flag) { $link .= '&previous='.$prev; }
+ if ($adds) { $link .= $adds; }
+ return &Apache::loncommon::modal_link($link,$linktext,600,400);
+}
+
+
sub send_feedback_link {
- my ($ressymb,$target) = @_;
- my $output = '
'.
- ' '.
- '';
- return $output;
+ my ($ressymb) = @_;
+ return '
'.
+ &discussion_link($ressymb,
+ '',
+ 'replydisc').
+ '';
}
sub send_message_link {
@@ -850,6 +871,11 @@ sub postingform_display {
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
$postingform = &Apache::lonhtmlcommon::htmlareaselectactive();
$textareaclass = 'class="LC_richDefaultOff"';
+ if ($env{'request.course.id'}) {
+ unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) {
+ undef($textareaclass);
+ }
+ }
}
$postingform .= (<
@@ -905,7 +931,7 @@ ENDDISCUSS
}
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,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
+ 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,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
my @original=();
my @index=();
my $skip_group_check = 0;
@@ -1084,7 +1110,7 @@ sub build_posting_display {
$sender .= '&previous='.$prevread;
}
$sender .= &group_args($group);
- $sender .= '" '.$target.'>'.&mt('Edit').'';
+ $sender .= '">'.&mt('Edit').'';
unless ($seeid) {
my $grpargs = &group_args($group);
@@ -1148,23 +1174,14 @@ sub build_posting_display {
if (&discussion_open($status)) {
if (($group ne '') &&
(&check_group_priv($group,'pgd') eq 'ok')) {
- $sender.=' '.&mt('Reply').'';
+ $sender.=' '.
+ &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread,&group_args($group));
} elsif (&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.
$env{'request.course.sec'}:''))) {
- $sender.=' '.&mt('Reply').'';
+ $sender.=' '.
+ &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread);
}
}
if ($viewgrades) {
@@ -1699,6 +1716,11 @@ END
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
$textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive();
$textareaclass = 'class="LC_richDefaultOff"';
+ if ($env{'request.course.id'}) {
+ unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) {
+ undef($textareaclass);
+ }
+ }
}
# Breadcrumbs
@@ -1706,10 +1728,10 @@ END
'text' => 'Resource Feedback and Discussion'}];
my %onload = ('onload' => 'window.focus();setposttype();');
+ my %parms=('add_entries' => \%onload);
+ if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
my $start_page=
- &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
- {'add_entries' => \%onload,
- 'bread_crumbs' => $brcrum,});
+ &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms);
if ($quote ne '') {
$quote = &HTML::Entities::decode($quote);
@@ -1726,6 +1748,7 @@ $start_page
enctype="multipart/form-data">
$prevtag
+
END
if ($env{'form.replydisc'}) {
$r->print(< 1);
+ if ($env{'form.modal'}) {
+ $parms{'add_entries'}={'onLoad' => 'document.forms.reldt.submit()'};
+ } else {
+ $parms{'redirect'}=[0,$feedurl];
+ }
my $start_page=
- &Apache::loncommon::start_page('Feedback sent',undef,
- {'redirect' => [0,$feedurl],
- 'only_body' => 1,
- 'add_entries' => \%onload});
+ &Apache::loncommon::start_page('Feedback sent',undef,\%parms);
my $end_page = &Apache::loncommon::end_page();
$r->print(< '.
$contribdisc.
'