[jboss-svn-commits] JBL Code SVN: r5323 - in labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds: . data/special tag tools

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jul 27 16:37:32 EDT 2006


Author: adamw
Date: 2006-07-27 16:37:29 -0400 (Thu, 27 Jul 2006)
New Revision: 5323

Modified:
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/VelocityContextAttributes.java
Log:
http://jira.jboss.org/jira/browse/JBSHOTOKU-38

Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java	2006-07-27 20:29:31 UTC (rev 5322)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java	2006-07-27 20:37:29 UTC (rev 5323)
@@ -96,10 +96,16 @@
      */
     private Set<String> duringGeneration;
 
+    /**
+     * Feeds configuration id.
+     */
+    private String id;
+
     private FeedsConfigurationWatcher fcw;
 
     public FeedsDescriptor(String id, FeedsConfigurationWatcher fcw) {
         this.fcw = fcw;
+        this.id = id;
 
         confKey = tuple(
                 ContentManager.getProperty(FeedsConstants.CONFIGID, ""),
@@ -353,4 +359,8 @@
            }
        }
     }
+
+    public String getId() {
+        return id;
+    }
 }

Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java	2006-07-27 20:29:31 UTC (rev 5322)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java	2006-07-27 20:37:29 UTC (rev 5323)
@@ -124,6 +124,7 @@
 
         vc.put("commented", commentedNode);
         vc.put("youngest", youngest);
+        vc.put("author", feed.getAttributes().get(FeedDefAttributes.AUTHOR));
         vc.put(VelocityContextAttributes.NODES_LIST, comments);
 
         try {

Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java	2006-07-27 20:29:31 UTC (rev 5322)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java	2006-07-27 20:37:29 UTC (rev 5323)
@@ -124,8 +124,8 @@
                 FeedDefAttributes.DISP_NAME));
 
         ContentManager cm = ContentManager.getContentManager(
-                Tools.toString(FeedDefAttributes.CM_ID),
-                Tools.toString(FeedDefAttributes.CM_PREFIX));
+                Tools.toString(attributes.get(FeedDefAttributes.CM_ID)),
+                Tools.toString(attributes.get(FeedDefAttributes.CM_PREFIX)));
 
         VelocityContext vc = new VelocityContext(attributes);
         FeedsTools.prepareVelocityContext(attributes, vc);
@@ -182,6 +182,15 @@
             vc.put(VelocityContextAttributes.LINK,
                     generateFeedLink(fd, true, feedName, feedType));
 
+            CommentableFeed cf = new CommentableFeed(newFeed, nodesNodeList);
+
+            if (cf.getCommentsEnabled()) {
+                vc.put(VelocityContextAttributes.FEED_ID, fd.getId());
+                vc.put(VelocityContextAttributes.FEED_TYPE, getFeedType());
+                vc.put(VelocityContextAttributes.COMMENTS_SERVICE,
+                        FeedsTools.getCommentsService());
+            }
+
             // Now that we have type and site, we can render the
             // template.
             Writer w = newFeed.getWriter();
@@ -190,8 +199,7 @@
             w.close();
 
             // And add the feed.
-            fd.addCommentableFeed(feedName, feedType,
-                    new CommentableFeed(newFeed, nodesNodeList));
+            fd.addCommentableFeed(feedName, feedType, cf);
         } catch (Exception e) {
             log.error("Cannot merge template " + template + " for "
                     + feedName + ".", e);

Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java	2006-07-27 20:29:31 UTC (rev 5322)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java	2006-07-27 20:37:29 UTC (rev 5323)
@@ -48,4 +48,9 @@
      * and placed in the velocity context.
      */
     public static final String CLASS_ATTR_PREFIX = "class-";
+
+    /**
+     * Author of a feed.
+     */
+    public static final String AUTHOR   = "author";
 }

Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/VelocityContextAttributes.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/VelocityContextAttributes.java	2006-07-27 20:29:31 UTC (rev 5322)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/VelocityContextAttributes.java	2006-07-27 20:37:29 UTC (rev 5323)
@@ -15,4 +15,19 @@
      * Link to a feed.
      */
     public static final String LINK         = "link";
+
+    /**
+     * Comments service.
+     */
+    public static final String COMMENTS_SERVICE = "commentsService";
+
+    /**
+     * Generated feed id (id of feeds configuration).
+     */
+    public static final String FEED_ID  = "feedId";
+
+    /**
+     * Generated feed type.
+     */
+    public static final String FEED_TYPE = "feedType";
 }




More information about the jboss-svn-commits mailing list