--- loncom/interface/lonfeedback.pm 2001/02/09 21:17:48 1.6
+++ loncom/interface/lonfeedback.pm 2009/12/08 13:33:12 1.282
@@ -1,192 +1,2661 @@
# The LearningOnline Network
# Feedback
#
-# (Internal Server Error Handler
+# $Id: lonfeedback.pm,v 1.282 2009/12/08 13:33:12 wenzelju Exp $
#
-# (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)
+# Copyright Michigan State University Board of Trustees
#
-# 3/1/1 Gerd Kortemeyer)
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
-# 3/1,2/3,2/5,2/6,2/8 Gerd Kortemeyer
+# LON-CAPA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# LON-CAPA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LON-CAPA; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# /home/httpd/html/adm/gpl.txt
+#
+# http://www.lon-capa.org/
+#
+###
+
package Apache::lonfeedback;
use strict;
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 Apache::lonspeller();
+use Apache::longroup;
+use Cwd;
+use LONCAPA;
-sub mail_screen {
- my ($r,$feedurl,$options) = @_;
- $r->print(<
-
-The LearningOnline Network with CAPA
-
+END
+
+ # Breadcrumbs
+ my $brcrum = [{'href' => '',
+ 'text' => 'Resource Feedback and Discussion'}];
+
+ my %onload = ('onload' => 'window.focus();setposttype();');
+ my $start_page=
+ &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
+ {'add_entries' => \%onload,
+ 'bread_crumbs' => $brcrum,});
+
+ if ($quote ne '') {
+ &newline_to_br(\$quote);
+ $quote=''.&Apache::lontexconvert::msgtexconverted($quote).'
';
+ }
+
+ $r->print(<$restitle
+
+
+END
+ if ($env{'form.editdisc'} || $env{'form.replydisc'}) {
+ my $now = time;
+ my $ressymb = $symb;
+ &Apache::lonenc::check_encrypt(\$ressymb);
+ my $postidx = '';
+ if ($env{'form.editdisc'}) {
+ $postidx = $idx;
+ }
+ if (@currnewattach > 0) {
+ $attachnum += @currnewattach;
+ }
+ my $blockblog = &Apache::loncommon::blocking_status('blogs');
+ $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog));
+ if ($attachnum > 0) {
+ if (@currnewattach > 0) {
+ $newattachmsg .= '
'.&mt('New attachments').'
';
+ if (@currnewattach > 1) {
+ $newattachmsg .= '';
+ foreach my $item (@currnewattach) {
+ $item =~ m#.*/([^/]+)$#;
+ $newattachmsg .= '- '.$1.'
'."\n";
+ }
+ $newattachmsg .= '
'."\n";
+ } else {
+ $currnewattach[0] =~ m#.*/([^/]+)$#;
+ $newattachmsg .= ''.$1.'
'."\n";
+ }
+ }
+ if ($attachmsg) {
+ $r->print("
$lt{'reta'}:$attachmsg
\n");
+ }
+ if ($newattachmsg) {
+ $r->print("$newattachmsg
");
+ }
+ }
+ }
+ $r->print(&generate_preview_button().
+ &Apache::lonhtmlcommon::htmlareaselectactive('comment').
+ &Apache::loncommon::end_page());
+
+}
+
+sub print_display_options {
+ my ($r,$symb,$previous,$dispchgA,$dispchgB,$markchg,$toggchg,$feedurl) = @_;
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+
+ my $function = &Apache::loncommon::get_users_function();
+ my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',
+ $env{'user.domain'});
+
+ my %lt = &Apache::lonlocal::texthash(
+ 'pref' => 'Display Preference',
+ 'curr' => 'Current setting ',
+ 'actn' => 'Action',
+ 'deff' => 'Default for all discussions',
+ 'prca' => 'Preferences can be set for this discussion that determine ....',
+ 'whpo' => 'Which posts are displayed when you display this discussion board or resource, and',
+ 'unwh' => 'Under what circumstances posts are identified as "NEW", and',
+ 'wipa' => 'Whether individual posts can be marked as read/unread',
+ 'allposts' => 'All posts',
+ 'unread' => 'New posts only',
+ 'unmark' => 'Posts not marked read',
+ 'ondisp' => 'Once displayed',
+ 'onmark' => 'Once marked not NEW',
+ 'toggon' => 'Shown',
+ 'toggoff' => 'Not shown',
+ 'disa' => 'Posts displayed?',
+ 'npmr' => 'New posts cease to be identified as "NEW"?',
+ 'dotm' => 'Option to mark each post as read/unread?',
+ 'chgt' => 'Change to ',
+ 'mkdf' => 'Set to ',
+ 'yhni' => 'You have not indicated that you wish to change any of the discussion settings',
+ 'ywbr' => 'You will be returned to the previous page if you click OK.'
+ );
+
+ my $dispchangeA = $lt{'unread'};
+ my $dispchangeB = $lt{'unmark'};
+ my $markchange = $lt{'ondisp'};
+ my $toggchange = $lt{'toggon'};
+ my $currdisp = $lt{'allposts'};
+ my $currmark = $lt{'onmark'};
+ my $discdisp = 'allposts';
+ my $discmark = 'onmark';
+ my $currtogg = $lt{'toggoff'};
+ my $disctogg = 'toggoff';
+
+ if ($dispchgA eq 'allposts') {
+ $dispchangeA = $lt{'allposts'};
+ $currdisp = $lt{'unread'};
+ $discdisp = 'unread';
+ }
+
+ if ($markchg eq 'markonread') {
+ $markchange = $lt{'onmark'};
+ $currmark = $lt{'ondisp'};
+ $discmark = 'ondisp';
+ }
+
+ if ($dispchgB eq 'onlyunread') {
+ $dispchangeB = $lt{'unread'};
+ $currdisp = $lt{'unmark'};
+ $discdisp = 'unmark';
+ }
+ if ($toggchg eq 'toggoff') {
+ $toggchange = $lt{'toggoff'};
+ $currtogg = $lt{'toggon'};
+ $disctogg = 'toggon';
+ }
+
+ my $js = <
+function discdispChk(caller) {
+ var disctogg = '$toggchg'
+ if (caller == 0) {
+ if (document.modifydisp.discdisp[0].checked == true) {
+ if (document.modifydisp.discdisp[1].checked == true) {
+ document.modifydisp.discdisp[1].checked = false
+ }
+ }
+ }
+ if (caller == 1) {
+ if (document.modifydisp.discdisp[1].checked == true) {
+ if (document.modifydisp.discdisp[0].checked == true) {
+ document.modifydisp.discdisp[0].checked = false
+ }
+ if (disctogg == 'toggon') {
+ document.modifydisp.disctogg.checked = true
+ }
+ if (disctogg == 'toggoff') {
+ document.modifydisp.disctogg.checked = false
+ }
+ }
+ }
+ if (caller == 2) {
+ var dispchgB = '$dispchgB'
+ if (disctogg == 'toggoff') {
+ if (document.modifydisp.disctogg.checked == true) {
+ if (dispchgB == 'onlyunmark') {
+ document.modifydisp.discdisp[1].checked = false
+ }
+ }
+ }
+ }
+}
+
+function setDisp() {
+ var prev = "$previous"
+ var chktotal = 0
+ if (document.modifydisp.discdisp[0].checked == true) {
+ document.modifydisp.$dispchgA.value = "$symb"
+ chktotal ++
+ }
+ if (document.modifydisp.discdisp[1].checked == true) {
+ document.modifydisp.$dispchgB.value = "$symb"
+ chktotal ++
+ }
+ if (document.modifydisp.discmark.checked == true) {
+ document.modifydisp.$markchg.value = "$symb"
+ chktotal ++
+ }
+ if (document.modifydisp.disctogg.checked == true) {
+ document.modifydisp.$toggchg.value = "$symb"
+ chktotal ++
+ }
+ if (chktotal > 0) {
+ document.modifydisp.submit()
+ } else {
+ if(confirm("$lt{'yhni'}. \\n$lt{'ywbr'}")) {
+ if (prev > 0) {
+ location.href = "$feedurl?previous=$previous"
+ } else {
+ location.href = "$feedurl"
+ }
+ }
+ }
+}
-
-
-
-Feedback
-$feedurl
-