--- loncom/interface/lonfeedback.pm 2010/08/14 18:14:29 1.290.2.2
+++ loncom/interface/lonfeedback.pm 2010/06/08 16:56:57 1.296
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.290.2.2 2010/08/14 18:14:29 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.296 2010/06/08 16:56:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,15 +58,15 @@ sub discussion_open {
return 1;
}
# It was not explicitly open, check if the problem is available.
-# If the problem is not available, close the discussion
+# 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;
}
# 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;
}
@@ -282,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;
@@ -425,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
@@ -727,7 +722,7 @@ END
$attachnum += @{$currnewattach};
}
}
- if (&discussion_open($status) && ($outputtarget ne 'tex')) {
+ if (&discussion_open($status)) {
if (($group ne '') && ($mode eq 'board')) {
if (&check_group_priv($group,'pgd') eq 'ok') {
$discussion .=
@@ -743,25 +738,24 @@ END
$currnewattach,$currdelold,'',$crstype);
}
}
- } elsif ($outputtarget ne 'tex') {
+ } else {
$discussion.='
';
if (&discussion_open($status) &&
&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- $discussion.= &send_feedback_link($ressymb,$target);
- if ($env{'request.role.adv'}) {
- my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
- if (defined($close) && $close ne '' && $close < time) {
- $discussion .= ' '.&mt('(Closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
- }
+ if ($outputtarget ne 'tex') {
+ $discussion.= &send_feedback_link($ressymb,$target);
+ }
+ } else {
+ if ($outputtarget ne 'tex') {
+ $discussion.= &mt('This discussion is closed.');
}
- } else {
- $discussion.= ''.&mt('This discussion is closed.').'';
}
- $discussion.= &send_message_link($ressymb).
- '
';
+ if ($outputtarget ne 'tex') {
+ $discussion.= &send_message_link($ressymb);
+ }
+ $discussion.='';
}
return $discussion;
}
@@ -841,6 +835,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',
@@ -852,12 +847,7 @@ sub postingform_display {
if ($crstype eq 'Community') {
$lt{'note'} = &mt('Note: in anonymous discussion, your name is visible only to community facilitators');
}
- my ($postingform,$textareaclass);
- if (&Apache::lonhtmlcommon::htmlareabrowser()) {
- $postingform = &Apache::lonhtmlcommon::htmlareaselectactive();
- $textareaclass = 'class="LC_richDefaultOff"';
- }
- $postingform .= (<
@@ -865,7 +855,7 @@ sub postingform_display {
$lt{'note'} $lt{'title'}:
';
} else {
$$newitem{$idx} = 0;
$$discussionitems[$idx] .= '
@@ -1688,12 +1674,6 @@ END
END
- my ($textareaheader,$textareaclass);
- if (&Apache::lonhtmlcommon::htmlareabrowser()) {
- $textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive();
- $textareaclass = 'class="LC_richDefaultOff"';
- }
-
# Breadcrumbs
my $brcrum = [{'href' => '',
'text' => 'Resource Feedback and Discussion'}];
@@ -1733,16 +1713,14 @@ END
$r->print(<
$quote
-
$lt{'myqu'}
-$textareaheader
-
+
$lt{'myqu'}
$latexHelp
$lt{'title'}:
-
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
@@ -1820,6 +1798,7 @@ END
}
}
$r->print(&generate_preview_button().
+ &Apache::lonhtmlcommon::htmlareaselectactive('comment').
&Apache::loncommon::end_page());
}
@@ -2542,10 +2521,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],
@@ -2579,10 +2554,6 @@ sub no_redirect_back {
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',
@@ -2701,7 +2672,9 @@ sub resource_output {
}
sub clear_out_html {
- my ($message,$override)=@_;
+ my ($message,$override,$ignore_htmlarea)=@_;
+ if (!$ignore_htmlarea
+ && !&Apache::lonhtmlcommon::htmlareablocked()) { return $message; }
# Always allow the -tag
my %html=(M=>1);
# Check if more is allowed
@@ -2712,8 +2685,8 @@ sub clear_out_html {
#
#
%html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1,
- BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, PRE=>1, DIV=>1, IMG=>1,
- M=>1, CHEM=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1,
+ BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1,
+ M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1,
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1,
TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);
}
@@ -2961,7 +2934,7 @@ sub show_preview {
&newline_to_br(\$message);
$message=&Apache::lonspeller::markeduptext($message);
$message=&Apache::lontexconvert::msgtexconverted($message);
- my $subject=&clear_out_html($env{'form.subject'});
+ my $subject=&clear_out_html($env{'form.subject'},undef,1);
$subject=~s/\n/\ /g;
$subject=&Apache::lontexconvert::msgtexconverted($subject);
@@ -3073,7 +3046,7 @@ END
{'bread_crumbs' => $brcrum,});
my $orig_subject = &unescape($env{'form.subject'});
- my $subject=&clear_out_html($orig_subject);
+ my $subject=&clear_out_html($orig_subject,undef,1);
$subject=~s/\n/\ /g;
$subject=&Apache::lontexconvert::msgtexconverted($subject);
my $timestamp=$env{'form.timestamp'};
@@ -3589,10 +3562,6 @@ sub handler {
$r->send_http_header;
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('New posts marked as read',undef,
@@ -3925,7 +3894,8 @@ ENDREDIR
my ($typestyle,%to) = &Apache::lonmsg::decide_receiver($feedurl);
# Actually send mail
- my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}),
+ my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'},
+ undef,1),
$feedurl,$email,$citations,
$attachmenturl,$usersymb,%to);
@@ -3934,7 +3904,7 @@ ENDREDIR
if ( ($env{'form.discuss'} ne ''
&& $env{'form.discuss'} !~ /^(?:author|question|course|policy)/)
|| $env{'form.anondiscuss'} ne '') {
- my $subject = &clear_out_html($env{'form.subject'});
+ my $subject = &clear_out_html($env{'form.subject'},undef,1);
my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} );
$typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,
$subject);
@@ -3945,7 +3915,7 @@ ENDREDIR
my $blog='';
if ($env{'form.blog'}) {
- my $subject = &clear_out_html($env{'form.subject'});
+ my $subject = &clear_out_html($env{'form.subject'},undef,1);
$status.=&Apache::lonrss::addentry($env{'user.name'},
$env{'user.domain'},
'CourseBlog_'.$env{'request.course.id'},