[jboss-svn-commits] JBL Code SVN: r11046 - in labs/jbossforums/branches/forums101P24/forums/src: main/org/jboss/portlet/forums/ui/action and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Apr 16 18:35:22 EDT 2007
Author: unibrew
Date: 2007-04-16 18:35:21 -0400 (Mon, 16 Apr 2007)
New Revision: 11046
Added:
labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/watches/topicWatch.xhtml
Modified:
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml
Log:
[JBFORUMS-206] New view, for choosing notification type for topic subscribtion, created.
Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-04-16 22:34:11 UTC (rev 11045)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-04-16 22:35:21 UTC (rev 11046)
@@ -204,6 +204,8 @@
// watches views
TEMP_VIEW_ID_TO_NAME.put("w","/views/watches/forumWatch.jsf");
TEMP_VIEW_NAME_TO_ID.put("/views/watches/forumWatch.jsf","w");
+ TEMP_VIEW_ID_TO_NAME.put("wt","/views/watches/topicWatch.jsf");
+ TEMP_VIEW_NAME_TO_ID.put("/views/watches/topicWatch.jsf","wt");
// MyForums views
TEMP_VIEW_ID_TO_NAME.put("my","/views/myforums/myforums_main.jsf");
Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java 2007-04-16 22:34:11 UTC (rev 11045)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java 2007-04-16 22:35:21 UTC (rev 11046)
@@ -42,6 +42,7 @@
private int topicId ;
private int watchType ;
private boolean editMode;
+ private Topic topic;
/**
*
@@ -58,6 +59,62 @@
{
this.watchType = watchType;
}
+
+ /**
+ *
+ */
+ public String dummyAction()
+ {
+ return "success";
+ }
+
+ /**
+ *
+ */
+ public int getTopicId()
+ {
+ return topicId;
+ }
+
+ /**
+ *
+ */
+ public void setTopicId(int topicId)
+ {
+ this.topicId = topicId;
+ }
+
+ /**
+ *
+ */
+ public Topic getTopic()
+ {
+ return this.topic;
+ }
+
+ /**
+ *
+ */
+ public void setTopic(Topic topic)
+ {
+ this.topic = topic;
+ }
+
+ /**
+ *
+ */
+ public void setEditMode(boolean editMode)
+ {
+ this.editMode = editMode;
+ }
+
+ /**
+ *
+ */
+ public boolean getEditMode()
+ {
+ return this.editMode;
+ }
/**
*
@@ -79,6 +136,18 @@
topicId = -1;
}
+ if (topicId!=-1)
+ {
+ try
+ {
+ this.topic = getForumsModule().findTopicById(new Integer(this.topicId));
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ this.topic = null;
+ }
+ }
+
try
{
String wt = JSFUtil.getRequestParameter(Constants.p_notified_watch_type);
@@ -119,6 +188,12 @@
try
{
+ // checking for needed parameters
+ if (this.topicId == -1 || this.watchType==-1)
+ {
+ return navState;
+ }
+
//make sure a watch for this topic is not already issued for this user
boolean isDuplicate = this.isWatched();
if(isDuplicate)
@@ -131,8 +206,8 @@
//activate the watch for the selected topic
- getForumsModule().createWatch(PortalUtil.getPoster(),topic,ForumsConstants.WATCH_MODE_EMBEDED);
-
+ getForumsModule().createWatch(PortalUtil.getPoster(),topic,this.watchType);
+ navState="success";
}
catch(Exception e)
{
@@ -189,6 +264,14 @@
return navState;
}
+ /**
+ * When user cancels creating topic notification then this action is executed.
+ */
+ public String cancel()
+ {
+ return "cancel";
+ }
+
public boolean isWatched()
{
TopicWatch topicWatch = null;
@@ -206,44 +289,4 @@
return topicWatch!=null;
}
- /**
- *
- */
- public String dummyAction()
- {
- return "success";
- }
-
- /**
- *
- */
- public int getTopicId()
- {
- return topicId;
- }
-
- /**
- *
- */
- public void setTopicId(int topicId)
- {
- this.topicId = topicId;
- }
-
- /**
- *
- */
- public void setEditMode(boolean editMode)
- {
- this.editMode = editMode;
- }
-
- /**
- *
- */
- public boolean getEditMode()
- {
- return this.editMode;
- }
-
}
Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2007-04-16 22:34:11 UTC (rev 11045)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2007-04-16 22:35:21 UTC (rev 11046)
@@ -92,6 +92,10 @@
<key>forumWatch</key>
<value>/views/watches/forumWatch.jsf</value>
</map-entry>
+ <map-entry>
+ <key>topicWatch</key>
+ <value>/views/watches/topicWatch.jsf</value>
+ </map-entry>
<map-entry>
<key>admin</key>
<value>/views/admin/index.jsf</value>
@@ -536,13 +540,28 @@
<to-view-id>/views/forums/viewforum_body.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+
+ <!-- topic watch controller -->
+ <managed-bean>
+ <managed-bean-name>topicWatch</managed-bean-name>
+ <managed-bean-class>org.jboss.portlet.forums.ui.action.TopicWatchController</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
- <from-view-id>/views/myforums/myforums_editforums.xhtml</from-view-id>
+ <from-view-id>/views/watches/topicWatch.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
- <to-view-id>/views/myforums/myforums_editforums.xhtml</to-view-id>
+ <to-view-id>/views/topics/viewtopic_body.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/views/watches/topicWatch.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>cancel</from-outcome>
+ <to-view-id>/views/topics/viewtopic_body.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
<!-- myforums controller -->
<managed-bean>
@@ -570,4 +589,11 @@
<managed-bean-class>org.jboss.portlet.forums.ui.view.ViewMyForumsEditAllForums</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <navigation-rule>
+ <from-view-id>/views/myforums/myforums_editforums.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/views/myforums/myforums_editforums.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2007-04-16 22:34:11 UTC (rev 11045)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2007-04-16 22:35:21 UTC (rev 11046)
@@ -104,16 +104,14 @@
</c:when>
<c:otherwise>
- <h:commandLink id="activateWatch" action="#{topicWatch.activateWatch}">
+ <h:outputLink value="#{forums:outputLink(shared.links['topicWatch'],true)}">
<f:param name="t" value="#{topic.topic.id}"/>
- <f:verbatim>
- <img src="#{forums:themeURL('resourceIconSubscribeURL')}"
- alt="${resource.Subscribe_to_topic}"
- name="subscribe"
- border="0"
- id="subscribe" />
- </f:verbatim>
- </h:commandLink>
+ <img src="#{forums:themeURL('resourceIconSubscribeURL')}"
+ alt="${resource.Subscribe_to_topic}"
+ name="subscribe"
+ border="0"
+ id="subscribe" />
+ </h:outputLink>
</c:otherwise>
</c:choose>
Copied: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/watches/topicWatch.xhtml (from rev 11045, labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/watches/topicWatch.xhtml)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/watches/topicWatch.xhtml (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/watches/topicWatch.xhtml 2007-04-16 22:35:21 UTC (rev 11046)
@@ -0,0 +1,99 @@
+<!--
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+-->
+
+<div xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
+ class="forumscontainer">
+
+<ui:composition template="/views/common/common.xhtml">
+<ui:define name="mainContent">
+
+<c:if test="#{topicWatch.anonymous==false}">
+<div class="forumsubscriptionconfirm">
+<h:form>
+
+ <h3>${resource.Subscribe_to_topic}</h3>
+ <p>${resource.Selected_topic}:</p>
+ <h4>#{topicWatch.topic.subject}</h4>
+ <label>${resource.Notification_type}:</label>
+ <br />
+ <select name="notified_watch_type" id="notification">
+ <option value="-1">${resource.SELECT_NOTIFICATION_TYPE}</option>
+ <option value="2">${resource.EMAIL_NO_NOTIFICATION}</option>
+ <option value="0">${resource.EMAIL_LINKED_NOTIFICATION}</option>
+ <option value="1">${resource.EMAIL_EMBEDED_NOTIFICATION}</option>
+ </select>
+ <div class="forumformbuttonrow">
+ <ul>
+ <li>
+ <h:commandButton value="${resource.Add_Subscribtion}"
+ styleClass="buttonMed"
+ action="#{topicWatch.activateWatch}" />
+ </li>
+ <li>
+ <h:commandButton action="#{topicWatch.cancel}"
+ value="${resource.Cancel}"
+ accesskey="c"
+ tabindex="7"
+ styleClass="buttonMed" />
+ </li>
+ </ul>
+ <input type="hidden" name="t" value="${topicWatch.topicId}" />
+ </div>
+
+</h:form>
+</div>
+</c:if>
+
+<!-- in case of anonymous access -->
+<c:if test="#{topicWatch.anonymous==true}">
+<table width="100%" border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+ <tr>
+ <td>
+ <table width="100%" cellspacing="0" cellpadding="1" border="0">
+ <tr>
+ <td> </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <h:outputText value="${resource.Watch_Login_Requirement}"/>
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</c:if>
+
+</ui:define>
+</ui:composition>
+
+</div>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list