[LON-CAPA-cvs] cvs: loncom /interface lonannounce.pm
raeburn
raeburn@source.lon-capa.org
Wed, 04 Nov 2009 20:01:24 -0000
raeburn Wed Nov 4 20:01:24 2009 EDT
Modified files:
/loncom/interface lonannounce.pm
Log:
- Accommodate Communities.
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.79 loncom/interface/lonannounce.pm:1.80
--- loncom/interface/lonannounce.pm:1.79 Sat Apr 4 21:47:40 2009
+++ loncom/interface/lonannounce.pm Wed Nov 4 20:01:24 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Announce
#
-# $Id: lonannounce.pm,v 1.79 2009/04/04 21:47:40 bisitz Exp $
+# $Id: lonannounce.pm,v 1.80 2009/11/04 20:01:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,7 +45,7 @@
my %showedcheck;
sub editfield {
- my ($r,$start,$end,$text)=@_;
+ my ($r,$start,$end,$text,$crstype)=@_;
# Deal with date forms
my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',
'startdate',
@@ -61,6 +61,10 @@
'start' => 'Starting date',
'end' => 'Ending date',
'incrss' => 'Include in course RSS newsfeed');
+ if ($crstype eq 'Community') {
+ $lt{'anon'} = &mt('Community Announcements');
+ $lt{'incrss'} = &mt('Include in community RSS newsfeed');
+ }
$r->print(<<ENDFORM);
<h2>$lt{'annon'} $help</h2>
@@ -595,6 +599,7 @@
if ($allowed) {
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $crstype = &Apache::loncommon::course_type();
# ----------------------------------------------------- Store new submitted one
if ($env{'form.action'} eq 'new') {
my $startdate =
@@ -612,7 +617,13 @@
$startdate.'_'.$enddate =>
$env{'form.msg'} },$coursedom,$coursenum);
if ($env{'form.rsspost'}) {
- &Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements',
+ my $feed;
+ if ($crstype eq 'Community') {
+ $feed = 'Community_Announcements';
+ } else {
+ $feed = 'Course_Announcements';
+ }
+ &Apache::lonrss::addentry($coursenum,$coursedom,$feed,
&mt('Event from [_1] to [_2]',
&Apache::lonlocal::locallocaltime($startdate),
&Apache::lonlocal::locallocaltime($enddate)),
@@ -634,7 +645,7 @@
$tomorrowhash{'day'}++;
my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);
- &editfield($r,$today,$tomorrow,'');
+ &editfield($r,$today,$tomorrow,'',$crstype);
}
# ----------------------------------------------------- Summarize all calendars
my %allcal=&get_all_calendars();