--- loncom/interface/lonrss.pm 2005/11/22 16:16:53 1.7 +++ loncom/interface/lonrss.pm 2006/04/13 16:23:03 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network # RSS Feeder # -# $Id: lonrss.pm,v 1.7 2005/11/22 16:16:53 albertel Exp $ +# $Id: lonrss.pm,v 1.14 2006/04/13 16:23:03 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,7 +74,6 @@ sub renamefeed { } sub advertisefeeds { - return; my ($uname,$udom,$edit)=@_; my $feeds=''; my %feednames=&Apache::lonnet::dump('nohist_all_rss_feeds',$udom,$uname); @@ -84,7 +83,7 @@ sub advertisefeeds { } foreach my $feed (sort(keys(%feednames))) { if ($feed!~/^error\:/) { - my $feedurl='feed://'.$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss'; + my $feedurl='http://'.$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss'; my $htmlurl='http://'.$ENV{'HTTP_HOST'}.'/'.$mode.'/'.$udom.'/'.$uname.'/'.$feed.'_rss.html'; $feeds.='<li>'.$feednames{$feed}. '<br />'.($edit?&mt('Edit'):'HTML').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'. @@ -98,6 +97,12 @@ sub advertisefeeds { } } +sub rss_link { + my ($url) = @_; + return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|; + +} + { my $feedcounter; sub addentry { @@ -139,8 +144,18 @@ sub changestatus { } } +sub changed_js { + return <<ENDSCRIPT; +<script type="text/javascript"> + function changed(tform,id) { + tform.elements[id+"_modified"].checked=true; + } +</script> +ENDSCRIPT +} + sub handler { - my $r = shift; + my ($r) = @_; my $edit=0; my $html=0; @@ -166,15 +181,12 @@ sub handler { my $feedname=&feedname($filename); my $displayfeedname=&displayfeedname($filename,$uname,$udom); if ($html) { - $r->print(&Apache::lonxml::xmlbegin().&Apache::loncommon::bodytag - ($displayfeedname,'','','',$udom, - $env{'form.register'}).<<ENDSCRIPT); -<script> - function changed(tform,id) { - tform.elements[id+"_modified"].checked=true; - } -</script> -ENDSCRIPT + $r->print(&Apache::loncommon::start_page($displayfeedname,undef, + {'domain' => $udom, + 'force_register' => + $env{'form.register'}}). + &changed_js()); + } else { $r->print("<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1'>\n<channel>". "\n<link>http://".$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'. @@ -265,7 +277,7 @@ ENDEDIT } } } - $r->print("\n".($html?'</ul>'.($edit?'<input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').'</body></html>':'</channel></rss>'."\n")); + $r->print("\n".($html?'</ul>'.($edit?'<input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').&Apache::loncommon::end_page():'</channel></rss>'."\n")); return OK; } 1;