--- loncom/interface/lonrss.pm 2006/05/11 15:27:49 1.20 +++ loncom/interface/lonrss.pm 2006/05/11 17:38:44 1.21 @@ -1,7 +1,7 @@ # The LearningOnline Network # RSS Feeder # -# $Id: lonrss.pm,v 1.20 2006/05/11 15:27:49 www Exp $ +# $Id: lonrss.pm,v 1.21 2006/05/11 17:38:44 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -180,6 +180,34 @@ sub determine_enclosure_types { return &Apache::loncommon::filemimetype($ending); } +sub course_blog_link { + my ($id,$title,$description,$url,$encurl,$enctype)=@_; + if ($env{'request.course.id'}) { + return &add_blog_entry_link($id, + $env{'course.'.$env{'request.course.id'}.'.num'}, + $env{'course.'.$env{'request.course.id'}.'.domain'}, + 'Course_Announcements', + $title,$description,$url,'public',$encurl,$enctype, + &mt('Add to Course Announcements')); + } else { + return ''; + } +} + +sub add_blog_entry_link { + my ($id,$uname,$udom,$filename,$title,$description,$url,$status,$encurl,$enctype,$linktext)=@_; + return "".$linktext.''; + +} + sub handler { my ($r) = @_; @@ -190,6 +218,10 @@ sub handler { $edit=1; $html=1; } + if (($mode eq 'adm') && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { + $edit=1; + $html=1; + } if ($filename=~/\.html$/) { $html=1; } @@ -220,7 +252,7 @@ sub handler { &mt('An RSS Feed provided by the LON-CAPA Learning Content Management System'). ''); } -# Do we have stuff to store? +# This will be the entry id for new additions to the blog my $newid = &get_new_feed_id(); # Is this user for real? my $homeserver=&Apache::lonnet::homeserver($uname,$udom); @@ -265,13 +297,36 @@ sub handler { # Add a new feed if (($html) && ($edit)) { $r->print('
'); - $r->print(&mt('Name for New Blog').": "); - $r->print(''); + $r->print(&mt('Name for New Feed').": "); + $r->print(''); $r->print('
'); } if ($displayfeedname) { # this is an existing feed # Anything to store? if ($edit) { +# check if this was called with a query string + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['queryid']); + if ($env{'form.queryid'}) { +# yes, collect the remainder + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['title', + 'description', + 'url', + 'status', + 'enclosureurl', + 'enclosuretype']); +# my ($id,$uname,$udom,$filename,$title,$description,$url,$status,$encurl,$enctype)=@_; + + &editentry($env{'form.queryid'}, + $uname,$udom,$filename, + $env{'form.title'}, + $env{'form.description'}, + $env{'form.url'}, + $env{'form.status'}, + $env{'form.encurl'}, + $env{'form.enctype'} + ); + } my %newsfeed=&Apache::lonnet::dump($feedname,$udom,$uname); foreach my $entry (sort(keys(%newsfeed)),$env{'form.newid'}.'_status') { if ($entry=~/^(\d+)\_status$/) { @@ -281,7 +336,10 @@ sub handler { $env{'form.'.$id.'_title'}, $env{'form.'.$id.'_description'}, $env{'form.'.$id.'_url'}, - $env{'form.'.$id.'_status'}); + $env{'form.'.$id.'_status'}, + $env{'form.'.$id.'_enclosureurl'}, + $env{'form.'.$id.'_enclosuretype'}, + ); } } } @@ -292,7 +350,7 @@ sub handler { &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name). ($displayoption eq 'hidden'?' ('.&mt('Hidden').')':''). ($html?''.($edit?'

'. - &mt('Name of blog/journal'). + &mt('Name of this Feed'). ': ':'').'