';
if (&discussion_open($status) &&
&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- if ($outputtarget ne 'tex') {
- $discussion.= &send_feedback_link($ressymb,$target);
+ $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_message_link($ressymb);
+ } else {
+ $discussion.= ''.&mt('This discussion is closed.').' ';
}
- $discussion.='
';
+ $discussion.= &send_message_link($ressymb).'';
}
return $discussion;
}
@@ -755,9 +776,9 @@ sub send_feedback_link {
my $output = ''.
- '';
+ ''.
+ '';
my $escsymb=&escape($ressymb);
- if ($visible>2) {
- $discussion .= ' '.
- ' '.
' '.&mt('Chronological View').'
'.&mt('Sorting/Filtering options').' '.(' ' x2);
- } else {
- $discussion .= ' ';
@@ -813,7 +832,7 @@ sub action_links_bar {
&mt('Preferences on what is marked as NEW').
''.&mt('Mark NEW posts no longer new').' ';
+ $discussion .= '">'.&mt('Mark NEW posts no longer new').'';
} else {
$discussion .= ' ';
}
@@ -826,7 +845,7 @@ sub action_links_bar {
sub postingform_display {
my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
- $currnewattach,$currdelold,$group) = @_;
+ $currnewattach,$currdelold,$group,$crstype) = @_;
my $newattachmsg;
my %lt = &Apache::lonlocal::texthash(
'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
@@ -835,7 +854,20 @@ sub postingform_display {
'poan' => 'Post Anonymous Discussion',
'newa' => 'New attachments',
);
- my $postingform = (<
@@ -843,7 +875,7 @@ sub postingform_display {
$lt{'note'}
$lt{'title'}:
-
+
ENDDISCUSS
if ($env{'form.origpage'}) {
$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 .= '';
- foreach my $item (@{$currnewattach}) {
- $item =~ m#.*/([^/]+)$#;
- $newattachmsg .= ''.$1.' '."\n";
- }
- $newattachmsg .= ' '."\n";
- } else {
- $$currnewattach[0] =~ m#.*/([^/]+)$#;
- $newattachmsg .= ''.$1.' '."\n";
- }
- }
- $postingform .= $newattachmsg;
- $postingform .= &generate_preview_button();
+ if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
+ $newattachmsg = ''.$lt{'newa'}.' ';
+ if (@{$currnewattach} > 1) {
+ $newattachmsg .= '';
+ foreach my $item (@{$currnewattach}) {
+ $item =~ m#.*/([^/]+)$#;
+ $newattachmsg .= ''.$1.' '."\n";
+ }
+ $newattachmsg .= ' '."\n";
+ } else {
+ $$currnewattach[0] =~ m#.*/([^/]+)$#;
+ $newattachmsg .= ''.$1.' '."\n";
+ }
}
+ $postingform .= $newattachmsg;
+ $postingform .= &generate_preview_button();
return $postingform;
}
@@ -907,6 +937,19 @@ sub build_posting_display {
if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) {
$skip_group_check = 1;
}
+ my (%deletions,%hiddens);
+ if ($contrib{'deleted'}) {
+ my $deleted = $contrib{'deleted'};
+ $deleted =~ s/^\.//;
+ $deleted =~ s/\.$//;
+ %deletions = map { $_ => 1 } (split(/\.\./,$deleted));
+ }
+ if ($contrib{'hidden'}) {
+ my $hidden = $contrib{'hidden'};
+ $hidden =~ s/^\.//;
+ $hidden =~ s/\.$//;
+ %hiddens = map { $_ => 1 } (split(/\.\./,$hidden));
+ }
if ($contrib{'version'}) {
my $oldest = $contrib{'1:timestamp'};
if ($prevread eq '0') {
@@ -920,13 +963,13 @@ sub build_posting_display {
}
for (my $id=1;$id<=$contrib{'version'};$id++) {
my $idx=$id;
+ next if ($contrib{$idx.':deleted'});
+ next if ($contrib{$idx.':hidden'});
my $posttime = $contrib{$idx.':timestamp'};
if ($prevread <= $posttime) {
$$newpostsflag = 1;
}
- my $hidden=($contrib{'hidden'}=~/\.$idx\./);
my $studenthidden=($contrib{'studenthidden'}=~/\.$idx\./);
- my $deleted=($contrib{'deleted'}=~/\.$idx\./);
my $origindex='0.';
my $numoldver=0;
if ($contrib{$idx.':replyto'}) {
@@ -950,7 +993,7 @@ sub build_posting_display {
} else {
$$replies[$$depth[$idx]]=1;
}
- unless ((($hidden) && (!$seeid)) || ($deleted)) {
+ unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) {
$$visible++;
if ($contrib{$idx.':history'}) {
if ($contrib{$idx.':history'} =~ /:/) {
@@ -984,7 +1027,7 @@ sub build_posting_display {
$message.=$attachtxt{$numoldver};
$subject=$subjects{$numoldver};
if ($message) {
- if ($hidden) {
+ if ($hiddens{$idx}) {
$message=''.$message.' ';
if ($studenthidden) {
$message .=' Deleted by poster (student).';
@@ -1011,6 +1054,7 @@ sub build_posting_display {
$contrib{$idx.':senderdomain'}).' ('.
$contrib{$idx.':sendername'}.':'.
$contrib{$idx.':senderdomain'}.')';
+ $sender = ''.$sender.' ';
if ($contrib{$idx.':anonymous'}) {
$sender.=' ['.$$anonhash{$key}.'] '.
$screenname;
@@ -1047,53 +1091,56 @@ sub build_posting_display {
} else {
@{$$namesort{$lastname}{$firstname}} = ("$idx");
}
- if (&editing_allowed($escsymb.':::'.$idx,$group)) {
- if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
- $sender.=' '.&mt('Edit').' ';
+ if ($outputtarget ne 'tex') {
+ if (&editing_allowed($escsymb.':::'.$idx,$group)) {
+ if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
+ $sender.=' '.&mt('Edit').' ';
- unless ($seeid) {
- my $grpargs = &group_args($group);
- $sender.=" ';
+ unless ($seeid) {
+ my $grpargs = &group_args($group);
+ $sender.=" ';
+ }
}
}
- }
- if ($seeid) {
- if ($hidden) {
- unless ($studenthidden) {
- $sender.=' ';
+ }
+ } else {
+ $sender.=' '.&mt('Make Visible').' ';
- }
- } else {
- $sender.=' '.&mt('Hide').' ';
- }
- my $grpargs = &group_args($group);
- $sender.=
- " ";
- $sender .= &mt('Delete').' ';
+ $sender .= &group_args($group);
+ $sender .= '">'.&mt('Hide').'';
+ }
+ my $grpargs = &group_args($group);
+ $sender.=
+ " ";
+ $sender .= &mt('Delete').' ';
+ }
}
- } else {
+ } else {
if ($screenname) {
$sender=''.$screenname.' ';
} else {
$sender=''.$$anonhash{$key}.' ';
}
+ $sender = ''.$sender.' ';
# Set up for sorting by domain, then username for anonymous
unless (defined($$usernamesort{'__anon'})) {
%{$$usernamesort{'__anon'}} = ();
@@ -1113,36 +1160,38 @@ sub build_posting_display {
@{$$namesort{'__anon'}{'__anon'}} = ("$idx");
}
}
- if (&discussion_open($status)) {
- if (($group ne '') &&
- (&check_group_priv($group,'pgd') eq 'ok')) {
- $sender.=' '.&mt('Reply').' ';
- } elsif (&Apache::lonnet::allowed('pch',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.
- $env{'request.course.sec'}:''))) {
- $sender.=' '.&mt('Reply').' ';
+ } elsif (&Apache::lonnet::allowed('pch',
+ $env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.
+ $env{'request.course.sec'}:''))) {
+ $sender.=' '.&mt('Reply').' ';
}
- $sender .= '" '.$target.'>'.&mt('Reply').'';
}
- }
- if ($viewgrades) {
- $vgrlink=&Apache::loncommon::submlink('Submissions',
- $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
- }
- if ($$dischash{$readkey}=~/\.$idx\./) {
- $ctlink = ''.&mt('Mark unread').'? ';
- } else {
- $ctlink = ''.&mt('Mark read').'? ';
+ if ($viewgrades) {
+ $vgrlink=&Apache::loncommon::submlink(&mt('Submissions'),
+ $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
+ }
+ if ($$dischash{$readkey}=~/\.$idx\./) {
+ $ctlink = ''.&mt('Mark unread').'? ';
+ } else {
+ $ctlink = ''.&mt('Mark read').'? ';
+ }
}
}
#figure out at what position this needs to print
@@ -1159,7 +1208,7 @@ sub build_posting_display {
if ($outputtarget eq 'export') {
%{$$imsitems{$idx}} = ();
$$imsitems{$idx}{'isvisible'}='true';
- if ($hidden) {
+ if ($hiddens{$idx}) {
$$imsitems{$idx}{'isvisible'}='false';
}
$$imsitems{$idx}{'title'}=$subjects{$numoldver};
@@ -1167,7 +1216,7 @@ sub build_posting_display {
$$imsitems{$idx}{'attach'}=$attachtxt{$numoldver};
$$imsitems{$idx}{'timestamp'}=$contrib{$idx.':timestamp'};
$$imsitems{$idx}{'sender'}=$plainname.' ('.
- $contrib{$idx.':sendername'}.' at '.
+ $contrib{$idx.':sendername'}.':'.
$contrib{$idx.':senderdomain'}.')';
$$imsitems{$idx}{'isanonymous'}='false';
if ($contrib{$idx.':anonymous'}) {
@@ -1240,24 +1289,24 @@ sub build_posting_display {
if ($prevread > 0 && $prevread <= $posttime) {
$$newitem{$idx} = 1;
$$discussionitems[$idx] .= '
-
- '.&mt('NEW').' ';
+
+ '.&mt('NEW').' ';
} else {
$$newitem{$idx} = 0;
$$discussionitems[$idx] .= '
-
+
';
}
$$discussionitems[$idx] .= ' '.
''.$subject.' '.
- $sender.' '.$vgrlink.' ('.
+ $sender.' '.$vgrlink.' ('.
&Apache::lonlocal::locallocaltime($posttime).') ';
if ($$dischash{$toggkey}) {
$$discussionitems[$idx].=' '.
$ctlink.' ';
}
$$discussionitems[$idx].= '
'.
- $message.' ';
+ $message.'';
if ($contrib{$idx.':history'}) {
my @postversions = ();
$$discussionitems[$idx] .= &mt('This post has been edited by the author.');
@@ -1364,7 +1413,7 @@ sub get_post_contents {
$$plainname,
$$contrib{$idx.':sendername'},
$$contrib{$idx.':senderdomain'}).' ('.
- $$contrib{$idx.':sendername'}.' at '.
+ $$contrib{$idx.':sendername'}.':'.
$$contrib{$idx.':senderdomain'}.')';
my $attachmenturls = $$contrib{$idx.':attachmenturl'};
my @postversions = ();
@@ -1392,7 +1441,9 @@ sub get_post_contents {
my ($timesent,$attachmsg);
my %currattach = ();
$timesent = &Apache::lonlocal::locallocaltime($postversions[$i]);
- &newline_to_br(\$messages->{$i});
+ unless (&contains_block_html($messages->{$i})) {
+ &newline_to_br(\$messages->{$i});
+ }
$$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i});
$$subjects{$i}=~s/\n/\ /g;
$$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i});
@@ -1406,7 +1457,7 @@ sub get_post_contents {
foreach my $key (sort(keys(%currattach))) {
if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {
my $fname = $1.$3.'/'.$4;
- $$imsfiles{$idx}{$i} .= ''."\n";
+ $$imsfiles{$idx}{$i} .= ' '."\n";
$$attachtxt{$i}.= ''.$4.' ';
}
}
@@ -1479,7 +1530,6 @@ sub mail_screen {
}
my %lt = &Apache::lonlocal::texthash(
- 'plch' => 'Please check at least one of the following feedback types:',
'myqu' => 'My question/comment/feedback:',
'title' => 'Title',
'reta' => 'Retained attachments',
@@ -1661,13 +1711,32 @@ END
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 $start_page=
&Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
- {'add_entries' => \%onload});
+ {'add_entries' => \%onload,
+ 'bread_crumbs' => $brcrum,});
if ($quote ne '') {
- &newline_to_br(\$quote);
+ $quote = &HTML::Entities::decode($quote);
+ unless (&contains_block_html($quote)) {
+ &newline_to_br(\$quote);
+ }
$quote=''.&Apache::lontexconvert::msgtexconverted($quote).' ';
}
@@ -1690,19 +1759,19 @@ END
END
}
$r->print(<
$quote
-$lt{'myqu'}
+$lt{'myqu'}
+$textareaheader
+
$latexHelp
$lt{'title'}:
-
-
END
if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
if ($env{'form.origpage'}) {
@@ -1724,6 +1793,7 @@ END
}
} else {
$r->print(<
$lt{'atta'} $attachmaxtext:
END
@@ -1737,7 +1807,7 @@ END
$r->print(<
-
+
END
@@ -1778,7 +1848,6 @@ END
}
}
$r->print(&generate_preview_button().
- &Apache::lonhtmlcommon::htmlareaselectactive('comment').
&Apache::loncommon::end_page());
}
@@ -1944,9 +2013,9 @@ END
$r->print(<$lt{'disa'}
$lt{$discdisp}
- $lt{'chgt'} "$dispchangeA"
+ $lt{'chgt'} "$dispchangeA"
- $lt{'chgt'} "$dispchangeB"
+ $lt{'chgt'} "$dispchangeB"
END
$r->print(&Apache::loncommon::end_data_table_row());
@@ -1961,7 +2030,7 @@ END
$r->print(<$lt{'dotm'}
$lt{$disctogg}
- $lt{'chgt'} "$toggchange"
+ $lt{'chgt'} "$toggchange"
END
my $save = &mt('Save');
$r->print(&Apache::loncommon::end_data_table_row());
@@ -1975,7 +2044,7 @@ END
-
+
END
if (exists($env{'form.group'})) {
$r->print(' ');
@@ -2006,7 +2075,14 @@ sub print_sortfilter_options {
my $group_sel = '';
my $numgroupvis = 5;
my %sectioncount = &Apache::loncommon::get_sections();
-
+ my @courseroles = qw(st ad ep ta in);
+ my $crstype = &Apache::loncommon::course_type();
+ my $ccrole = 'cc';
+ if ($crstype eq 'Community') {
+ $ccrole = 'co';
+ }
+ push(@courseroles,$ccrole);
+
if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section
@sections = ('all',$env{'request.course.sec'});
$numvisible = 2;
@@ -2069,7 +2145,7 @@ sub print_sortfilter_options {
my %sort_types = ();
my %role_types = ();
my %status_types = ();
- &sort_filter_names(\%sort_types,\%role_types,\%status_types);
+ &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);
my $js = <
@@ -2121,17 +2197,17 @@ $start_page
- $lt{'soor'}
-
- $lt{'sprs'}
-
- $lt{'spur'}
-
- $lt{'spse'}
-
- $lt{'spgr'}
-
- $lt{'psub'}
+ $lt{'soor'}
+
+ $lt{'sprs'}
+
+ $lt{'spur'}
+
+ $lt{'spse'}
+
+ $lt{'spgr'}
+
+ $lt{'psub'}
@@ -2158,10 +2234,11 @@ $start_page
$role_types{'all'}
$role_types{'st'}
- $role_types{'cc'}
+ $role_types{$ccrole}
$role_types{'in'}
$role_types{'ta'}
$role_types{'ep'}
+ $role_types{'ad'}
$role_types{'cr'}
@@ -2185,7 +2262,7 @@ $start_page
-
+
END
if (exists($env{'form.group'})) {
$r->print(' ');
@@ -2308,7 +2385,7 @@ END
-
+
$end_page
END
@@ -2380,7 +2457,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,
@@ -2411,7 +2488,7 @@ sub redirect_back {
if ($previous > 0) {
$qrystr = 'previous='.$previous;
if ($feedurl =~ /\?register=1/) {
- $feedurl .= '&'.$qrystr;
+ $feedurl .= '&'.$qrystr;
} else {
$feedurl .= '?'.$qrystr;
}
@@ -2420,18 +2497,18 @@ sub redirect_back {
if (defined($sort)) {
my $sortqry = 'sortposts='.$sort;
if (($feedurl =~ /\?register=1/) || ($feedurl =~ /\?previous=/)) {
- $feedurl .= '&'.$sortqry;
+ $feedurl .= '&'.$sortqry;
} else {
$feedurl .= '?'.$sortqry;
}
$sorttag = ' ';
if (defined($numpicks)) {
my $userpickqry = 'totposters='.$numpicks;
- $feedurl .= '&'.$userpickqry;
+ $feedurl .= '&'.$userpickqry;
$userpicktag = ' ';
} else {
if (ref($sectionpick) eq 'ARRAY') {
- $feedurl .= '§ionpick=';
+ $feedurl .= '§ionpick=';
$sectag .= ' ';
} else {
- $feedurl .= '§ionpick='.$sectionpick;
+ $feedurl .= '§ionpick='.$sectionpick;
$sectag = ' ';
}
if (ref($grouppick) eq 'ARRAY') {
- $feedurl .= '&grouppick=';
+ $feedurl .= '&grouppick=';
$sectag .= ' ';
} else {
- $feedurl .= '&grouppick='.$grouppick;
+ $feedurl .= '&grouppick='.$grouppick;
$grptag = ' ';
}
if (ref($rolefilter) eq 'ARRAY') {
- $feedurl .= '&rolefilter=';
+ $feedurl .= '&rolefilter=';
$roletag .= ' ';
} else {
- $feedurl .= '&rolefilter='.$rolefilter;
+ $feedurl .= '&rolefilter='.$rolefilter;
$roletag = ' ';
}
- $feedurl .= '&statusfilter='.$statusfilter;
+ $feedurl .= '&statusfilter='.$statusfilter;
$statustag =' ';
}
}
@@ -2493,10 +2570,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],
@@ -2527,13 +2600,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',
@@ -2560,7 +2629,23 @@ 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');
+ my $anoncontrib = &mt('Anonymous contribution to course discussion of resource');
+ my $namevis = &mt('name only visible to course faculty');
+ my $crstype;
+ if ($env{'request.course.id'}) {
+ $crstype = &Apache::loncommon::course_type();
+ if ($crstype eq 'Community') {
+ $crscontent = &mt('Question/Comment/Feedback about community content');
+ $crspolicy = &mt('Question/Comment/Feedback about community policy');
+ $contribdisc = &mt('Contribution to community discussion of resource');
+ $anoncontrib = &mt('Anonymous contribution to community discussion of resource');
+ $namevis = &mt('name only visible to community facilitators');
+ }
+ }
my $msgoptions='';
my $discussoptions='';
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
@@ -2581,42 +2666,48 @@ sub screen_header {
if (&feedback_available(0,1)) {
$msgoptions.=
' '.
- ($optionhash{'comment'}?$optionhash{'comment'}:&mt('Question/Comment/Feedback about course content')).
+ ($optionhash{'comment'}?$optionhash{'comment'}:$crscontent).
'
';
}
if (&feedback_available(0,0,1)) {
$msgoptions.=
' '.
- ($optionhash{'policy'}?$optionhash{'policy'}:&mt('Question/Comment/Feedback about course policy')).
+ ($optionhash{'policy'}?$optionhash{'policy'}:$crspolicy).
'
';
}
}
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',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
+ 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'}:'')) || (($group ne '') && (&check_group_priv($group,'pgd') eq 'ok')))) {
$discussoptions=' '.
- &mt('Contribution to course discussion of resource');
- $discussoptions.=' '.
- &mt('Anonymous contribution to course discussion of resource').
- ' ('.&mt('name only visible to course faculty').') '.
+ $contribdisc.
+ ' '.
+ $anoncontrib.
+ ' ('.$namevis.') '.
''.&mt('Change Screenname').' ';
my $blockblog = &Apache::loncommon::blocking_status('blogs');
if (!$blockblog) {
- $discussoptions.= &add_blog_checkbox();
+ $discussoptions.= &add_blog_checkbox($crstype);
}
}
}
if ($msgoptions) {
- $msgoptions=' '
- .' '.&mt('Send Feedback').' '
+ $msgoptions=' '
+ .' '.&mt('Send Feedback').''.&Apache::lonhtmlcommon::coursepreflink(&mt('Feedback Settings'),'feedback').'
'
.$msgoptions;
}
if ($discussoptions) {
- $discussoptions=' '
- .' '.&mt('Discussion Contributions').' '
+ $discussoptions=' '
+ .' '.&mt('Discussion Contributions').''.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'
'
.$discussoptions;
}
return $msgoptions.$discussoptions;
@@ -2636,9 +2727,7 @@ sub resource_output {
}
sub clear_out_html {
- my ($message,$override,$ignore_htmlarea)=@_;
- if (!$ignore_htmlarea
- && !&Apache::lonhtmlcommon::htmlareablocked()) { return $message; }
+ my ($message,$override)=@_;
# Always allow the -tag
my %html=(M=>1);
# Check if more is allowed
@@ -2647,11 +2736,12 @@ sub clear_out_html {
($override)) {
# allows
#
- #
+ #
%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, DIV=>1, IMG=>1,
- M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1,
- H1=>1, H2=>1, H3=>1, H4=>1, H5=>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,
+ H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1,
+ TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);
}
# Do the substitution of everything that is not explicitly allowed
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/
@@ -2668,6 +2758,9 @@ sub assemble_email {
'orig' => 'Original screen output (if applicable)',
'corr' => 'Correct Answer(s) (if applicable)',
);
+ if (&Apache::loncommon::course_type() eq 'Community') {
+ $lt{'prev'} = &mt('Previous attempts of member (if applicable)');
+ }
my $email=<<"ENDEMAIL";
$message
ENDEMAIL
@@ -2733,7 +2826,7 @@ sub send_msg {
}
sub adddiscuss {
- my ($symb,$email,$anon,$attachmenturl,$subject)=@_;
+ my ($symb,$email,$anon,$attachmenturl,$subject,$group)=@_;
my $status='';
my $realsymb;
if ($symb=~/^bulletin___/) {
@@ -2742,8 +2835,9 @@ sub adddiscuss {
$realsymb=&Apache::lonnet::symbread($filename);
}
if (&discussion_open(undef,$realsymb) &&
- &Apache::lonnet::allowed('pch',$env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
+ (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) ||
+ ($group ne '' && &check_group_priv($group,'pgd')))) {
my %contrib=('message' => $email,
'sendername' => $env{'user.name'},
@@ -2894,7 +2988,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'},undef,1);
+ my $subject=&clear_out_html($env{'form.subject'});
$subject=~s/\n/\ /g;
$subject=&Apache::lontexconvert::msgtexconverted($subject);
@@ -2914,6 +3008,31 @@ sub show_preview {
);
}
+sub contains_block_html {
+ my ($message)=@_;
+ return ($message =~ m{
+ <(br|h1|h2|h3|h4|h5|h6|p|ol|ul|table|pre|address|blockquote|center|div)
+ \s*
+ (\w+\=['"]\w+['"])*
+ \s*
+ (
+ \s*/>|
+ >.*\1\s*>
+ )}xs
+ );
+}
+
+sub tidy_html {
+ my ($message)=@_;
+# my $tidy = HTML::Tidy::libXML->new();
+# my $xhtml = $tidy->clean($message, 'utf-8', 1);
+# $xhtml =~ m/(.*)<\/body>/is;
+# my $clean = $1;
+# # remove any empty block-level tags
+# $clean =~ s/<(table|p|div|tbody|blockquote|m|pre|algebra|center|ol|ul|span|h1|h2|h3|h4|h5|h6)\s*\/>//i;
+# $message=$clean;
+ return $message;
+}
sub newline_to_br {
my ($message)=@_;
@@ -2947,7 +3066,7 @@ sub generate_preview_button {
+onclick="if (typeof(document.$formname.onsubmit)=='function') {document.$formname.onsubmit();};this.form.comment.value=document.$formname.$fieldname.value;this.form.subject.value=document.$formname.subject.value;this.form.submit();" />
ENDPREVIEW
}
@@ -2973,11 +3092,15 @@ sub modify_attachments {
END
+ # Breadcrumbs
+ my $brcrum = [{'href' => '',
+ 'text' => 'Discussion Post Attachments'}];
my $start_page =
- &Apache::loncommon::start_page('Discussion Post Attachments',$js);
+ &Apache::loncommon::start_page('Discussion Post Attachments',$js,
+ {'bread_crumbs' => $brcrum,});
my $orig_subject = &unescape($env{'form.subject'});
- my $subject=&clear_out_html($orig_subject,undef,1);
+ my $subject=&clear_out_html($orig_subject);
$subject=~s/\n/\ /g;
$subject=&Apache::lontexconvert::msgtexconverted($subject);
my $timestamp=$env{'form.timestamp'};
@@ -3002,7 +3125,7 @@ $toolarge