--- loncom/interface/lonfeedback.pm 2010/01/25 03:56:00 1.273.4.6
+++ loncom/interface/lonfeedback.pm 2010/09/21 04:58:17 1.273.4.11
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.273.4.6 2010/01/25 03:56:00 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.273.4.11 2010/09/21 04:58:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -48,13 +48,22 @@ use LONCAPA;
sub discussion_open {
my ($status,$symb)=@_;
+# Advanced roles can always discuss
if ($env{'request.role.adv'}) { return 1; }
+# Get discussion closing date
+ my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
+# If it is defined and in the future, the instructor wants this discussion to be open
+ if (defined($close) && $close ne '' && $close > time) {
+ return 1;
+ }
+# It was not explicitly open, check if the problem is available.
+# If the problem is not available, close the discussion
if (defined($status) &&
!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
|| $status eq 'OPEN')) {
return 0;
}
- my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
+# The problem is available, but check if the instructor explictly closed discussion
if (defined($close) && $close ne '' && $close < time) {
return 0;
}
@@ -400,8 +409,8 @@ sub list_discussion {
my $manifestfilename = $tempexport.$manifest;
if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {
$manifestok=1;
- print $manifestfile qq|
-
+ print $manifestfile qq|
+
'.
- ''.$imsitems{$alldiscussion{$post}}{'title'}.'';
+ ''.$imsitems{$alldiscussion{$post}}{'title'}.'';
$imsresources .= "\n".
''."\n".
''."\n".
- $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}."\n".
+ $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}.''."\n".
'';
}
my $postingfile;
@@ -741,13 +750,21 @@ END
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
if ($outputtarget ne 'tex') {
- $discussion.= &send_feedback_link($ressymb,$target);
+ $discussion.= &send_feedback_link($ressymb,$target);
+ if ($env{'request.role.adv'}) {
+ my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
+ if (defined($close) && $close ne '' && $close < time) {
+ $discussion .= ' '.&mt('(Closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ }
+ }
+ }
+ } else {
+ if ($outputtarget ne 'tex') {
+ $discussion.= ''.&mt('This discussion is closed.').'';
}
- }
- if ($outputtarget ne 'tex') {
- $discussion.= &send_message_link($ressymb);
}
- $discussion.='';
+ $discussion.=&send_message_link($ressymb).'';
}
return $discussion;
}
@@ -1172,7 +1189,7 @@ sub build_posting_display {
$$imsitems{$idx}{'attach'}=$attachtxt{$numoldver};
$$imsitems{$idx}{'timestamp'}=$contrib{$idx.':timestamp'};
$$imsitems{$idx}{'sender'}=$plainname.' ('.
- $contrib{$idx.':sendername'}.' at '.
+ $contrib{$idx.':sendername'}.':'.
$contrib{$idx.':senderdomain'}.')';
$$imsitems{$idx}{'isanonymous'}='false';
if ($contrib{$idx.':anonymous'}) {
@@ -1369,7 +1386,7 @@ sub get_post_contents {
$$plainname,
$$contrib{$idx.':sendername'},
$$contrib{$idx.':senderdomain'}).' ('.
- $$contrib{$idx.':sendername'}.' at '.
+ $$contrib{$idx.':sendername'}.':'.
$$contrib{$idx.':senderdomain'}.')';
my $attachmenturls = $$contrib{$idx.':attachmenturl'};
my @postversions = ();
@@ -1397,7 +1414,9 @@ sub get_post_contents {
my ($timesent,$attachmsg);
my %currattach = ();
$timesent = &Apache::lonlocal::locallocaltime($postversions[$i]);
- &newline_to_br(\$messages->{$i});
+ unless (&contains_block_html($messages->{$i})) {
+ &newline_to_br(\$messages->{$i});
+ }
$$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i});
$$subjects{$i}=~s/\n/\
/g;
$$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i});
@@ -1411,7 +1430,7 @@ sub get_post_contents {
foreach my $key (sort(keys(%currattach))) {
if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {
my $fname = $1.$3.'/'.$4;
- $$imsfiles{$idx}{$i} .= ''."\n";
+ $$imsfiles{$idx}{$i} .= ''."\n";
$$attachtxt{$i}.= ''.$4.'
';
}
}
@@ -1671,7 +1690,10 @@ END
{'add_entries' => \%onload});
if ($quote ne '') {
- &newline_to_br(\$quote);
+ $quote = &HTML::Entities::decode($quote);
+ unless (&contains_block_html($quote)) {
+ &newline_to_br(\$quote);
+ }
$quote=''.&Apache::lontexconvert::msgtexconverted($quote).'
';
}
@@ -1705,7 +1727,6 @@ $lt{'title'}: $comment
-
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1727,6 +1748,7 @@ END
}
} else {
$r->print(<
$lt{'atta'} $attachmaxtext:
END
@@ -2620,7 +2642,13 @@ sub screen_header {
}
if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) {
my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards');
- if (!$blocked && &discussion_open(undef,$symb) &&
+ my $realsymb = $symb;
+ if ($symb=~/^bulletin___/) {
+ my $filename=(&Apache::lonnet::decode_symb($symb))[2];
+ $filename=~s|^adm/wrapper/||;
+ $realsymb=&Apache::lonnet::symbread($filename);
+ }
+ if (!$blocked && &discussion_open(undef,$realsymb) &&
&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
@@ -2643,7 +2671,7 @@ sub screen_header {
.$msgoptions;
}
if ($discussoptions) {
- $discussoptions='
'
+ $discussoptions='
'
.' '.&mt('Discussion Contributions').'
'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'
'
.$discussoptions;
}
@@ -2675,11 +2703,13 @@ sub clear_out_html {
($override)) {
# allows
#
- #
+ # | |
%html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1,
BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1,
M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1,
- H1=>1, H2=>1, H3=>1, H4=>1, H5=>1);
+ H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1,
+ TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);
+
}
# Do the substitution of everything that is not explicitly allowed
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/