[jboss-svn-commits] JBL Code SVN: r10875 - in labs/jbossforums/branches/forums101P26/forums/src: main/org/jboss/portlet/forums/impl and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Apr 10 19:57:16 EDT 2007
Author: unibrew
Date: 2007-04-10 19:57:16 -0400 (Tue, 10 Apr 2007)
New Revision: 10875
Modified:
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/Constants.java
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java
labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java
labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml
Log:
[JBFORUMS-176] After having many issues with JSF+Facelets+JSTL in MyForumsViewAllSubscribedView, I finally managed to add possibility to edit topic subscribtion type.
Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -544,10 +544,12 @@
List findForumWatchedByUserFetchForumWatches(User user) throws ModuleException;
- List findTopicWatchedByUserFetchTopicWatches(User user) throws ModuleException;
+ List findTopicWatchedByUser(User user) throws ModuleException;
- List findTopicWatchedByUserFetchTopicWatches(User user,Date date) throws ModuleException;
+ List findTopicWatchedByUser(User user,Date date) throws ModuleException;
+ Map findTopicWatches(User user) throws ModuleException;
+
Attachment findFindAttachmentById(Integer attachID)
throws ModuleException;
Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -1574,7 +1574,7 @@
}
}
- public List findTopicWatchedByUserFetchTopicWatches(User user) throws ModuleException
+ public List findTopicWatchedByUser(User user) throws ModuleException
{
try
{
@@ -1597,7 +1597,7 @@
}
}
- public List findTopicWatchedByUserFetchTopicWatches(User user,Date datePoint) throws ModuleException
+ public List findTopicWatchedByUser(User user,Date datePoint) throws ModuleException
{
try
{
@@ -1621,6 +1621,42 @@
throw new ModuleException(message, e);
}
}
+
+ /**
+ *
+ * This method returns Map<Integer,TopicWatch> pairs where Integer
+ * key is watched topic id.
+ *
+ * @param user
+ * @return
+ * @throws ModuleException
+ */
+ public Map findTopicWatches(User user) throws ModuleException
+ {
+ try
+ {
+ Session session = getSession();
+ Query query = session.createQuery("select tw.topic.id , tw " +
+ "from TopicWatchImpl tw " +
+ "where tw.poster.userId = :userId ");
+ query.setString("userId", user.getId().toString());
+ List results = query.list();
+ HashMap map = new HashMap(results.size());
+ Iterator it = results.iterator();
+ while (it.hasNext())
+ {
+ Object[] element = (Object[]) it.next();
+ map.put(element[0], element[1]);
+ }
+ return map;
+ }
+ catch (HibernateException e)
+ {
+ String message = "Cannot find topic watched";
+ log.error(message, e);
+ throw new ModuleException(message, e);
+ }
+ }
public void createWatch(Poster poster, Forum forum, int mode) throws ModuleException
{
Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/Constants.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -39,6 +39,7 @@
public static final String FEEDBACK = "feedback";
public static final String EDIT_CATEGORY = "editCategory";
public static final String EDIT_FORUM = "editForum";
+ public static final String EDIT_WATCH = "editWatch";
public static final String DELETE_CATEGORY = "deleteCategory";
public static final String DELETE_FORUM = "deleteForum";
//---------parameter constants--------------------------------------------------------------------------------------------------
Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -460,6 +460,7 @@
String viewId = ForumUtil.getParameter(request,Constants.p_viewId);
String adminEditCatMode = ForumUtil.getParameter(request,Constants.EDIT_CATEGORY);
String adminEditForMode = ForumUtil.getParameter(request,Constants.EDIT_FORUM);
+ String editWatch = ForumUtil.getParameter(request,Constants.EDIT_WATCH);
if(categoryId!=null && categoryId.trim().length()>0)
{
response.setRenderParameter(Constants.p_categoryId,categoryId);
@@ -524,6 +525,10 @@
{
response.setRenderParameter(Constants.EDIT_FORUM,adminEditForMode);
}
+ if(editWatch!=null && editWatch.trim().length()>0)
+ {
+ response.setRenderParameter(Constants.EDIT_WATCH,editWatch);
+ }
}
/**
Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -21,12 +21,12 @@
*/
package org.jboss.portlet.forums.ui.action;
+import org.jboss.portlet.forums.ForumsConstants;
import org.jboss.portlet.forums.model.Topic;
import org.jboss.portlet.forums.model.TopicWatch;
import org.jboss.portlet.forums.ui.Constants;
import org.jboss.portlet.forums.ui.JSFUtil;
import org.jboss.portlet.forums.ui.PortalUtil;
-import org.jboss.portlet.forums.ForumsConstants;
/**
* This controller is used for activating/deactivating topic watches
@@ -40,19 +40,72 @@
{
private int topicId ;
+ private int watchType ;
+ private boolean editMode;
/**
*
+ */
+ public int getWatchType()
+ {
+ return watchType;
+ }
+
+ /**
+ *
+ */
+ public void setWatchType(int watchType)
+ {
+ this.watchType = watchType;
+ }
+
+ /**
+ *
*
*/
public TopicWatchController()
- {
- String t = JSFUtil.getRequestParameter(Constants.p_topicId);
- if (t!=null && t.trim().length()>0) {
- topicId = Integer.parseInt(t);
- } else {
+ {
+ try
+ {
+ String t = JSFUtil.getRequestParameter(Constants.p_topicId);
+ if (t!=null && t.trim().length()>0) {
+ topicId = Integer.parseInt(t);
+ } else {
+ topicId = -1;
+ }
+ } catch (NumberFormatException e)
+ {
+ JSFUtil.handleException(e);
topicId = -1;
}
+
+ try
+ {
+ String wt = JSFUtil.getRequestParameter(Constants.p_notified_watch_type);
+ if (wt!=null && wt.trim().length()>0) {
+ watchType = Integer.parseInt(wt);
+ } else {
+ watchType = -1;
+ }
+ } catch (NumberFormatException e)
+ {
+ JSFUtil.handleException(e);
+ watchType = -1;
+ }
+
+ try
+ {
+ String edit = JSFUtil.getRequestParameter(Constants.EDIT_WATCH);
+ if (edit!=null && edit.trim().length()>0) {
+ editMode = Boolean.parseBoolean(edit);
+ } else {
+ editMode = false;
+ }
+ } catch (NumberFormatException e)
+ {
+ JSFUtil.handleException(e);
+ editMode = false;
+ }
}
/**
@@ -97,32 +150,100 @@
{
String navState = null;
- try {
+ try
+ {
TopicWatch watch = getForumsModule().findTopicWatchByUserAndTopic(PortalUtil.getUser(),topicId);
getForumsModule().removeWatch(watch);
- } catch (Exception e) {
+ } catch (Exception e)
+ {
JSFUtil.handleException(e);
}
return navState;
}
+ /**
+ *
+ */
+ public String updateNotificationType()
+ {
+ String navState = null;
+ if (watchType==-1 || topicId==-1)
+ {
+ return navState;
+ }
+
+ try
+ {
+ TopicWatch topicWatch = getForumsModule().findTopicWatchByUserAndTopic(PortalUtil.getUser(),this.topicId);
+ topicWatch.setMode(watchType);
+ navState="success";
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ topicId=-1;
+ return navState;
+ }
+
public boolean isWatched()
{
TopicWatch topicWatch = null;
- try {
+ try
+ {
topicWatch = getForumsModule().findTopicWatchByUserAndTopic(PortalUtil.getUser(),this.topicId);
- } catch (Exception e) {
+ } catch (Exception e)
+ {
JSFUtil.handleException(e);
}
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/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -23,23 +23,84 @@
package org.jboss.portlet.forums.ui.view;
import java.util.Collection;
+import java.util.Map;
+
+import org.jboss.portlet.forums.model.Watch;
import org.jboss.portlet.forums.ui.BaseController;
+import org.jboss.portlet.forums.ui.Constants;
import org.jboss.portlet.forums.ui.JSFUtil;
import org.jboss.portlet.forums.ui.PortalUtil;
public class ViewMyForumsAllSubscribed extends ViewMyForumsBase
{
+
+ private int topicId;
+ private Watch watch;
+ private Map topicWatches;
+
+ public ViewMyForumsAllSubscribed()
+ {
+ try {
+ String t = JSFUtil.getRequestParameter(Constants.p_topicId);
+ if (t!=null && t.trim().length()>0) {
+ topicId = Integer.parseInt(t);
+ } else {
+ topicId = -1;
+ }
+ if (topicId != -1)
+ {
+ watch = getForumsModule().findTopicWatchByUserAndTopic(PortalUtil.getUser(),topicId);
+ }
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ topicId=-1;
+ watch=null;
+ }
+ }
+
+ /**
+ *
+ */
+ public Watch getWatch()
+ {
+ return watch;
+ }
+
+ /**
+ *
+ */
+ public void setWatch(Watch watch)
+ {
+ this.watch = watch;
+ }
/**
*
*/
+ public int getTopicId()
+ {
+ return topicId;
+ }
+
+ /**
+ *
+ */
+ public void setTopicId(int topicId)
+ {
+ this.topicId = topicId;
+ }
+
+ /**
+ *
+ */
public Collection getWatchedTopics()
{
if (watchedTopics==null)
{
try
{
- watchedTopics = BaseController.getForumsModule().findTopicWatchedByUserFetchTopicWatches(PortalUtil.getUser());
+ watchedTopics = BaseController.getForumsModule().findTopicWatchedByUser(PortalUtil.getUser());
} catch (Exception e)
{
JSFUtil.handleException(e);
@@ -51,6 +112,24 @@
/**
*
*/
+ public Map getTopicWatches()
+ {
+ if (topicWatches==null)
+ {
+ try
+ {
+ topicWatches = BaseController.getForumsModule().findTopicWatches(PortalUtil.getUser());
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ }
+ return topicWatches;
+ }
+
+ /**
+ *
+ */
public void setWatchedTopics(Collection watchedTopics)
{
this.watchedTopics = watchedTopics;
Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java 2007-04-10 23:57:16 UTC (rev 10875)
@@ -63,7 +63,7 @@
return watchedTopics;
}
watchedTopics = BaseController.getForumsModule().
- findTopicWatchedByUserFetchTopicWatches(PortalUtil.getUser(),lastLoginDate);
+ findTopicWatchedByUser(PortalUtil.getUser(),lastLoginDate);
/*
watchedTopics = new LinkedList();
Iterator it = topics.iterator();
Modified: labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2007-04-10 23:57:16 UTC (rev 10875)
@@ -2413,6 +2413,9 @@
EMAIL_LINKED_MODE_INFO=You are receiving this e-mail because you subscribed to
EMAIL_FOOTER_MESSAGE=This message is generated automaticaly. Please do not reply.
TOPICWATCH_MAIL_1 = You are receiving this email because you are watching this topic. This topic has received a reply since your last visit. You can use the following link to view the replies made.
+EMAIL_NO_NOTIFICATION=No Notification by Email
+EMAIL_LINKED_NOTIFICATION=Linked mode Email notification
+EMAIL_EMBEDED_NOTIFICATION=Embeded mode Email notification
// BB Code variables
Message_code=Code
Modified: labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2007-04-10 23:57:16 UTC (rev 10875)
@@ -499,6 +499,13 @@
<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_viewall.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/views/myforums/myforums_viewall.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
<!-- forum watch controller -->
<managed-bean>
Modified: labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml 2007-04-10 23:51:22 UTC (rev 10874)
+++ labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml 2007-04-10 23:57:16 UTC (rev 10875)
@@ -52,132 +52,276 @@
<c:if test="${forums:collectionSize(myForumsAll.watchedTopics) gt 0}">
<c:forEach items="#{myForumsAll.watchedTopics}" var="topicrow" varStatus="status" >
- <tr class='${(status.index%2==0)?"evenRow":"oddRow"}'>
- <td class="forumlisticon">
- <img src="#{forums:folderTypeURL(topicrow,myForumsAll.anonymous)}"
- width="11" height="14"
- alt="${resource.Topic_Moved}" title="${resource.Topic_Moved}" />
- </td>
- <td>
- <h3>
- <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
- <f:param name="t" value="${topicrow.id}"/>
- <h:outputText value="${topicrow.subject}"/>
- </h:outputLink>
- </h3>
-
- <!-- mini post navigator for this topic -->
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
-  ( 
- <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="0"/>
- <h:outputText value="${1}"/>
- </h:outputLink>
-  
- <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="1"/>
- <h:outputText value="${2}"/>
- </h:outputLink>
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
-  
+ <ui:fragment>
+ <c:choose>
+
+ <c:when test="${topicWatch.topicId ne topicrow.id || topicWatch.editMode eq false}">
+ <ui:fragment>
+ <tr class='${(status.index%2==0)?"evenRow":"oddRow"}'>
+ <td class="forumlisticon">
+ <img src="#{forums:folderTypeURL(topicrow,myForumsAll.anonymous)}"
+ width="11" height="14"
+ alt="${resource.Topic_Moved}" title="${resource.Topic_Moved}" />
+ </td>
+ <td>
+ <h3>
<h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="${topicrow.id}"/>
+ <h:outputText value="${topicrow.subject}"/>
+ </h:outputLink>
+ </h3>
+
+ <!-- mini post navigator for this topic -->
+ <c:if test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
+  ( 
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
<f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="2"/>
- <h:outputText value="${3}"/>
+ <f:param name="page" value="0"/>
+ <h:outputText value="${1}"/>
</h:outputLink>
- </c:if>
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
-  … 
+  
<h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
<f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}"/>
- <h:outputText value="${resource.Last_page}"/>
+ <f:param name="page" value="1"/>
+ <h:outputText value="${2}"/>
</h:outputLink>
+ <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
+  
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="2"/>
+ <h:outputText value="${3}"/>
+ </h:outputLink>
+ </c:if>
+ <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
+  … 
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}"/>
+ <h:outputText value="${resource.Last_page}"/>
+ </h:outputLink>
+ </c:if>
+  )
</c:if>
-  )
- </c:if>
- <br />
- ${resource.By} 
- <c:choose>
+ <br />
+ ${resource.By} 
+ <c:choose>
+
+ <c:when test="#{myForumsAll.anonymous}">
+ ${topicrow.poster.user.userName}
+ </c:when>
+
+ <c:otherwise>
+ <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+ <f:param name="uid" value="${topicrow.poster.user.id}"/>
+ <h:outputText value="${topicrow.poster.user.userName}"/>
+ </h:outputLink>
+ </c:otherwise>
+
+ </c:choose>
+ </td>
+ <td class="forumlistlast">
+ <a href="#{forums:postPermlink(myForumsAll.topicsLastPosts[topicrow.id].id)}">
+ <c:choose>
+
+ <c:when test="#{forums:isLongerThan(myForumsAll.topicsLastPosts[topicrow.id].message.subject,25)}">
+ #{forums:subString(myForumsAll.topicsLastPosts[topicrow.id].message.subject,25)}…
+ </c:when>
+
+ <c:otherwise>
+ #{myForumsAll.topicsLastPosts[topicrow.id].message.subject}
+ </c:otherwise>
+
+ </c:choose>
+ </a>
+ <br />
+ ${resource.By}
+ <c:choose>
- <c:when test="#{myForumsAll.anonymous}">
- ${topicrow.poster.user.userName}
- </c:when>
-
- <c:otherwise>
- <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
- <f:param name="uid" value="${topicrow.poster.user.id}"/>
- <h:outputText value="${topicrow.poster.user.userName}"/>
- </h:outputLink>
- </c:otherwise>
-
- </c:choose>
- </td>
- <td class="forumlistlast">
- <a href="#{forums:postPermlink(myForumsAll.topicsLastPosts[topicrow.id].id)}">
+ <c:when test="#{myForumsAll.anonymous}">
+ ${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}
+ </c:when>
+
+ <c:otherwise>
+ <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+ <f:param name="uid" value="#{myForumsAll.topicsLastPosts[topicrow.id].poster.user.id}"/>
+ <h:outputText value="${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}"/>
+ </h:outputLink>
+ </c:otherwise>
+
+ </c:choose>
+ <br />
+ #{myForumsAll.topicsLastPosts[topicrow.id].createDate}
+ </td>
+ <td class="forumlistopen">
+ <h:form>
+ <input type="hidden" name="t" value="${topicrow.id}"/>
+ <input type="hidden" name="editWatch" value="true"/>
<c:choose>
- <c:when test="#{forums:isLongerThan(myForumsAll.topicsLastPosts[topicrow.id].message.subject,25)}">
- #{forums:subString(myForumsAll.topicsLastPosts[topicrow.id].message.subject,25)}…
+ <c:when test="${myForumsAll.topicWatches[topicrow.id].mode eq 0}">
+ ${resource.EMAIL_LINKED_NOTIFICATION}
</c:when>
+ <c:when test="${myForumsAll.topicWatches[topicrow.id].mode eq 1}">
+ ${resource.EMAIL_EMBEDED_NOTIFICATION}
+ </c:when>
+
<c:otherwise>
- #{myForumsAll.topicsLastPosts[topicrow.id].message.subject}
+ ${resource.EMAIL_NO_NOTIFICATION}
</c:otherwise>
</c:choose>
- </a>
- <br />
- ${resource.By}
- <c:choose>
-
- <c:when test="#{myForumsAll.anonymous}">
- ${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}
- </c:when>
-
- <c:otherwise>
- <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
- <f:param name="uid" value="#{myForumsAll.topicsLastPosts[topicrow.id].poster.user.id}"/>
- <h:outputText value="${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}"/>
+  (
+ <h:commandLink action="#{topicWatch.dummyAction}">
+ <h:outputText value="${resource.Edit}"/>
+ </h:commandLink>
+ )
+ </h:form>
+ </td>
+ <td class="forumlistcentered">
+ <h:form>
+ <div class="actionbuttons">
+ <ul>
+ <li>
+ <h:commandLink id="deActivateWatch" action="#{topicWatch.deActivateWatch}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <img src="#{forums:themeURL('resourceTopicModeDeleteURL')}"
+ alt="${resource.Unsubscribe_from_topic}"
+ name="unSubscribe"
+ border="0"
+ id="unSubscribe" />
+ </h:commandLink>
+ </li>
+ </ul>
+ </div>
+ </h:form>
+ </td>
+ </tr>
+ </ui:fragment>
+ </c:when>
+
+ <c:otherwise>
+ <ui:fragment>
+ <tr class="editRow">
+ <td class="forumlisticon">
+ <img src="#{forums:folderTypeURL(topicrow,myForumsAll.anonymous)}"
+ width="11" height="14"
+ alt="${resource.Topic_Moved}" title="${resource.Topic_Moved}" />
+ </td>
+ <td>
+ <h3>
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="${topicrow.id}"/>
+ <h:outputText value="${topicrow.subject}"/>
</h:outputLink>
- </c:otherwise>
+ </h3>
+ <!-- mini post navigator for this topic -->
+ <c:if test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
+  ( 
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="0"/>
+ <h:outputText value="${1}"/>
+ </h:outputLink>
+  
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="1"/>
+ <h:outputText value="${2}"/>
+ </h:outputLink>
+ <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
+  
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="2"/>
+ <h:outputText value="${3}"/>
+ </h:outputLink>
+ </c:if>
+ <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
+  … 
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}"/>
+ <h:outputText value="${resource.Last_page}"/>
+ </h:outputLink>
+ </c:if>
+  )
+ </c:if>
+ <br />
+ ${resource.By} 
+ <c:choose>
+
+ <c:when test="#{myForumsAll.anonymous}">
+ ${topicrow.poster.user.userName}
+ </c:when>
+
+ <c:otherwise>
+ <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+ <f:param name="uid" value="${topicrow.poster.user.id}"/>
+ <h:outputText value="${topicrow.poster.user.userName}"/>
+ </h:outputLink>
+ </c:otherwise>
+
+ </c:choose>
+ </td>
+ <td colspan="3">
+ <div class="forumfloatright">
+ <h:form id="notification_${topicrow.id}" >
+ <input type="hidden" name="t" value="${topicrow.id}" />
+ <select name="notified_watch_type" id="notified_watch_type">
+
+ <c:choose>
+ <c:when test="${myForumsAll.watch.mode eq 0}">
+ <option value="0" selected="selected" >
+ ${resource.EMAIL_LINKED_NOTIFICATION}
+ </option>
+ </c:when>
+ <c:otherwise>
+ <option value="0">
+ ${resource.EMAIL_LINKED_NOTIFICATION}
+ </option>
+ </c:otherwise>
+ </c:choose>
+
+ <c:choose>
+ <c:when test="${myForumsAll.watch.mode eq 1}">
+ <option value="1" selected="selected" >
+ ${resource.EMAIL_EMBEDED_NOTIFICATION}
+ </option>
+ </c:when>
+ <c:otherwise>
+ <option value="1">
+ ${resource.EMAIL_EMBEDED_NOTIFICATION}
+ </option>
+ </c:otherwise>
+ </c:choose>
- </c:choose>
- <br />
- #{myForumsAll.topicsLastPosts[topicrow.id].createDate}
- </td>
-
-<!-- TODO: EDIT VIEW MUST BE HOOKED HERE -->
- <td class="forumlistopen">
- ${resource.None} (
- <a href="#">
- ${resource.Edit}
- </a>
- )
- </td>
-<!-- TODO: EDIT VIEW MUST BE HOOKED HERE -->
-
- <td class="forumlistcentered">
- <h:form>
- <div class="actionbuttons">
- <ul>
- <li>
- <h:commandLink id="deActivateWatch" action="#{topicWatch.deActivateWatch}">
- <f:param name="t" value="#{topicrow.id}"/>
- <img src="#{forums:themeURL('resourceTopicModeDeleteURL')}"
- alt="${resource.Unsubscribe_from_topic}"
- name="unSubscribe"
- border="0"
- id="unSubscribe" />
- </h:commandLink>
- </li>
- </ul>
- </div>
- </h:form>
- </td>
- </tr>
+ <c:choose>
+ <c:when test="${myForumsAll.watch.mode eq 2}">
+ <option value="2" selected="selected" >
+ ${resource.EMAIL_NO_NOTIFICATION}
+ </option>
+ </c:when>
+ <c:otherwise>
+ <option value="2">
+ ${resource.EMAIL_NO_NOTIFICATION}
+ </option>
+ </c:otherwise>
+ </c:choose>
+
+ </select>
+ <h:commandButton action="${topicWatch.updateNotificationType}"
+ value="${resource.Update}" styleClass="buttonMed" />
+ </h:form>
+ </div>
+ </td>
+ </tr>
+ </ui:fragment>
+ </c:otherwise>
+
+ </c:choose>
+ </ui:fragment>
</c:forEach>
</c:if>
</table>
More information about the jboss-svn-commits
mailing list