[jboss-cvs] JBossBlog SVN: r290 - in trunk: src/action/org/jboss/blog/session/tools and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 24 07:27:42 EDT 2008
Author: adamw
Date: 2008-04-24 07:27:42 -0400 (Thu, 24 Apr 2008)
New Revision: 290
Added:
trunk/src/action/org/jboss/blog/session/tools/PostToToolsBean.java
Modified:
trunk/resources/templates/atom_standard.vm
trunk/src/model/org/jboss/blog/model/feed/Feed.java
trunk/src/model/org/jboss/blog/model/feed/RestrictedFeed.java
trunk/view/common/post.xhtml
trunk/view/manage/feed_mod.xhtml
trunk/view/search/search.xhtml
trunk/view/view/feed.xhtml
trunk/view/view/post.xhtml
Log:
Modified: trunk/resources/templates/atom_standard.vm
===================================================================
--- trunk/resources/templates/atom_standard.vm 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/resources/templates/atom_standard.vm 2008-04-24 11:27:42 UTC (rev 290)
@@ -1,38 +1,38 @@
- <?xml version="1.0" encoding="utf-8"?>
- <feed xmlns="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
- <id>$tools.feedLink($feed, $xmlType)</id>
- <title type="html"><![CDATA[$feed.title]]></title>
- <updated>$tools.formatDate($tools.feedPubDate($feed, $posts))</updated>
- <author>
- <name>$feed.author</name>
- </author>
- <link rel="alternate" type="text/html" href="$tools.feedPageLink($feed)"/>
- <link rel="self" type="application/atom+xml" href="$tools.feedLink($feed, $xmlType)"/>
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
+ <id>$tools.feedLink($feed, $xmlType)</id>
+ <title type="html"><![CDATA[$feed.title]]></title>
+ <updated>$tools.formatDate($tools.feedPubDate($feed, $posts))</updated>
+ <author>
+ <name>$feed.author</name>
+ </author>
+ <link rel="alternate" type="text/html" href="$tools.feedPageLink($feed)"/>
+ <link rel="self" type="application/atom+xml" href="$tools.feedLink($feed, $xmlType)"/>
- #foreach($post in $posts)
- <entry>
- <id>$tools.postLink($post)</id>
- <title type="html"><![CDATA[$post.title]]></title>
- <link rel="alternate" type="text/html" href="$tools.postLink($post)"/>
+ #foreach($post in $posts)
+ <entry>
+ <id>$tools.postLink($post)</id>
+ <title type="html"><![CDATA[$post.title]]></title>
+ <link rel="alternate" type="text/html" href="$tools.postLink($post)"/>
- <updated>$tools.formatDate($post.modified)</updated>
- <published>$tools.formatDate($post.published)</published>
+ <updated>$tools.formatDate($post.modified)</updated>
+ <published>$tools.formatDate($post.published)</published>
- <content type="html" xml:lang="en">
- <![CDATA[$post.content]]>
- </content>
+ <content type="html" xml:lang="en">
+ <![CDATA[$post.content]]>
+ </content>
- <author>
- <name>$post.effectiveAuthor</name>
- </author>
+ <author>
+ <name>$post.effectiveAuthor</name>
+ </author>
- #foreach($enclosure in $post.enclosures)
- <link href="$enclosure.url" rel="enclosure" length="$enclosure.length" type="$enclosure.type" />
- #end
+ #foreach($enclosure in $post.enclosures)
+ <link href="$enclosure.url" rel="enclosure" length="$enclosure.length" type="$enclosure.type" />
+ #end
- #foreach($image in $post.images)
- <itunes:image href="$image.url" />
- #end
- </entry>
- #end
- </feed>
+ #foreach($image in $post.images)
+ <itunes:image href="$image.url" />
+ #end
+ </entry>
+ #end
+</feed>
Added: trunk/src/action/org/jboss/blog/session/tools/PostToToolsBean.java
===================================================================
--- trunk/src/action/org/jboss/blog/session/tools/PostToToolsBean.java (rev 0)
+++ trunk/src/action/org/jboss/blog/session/tools/PostToToolsBean.java 2008-04-24 11:27:42 UTC (rev 290)
@@ -0,0 +1,78 @@
+package org.jboss.blog.session.tools;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.ScopeType;
+import org.jboss.blog.model.Post;
+
+import java.net.URLEncoder;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+ at Name("postToTools")
+ at Scope(ScopeType.APPLICATION)
+ at AutoCreate
+public class PostToToolsBean {
+ public String encodeLinkForDelicious(Post post) {
+ String link = post.getLink();
+ int hashPos;
+ if ((hashPos = link.indexOf('#')) != -1) {
+ link = link.substring(0, hashPos);
+ }
+
+ try {
+ return URLEncoder.encode(link, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return link;
+ }
+ }
+
+ public String encodeTitleForDelicious(Post post) {
+ try {
+ return URLEncoder.encode(post.getTitle(), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return post.getTitle();
+ }
+ }
+
+ public String encodeLinkForDigg(Post post) {
+ String link = post.getLink();
+ int hashPos;
+ if ((hashPos = link.indexOf('#')) != -1) {
+ link = link.substring(0, hashPos);
+ }
+
+ try {
+ return URLEncoder.encode(link, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return "";
+ }
+ }
+
+ public String encodeTitleForDigg(Post post) {
+ try {
+ String title = post.getTitle();
+ if (title.length() > 75) {
+ title = title.substring(0, 75);
+ }
+ return URLEncoder.encode(title, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return "";
+ }
+ }
+
+ public String encodeBodyForDigg(Post post) {
+ try {
+ String content = post.getContent();
+ if (content.length() > 350) {
+ content = content.substring(0, 350);
+ }
+ return URLEncoder.encode(content, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return "";
+ }
+ }
+}
Modified: trunk/src/model/org/jboss/blog/model/feed/Feed.java
===================================================================
--- trunk/src/model/org/jboss/blog/model/feed/Feed.java 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/src/model/org/jboss/blog/model/feed/Feed.java 2008-04-24 11:27:42 UTC (rev 290)
@@ -72,6 +72,15 @@
@NotNull
private boolean accepted;
+ @Column
+ private Boolean showDigg;
+
+ @Column
+ private Boolean showDzone;
+
+ @Column
+ private Boolean showDelicious;
+
public Integer getId() {
return id;
}
@@ -176,6 +185,30 @@
this.accepted = accepted;
}
+ public Boolean getShowDigg() {
+ return showDigg;
+ }
+
+ public void setShowDigg(Boolean showDigg) {
+ this.showDigg = showDigg;
+ }
+
+ public Boolean getShowDzone() {
+ return showDzone;
+ }
+
+ public void setShowDzone(Boolean showDzone) {
+ this.showDzone = showDzone;
+ }
+
+ public Boolean getShowDelicious() {
+ return showDelicious;
+ }
+
+ public void setShowDelicious(Boolean showDelicious) {
+ this.showDelicious = showDelicious;
+ }
+
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Feed)) return false;
Modified: trunk/src/model/org/jboss/blog/model/feed/RestrictedFeed.java
===================================================================
--- trunk/src/model/org/jboss/blog/model/feed/RestrictedFeed.java 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/src/model/org/jboss/blog/model/feed/RestrictedFeed.java 2008-04-24 11:27:42 UTC (rev 290)
@@ -21,4 +21,10 @@
int getMaxPostsInFeed();
int getMaxPostsOnPage();
+
+ Boolean getShowDigg();
+
+ Boolean getShowDzone();
+
+ Boolean getShowDelicious();
}
Modified: trunk/view/common/post.xhtml
===================================================================
--- trunk/view/common/post.xhtml 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/view/common/post.xhtml 2008-04-24 11:27:42 UTC (rev 290)
@@ -35,6 +35,25 @@
<h:outputText value="#{post.content}" escape="false" rendered="#{!showSummary}" />
<h:outputText value="#{stringTools.createSummary(post.content)}" rendered="#{showSummary}" />
-
+
+ <s:fragment rendered="#{showPostTo and post.feed.showDzone}">
+ <img src="http://www.dzone.com/links/themes/reader/images/actions/icon-vote.gif" alt="" />
+ <a href="http://www.dzone.com/links/add.html?url=#{postToTools.encodeLinkForDelicious(post)}&title=#{postToTools.encodeTitleForDelicious(post)}">
+ Post to DZone
+ </a>  
+ </s:fragment>
+ <s:fragment rendered="#{showPostTo and post.feed.showDelicious}">
+ <img src="http://images.del.icio.us/static/img/delicious.small.gif" alt="" />
+ <a href="http://del.icio.us/post?v=4&url=#{postToTools.encodeLinkForDelicious(post)}&title=#{postToTools.encodeTitleForDelicious(post)}">
+ Post to del.icio.us
+ </a>  
+ </s:fragment>
+ <s:fragment rendered="#{showPostTo and post.feed.showDigg}">
+ <img src="http://digg.com/img/badges/10x10-digg-thumb.png" alt="" />
+ <a href="http://digg.com/submit?url=#{postToTools.encodeLinkForDigg(post)}&title=#{postToTools.encodeTitleForDigg(post)}&bodytext=#{postToTools.encodeBodyForDigg(post)}&media=news&topic=programming">
+ Digg This!
+ </a>
+ </s:fragment>
+
<hr />
</ui:composition>
\ No newline at end of file
Modified: trunk/view/manage/feed_mod.xhtml
===================================================================
--- trunk/view/manage/feed_mod.xhtml 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/view/manage/feed_mod.xhtml 2008-04-24 11:27:42 UTC (rev 290)
@@ -121,6 +121,27 @@
</a:outputPanel>
</h:panelGroup>
+<h:outputLabel for="showDelicious">
+ Show "save to del.icio.us" link at the bottom of every post:
+</h:outputLabel>
+<h:panelGroup>
+ <h:selectBooleanCheckbox id="showDelicious" value="#{feedMod.feed.showDelicious}" />
+</h:panelGroup>
+
+<h:outputLabel for="showDigg">
+ Show "digg this!" link at the bottom of every post:
+</h:outputLabel>
+<h:panelGroup>
+ <h:selectBooleanCheckbox id="showDigg" value="#{feedMod.feed.showDigg}" />
+</h:panelGroup>
+
+<h:outputLabel for="showDzone">
+ Show "post to dzone" link at the bottom of every post:
+</h:outputLabel>
+<h:panelGroup>
+ <h:selectBooleanCheckbox id="showDzone" value="#{feedMod.feed.showDzone}" />
+</h:panelGroup>
+
<!--<h:outputLabel><span class="required">*</span> Xml templates:</h:outputLabel>
<h:panelGroup>
<h:dataTable var="templateType" value="#{feedMod.templateTypes}">
Modified: trunk/view/search/search.xhtml
===================================================================
--- trunk/view/search/search.xhtml 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/view/search/search.xhtml 2008-04-24 11:27:42 UTC (rev 290)
@@ -39,6 +39,7 @@
<ui:param name="post" value="#{result[1]}" />
<ui:param name="showSummary" value="true" />
<ui:param name="showAddToHighlights" value="false" />
+ <ui:param name="showPostTo" value="false" />
<ui:param name="additionalHeader"
value="(#{postSearch.formatScore(result[0])}%)" />
</ui:include>
Modified: trunk/view/view/feed.xhtml
===================================================================
--- trunk/view/view/feed.xhtml 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/view/view/feed.xhtml 2008-04-24 11:27:42 UTC (rev 290)
@@ -37,7 +37,8 @@
<ui:include src="../common/post.xhtml">
<ui:param name="post" value="#{post}" />
<ui:param name="showSummary" value="false" />
- <ui:param name="showAddToHighlights" value="true" />
+ <ui:param name="showAddToHighlights" value="true" />
+ <ui:param name="showPostTo" value="true" />
</ui:include>
</a:repeat>
Modified: trunk/view/view/post.xhtml
===================================================================
--- trunk/view/view/post.xhtml 2008-04-23 16:56:37 UTC (rev 289)
+++ trunk/view/view/post.xhtml 2008-04-24 11:27:42 UTC (rev 290)
@@ -42,6 +42,7 @@
<ui:param name="post" value="#{post}" />
<ui:param name="showSummary" value="false" />
<ui:param name="showAddToHighlights" value="true" />
+ <ui:param name="showPostTo" value="true" />
</ui:include>
</div>
</div>
More information about the jboss-cvs-commits
mailing list