[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /interface lonannounce.pm lonmsg.pm lonsyllabus.pm doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs@mail.lon-capa.org
Thu, 17 Nov 2005 21:33:41 -0000


This is a MIME encoded message

--www1132263221
Content-Type: text/plain

www		Thu Nov 17 16:33:41 2005 EDT

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom	loncapa_apache.conf 
    /loncom/interface	lonannounce.pm lonmsg.pm lonsyllabus.pm 
  Log:
  Having fun with RSS. Option when doing Broadcasts and Calendar Announcements
  
  Next steps:
  * dynamically generated, showing due dates, etc
  
  Long term:
  * podcasts
  * blogs
  
  
  
--www1132263221
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20051117163341.txt"

Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.458 doc/loncapafiles/loncapafiles.lpml:1.459
--- doc/loncapafiles/loncapafiles.lpml:1.458	Fri Oct 28 17:02:35 2005
+++ doc/loncapafiles/loncapafiles.lpml	Thu Nov 17 16:33:14 2005
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.458 2005/10/28 21:02:35 albertel Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.459 2005/11/17 21:33:14 www Exp $ -->
 
 <!--
 
@@ -2057,6 +2057,15 @@
 <status>works/unverified</status>
 </file>
 <file>
+<source>loncom/interface/lonrss.pm</source>
+<target dist='default'>home/httpd/lib/perl/Apache/lonrss.pm</target>
+<categoryname>handler</categoryname>
+<description>
+Handler for adding to and displaying RSS
+</description>
+<status>works/unverified</status>
+</file>
+<file>
 <source>loncom/homework/lonsimpleproblemedit.pm</source>
 <target dist='default'>home/httpd/lib/perl/Apache/lonsimpleproblemedit.pm</target>
 <categoryname>handler</categoryname>
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.120 loncom/loncapa_apache.conf:1.121
--- loncom/loncapa_apache.conf:1.120	Tue Nov 15 18:05:05 2005
+++ loncom/loncapa_apache.conf	Thu Nov 17 16:33:21 2005
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.120 2005/11/15 23:05:05 raeburn Exp $
+## $Id: loncapa_apache.conf,v 1.121 2005/11/17 21:33:21 www Exp $
 ##
 
 #
@@ -115,6 +115,14 @@
 ErrorDocument	  500 /adm/errorhandler
 </LocationMatch>
 
+<LocationMatch "^/+public/.*\.rss$">
+PerlAccessHandler	Apache::lonacc
+SetHandler              perl-script
+PerlHandler             Apache::lonrss
+ErrorDocument     404 /adm/notfound.html
+ErrorDocument	  500 /adm/errorhandler
+</LocationMatch>
+
 <LocationMatch "^/adm/.*/aboutme$">
 PerlAccessHandler	Apache::lonacc
 SetHandler              perl-script
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.35 loncom/interface/lonannounce.pm:1.36
--- loncom/interface/lonannounce.pm:1.35	Thu Nov 17 14:54:49 2005
+++ loncom/interface/lonannounce.pm	Thu Nov 17 16:33:40 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.35 2005/11/17 19:54:49 www Exp $
+# $Id: lonannounce.pm,v 1.36 2005/11/17 21:33:40 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::loncommon;
 use Apache::lonhtmlcommon();
 use Apache::lonlocal;
+use Apache::lonrss();
 use Apache::lonnet;
 use HTML::Entities();
 
@@ -49,14 +50,21 @@
                                                           'enddate',
                                                           $end);
     my $help=&Apache::loncommon::help_open_menu('','Calendar Add Announcement','Calendar_Add_Announcement','',274,'Communication Tools');
+    my %lt=&Apache::lonlocal::texthash('post' => 'Post Announcement',
+				       'start' => 'Starting date',
+				       'end' => 'Ending date',
+				       'incrss' => 'Include in course newsfeed');
+
     $r->print(<<ENDFORM);
 $help
 <form name="anno" method="post">
-<input type="hidden" value=''          name="action"      >
-<table><tr><td>Starting date:</td><td>$startdateform</td></tr>
-<tr><td>Ending date:</td><td>$enddateform</td></tr></table>
+<input type="hidden" value='' name="action" />
+<table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr>
+<tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table>
 <textarea name="msg" rows="4" cols="60">$text</textarea>
-<input type="button" onClick="trysubmit()" value="Post Announcement"><hr />
+<br />
+<label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> 
+<br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr />
 ENDFORM
 }
 
@@ -421,6 +429,13 @@
 	    &Apache::lonnet::put('calendar',{ 
 		$startdate.'_'.$enddate => 
 		    $env{'form.msg'} },$coursedom,$coursenum);
+	    if ($env{'form.rsspost'}) {
+               &Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements',
+					 &mt('Event from [_1] to [_2]',
+					     &Apache::lonlocal::locallocaltime($startdate),
+					     &Apache::lonlocal::locallocaltime($enddate)),
+					 $env{'form.msg'},'/adm/announcements','public');
+	   }
         }
 # ---------------------------------------------------------------- Remove items
         if ($env{'form.action'} eq 'del') {
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.153 loncom/interface/lonmsg.pm:1.154
--- loncom/interface/lonmsg.pm:1.153	Tue Nov  1 10:59:18 2005
+++ loncom/interface/lonmsg.pm	Thu Nov 17 16:33:40 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.153 2005/11/01 15:59:18 www Exp $
+# $Id: lonmsg.pm,v 1.154 2005/11/17 21:33:40 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -115,6 +115,7 @@
 use Apache::lonlocal;
 use Apache::loncommunicate;
 use Apache::lonfeedback;
+use Apache::lonrss();
 
 # Querystring component with sorting type
 my $sqs;
@@ -1114,8 +1115,9 @@
  '<label><input type="checkbox" name="sendbck" /> '.&mt('Send as critical message').'  ' .
  &mt('and return receipt') . '</label>' . $crithelp . 
  '</p><p><label><input type="checkbox" name="permanent" /> '.
-&mt('Send copy to permanent email address (if known)').'</label></p>';
-     }
+&mt('Send copy to permanent email address (if known)').'</label></p>'.
+'<p><label><input type="checkbox" name="rsspost" /> '.
+		  &mt('Include in course newsfeed').'</label></p>';      }
     my %message;
     my %content;
     my $defdom=$env{'user.domain'};
@@ -2195,6 +2197,13 @@
 	if ($env{'form.storebasecomment'}) {
 	    &storecomment($r);
 	}
+	if (($env{'form.rsspost'}) && ($env{'request.course.id'})) {
+	    &Apache::lonrss::addentry($env{'course.'.$env{'request.course.id'}.'.num'},
+				      $env{'course.'.$env{'request.course.id'}.'.domain'},
+				      'Course_Announcements',
+				      $env{'form.subject'},
+				      $env{'form.message'},'/adm/communicate','public');
+	}
 	&disall($r,($folder?$folder:$dismode));
     } elsif ($env{'form.newfolder'}) {
 	&printheader($r,'','New Folder');
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.41 loncom/interface/lonsyllabus.pm:1.42
--- loncom/interface/lonsyllabus.pm:1.41	Sun Jun  5 22:29:46 2005
+++ loncom/interface/lonsyllabus.pm	Thu Nov 17 16:33:40 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.41 2005/06/06 02:29:46 albertel Exp $
+# $Id: lonsyllabus.pm,v 1.42 2005/11/17 21:33:40 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -47,17 +47,20 @@
 
 # ------------------------------------------------------------ Print the screen
     my $target=$env{'form.grade_target'};
+    my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
+    my $feedurl='feed://'.$ENV{'HTTP_HOST'}.'/public/'.$cdom.'/'.$cnum.'/Course_Announcements.rss';
     if ($target ne 'tex') {
 	my $html=&Apache::lonxml::xmlbegin();
 	$r->print(<<ENDDOCUMENT);
 $html
 <head>
 <title>The LearningOnline Network with CAPA</title>
+<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$feedurl" />
 ENDDOCUMENT
     } else {
 	$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
     } 
-    my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
+
 # Is this even a course?
     my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom); 
     if ($homeserver eq 'no_host') {
@@ -113,7 +116,9 @@
 # -------------------------------------------------------------- Announcements?
     if ($target ne 'tex') {
 	$r->print(&Apache::lonannounce::showday(time,2,
-                         &Apache::lonannounce::readcalendar($cdom.'_'.$cnum)));
+                         &Apache::lonannounce::readcalendar($cdom.'_'.$cnum)).
+		  '<p>'.&mt('Course Announcement RSS Feed').': '.
+		  '<a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a>');
     } else {
 	$r->print(&Apache::lonxml::xmlparse($r,'tex',
 		       &Apache::lonannounce::showday(time,2,

--www1132263221--