--- loncom/interface/lonfeedback.pm 2010/01/21 23:13:50 1.284
+++ loncom/interface/lonfeedback.pm 2012/03/06 21:24:01 1.290.2.7.2.1
@@ -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.290.2.7.2.1 2012/03/06 21:24:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,15 +49,24 @@ 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;
+ !($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;
+ return 0;
}
return 1;
}
@@ -317,6 +326,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 +378,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') {
@@ -514,7 +523,6 @@ imscp_v1p1.xsd http://www.imsglobal.org/
$threadinsert=' Reply: '.$thisdepth.'';
}
$discussionitems[$alldiscussion{$post}]=~s/<\/td>
';
}
@@ -1700,16 +1780,17 @@ END
$r->print(<
$quote
-
$lt{'myqu'}
+
$lt{'myqu'}
+$textareaheader
+
$latexHelp
$lt{'title'}:
-
-
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1731,6 +1812,7 @@ END
}
} else {
$r->print(<
$lt{'atta'} $attachmaxtext:
END
@@ -1785,7 +1867,6 @@ END
}
}
$r->print(&generate_preview_button().
- &Apache::lonhtmlcommon::htmlareaselectactive('comment').
&Apache::loncommon::end_page());
}
@@ -2234,7 +2315,7 @@ sub print_showposters {
my $group = $env{'form.group'};
my $ressymb = &wrap_symb($symb);
if (($group ne '') &&
- ($ressymb =~ m|^bulletin___ \d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {
+ ($ressymb =~ m|^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {
if (&check_group_priv($group,'dgp') eq 'ok') {
$seeid = 1;
}
@@ -2395,7 +2476,7 @@ sub fail_redirect {
my ($r,$feedurl) = @_;
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
my %lt = &Apache::lonlocal::texthash(
- 'sorr' => 'Sorry, no recipients ...',
+ 'sorr' => 'Sorry, no recipients ...',
);
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print(&Apache::loncommon::start_page('Feedback not sent',undef,
@@ -2542,7 +2623,7 @@ ENDREDIR
sub no_redirect_back {
my ($r,$feedurl) = @_;
- my $nofeed=&mt('Sorry, no feedback possible on this resource ...');
+ my $nofeed=&mt('Sorry, no feedback possible on this resource ...');
my %onload;
if ($env{'environment.remote'} ne 'off') {
@@ -2575,7 +2656,7 @@ ENDNOREDIRTWO
}
sub screen_header {
- my ($feedurl,$symb) = @_;
+ my ($feedurl,$symb,$group) = @_;
my $crscontent = &mt('Question/Comment/Feedback about course content');
my $crspolicy = &mt('Question/Comment/Feedback about course policy');
my $contribdisc = &mt('Contribution to course discussion of resource');
@@ -2624,10 +2705,19 @@ 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) &&
- &Apache::lonnet::allowed('pch',
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ 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'}:''))) {
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) ||
+ (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) {
$discussoptions='