[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm lonrss.pm lonsyllabus.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 27 Jul 2007 00:17:18 -0000
albertel Thu Jul 26 20:17:18 2007 EDT
Modified files:
/loncom/interface lonrss.pm lonsyllabus.pm lonaboutme.pm
Log:
- BUG#5336 - add <link> rss advertisments to the aboutme page and rss pages
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.36 loncom/interface/lonrss.pm:1.37
--- loncom/interface/lonrss.pm:1.36 Mon May 21 19:15:11 2007
+++ loncom/interface/lonrss.pm Thu Jul 26 20:17:17 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# RSS Feeder
#
-# $Id: lonrss.pm,v 1.36 2007/05/21 23:15:11 albertel Exp $
+# $Id: lonrss.pm,v 1.37 2007/07/27 00:17:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,18 +94,20 @@
}
my $server = &Apache::lonnet::absolute_url();
foreach my $feed (sort(keys(%feednames))) {
- if (($feed!~/^error\:/) && ($feed!~/^feed\_display\_option\_/)) {
- my $feedurl= $server.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss';
- my $htmlurl= $server.'/'.$mode.'/'.$udom.'/'.$uname.'/'.$feed.'_rss.html';
- if ($feednames{'feed_display_option_'.$feed} eq 'hidden') {
- if ($edit) {
- $feeds.='<li><i>'.$feednames{$feed}.'</i><br />'.&mt('Hidden').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a></li>';
- }
- } else {
- $feeds.='<li><b>'.$feednames{$feed}.
- '</b><br />'.($edit?&mt('Edit'):'HTML').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'.
- '<br />'.&mt('Public RSS/podcast (subscribe to)').': <a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a></li>';
+ next if ($feed =~/^\s*$/ ||
+ $feed =~ /^error:/ ||
+ $feed =~ /^feed_display_option_/);
+
+ my $feedurl= $server.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss';
+ my $htmlurl= $server.'/'.$mode.'/'.$udom.'/'.$uname.'/'.$feed.'_rss.html';
+ if ($feednames{'feed_display_option_'.$feed} eq 'hidden') {
+ if ($edit) {
+ $feeds.='<li><i>'.$feednames{$feed}.'</i><br />'.&mt('Hidden').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a></li>';
}
+ } else {
+ $feeds.='<li><b>'.$feednames{$feed}.
+ '</b><br />'.($edit?&mt('Edit'):'HTML').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'.
+ '<br />'.&mt('Public RSS/podcast (subscribe to)').': <a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a></li>';
}
}
if ($feeds) {
@@ -116,8 +118,22 @@
}
sub rss_link {
- my ($url) = @_;
- return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|;
+ my ($uname,$udom)=@_;
+ my $result;
+ my $server = &Apache::lonnet::absolute_url();
+ my %feednames=&Apache::lonnet::dump('nohist_all_rss_feeds',$udom,$uname);
+ foreach my $feed (sort(keys(%feednames))) {
+ next if ($feed =~/^\s*$/ ||
+ $feed =~ /^error:/ ||
+ $feed =~/^feed_display_option_/ );
+ my $url= $server.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss';
+ my $title = $feed;
+ $title =~ s/_/ /g;
+ $result.=qq|
+<link rel="alternate" type="application/rss+xml" title="$title" href="$url" />
+|;
+ }
+ return $result;
}
{
@@ -294,7 +310,8 @@
if ($html) {
my $title = $displayfeedname?$displayfeedname
:"Available RSS Feeds and Blogs";
- $r->print(&Apache::loncommon::start_page($title,undef,
+ my $rss_link = &Apache::lonrss::rss_link($uname,$udom);
+ $r->print(&Apache::loncommon::start_page($title,$rss_link,
{'domain' => $udom,
'force_register' =>
$env{'form.register'}}).
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.59 loncom/interface/lonsyllabus.pm:1.60
--- loncom/interface/lonsyllabus.pm:1.59 Tue May 1 21:33:49 2007
+++ loncom/interface/lonsyllabus.pm Thu Jul 26 20:17:17 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Syllabus
#
-# $Id: lonsyllabus.pm,v 1.59 2007/05/02 01:33:49 albertel Exp $
+# $Id: lonsyllabus.pm,v 1.60 2007/07/27 00:17:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,9 +66,6 @@
# ------------------------------------------------------------ Print the screen
- my $rss_link =
- &Apache::lonrss::rss_link('http://'.$ENV{'HTTP_HOST'}.'/public/'.$cdom.'/'.$cnum.'/Course_Announcements.rss');
-
if ($target eq 'tex') {
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
}
@@ -112,6 +109,8 @@
# ----------------------------------------------------------------- Make header
if ($target ne 'tex') {
+ my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
+
my $start_page =
&Apache::loncommon::start_page("Syllabus", $rss_link,
{'function' => $forcestudent,
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.64 loncom/interface/lonaboutme.pm:1.65
--- loncom/interface/lonaboutme.pm:1.64 Thu Jul 19 20:15:06 2007
+++ loncom/interface/lonaboutme.pm Thu Jul 26 20:17:17 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# "About Me" Personal Information
#
-# $Id: lonaboutme.pm,v 1.64 2007/07/20 00:15:06 raeburn Exp $
+# $Id: lonaboutme.pm,v 1.65 2007/07/27 00:17:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -114,8 +114,9 @@
# --------------------------------------- There is such a user, get environment
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
if ($target ne 'tex') {
+ my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
my $start_page =
- &Apache::loncommon::start_page("Personal Information",undef,
+ &Apache::loncommon::start_page("Personal Information", $rss_link,
{'function' => $forcestudent,
'domain' => $cdom,
'force_register' =>