Diff
Modified: branches/event_logging/app/controllers/home_controller.rb (1937 => 1938)
--- branches/event_logging/app/controllers/home_controller.rb 2008-11-10 16:43:19 UTC (rev 1937)
+++ branches/event_logging/app/controllers/home_controller.rb 2008-11-10 17:23:23 UTC (rev 1938)
@@ -5,8 +5,6 @@
class HomeController < ApplicationController
- before_filter :login_required, :except => [:index]
-
# GET /home
def index
respond_to do |format|
@@ -14,6 +12,14 @@
end
end
+ def public_news_rss
+ respond_to do |format|
+ format.rss do
+ render :action ="" 'public_news.rxml', :layout => false
+ end
+ end
+ end
+
protected
end
Modified: branches/event_logging/app/helpers/application_helper.rb (1937 => 1938)
--- branches/event_logging/app/helpers/application_helper.rb 2008-11-10 16:43:19 UTC (rev 1937)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-11-10 17:23:23 UTC (rev 1938)
@@ -581,7 +581,15 @@
return "#{issn[0..3]}-#{issn[4..7]}"
end
+ def formatted_time(long_time)
+ # bugfix to 'pad out' hours and minutes which are less than ten.. eg: 3:2 --> 03:02 [am]
+ time = "#{(long_time.hour < 10 ? "0#{long_time.hour}" : long_time.hour)}:#{(long_time.min < 10 ? "0#{long_time.min}" : long_time.min)}"
+ end
+ def formatted_date(long_date)
+ date = "#{long_date.day}/#{long_date.month}/#{long_date.year}"
+ end
+
# A generic caller method / interpreter of results of a true news generation method;
#
# Parameters:
@@ -614,8 +622,7 @@
}.each do |news_item|
nearest_day = news_item[0] - (news_item[0].hour.hours + news_item[0].min.minutes + news_item[0].sec.seconds)
- # bugfix to 'pad out' hours and minutes which are less than ten.. eg: 3:2 --> 03:02 [am]
- time = "#{(news_item[0].hour < 10 ? "0#{news_item[0].hour}" : news_item[0].hour)}:#{(news_item[0].min < 10 ? "0#{news_item[0].min}" : news_item[0].min)}"
+ time = formatted_time(news_item[0])
if hash.has_key? nearest_day
hash[nearest_day] << ["#{time}", "#{news_item[1]}"]
Modified: branches/event_logging/app/views/home/_news.rhtml (1937 => 1938)
--- branches/event_logging/app/views/home/_news.rhtml 2008-11-10 16:43:19 UTC (rev 1937)
+++ branches/event_logging/app/views/home/_news.rhtml 2008-11-10 17:23:23 UTC (rev 1938)
@@ -3,7 +3,7 @@
<div class="box">
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
<div class="box_title">
- <%= (logged_in? ? "My News" : "Public News") -%>
+ <%= (logged_in? ? "My News" : feed_icon_tag("myExperiment Public News", home_public_news_url) + " Public News") -%>
</div>
<div class="content">
<% news_for = (logged_in? ? current_user : nil) %>
Added: branches/event_logging/app/views/home/public_news.rxml (0 => 1938)
--- branches/event_logging/app/views/home/public_news.rxml (rev 0)
+++ branches/event_logging/app/views/home/public_news.rxml 2008-11-10 17:23:23 UTC (rev 1938)
@@ -0,0 +1,12 @@
+xml.rss "version" => "2.0", 'xmlns:opensearch' => "http://a9.com/-/spec/opensearch/1.1/", 'xmlns:atom' => "http://www.w3.org/2005/Atom" do
+ xml.channel do
+ xml.title "myExperiment.org - Public News"
+ xml.link url_for(:controller => 'home', :action ="" 'index')
+ xml.language "en-us"
+ xml.ttl "60"
+ xml.tag! "atom:link", :rel => 'search', :type => 'application/opensearchdescription+xml', :href ="" "http://#{request.host_with_port}/open_search.xml"
+ xml.description "RSS feed listing the latest public activities on myExperiment.org"
+
+ render(:partial => "layouts/public_news_entry", :collection => news_from_log_public(Time.now, Time.now-DEFAULT_PUBLIC_NEWS_RSS_TIMEFRAME, DEFAULT_PUBLIC_NEWS_RSS_COUNT, nil), :locals => { :xm => xml })
+ end
+end
\ No newline at end of file
Added: branches/event_logging/app/views/layouts/_public_news_entry.rxml (0 => 1938)
--- branches/event_logging/app/views/layouts/_public_news_entry.rxml (rev 0)
+++ branches/event_logging/app/views/layouts/_public_news_entry.rxml 2008-11-10 17:23:23 UTC (rev 1938)
@@ -0,0 +1,5 @@
+xm.item do
+ xm.title "#{formatted_date(public_news_entry[0])} @ #{formatted_time(public_news_entry[0])} - #{strip_html(public_news_entry[1])}"
+ xm.description white_list(public_news_entry[1])
+ xm.pubDate public_news_entry[0].rfc822
+end
\ No newline at end of file
Modified: branches/event_logging/config/environment_private.rb.pre (1937 => 1938)
--- branches/event_logging/config/environment_private.rb.pre 2008-11-10 16:43:19 UTC (rev 1937)
+++ branches/event_logging/config/environment_private.rb.pre 2008-11-10 17:23:23 UTC (rev 1938)
@@ -75,6 +75,13 @@
# =========== Settings for Event Logging and News Generation ===========
+#
+# Many settings (below) are required to ensure that very flexible
+# configuration of news feed generation can be achieved - this is
+# because it is performance intense operation (even after all
+# improvement work), so need to make sure that different values
+# can be tried to out easily determine the best performance / coverage
+# ratio on all affected pages.
# Switch event logging on or off
USE_EVENT_LOG = true
@@ -86,14 +93,16 @@
# Default timeframes for various types of news
# [this means that only events after (Time.now - DEFAULT_<>_TIMEFRAME) will be fetched from event log]
DEFAULT_NEWS_TIMEFRAME = 1.week
+DEFAULT_ANONYMOUS_HOME_PAGE_NEWS_TIMEFRAME = DEFAULT_NEWS_TIMEFRAME
+DEFAULT_PUBLIC_NEWS_RSS_TIMEFRAME = DEFAULT_NEWS_TIMEFRAME
DEFAULT_USER_HOME_PAGE_NEWS_TIMEFRAME = DEFAULT_NEWS_TIMEFRAME
-DEFAULT_ANONYMOUS_HOME_PAGE_NEWS_TIMEFRAME = DEFAULT_NEWS_TIMEFRAME
DEFAULT_USER_NEWS_TIMEFRAME = DEFAULT_NEWS_TIMEFRAME
DEFAULT_GROUP_NEWS_TIMEFRAME = 2.weeks
# Default news entry counts
DEFAULT_NEWS_COUNT = 30
+DEFAULT_ANONYMOUS_HOME_PAGE_NEWS_COUNT = 50
+DEFAULT_PUBLIC_NEWS_RSS_COUNT = 50
DEFAULT_USER_HOME_PAGE_NEWS_COUNT = DEFAULT_NEWS_COUNT
-DEFAULT_ANONYMOUS_HOME_PAGE_NEWS_COUNT = 50
DEFAULT_USER_NEWS_COUNT = DEFAULT_NEWS_COUNT
DEFAULT_GROUP_NEWS_COUNT = DEFAULT_NEWS_COUNT
\ No newline at end of file
Modified: branches/event_logging/config/routes.rb (1937 => 1938)
--- branches/event_logging/config/routes.rb 2008-11-10 16:43:19 UTC (rev 1937)
+++ branches/event_logging/config/routes.rb 2008-11-10 17:23:23 UTC (rev 1938)
@@ -232,6 +232,8 @@
# NB! this is moved to the bottom of the file for it to be discovered
# before 'announcements' resource within 'groups'
map.resources :announcements
+
+ map.home_public_news 'home/public_news.rss', :controller => 'home', :action ="" 'public_news_rss', :format => 'rss'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'