--- loncom/interface/lonfeedback.pm 2010/01/21 23:13:50 1.284
+++ loncom/interface/lonfeedback.pm 2010/08/14 15:24:46 1.298
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.284 2010/01/21 23:13:50 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.298 2010/08/14 15:24:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,13 +49,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;
}
@@ -273,10 +282,6 @@ sub list_discussion {
my %anonhash=();
my $anoncnt=0;
my $target='';
- unless ($env{'browser.interface'} eq 'textual' ||
- $env{'environment.remote'} eq 'off' ) {
- $target='target="LONcom"';
- }
my $now = time;
$discinfo{$visitkey} = $visit;
@@ -317,6 +322,7 @@ sub list_discussion {
'dpwn' => 'Deleted posts will no longer be visible to you and other students',
'bwco' => 'but will continue to be visible to your instructor',
'depo' => 'Deleted posts will no longer be visible to you or anyone else.',
+ 'discussions' => 'DISCUSSIONS'
);
my $currdisp = $lt{'allposts'};
@@ -368,8 +374,7 @@ sub list_discussion {
# Print the discusssion
if ($outputtarget eq 'tex') {
$discussion.='
Reply: '.$thisdepth.'';
}
$discussionitems[$alldiscussion{$post}]=~s/<\/td>
'.&mt('NEW').' | '; +||||
'.&mt('NEW').' | '; } else { $$newitem{$idx} = 0; $$discussionitems[$idx] .= ' @@ -1254,7 +1274,7 @@ sub build_posting_display { } $$discussionitems[$idx] .= ''. ''.$subject.' '. - ''.$sender.' '.$vgrlink.' ('. + $sender.' '.$vgrlink.' ('. &Apache::lonlocal::locallocaltime($posttime).') | '; if ($$dischash{$toggkey}) { $$discussionitems[$idx].=' '.
@@ -1396,7 +1416,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}); @@ -1664,6 +1686,12 @@ END END + my ($textareaheader,$textareaclass); + if (&Apache::lonhtmlcommon::htmlareabrowser()) { + $textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive(); + $textareaclass = 'class="LC_richDefaultOff"'; + } + # Breadcrumbs my $brcrum = [{'href' => '', 'text' => 'Resource Feedback and Discussion'}]; @@ -1675,7 +1703,10 @@ END 'bread_crumbs' => $brcrum,}); 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).''; } @@ -1700,16 +1731,17 @@ END $r->print(< $lt{'myqu'} +$lt{'myqu'} +$textareaheader + $latexHelp $lt{'title'}: - -
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1731,6 +1763,7 @@ END
}
} else {
$r->print(< '
+ $msgoptions=' |