--- loncom/interface/lonfeedback.pm 2008/03/12 02:45:07 1.253
+++ loncom/interface/lonfeedback.pm 2011/11/07 20:05:55 1.305
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.253 2008/03/12 02:45:07 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.305 2011/11/07 20:05:55 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,7 @@ use Apache::lonnavmaps;
use Apache::lonenc();
use Apache::lonrss();
use HTML::LCParser();
+#use HTML::Tidy::libXML;
use Apache::lonspeller();
use Apache::longroup;
use Cwd;
@@ -48,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;
}
@@ -91,7 +101,7 @@ sub list_discussion {
if (not &discussion_visible($status)) {
if ($mode ne 'board') {
&Apache::lonenc::check_encrypt(\$ressymb);
- return ' '.&send_message_link($ressymb);
+ return '
'.&send_message_link($ressymb)."
";
}
}
if ($group ne '' && $mode eq 'board') {
@@ -103,14 +113,17 @@ sub list_discussion {
my ($blocked,$blocktext) =
&Apache::loncommon::blocking_status('boards');
if ($blocked) {
+ $blocktext = '
'.$blocktext."";
&Apache::lonenc::check_encrypt(\$ressymb);
if ($mode ne 'board') {
- $blocktext.=' '.&send_message_link($ressymb);
+ $blocktext.=&send_message_link($ressymb).'
';
+ }else{
+ $blocktext.="";
}
return $blocktext;
}
- my @bgcols = ("#cccccc","#eeeeee");
+ my @bgcols = ("LC_disc_old_item","LC_disc_new_item");
my $discussiononly=0;
if ($mode eq 'board') { $discussiononly=1; }
unless ($env{'request.course.id'}) { return ''; }
@@ -122,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 =();
@@ -169,6 +182,7 @@ sub list_discussion {
my $cdom = $env{'course.'.$cid.'.domain'};
my $cnum = $env{'course.'.$cid.'.num'};
+ my $crstype = &Apache::loncommon::course_type();
# Get information about students and non-students in course for filtering display of posts
my %roleshash = ();
@@ -268,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;
@@ -312,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'};
@@ -352,10 +363,10 @@ sub list_discussion {
$togglink = 'toggoff';
}
- $chglink .= '&changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink;
+ $chglink .= '&changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink;
if ($newpostsflag) {
- $chglink .= '&previous='.$prevread;
+ $chglink .= '&previous='.$prevread;
}
$chglink.=&group_args($group);
@@ -363,8 +374,7 @@ sub list_discussion {
# Print the discusssion
if ($outputtarget eq 'tex') {
$discussion.='{\tiny \vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}'.
- '\textbf{DISCUSSIONS}\makebox[2 cm][b]{\hrulefill}'.
- '\vskip 0 mm\noindent\textbf{'.$lt{'cuse'}.'}:\vskip 0 mm'.
+ '\textbf{'.$lt{'discussions'}.'}\makebox[2 cm][b]{\hrulefill}\vskip 0 mm'.
'\noindent\textbf{'.$lt{'disa'}.'}: \textit{'.$currdisp.'}\vskip 0 mm'.
'\noindent\textbf{'.$lt{'npce'}.'}: \textit{'.$currmark.'}}';
} elsif ($outputtarget eq 'export') {
@@ -398,8 +408,7 @@ sub list_discussion {
my $manifestfilename = $tempexport.$manifest;
if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {
$manifestok=1;
- print $manifestfile qq|
-
+ print $manifestfile qq|
- |;
- $discussion.='