[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm lonmsgdisplay.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 29 Nov 2006 19:31:49 -0000
raeburn Wed Nov 29 14:31:49 2006 EDT
Modified files:
/loncom/interface lonmsgdisplay.pm lonfeedback.pm
Log:
Can set blocking of posting to discussion boards in a course, and to a user's course blog via FDBK.
More concise use of &mt() for internationalization.
Ignore the duplication of message in disnew() and disfolder(), for now, because disnew()'s days are numbered.
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.44 loncom/interface/lonmsgdisplay.pm:1.45
--- loncom/interface/lonmsgdisplay.pm:1.44 Wed Nov 29 02:46:39 2006
+++ loncom/interface/lonmsgdisplay.pm Wed Nov 29 14:31:47 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.44 2006/11/29 07:46:39 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.45 2006/11/29 19:31:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -704,17 +704,10 @@
if ($numblocked > 0) {
my $beginblock = &Apache::lonlocal::locallocaltime($startblock);
my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
- if ($numblocked == 1) {
- $r->print("<h3>".&mt('You have').' '.$numblocked.' '.&mt('blocked unread message').".</h3>");
- $r->print(&mt('This message is not viewable because').' ');
- } else {
- $r->print("<h3>".&mt('You have').' '.$numblocked.' '.&mt('blocked unread messages').".</h3>");
- $r->print(&mt('These').' '.$numblocked.' '.&mt('messages are not viewable because '));
- }
- $r->print(
-&mt('display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams').'.');
- $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
- \%setters));
+ $r->print('<h3>'.&mt('You have [quant,_1,blocked unread message,blocked unread messages].',$numblocked).'</h3>'."\n".
+ &mt('[quant,_1,message is,messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock).'<br />'."\n".
+ &Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -883,7 +876,7 @@
my $beginblock = &Apache::lonlocal::locallocaltime($startblock);
my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
$r->print('<br /><br />'.
- $numblocked.' '.&mt('message(s) is/are not viewable because display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams.'));
+ &mt('[_1,quant,message is, messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock));
$r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
\%setters));
}
@@ -1598,9 +1591,10 @@
'chat' => 'Chat',
'boards' => 'Discussion',
'port' => 'Portfolio',
- 'groups' => 'Groups'
+ 'groups' => 'Groups',
+ 'blogs' => 'Blogs',
);
- my $typeorder = ['com','chat','boards','port','groups'];
+ my $typeorder = ['com','chat','boards','port','groups','blogs'];
return ($typeorder,\%types);
}
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.222 loncom/interface/lonfeedback.pm:1.223
--- loncom/interface/lonfeedback.pm:1.222 Tue Nov 28 23:25:23 2006
+++ loncom/interface/lonfeedback.pm Wed Nov 29 14:31:48 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.222 2006/11/29 04:25:23 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.223 2006/11/29 19:31:48 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -93,6 +93,11 @@
}
}
+ my ($blocked,$blocktext) = &blocking_posts('boards',1);
+ if ($blocked) {
+ return $blocktext;
+ }
+
my @bgcols = ("#cccccc","#eeeeee");
my $discussiononly=0;
if ($mode eq 'board') { $discussiononly=1; }
@@ -791,6 +796,25 @@
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).'<br />'.
+ &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) = @_;
@@ -2543,15 +2567,21 @@
&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
- &mt('Contribution to course discussion of resource');
- $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
- &mt('Anonymous contribution to course discussion of resource').
- ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
- '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
+ my ($blocked) = &blocking_posts('boards');
+ if (!$blocked) {
+ $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
+ &mt('Contribution to course discussion of resource');
+ $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
+ &mt('Anonymous contribution to course discussion of resource').
+ ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
+ '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
+ }
+ }
+ my ($blockblog) = &blocking_posts('blogs');
+ if (!$blockblog) {
+ $discussoptions.='<br /><label><input type="checkbox" name="blog" /> '.
+ &mt('Add to my public course blog').'</label>';
}
- $discussoptions.='<br /><label><input type="checkbox" name="blog" /> '.
- &mt('Add to my public course blog').'</label>';
}
if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; }
if ($discussoptions) {