--- loncom/interface/lonfeedback.pm 2003/09/09 18:46:28 1.52
+++ loncom/interface/lonfeedback.pm 2022/01/19 00:44:31 1.390
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.52 2003/09/09 18:46:28 www Exp $
+# $Id: lonfeedback.pm,v 1.390 2022/01/19 00:44:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,24 +25,7 @@
#
# http://www.lon-capa.org/
#
-# (Internal Server Error Handler
-#
-# (Login Screen
-# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
-# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
-#
-# 3/1/1 Gerd Kortemeyer)
-#
-# 3/1,2/3,2/5,2/6,2/8 Gerd Kortemeyer
-# 2/9 Guy Albertelli
-# 2/10 Gerd Kortemeyer
-# 2/13 Guy Albertelli
-# 7/25 Gerd Kortemeyer
-# 7/26 Guy Albertelli
-# 7/26,8/10,10/1,11/5,11/6,12/27,12/29 Gerd Kortemeyer
-# YEAR=2002
-# 1/1,1/16 Gerd Kortemeyer
-#
+###
package Apache::lonfeedback;
@@ -51,180 +34,3068 @@ use Apache::Constants qw(:common);
use Apache::lonmsg();
use Apache::loncommon();
use Apache::lontexconvert();
+use Apache::lonlocal; # must not have ()
+use Apache::lonnet;
+use Apache::lonhtmlcommon();
+use Apache::lonnavmaps;
+use Apache::lonenc();
+use Apache::lonrss();
+use HTML::LCParser();
+#use HTML::Tidy::libXML;
+use Apache::lonspeller();
+use Apache::longroup;
+use Archive::Zip qw( :ERROR_CODES );
+use LONCAPA qw(:DEFAULT :match);
+
+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;
+ }
+# The problem is available, but check if the instructor explictly closed discussion
+ if (defined($close) && $close ne '' && $close < time) {
+ return 0;
+ }
+ return 1;
+}
-sub mail_screen {
- my ($r,$feedurl,$options) = @_;
- my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion',
- '','onLoad="window.focus();"');
- my $title=&Apache::lonnet::gettitle($feedurl);
- if (!$title) { $title = $feedurl; }
- my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
- $r->print(<$title
+
+END
+
+ my ($textareaheader,$textareaclass);
+ if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+ $textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive();
+ $textareaclass = 'class="LC_richDefaultOff"';
+ if ($env{'request.course.id'}) {
+ unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) {
+ undef($textareaclass);
+ }
+ }
+ }
+
+ # Breadcrumbs
+ my $brcrum = [{'href' => '',
+ 'text' => 'Resource Feedback and Discussion'}];
+
+ my %onload = ('onload' => 'window.focus();setposttype();');
+ my %parms=('add_entries' => \%onload);
+ if ($env{'form.modal'} ne 'yes') { $parms{'bread_crumbs'} = $brcrum; }
+ my $start_page=
+ &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms);
+
+ if ($quote ne '') {
+ $quote = &HTML::Entities::decode($quote);
+ unless (&contains_block_html($quote)) {
+ &newline_to_br(\$quote);
+ }
+ $quote=&Apache::lonhtmlcommon::start_pick_box().
+ &Apache::lonhtmlcommon::row_title(&mt('Quote')).
+ &Apache::lontexconvert::msgtexconverted($quote).
+ &Apache::lonhtmlcommon::row_closure(1).
+ &Apache::lonhtmlcommon::end_pick_box();
+ }
+ my $header='';
+ unless ($env{'form.modal'}) {
+ $header="$restitle
";
+ }
+ $r->print(<