--- loncom/interface/lonfeedback.pm 2006/11/29 03:55:15 1.221 +++ loncom/interface/lonfeedback.pm 2006/11/30 08:51:20 1.225 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.221 2006/11/29 03:55:15 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.225 2006/11/30 08:51:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -93,6 +93,11 @@ sub list_discussion { } } + my ($blocked,$blocktext) = &blocking_posts('boards',1); + if ($blocked) { + return $blocktext; + } + my @bgcols = ("#cccccc","#eeeeee"); my $discussiononly=0; if ($mode eq 'board') { $discussiononly=1; } @@ -421,55 +426,10 @@ imscp_v1p1.xsd http://www.imsglobal.org/ |; $discussion.='
'; - $discussion .=''; - + $discussion .= &action_links_bar($colspan,$ressymb,$visible, + $newpostsflag,$group, + $prevread,$markondisp); + my $escsymb=&escape($ressymb); my $numhidden = keys(%notshown); if ($numhidden > 0) { my $colspan = $maxdepth+1; @@ -680,9 +640,13 @@ END
'. - ''; - my $escsymb=&escape($ressymb); - if ($visible>2) { - $discussion.=''; - if ($newpostsflag) { - if (!$markondisp) { - $discussion .=''; - } - } else { - $discussion .= ''; - } - $discussion .= '
'. - ''.&mt('Threaded View').'  '. - ''.&mt('Chronological View').'   - '.&mt('Sorting/Filtering options').'  '; - } else { - $discussion .= ''; - } - $discussion .=''.&mt('Export').'?  '. - &mt('Preferences on what is marked as NEW'). - '
'.&mt('Mark NEW posts no longer new').''; - } else { - $discussion .= '
  
- -

END + $discussion .= &action_links_bar($colspan,$ressymb,$visible, + $newpostsflag,$group, + $prevread,$markondisp); + $discussion .= " + +

\n"; } if ($outputtarget eq 'export') { if ($manifestok) { @@ -779,6 +743,78 @@ END return $discussion; } +sub action_links_bar { + my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_; + my $discussion = ''. + ''; + my $escsymb=&escape($ressymb); + if ($visible>2) { + $discussion .= ''; + if ($newpostsflag) { + if (!$markondisp) { + $discussion .=''; + } + } else { + $discussion .= ''; + } + $discussion .= '
'. + ''.&mt('Threaded View').'  '. + ''.&mt('Chronological View').'   + '.&mt('Sorting/Filtering options').'  '; + } else { + $discussion .= ''; + } + $discussion .=''.&mt('Export').'?  '. + &mt('Preferences on what is marked as NEW'). + '
'.&mt('Mark NEW posts no longer new').''; + } else { + $discussion .= '
  
'; + return $discussion; +} + +sub blocking_posts { + my ($type,$showstatus) = @_; + my %setters; + my ($blocked,$output); + my ($startblock,$endblock) = + &Apache::loncommon::blockcheck(\%setters,$type); + if ($startblock && $endblock) { + $blocked = 1; + if ($showstatus) { + my $showstart = &Apache::lonlocal::locallocaltime($startblock); + my $showend = &Apache::lonlocal::locallocaltime($endblock); + $output = &mt('Discussion postings will not be viewable for resources in this course between [_1] and [_2] because communication is being blocked.',$showstart, $showend).'
'. + &Apache::loncommon::build_block_table($startblock,$endblock, + \%setters); + } + } + return ($blocked,$output); +} + sub postingform_display { my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum, $currnewattach,$currdelold,$group) = @_; @@ -815,11 +851,16 @@ ENDDISCUSS if ($group ne '') { $postingform .=''; } + my ($blockblog) = &blocking_posts('blogs'); + if (!$blockblog) { + $postingform .= &add_blog_checkbox(); + } $postingform .= "\n"; if ($outputtarget ne 'tex') { $postingform .= &generate_attachments_button('',$attachnum,$ressymb, $now,$currnewattach, - $currdelold,'',$mode); + $currdelold,'',$mode, + $blockblog); if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { $newattachmsg = '
'.$lt{'newa'}.'
'; if (@{$currnewattach} > 1) { @@ -1520,7 +1561,7 @@ END if ($idx > 0) { my %subversions = (); &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver); - $subject = &mt('Re: ')..$subversions{$numoldver}; + $subject = &mt('Re: ').$subversions{$numoldver}; } $subject = &HTML::Entities::encode($subject,'<>&"'); } else { @@ -1695,7 +1736,8 @@ END if (@currnewattach > 0) { $attachnum += @currnewattach; } - $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver)); + my ($blockblog) = &blocking_posts('blogs'); + $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog)); if ($attachnum > 0) { if (@currnewattach > 0) { $newattachmsg .= '
'.&mt('New attachments').'
'; @@ -2531,15 +2573,20 @@ sub screen_header { &Apache::lonnet::allowed('pch', $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { - $discussoptions='
'. - ''.&mt('Change Screenname').''; + my ($blocked) = &blocking_posts('boards'); + if (!$blocked) { + $discussoptions='
'. + ''.&mt('Change Screenname').''; + } + } + my ($blockblog) = &blocking_posts('blogs'); + if (!$blockblog) { + $discussoptions.= &add_blog_checkbox(); } - $discussoptions.='
'; } if ($msgoptions) { $msgoptions='

'.&mt('Sending Messages').'

'.$msgoptions; } if ($discussoptions) { @@ -3036,7 +3083,8 @@ sub process_attachments { } sub generate_attachments_button { - my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach,$numoldver,$mode) = @_; + my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach, + $numoldver,$mode,$blockblog) = @_; my $origpage = $ENV{'REQUEST_URI'}; my $att=$attachnum.' '.&mt("attachments"); my %lt = &Apache::lonlocal::texthash( @@ -3048,6 +3096,9 @@ sub generate_attachments_button { $lt{'clic'}:  '. +&mt('Add to my public course blog').'
'."\n"; + return $output; +} + sub has_discussion { my $resourcesref = shift; my $navmap = Apache::lonnavmaps::navmap->new();