--- loncom/interface/lonfeedback.pm 2010/01/21 23:13:50 1.284
+++ loncom/interface/lonfeedback.pm 2010/06/05 22:07:05 1.295
@@ -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.295 2010/06/05 22:07:05 www 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.='{\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') {
@@ -416,7 +421,6 @@ imscp_v1p1.xsd http://www.imsglobal.org/
}
} else {
my $colspan=$maxdepth+1;
-#JW
$discussion.= &Apache::lonhtmlcommon::scripttag(qq|
function verifydelete (caller,symb,idx,newflag,previous,groupparm) {
var symbparm = symb+':::'+idx
@@ -744,7 +748,11 @@ END
if ($outputtarget ne 'tex') {
$discussion.= &send_feedback_link($ressymb,$target);
}
- }
+ } else {
+ if ($outputtarget ne 'tex') {
+ $discussion.= &mt('This discussion is closed.');
+ }
+ }
if ($outputtarget ne 'tex') {
$discussion.= &send_message_link($ressymb);
}
@@ -769,7 +777,7 @@ sub send_message_link {
my $output = ''.
' '.&mt('Send Feedback').'';
return $output;
}
@@ -828,6 +836,7 @@ sub action_links_bar {
sub postingform_display {
my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
$currnewattach,$currdelold,$group,$crstype) = @_;
+ if ($outputtarget eq 'tex') { return ''; }
my $newattachmsg;
my %lt = &Apache::lonlocal::texthash(
'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
@@ -869,28 +878,26 @@ ENDDISCUSS
$postingform .= &add_blog_checkbox($crstype);
}
$postingform .= "\n";
- if ($outputtarget ne 'tex') {
- $postingform .= &generate_attachments_button('',$attachnum,$ressymb,
+ $postingform .= &generate_attachments_button('',$attachnum,$ressymb,
$now,$currnewattach,
$currdelold,'',$mode,
$blockblog);
- if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
- $newattachmsg = ' '.$lt{'newa'}.' ';
- if (@{$currnewattach} > 1) {
- $newattachmsg .= '
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1731,6 +1744,7 @@ END
}
} else {
$r->print(<
$lt{'atta'} $attachmaxtext:
END
@@ -2395,7 +2409,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,
@@ -2508,10 +2522,6 @@ sub redirect_back {
&Apache::lonenc::check_encrypt(\$feedurl);
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
my %onload;
- if ($env{'environment.remote'} ne 'off') {
- $onload{'onload'} =
- "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }";
- }
my $start_page=
&Apache::loncommon::start_page('Feedback sent',undef,
{'redirect' => [0,$feedurl],
@@ -2542,13 +2552,9 @@ 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') {
- $onload{'onload'} =
- "if (window.name!='loncapaclient') { self.window.close(); }";
- }
my %body_options = ('only_body' => 1,
'bgcolor' => '#FFFFFF',
@@ -2641,12 +2647,12 @@ sub screen_header {
}
}
if ($msgoptions) {
- $msgoptions='