[jboss-cvs] JBossBlog SVN: r250 - in trunk: resources/WEB-INF and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 10 07:35:04 EDT 2008


Author: adamw
Date: 2008-03-10 07:35:04 -0400 (Mon, 10 Mar 2008)
New Revision: 250

Added:
   trunk/src/action/org/jboss/blog/session/feed/mod/PropositionsListener.java
   trunk/src/model/org/jboss/blog/model/log/
   trunk/src/model/org/jboss/blog/model/log/PropositionsLog.java
   trunk/view/emails/new_proposition_email.xhtml
Modified:
   trunk/resources/META-INF/persistence-design.xml
   trunk/resources/META-INF/persistence-dev.xml
   trunk/resources/META-INF/persistence-prod.xml
   trunk/resources/WEB-INF/components.xml
   trunk/view/emails/test_email.xhtml
   trunk/view/home.xhtml
   trunk/view/manage/feed_mod.xhtml
   trunk/view/view/post.xhtml
   trunk/view/view/right_box.xhtml
Log:


Modified: trunk/resources/META-INF/persistence-design.xml
===================================================================
--- trunk/resources/META-INF/persistence-design.xml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/resources/META-INF/persistence-design.xml	2008-03-10 11:35:04 UTC (rev 250)
@@ -23,6 +23,7 @@
         <class>org.jboss.blog.model.security.SecurityGroup</class>
         <class>org.jboss.blog.model.security.SecurityUser</class>
         <class>org.jboss.blog.model.shotoku.ShotokuFeed</class>
+        <class>org.jboss.blog.model.log.PropositionsLog</class>
         <properties>
             <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="update"/>

Modified: trunk/resources/META-INF/persistence-dev.xml
===================================================================
--- trunk/resources/META-INF/persistence-dev.xml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/resources/META-INF/persistence-dev.xml	2008-03-10 11:35:04 UTC (rev 250)
@@ -23,6 +23,7 @@
         <class>org.jboss.blog.model.security.SecurityGroup</class>
         <class>org.jboss.blog.model.security.SecurityUser</class>
         <class>org.jboss.blog.model.shotoku.ShotokuFeed</class>
+        <class>org.jboss.blog.model.log.PropositionsLog</class>
         <properties>
             <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="update"/>

Modified: trunk/resources/META-INF/persistence-prod.xml
===================================================================
--- trunk/resources/META-INF/persistence-prod.xml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/resources/META-INF/persistence-prod.xml	2008-03-10 11:35:04 UTC (rev 250)
@@ -23,6 +23,7 @@
         <class>org.jboss.blog.model.security.SecurityGroup</class>
         <class>org.jboss.blog.model.security.SecurityUser</class>
         <class>org.jboss.blog.model.shotoku.ShotokuFeed</class>
+        <class>org.jboss.blog.model.log.PropositionsLog</class>
         <properties>
             <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="update"/>

Modified: trunk/resources/WEB-INF/components.xml
===================================================================
--- trunk/resources/WEB-INF/components.xml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/resources/WEB-INF/components.xml	2008-03-10 11:35:04 UTC (rev 250)
@@ -62,7 +62,7 @@
         <action execute="#{feedMod.proposedFeed}"/>
     </event>
 
-    <mail:mail-session host="localhost" port="2525" username="test" password="test" />
+    <mail:mail-session host="localhost" port="25" username="root" password="" />
 
     <web:context-filter url-pattern="/feeds.seam" />
 

Added: trunk/src/action/org/jboss/blog/session/feed/mod/PropositionsListener.java
===================================================================
--- trunk/src/action/org/jboss/blog/session/feed/mod/PropositionsListener.java	                        (rev 0)
+++ trunk/src/action/org/jboss/blog/session/feed/mod/PropositionsListener.java	2008-03-10 11:35:04 UTC (rev 250)
@@ -0,0 +1,45 @@
+package org.jboss.blog.session.feed.mod;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.faces.Renderer;
+import org.jboss.seam.log.Log;
+import org.jboss.blog.model.log.PropositionsLog;
+import org.jboss.blog.session.security.FeedsIdentity;
+
+import javax.persistence.EntityManager;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:adam at warski.org">Adam Warski</a>
+ */
+ at Name("propositionsListener")
+public class PropositionsListener {
+    @In
+    private FeedModBean feedMod;
+
+    @In
+    private EntityManager entityManager;
+
+    @In(create = true)
+    private Renderer renderer;
+
+    @In
+    private FeedsIdentity identity;
+
+    @Logger
+    private Log log;
+
+    @Observer("org.jboss.blog.feed.proposed")
+    public void feedProposed() {
+        try {
+            renderer.render("/emails/new_proposition_email.xhtml");
+        } catch (Exception e) {
+            log.warn(e); 
+        }
+
+        entityManager.persist(new PropositionsLog(feedMod.getFeed(), identity.getSecurityUser(), new Date()));
+    }
+}

Added: trunk/src/model/org/jboss/blog/model/log/PropositionsLog.java
===================================================================
--- trunk/src/model/org/jboss/blog/model/log/PropositionsLog.java	                        (rev 0)
+++ trunk/src/model/org/jboss/blog/model/log/PropositionsLog.java	2008-03-10 11:35:04 UTC (rev 250)
@@ -0,0 +1,94 @@
+package org.jboss.blog.model.log;
+
+import org.jboss.blog.model.feed.Feed;
+import org.jboss.blog.model.security.SecurityUser;
+import org.hibernate.validator.NotNull;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:adam at warski.org">Adam Warski</a>
+ */
+ at Entity
+public class PropositionsLog {
+    @Id
+    @GeneratedValue
+    @Column(updatable = false)
+    private Integer id;
+
+    @NotNull
+    @ManyToOne
+    private Feed feed;
+
+    @NotNull
+    @ManyToOne
+    private SecurityUser securityUser;
+
+    @NotNull
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date date;
+
+    public PropositionsLog() { }
+
+    public PropositionsLog(Feed feed, SecurityUser securityUser, Date date) {
+        this.feed = feed;
+        this.securityUser = securityUser;
+        this.date = date;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Feed getFeed() {
+        return feed;
+    }
+
+    public void setFeed(Feed feed) {
+        this.feed = feed;
+    }
+
+    public SecurityUser getSecurityUser() {
+        return securityUser;
+    }
+
+    public void setSecurityUser(SecurityUser securityUser) {
+        this.securityUser = securityUser;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof PropositionsLog)) return false;
+
+        PropositionsLog that = (PropositionsLog) o;
+
+        if (date != null ? !date.equals(that.date) : that.date != null) return false;
+        if (feed != null ? !feed.equals(that.feed) : that.feed != null) return false;
+        if (id != null ? !id.equals(that.id) : that.id != null) return false;
+        if (securityUser != null ? !securityUser.equals(that.securityUser) : that.securityUser != null) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        int result;
+        result = (id != null ? id.hashCode() : 0);
+        result = 31 * result + (feed != null ? feed.hashCode() : 0);
+        result = 31 * result + (securityUser != null ? securityUser.hashCode() : 0);
+        result = 31 * result + (date != null ? date.hashCode() : 0);
+        return result;
+    }
+}

Copied: trunk/view/emails/new_proposition_email.xhtml (from rev 249, trunk/view/emails/test_email.xhtml)
===================================================================
--- trunk/view/emails/new_proposition_email.xhtml	                        (rev 0)
+++ trunk/view/emails/new_proposition_email.xhtml	2008-03-10 11:35:04 UTC (rev 250)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:m="http://jboss.com/products/seam/mail"
+    xmlns:h="http://java.sun.com/jsf/html"
+    charset="UTF-8">
+
+    <m:from name="JBoss.ORG Feeds robot" address="feeds-robot at jboss.org" />
+    <m:to>#{configurationManager.configuration.adminEmail}</m:to>
+    <m:subject>A new feed has been proposed</m:subject>
+
+    <m:body type="plain">
+        A new feed has been proposed:<br />
+        <br />
+        Title: #{feedMod.feed.title}<br />
+        Link: #{feedMod.feed.remoteLink}<br />
+        <br />
+        Visit http://labs.jboss.com/blogs/manage/proposition/proposition_list.seam to accept/reject the feed.<br />
+        <br />
+        -- <br />
+        JBoss.ORG Feeds robot
+    </m:body>
+</m:message>
\ No newline at end of file

Modified: trunk/view/emails/test_email.xhtml
===================================================================
--- trunk/view/emails/test_email.xhtml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/view/emails/test_email.xhtml	2008-03-10 11:35:04 UTC (rev 250)
@@ -4,11 +4,14 @@
     xmlns:h="http://java.sun.com/jsf/html"
     charset="UTF-8">
 
-    <m:from name="JBoss Labs Feeds administrator" address="feeds-admin at jboss.org" />
+    <m:from name="JBoss.ORG Feeds robot" address="feeds-robot at jboss.org" />
     <m:to>#{configurationManager.configuration.adminEmail}</m:to>
     <m:subject>JBoss Labs Feeds test e-mail</m:subject>
 
     <m:body type="plain">
-        <p>This is a test e-mail from JBoss Labs Feeds.</p>
+        This is a test e-mail from JBoss Labs Feeds.<br />
+        <br />
+        -- <br />
+        JBoss.ORG Feeds robot
     </m:body>
 </m:message>
\ No newline at end of file

Modified: trunk/view/home.xhtml
===================================================================
--- trunk/view/home.xhtml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/view/home.xhtml	2008-03-10 11:35:04 UTC (rev 250)
@@ -8,7 +8,7 @@
                 xmlns:rich="http://richfaces.org/rich"
                 template="layout/template.xhtml">
     <ui:define name="header">
-        Feeds central
+        JBoss.ORG Feeds home
     </ui:define>
 
     <ui:define name="body">

Modified: trunk/view/manage/feed_mod.xhtml
===================================================================
--- trunk/view/manage/feed_mod.xhtml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/view/manage/feed_mod.xhtml	2008-03-10 11:35:04 UTC (rev 250)
@@ -154,7 +154,10 @@
             </li>
         </s:fragment>
         <li>
-            <s:button value="Cancel" view="/manage/index.html" propagation="end" styleClass="submit" />
+            <s:button value="Cancel" view="/manage/index.xhtml" propagation="end" styleClass="submit" 
+                    rendered="#{identity.hasPermission('management', 'view')}"/>
+            <s:button value="Cancel" view="/home.xhtml" propagation="end" styleClass="submit"
+                    rendered="#{!identity.hasPermission('management', 'view')}"/>
         </li>
     </ul>
 </div>

Modified: trunk/view/view/post.xhtml
===================================================================
--- trunk/view/view/post.xhtml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/view/view/post.xhtml	2008-03-10 11:35:04 UTC (rev 250)
@@ -27,12 +27,13 @@
                             <f:param name="name" value="#{postView.post.feed.name}"/>
                         </s:link>
                     </li>
-                    <li>
-                        <br />
-                        <s:link value="Delete post" action="#{postView.delete}"
-                                onclick="if (!confirm('Are you sure you want to delete this post?')) return false"
-                                rendered="#{identity.hasPermission('post', 'delete', post, post.feed, post.feed.group)}"/>
-                    </li>
+                    <s:fragment rendered="#{identity.hasPermission('post', 'delete', post, post.feed, post.feed.group)}">
+                        <li>
+                            <br />
+                            <s:link value="Delete post" action="#{postView.delete}"
+                                    onclick="if (!confirm('Are you sure you want to delete this post?')) return false" />
+                        </li>
+                    </s:fragment>
                 </ul>
 
                 <ui:include src="../common/post.xhtml">

Modified: trunk/view/view/right_box.xhtml
===================================================================
--- trunk/view/view/right_box.xhtml	2008-03-10 11:10:16 UTC (rev 249)
+++ trunk/view/view/right_box.xhtml	2008-03-10 11:35:04 UTC (rev 250)
@@ -8,10 +8,11 @@
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:a="http://richfaces.org/a4j">
     <div class="feedsRightsidebox">
-        <ul id="feeds_subnav">
+        <h4>Navigation</h4>
+        <ul>
             <li><s:link view="/home.xhtml" value="Feeds home" propagation="none" /></li>
         </ul>
-             
+
         <s:div rendered="#{not empty feed.group.header}">
             <h:outputText value="#{feed.group.header}" escape="false" />
         </s:div>




More information about the jboss-cvs-commits mailing list