roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r589603 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/ui/rendering/pagers/ web/WEB-INF/velocity/templates/feeds/
Date Mon, 29 Oct 2007 12:43:02 GMT
Author: snoopdave
Date: Mon Oct 29 05:43:02 2007
New Revision: 589603

URL: http://svn.apache.org/viewvc?rev=589603&view=rev
Log:
Fix for incorrect feed update element values in site-wide feeds
http://opensource.atlassian.com/projects/roller/browse/ROL-1587

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java
    roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-atom.vm
    roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-rss.vm
    roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-atom.vm
    roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-rss.vm

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java?rev=589603&r1=589602&r2=589603&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
Mon Oct 29 05:43:02 2007
@@ -18,6 +18,7 @@
 
 package org.apache.roller.weblogger.ui.rendering.pagers;
 
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -52,6 +53,8 @@
     // are there more items?
     private boolean more = false;
     
+    // most recent update time of current set of entries
+    private Date lastUpdated = null;        
     
     public CommentsPager(
             URLStrategy    strat,
@@ -122,4 +125,25 @@
         return more;
     }
     
+    /** Get last updated time from items in pager */
+    public Date getLastUpdated() {
+        if (lastUpdated == null) {
+            // feeds are sorted by pubtime, so first might not be last updated
+            List<WeblogEntryCommentWrapper> items = (List<WeblogEntryCommentWrapper>)getItems();
+            if (getItems() != null && getItems().size() > 0) {
+                Timestamp newest = ((WeblogEntryCommentWrapper)getItems().get(0)).getPostTime();
+                for (WeblogEntryCommentWrapper c : items) {
+                    if (c.getPostTime().after(newest)) {
+                        newest = c.getPostTime();
+                    }
+                }
+                lastUpdated = new Date(newest.getTime());
+            } else {
+                // no update so we assume it's brand new
+                lastUpdated = new Date();
+            }
+        }
+        return lastUpdated;
+    }
 }
+

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java?rev=589603&r1=589602&r2=589603&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/WeblogEntriesListPager.java
Mon Oct 29 05:43:02 2007
@@ -18,6 +18,7 @@
 
 package org.apache.roller.weblogger.ui.rendering.pagers;
 
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -58,6 +59,9 @@
     // are there more entries?
     private boolean more = false;
     
+    // most recent update time of current set of entries
+    private Date lastUpdated = null;    
+    
     
     public WeblogEntriesListPager(
             URLStrategy    strat,
@@ -147,4 +151,24 @@
         return more;
     }
 
+    /** Get last updated time from items in pager */
+    public Date getLastUpdated() {
+        if (lastUpdated == null) {
+            // feeds are sorted by pubtime, so first might not be last updated
+            List<WeblogEntryWrapper> items = (List<WeblogEntryWrapper>)getItems();
+            if (getItems() != null && getItems().size() > 0) {
+                Timestamp newest = ((WeblogEntryWrapper)getItems().get(0)).getUpdateTime();
+                for (WeblogEntryWrapper e : items) {
+                    if (e.getUpdateTime().after(newest)) {
+                        newest = e.getPubTime();
+                    }
+                }
+                lastUpdated = new Date(newest.getTime());
+            } else {
+                // no update so we assume it's brand new
+                lastUpdated = new Date();
+            }
+        }
+        return lastUpdated;
+    }
 }

Modified: roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-atom.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-atom.vm?rev=589603&r1=589602&r2=589603&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-atom.vm
(original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-atom.vm
Mon Oct 29 05:43:02 2007
@@ -27,8 +27,8 @@
     #if($config.feedHistoryEnabled)
         #showFeedHistory($pager)
     #end    
-    <updated>$utils.formatIso8601Date($model.weblog.lastModified)</updated>
-    <generator uri="http://rollerweblogger.org" version="$config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)">Apache
Roller (incubating)</generator>
+    <updated>$utils.formatIso8601Date($pager.lastUpdated)</updated>
+    <generator uri="http://roller.apache.org" version="$config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)">Apache
Roller Weblogger</generator>
     #showCommentsAtom10($pager.items)
 </feed>
 

Modified: roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-rss.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-rss.vm?rev=589603&r1=589602&r2=589603&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-rss.vm
(original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-comments-rss.vm
Mon Oct 29 05:43:02 2007
@@ -26,10 +26,10 @@
   <atom:link rel="self" type="application/rss+xml" href="$url.feed.comments.rss($model.categoryPath,
$model.excerpts)" />
   <description>$utils.escapeXML($config.siteDescription)</description>
   <language>en-us</language>
-  <copyright>Copyright $utils.formatDate($model.weblog.lastModified, "yyyy")</copyright>
-  <lastBuildDate>$utils.formatRfc822Date($model.weblog.lastModified)</lastBuildDate>
-  <generator>Apache Roller (incubating) $config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)</generator>
-  #set($comments = $site.getCommentsPager(-1, $config.feedSize).items )
-  #showCommentsRSS20($comments)
+  #set($pager = $site.getCommentsPager(-1, $config.feedSize))
+  <copyright>Copyright $utils.formatDate($pager.lastUpdated, "yyyy")</copyright>
+  <lastBuildDate>$utils.formatRfc822Date($pager.lastUpdated)</lastBuildDate>
+  <generator>Apache Roller Weblogger $config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)</generator>
+  #showCommentsRSS20($pager.items)
 </channel>
 </rss>

Modified: roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-atom.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-atom.vm?rev=589603&r1=589602&r2=589603&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-atom.vm
(original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-atom.vm
Mon Oct 29 05:43:02 2007
@@ -33,8 +33,8 @@
     #if($config.feedHistoryEnabled)
         #showFeedHistory($pager)
     #end  
-    <updated>$utils.formatIso8601Date($model.weblog.lastModified)</updated>
-    <generator uri="http://rollerweblogger.org" version="$config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)">Apache
Roller (incubating)</generator>
+    <updated>$utils.formatIso8601Date($pager.lastUpdated)</updated>
+    <generator uri="http://roller.apache.org" version="$config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)">Apache
Roller Weblogger</generator>
     #showEntriesAtom10($pager.items)
 </feed>
 

Modified: roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-rss.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-rss.vm?rev=589603&r1=589602&r2=589603&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-rss.vm (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/velocity/templates/feeds/site-entries-rss.vm Mon
Oct 29 05:43:02 2007
@@ -32,10 +32,10 @@
   #end
   <description>$utils.escapeXML($config.siteDescription)</description>
   <language>en-us</language>
-  <copyright>Copyright $utils.formatDate($model.weblog.lastModified, "yyyy")</copyright>
-  <lastBuildDate>$utils.formatRfc822Date($model.weblog.lastModified)</lastBuildDate>
-  <generator>Apache Roller (incubating) $config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)</generator>
-  #set($entries = $site.getWeblogEntriesPager(-1, $config.feedSize).items )
-  #showEntriesRSS20($entries)
+  #set($pager = $site.getWeblogEntriesPager(-1, $config.feedSize))
+  <copyright>Copyright $utils.formatDate($pager.lastUpdated, "yyyy")</copyright>
+  <lastBuildDate>$utils.formatRfc822Date($pager.lastUpdated)</lastBuildDate>
+  <generator>Apache Roller Weblogger $config.rollerVersion ($config.rollerBuildTimestamp:$config.rollerBuildUser)</generator>
+  #showEntriesRSS20($pager.items)
 </channel>
 </rss>



Mime
View raw message