[jboss-svn-commits] JBL Code SVN: r38361 - in labs/jbossforums/branches/forums130P27/forums/src: main/org/jboss/portlet/forums/ui and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jun 19 13:38:04 EDT 2013
Author: sviluppatorefico
Date: 2013-06-19 13:38:04 -0400 (Wed, 19 Jun 2013)
New Revision: 38361
Added:
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/converters/PollOptionConverter.java
Removed:
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionPK.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
Modified:
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionImpl.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml
labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml
Log:
bug fixing on the moderation and polling
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -54,6 +54,7 @@
import org.jboss.portlet.forums.model.ForumWatch;
import org.jboss.portlet.forums.model.Message;
import org.jboss.portlet.forums.model.Poll;
+import org.jboss.portlet.forums.model.PollOption;
import org.jboss.portlet.forums.model.Post;
import org.jboss.portlet.forums.model.Poster;
import org.jboss.portlet.forums.model.Topic;
@@ -193,8 +194,8 @@
if (id != null) {
try {
EntityManager session = getSession();
- Category category = (Category) session.find(
- CategoryImpl.class, id);
+ Category category = (Category) session.find(CategoryImpl.class,
+ id);
if (category == null) {
throw new ModuleException("No category found for " + id);
}
@@ -556,6 +557,8 @@
session.merge(poster);
// for clustered versions
session.persist(poll);
+ for (PollOption pollOption : poll.getOptions())
+ session.persist(pollOption);
session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required
// for clustered versions
@@ -653,7 +656,7 @@
throws ModuleException {
try {
EntityManager session = getSession();
- Poster posterOld = this.findPosterByUserId(poster.getUserId());
+ Poster posterOld = this.findPosterByUserId(poster.getUserId());
if (posterOld == null) {
session.persist(poster);
}
@@ -704,6 +707,8 @@
}
session.persist(poll);
topic.setPoll((PollImpl) poll);
+ for (PollOption pollOption : poll.getOptions())
+ session.persist(pollOption);
session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required
// for clustered versions
return poll;
@@ -844,7 +849,7 @@
forum.setPostCount(forum.getPostCount() - topic.getReplies()
- 1);
forum.setTopicCount(forum.getTopicCount() - 1);
- session.merge(forum);
+ session.merge(forum);
session.remove(session.merge(topic));
} else {
session.remove(topic);
@@ -863,7 +868,7 @@
try {
EntityManager session = getSession();
Query query = session.createNamedQuery("getLastForumOrder");
- query.setParameter("categoryId", ""+ category.getId());
+ query.setParameter("categoryId", "" + category.getId());
Integer lastForumOrder = (Integer) uniqueElement(query
.getResultList());
return (lastForumOrder != null) ? lastForumOrder.intValue() : 0;
@@ -878,8 +883,8 @@
EntityManager session = getSession();
ForumImpl forum = new ForumImpl();
- forum.setCategory((CategoryImpl)category);
- //category.addForum(forum);
+ forum.setCategory((CategoryImpl) category);
+ // category.addForum(forum);
forum.setName(name);
forum.setDescription(description);
forum.setOrder(getLastForumOrder(category) + 10);
@@ -1495,9 +1500,13 @@
if (forum == null) {
throw new ModuleException("forum must not be null");
}
+
+ Poster posterOld = this.findPosterByUserId(poster.getUserId());
+ if (posterOld == null) {
+ session.persist(poster);
+ }
+ session.merge(poster);
- session.persist(poster);
-
ForumWatch forumWatch = new ForumWatchImpl();
forumWatch.setPoster((PosterImpl) poster);
forumWatch.setForum((ForumImpl) forum);
@@ -1516,7 +1525,7 @@
public void removeWatch(Watch watch) throws ModuleException {
EntityManager session = getSession();
try {
- session.remove(watch);
+ session.remove(session.find(WatchImpl.class, watch.getId()));
session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required
// for clustered versions
} catch (Exception e) {
@@ -1531,7 +1540,7 @@
try {
EntityManager session = getSession();
Query query = session.createNamedQuery("findForumWatchById");
- query.setParameter("forumWatchId", forumWatchId.toString());
+ query.setParameter("forumWatchId", forumWatchId);
return (ForumWatch) uniqueElement(query.getResultList());
} catch (Exception e) {
String message = "Cannot find forum watch";
@@ -1633,7 +1642,12 @@
throw new ModuleException("topic must not be null");
}
- session.persist(poster);
+ Poster posterOld = this.findPosterByUserId(poster.getUserId());
+ if (posterOld == null) {
+ session.persist(poster);
+ }
+ session.merge(poster);
+
session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required
// for clustered versions
@@ -1722,8 +1736,8 @@
if (id != null) {
try {
EntityManager session = getSession();
- ForumInstance forumInstance = (ForumInstance) session
- .find(ForumInstanceImpl.class, id);
+ ForumInstance forumInstance = (ForumInstance) session.find(
+ ForumInstanceImpl.class, id);
return forumInstance;
} catch (Exception e) {
String message = "Cannot find forum instance by id " + id;
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionImpl.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionImpl.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionImpl.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -25,74 +25,86 @@
import java.io.Serializable;
import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
+import org.jboss.portlet.forums.model.Poll;
import org.jboss.portlet.forums.model.PollOption;
/**
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw
+ * Dawidowicz</a>
* @version $Revision: 878 $
*/
@Entity
- at Table(name="JBP_FORUMS_POLL_OPTION")
-public class PollOptionImpl
- implements PollOption, Serializable
-{
- @EmbeddedId
- private PollOptionPK pk;
+ at Table(name = "JBP_FORUMS_POLL_OPTION")
+public class PollOptionImpl implements PollOption, Serializable {
- @Column(name="JBP_VOTES")
+ @Id
+ @GeneratedValue
+ @Column(name = "JBP_POLL_OPTION_POSITION")
+ private int pollOptionPosition;
+
+ @Column(name = "JBP_VOTES")
private int votes;
- @Column(name="JBP_QUESTION")
+ @Column(name = "JBP_QUESTION")
private String question;
@ManyToOne
- @JoinColumn(name="JBP_POLL_ID", insertable=false, updatable=false)
+ @JoinColumn(name = "JBP_POLL_ID")
private PollImpl poll;
+ public PollOptionImpl() {
+ }
- public PollOptionImpl()
- {
- }
+ public PollOptionImpl(Poll poll) {
+ this.poll = (PollImpl)poll;
+ }
- public PollOptionImpl(String question)
- {
- setQuestion(question);
- }
+ public int getPollOptionPosition() {
+ return pollOptionPosition;
+ }
- /**
+ public void setPollOptionPosition(int pollOptionPosition) {
+ this.pollOptionPosition = pollOptionPosition;
+ }
+
+ public PollImpl getPoll() {
+ return poll;
+ }
+
+ public void setPoll(PollImpl poll) {
+ this.poll = poll;
+ }
+
+ /**
*/
- public int getVotes()
- {
- return votes;
- }
+ public int getVotes() {
+ return votes;
+ }
- public void setVotes(int votes)
- {
- this.votes = votes;
- }
+ public void setVotes(int votes) {
+ this.votes = votes;
+ }
- /**
+ /**
*/
- public String getQuestion()
- {
- return question;
- }
+ public String getQuestion() {
+ return question;
+ }
- public void setQuestion(String question)
- {
- this.question = question;
- }
+ public void setQuestion(String question) {
+ this.question = question;
+ }
- public void incVotes()
- {
- votes++;
- }
+ public void incVotes() {
+ votes++;
+ }
}
Deleted: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionPK.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionPK.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/impl/PollOptionPK.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -1,62 +0,0 @@
-package org.jboss.portlet.forums.impl;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.GeneratedValue;
-
- at Embeddable
-public class PollOptionPK implements Serializable {
- @Column(name="JBP_POLL_ID")
- @GeneratedValue
- private int poll2;
-
- @Column(name="JBP_POLL_OPTION_POSITION")
- private int pollOptionPosition;
-
- private static final long serialVersionUID = 1L;
-
- public PollOptionPK() {
- super();
- }
-
- public int getPoll2() {
- return poll2;
- }
-
- public void setPoll2(int poll2) {
- this.poll2 = poll2;
- }
-
- public int getPollOptionPosition() {
- return pollOptionPosition;
- }
-
- public void setPollOptionPosition(int pollOptionPosition) {
- this.pollOptionPosition = pollOptionPosition;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if ( ! (o instanceof PollOptionPK)) {
- return false;
- }
- PollOptionPK other = (PollOptionPK) o;
- return (this.poll2 == other.poll2)
- && (this.pollOptionPosition == other.pollOptionPosition);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int hash = 17;
- hash = hash * prime + this.poll2;
- hash = hash * prime + this.pollOptionPosition;
- return hash;
- }
-
-}
Deleted: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -1,245 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, 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. *
- ******************************************************************************/
-package org.jboss.portlet.forums.ui;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.faces.GenericFacesPortlet;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.portlet.PortletFileUpload;
-import org.jboss.portal.portlet.impl.jsr168.PortletRequestParameterMap;
-import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
-import org.jboss.portlet.forums.helper.TempFileBinding;
-
-/**
- * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
- * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
- * @author <a href="mailto:l.stancapiano at sourcesense.com">Luca Stancapiano</a>
- *
- */
-public class ForumsJSFPortlet extends GenericFacesPortlet {
-
- /**
- * Called by the portlet container to allow the portlet to process an action
- * request.
- */
- public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, IOException {
-
- this.setupRenderParameters(request, response);
-
- try {
- // parse and setup any attachments if they are sent in
- if ((request.getContentType() != null)
- && request.getContentType().startsWith(
- "multipart/form-data")) {
- this.processAttachments(request, response);
- }
- } catch (Throwable t) {
- throw new PortletException(t);
- }
- super.processAction(request, response);
-
- }
-
- /**
- * Not sure why this needs to be done... This method tends to propagate the
- * request parameters over to the JSF layer this is a workaround for a bug
- * in either portal or MyFacesGenericPortlet...
- *
- * @author sshah
- *
- */
- private void setupRenderParameters(ActionRequest request,
- ActionResponse response) throws PortletException, IOException {
- String categoryId = ForumUtil.getParameter(request,
- Constants.p_categoryId);
- String forumId = ForumUtil.getParameter(request, Constants.p_forumId);
- String pollTitle = ForumUtil.getParameter(request,
- Constants.p_poll_title);
- String option = ForumUtil.getParameter(request, Constants.p_option);
- String pollDelete = ForumUtil.getParameter(request,
- Constants.p_poll_delete);
- String attachment = ForumUtil.getParameter(request,
- Constants.p_attachment);
- String topicId = ForumUtil.getParameter(request, Constants.p_topicId);
- String postId = ForumUtil.getParameter(request, Constants.p_postId);
- String userId = ForumUtil.getParameter(request, Constants.p_userId);
- String vote = ForumUtil.getParameter(request, Constants.p_vote);
- String results = ForumUtil.getParameter(request, Constants.p_results);
- String page = ForumUtil.getParameter(request, Constants.p_page);
- String watchId = ForumUtil.getParameter(request, Constants.p_watchId);
- 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 adminAddCatMode = ForumUtil.getParameter(request,
- Constants.ADD_CATEGORY);
- String adminAddForMode = ForumUtil.getParameter(request,
- Constants.ADD_FORUM);
- String editWatch = ForumUtil
- .getParameter(request, Constants.EDIT_WATCH);
- if (categoryId != null && categoryId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_categoryId, categoryId);
- }
- if (forumId != null && forumId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_forumId, forumId);
- }
- if (pollTitle != null && pollTitle.trim().length() > 0) {
- response.setRenderParameter(Constants.p_poll_title, pollTitle);
- }
- if (option != null && option.trim().length() > 0) {
- response.setRenderParameter(Constants.p_option, option);
- }
- if (pollDelete != null && pollDelete.trim().length() > 0) {
- response.setRenderParameter(Constants.p_poll_delete, pollDelete);
- }
- if (attachment != null && attachment.trim().length() > 0) {
- response.setRenderParameter(Constants.p_attachment, attachment);
- }
- if (topicId != null && topicId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_topicId, topicId);
- }
- if (userId != null && userId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_userId, userId);
- }
- if (postId != null && postId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_postId, postId);
- }
- if (vote != null && vote.trim().length() > 0) {
- response.setRenderParameter(Constants.p_vote, vote);
- }
- if (results != null && results.trim().length() > 0) {
- response.setRenderParameter(Constants.p_results, results);
- }
- if (page != null && page.trim().length() > 0) {
- response.setRenderParameter(Constants.p_page, page);
- }
- if (watchId != null && watchId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_watchId, watchId);
- }
- if (viewId != null && viewId.trim().length() > 0) {
- response.setRenderParameter(Constants.p_viewId, viewId);
- }
- if (adminEditCatMode != null && adminEditCatMode.trim().length() > 0) {
- response.setRenderParameter(Constants.EDIT_CATEGORY,
- adminEditCatMode);
- }
- if (adminEditForMode != null && adminEditForMode.trim().length() > 0) {
- response.setRenderParameter(Constants.EDIT_FORUM, adminEditForMode);
- }
- if (adminAddCatMode != null && adminAddCatMode.trim().length() > 0) {
- response
- .setRenderParameter(Constants.ADD_CATEGORY, adminAddCatMode);
- }
- if (adminAddForMode != null && adminAddForMode.trim().length() > 0) {
- response.setRenderParameter(Constants.ADD_FORUM, adminAddForMode);
- }
- if (editWatch != null && editWatch.trim().length() > 0) {
- response.setRenderParameter(Constants.EDIT_WATCH, editWatch);
- }
- }
-
- /**
- *
- *
- */
- private void processAttachments(ActionRequest req, ActionResponse response)
- throws Exception {
- // We need to have new map to which we collect request parameters from
- // multipart - we'll inject it little later
- Map newParams = new HashMap();
- newParams.putAll(req.getParameterMap());
-
- DiskFileItemFactory factory = new DiskFileItemFactory();
- PortletFileUpload upload = new PortletFileUpload(factory);
-
- // Merge with upload fields
- for (Iterator i = upload.parseRequest(req).iterator(); i.hasNext();) {
- FileItem item = (FileItem) i.next();
- if (item.isFormField()) {
- // if it's form field just add it to request params map
- // TODO:Be aware that this adds single value as we won't have
- // multiply values in new topic form for now...
- newParams.put(item.getFieldName(), new String[] { item
- .getString(req.getCharacterEncoding()) });
-
- // setup the render parameters properly to propagate to the JSF
- // layer
- String parameter = item.getFieldName();
- String value = item.getString(req.getCharacterEncoding());
- if (value != null && value.trim().length() > 0) {
- if (parameter.equals(Constants.p_forumId)) {
- response.setRenderParameter(Constants.p_forumId, value);
- } else if (parameter.equals(Constants.p_topicId)) {
- response.setRenderParameter(Constants.p_topicId, value);
- } else if (parameter.equals(Constants.p_page)) {
- response.setRenderParameter(Constants.p_page, value);
- } else if (parameter.equals(Constants.p_postId)) {
- response.setRenderParameter(Constants.p_postId, value);
- }
- }
-
- } else {
- // create the proper attachment file for the managed bean and
- // put it as a ThreadLocal value
- // the managed bean should pick this up from the thread
- TempFileBinding file = new TempFileBinding(item
- .getContentType(), item.get(), item.getName(), String
- .valueOf(System.currentTimeMillis())
- + "_" + item.getSize() // unique fileId for this
- // collection of files
- );
-
- // place it as a ThreadLocal variable
- PortalUtil.setUploadedAttachment(file);
- }
- }
- // we need to hack the request class and inject newly created Parameters
- // map using reflection as this are
- // protected fields
- try {
- Class requestClass = PortletRequestImpl.class;
- Field field = requestClass.getDeclaredField("requestParameterMap");
- field.setAccessible(true);
- field.set(req,
- new PortletRequestParameterMap(newParams, null, null) {
- });
-
- } catch (NoSuchFieldException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- }
-}
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -972,9 +972,9 @@
*
* @return
*/
- public static PollOption createPollOption()
+ public static PollOption createPollOption(Poll poll)
{
- PollOption pollOption = new PollOptionImpl();
+ PollOption pollOption = new PollOptionImpl(poll);
return pollOption;
}
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -206,7 +206,7 @@
for(Iterator itr=this.options.keySet().iterator();itr.hasNext();)
{
String key = (String)itr.next();
- PollOptionImpl pollOption = (PollOptionImpl)PortalUtil.createPollOption();
+ PollOptionImpl pollOption = (PollOptionImpl)PortalUtil.createPollOption(topic.getPoll());
pollOption.setQuestion((String)options.get(key));
pollOption.setVotes(0);
localPollOptions.add(pollOption);
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -231,6 +231,9 @@
this.forum.setPostCount(this.forum.getPostCount()-topic.getReplies()-1);
this.forum.setTopicCount(this.forum.getTopicCount()-1);
+ getForumsModule(forumsModule).update(this.forum);
+ getForumsModule(forumsModule).update(forumDest);
+ getForumsModule(forumsModule).update(topic);
}
}
setInfoBundleMessage("SUCC_TOPIC_MOVED");
@@ -264,6 +267,7 @@
{
Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
topic.setStatus(Constants.TOPIC_LOCKED);
+ getForumsModule(forumsModule).update(topic);
}
} catch(Exception e)
{
@@ -308,6 +312,7 @@
{
Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
topic.setStatus(Constants.TOPIC_UNLOCKED);
+ getForumsModule(forumsModule).update(topic);
}
} catch(Exception e)
{
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -138,7 +138,7 @@
for(Iterator itr=this.options.keySet().iterator();itr.hasNext();)
{
String option = (String)itr.next();
- PollOptionImpl pollOption = (PollOptionImpl)PortalUtil.createPollOption();
+ PollOptionImpl pollOption = (PollOptionImpl)PortalUtil.createPollOption(poll);
pollOption.setQuestion((String)options.get(option));
pollOption.setVotes(0);
pollOptions.add(pollOption);
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -88,6 +88,7 @@
poll.getVoted().add(poster.getUserId());
}
selectedOption.incVotes();
+ getForumsModule(forumsModule).update(selectedOption);
}
}
catch(Exception e)
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -69,10 +69,20 @@
// Topic to split
private TopicImpl topic;
+
+ private List<Post> posts;
// ---------- Getters And Setters for bean's attributes --------------------
- public void setNewTopicTitle(String newTopicTitle) {
+ public List<Post> getPosts() {
+ return posts;
+ }
+
+ public void setPosts(List<Post> posts) {
+ this.posts = posts;
+ }
+
+ public void setNewTopicTitle(String newTopicTitle) {
this.newTopicTitle = newTopicTitle;
}
@@ -116,7 +126,7 @@
}
// Checking whether topic has only one post, so it can't be splitted
- if (topic.getPosts().size()==1) {
+ if (posts.size()==1) {
setWarnBundleMessage("ERR_SPLIT_ONE_POST_TOPIC");
return "";
}
@@ -179,7 +189,7 @@
Integer selectedPostId = (Integer)checkboxes.keySet().iterator().next();
// Searching for the split pointing post in topic.
- Iterator it = topic.getPosts().iterator();
+ Iterator it = posts.iterator();
PostImpl tempPost = null;
while( it.hasNext() )
{
@@ -195,22 +205,30 @@
if (tempPost != null)
{
tempPost.setTopic((TopicImpl)newTopic);
+ getForumsModule(forumsModule).update(tempPost);
}
while (it.hasNext())
{
- ((PostImpl)it.next()).setTopic((TopicImpl)newTopic);
+ PostImpl post = (PostImpl)it.next();
+ post.setTopic((TopicImpl)newTopic);
+ getForumsModule(forumsModule).update(post);
}
+ newTopic = getForumsModule(forumsModule).findTopicById(newTopic.getId());
+ List<Post> postsNewTopic = getForumsModule(forumsModule).findPostsByTopicId(newTopic);
+ newTopic.setReplies(postsNewTopic.size()-1);
+ newTopic.setLastPostDate(postsNewTopic.get(postsNewTopic.size()-1).getCreateDate());
- newTopic.setReplies(newTopic.getPosts().size()-1);
- newTopic.setLastPostDate(newTopic.getPosts().get(topic.getPosts().size()-1).getCreateDate());
-
ForumImpl fromForum = topic.getForum();
topic.setReplies(topic.getReplies()-newTopic.getReplies()-1);
fromForum.setPostCount(fromForum.getPostCount()-newTopic.getReplies()-1);
- topic.setLastPostDate(topic.getPosts().get(topic.getPosts().size()).getCreateDate());
+ topic.setLastPostDate(((Post)posts.get(posts.size()-1)).getCreateDate());
destForum.addTopicSize();
destForum.setPostCount(destForum.getPostCount()+newTopic.getReplies()+1);
+ getForumsModule(forumsModule).update(newTopic);
+ getForumsModule(forumsModule).update(topic);
+ getForumsModule(forumsModule).update(fromForum);
+ getForumsModule(forumsModule).update(destForum);
} catch (Exception e) {
e.printStackTrace();
@@ -244,7 +262,7 @@
}
// Checking whether topic has only one post, so it can't be splitted
- if (topic.getPosts().size()==1) {
+ if (posts.size()==1) {
setWarnBundleMessage("ERR_SPLIT_ONE_POST_TOPIC");
return "";
}
@@ -256,7 +274,7 @@
}
// Checking if user didn't select all posts.
- if (checkboxes.size()==topic.getPosts().size()) {
+ if (checkboxes.size()==posts.size()) {
setWarnBundleMessage("ERR_SPLIT_ALL");
return "";
}
@@ -292,18 +310,24 @@
while (selectIt.hasNext()) {
movedPost = getForumsModule(forumsModule).findPostById((Integer)selectIt.next());
movedPost.setTopic((TopicImpl)newTopic);
+ getForumsModule(forumsModule).update(movedPost);
}
ForumImpl fromForum = topic.getForum();
topic.setReplies(topic.getReplies()-checkboxes.size());
fromForum.setPostCount(fromForum.getPostCount()-checkboxes.size());
- topic.setLastPostDate(topic.getPosts().get(topic.getPosts().size()-1).getCreateDate());
+ topic.setLastPostDate(posts.get(posts.size()-1).getCreateDate());
newTopic.setReplies(checkboxes.size()-1);
- newTopic.setLastPostDate(newTopic.getPosts().get(topic.getPosts().size()-1).getCreateDate());
+ List<Post> postsNewTopic = getForumsModule(forumsModule).findPostsByTopicId(newTopic);
+ newTopic.setLastPostDate(postsNewTopic.get(postsNewTopic.size()-1).getCreateDate());
destForum.addTopicSize();
destForum.setPostCount(destForum.getPostCount()+newTopic.getReplies()+1);
+ getForumsModule(forumsModule).update(topic);
+ getForumsModule(forumsModule).update(newTopic);
+ getForumsModule(forumsModule).update(fromForum);
+ getForumsModule(forumsModule).update(destForum);
} catch (Exception e) {
e.printStackTrace();
setWarnBundleMessage("ERR_INTERNAL");
@@ -353,8 +377,10 @@
//process the topic information
if (topicId != -1) {
this.topic = (TopicImpl)getForumsModule(forumsModule).findTopicById(topicId);
+ this.posts = getForumsModule(forumsModule).findPostsByTopicId(topic);
}
- if (checkboxes==null || checkboxes.size()!=topic.getPosts().size()) {
+ List posts = getForumsModule(forumsModule).findPostsByTopicId(topic);
+ if (checkboxes==null || checkboxes.size()!=posts.size()) {
checkboxes = new HashMap();
}
}
Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/converters/PollOptionConverter.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/converters/PollOptionConverter.java (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/converters/PollOptionConverter.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -0,0 +1,27 @@
+package org.jboss.portlet.forums.ui.action.converters;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+public class PollOptionConverter implements Converter {
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ // TODO Auto-generated method stub
+ return value;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ if (value == null) {
+ return "";
+ }
+ return ((Map.Entry) value).getValue() + "";
+ }
+
+}
Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/converters/PollOptionConverter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java 2013-06-19 17:38:04 UTC (rev 38361)
@@ -46,9 +46,6 @@
public abstract class ViewMyForumsBase extends BaseController
{
- //preference related data
- private PreferenceController userPreferences = null;
-
// Map<TopicId,LastPost>
private Map topicsLastPosts;
protected Collection watchedTopics;
@@ -105,17 +102,11 @@
/**
* @return Returns the userPreferences.
*/
- public PreferenceController getUserPreferences()
- {
- return userPreferences;
- }
+ public abstract PreferenceController getUserPreferences();
/**
* @param userPreferences The userPreferences to set.
*/
- public void setUserPreferences(PreferenceController userPreferences)
- {
- this.userPreferences = userPreferences;
- }
+ public abstract void setUserPreferences(PreferenceController userPreferences);
// -------- Business logic ----------------------------------------------------------------------------------------------------------------
@@ -164,7 +155,7 @@
if(courTopic.getReplies()>0)
{
PageNavigator topicNav = new PageNavigator(courTopic.getReplies()+1,
- Integer.parseInt(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)), //this is user's posts per page preference
+ Integer.parseInt(getUserPreferences().getPreference(Constants.POSTS_TOPIC_KEY)), //this is user's posts per page preference
0 //current page of the navigator
) {
protected Collection initializePage() {
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -63,6 +63,10 @@
<converter-id>pollDurationConverter</converter-id>
<converter-class>org.jboss.portlet.forums.ui.action.converters.PollDurationConverter</converter-class>
</converter>
+ <converter>
+ <converter-id>pollOptionConverter</converter-id>
+ <converter-class>org.jboss.portlet.forums.ui.action.converters.PollOptionConverter</converter-class>
+ </converter>
<navigation-rule>
<navigation-case>
@@ -592,7 +596,7 @@
</map-entry>
<map-entry>
<key>summarytopiclimit</key>
- <value>0</value>
+ <value>6</value>
</map-entry>
<map-entry>
<key>summarytopicdays</key>
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -327,6 +327,8 @@
</div>
</c:if>
+ </h:form>
+
<hr class="forumdashedHR" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
@@ -337,8 +339,6 @@
</tr>
</table>
- </h:form>
-
</forums:isAllowedWhen>
<forums:isAllowedOtherwise>
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -157,7 +157,7 @@
<td class="forumheaderopen">${resource.L_SELECT}</td>
</tr>
- <c:forEach items="#{splitTopic.topic.posts}" var="postrow" varStatus="status" >
+ <c:forEach items="#{splitTopic.posts}" var="postrow" varStatus="status" >
<tr class="oddRow">
<td class="forumpostleftcolumn">
<c:choose>
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -23,317 +23,310 @@
******************************************************************************/
-->
-<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"
->
+<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">
+ <ui:composition template="/views/common/common.xhtml">
+ <ui:define name="mainContent">
-<c:if test="#{myForumsAll.initialized}">
+ <c:if test="#{myForumsAll.initialized}">
-<div class="forumtitletext">
- <h4>${resource.MyForums_title}</h4>
- <p>${resource.MyForums_info}</p>
-</div>
+ <div class="forumtitletext">
+ <h4>${resource.MyForums_title}</h4>
+ <p>${resource.MyForums_info}</p>
+ </div>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0"
+ class="forumtablestyle">
- <tr class="header">
- <td class="forumheaderfirst" colspan="2">${resource.Subscribed_topics_info}</td>
- <td class="forumheaderopen">${resource.Last_Post}</td>
- <td class="forumheaderopen">${resource.Notification}</td>
- <td class="forumheadercentered">${resource.Delete}</td>
- </tr>
-
- <c:if test="${forums:collectionSize(myForumsAll.watchedTopics) gt 0}">
- <c:forEach items="#{myForumsAll.watchedTopics}" var="topicrow" varStatus="status" >
- <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:commandLink action="viewTopic" value="${topicrow.subject}">
- <f:param name="t" value="${topicrow.id}"/>
- </h:commandLink>
- </h3>
-
- <!-- mini post navigator for this topic -->
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
+ <tr class="header">
+ <td class="forumheaderfirst" colspan="2">${resource.Subscribed_topics_info}</td>
+ <td class="forumheaderopen">${resource.Last_Post}</td>
+ <td class="forumheaderopen">${resource.Notification}</td>
+ <td class="forumheadercentered">${resource.Delete}</td>
+ </tr>
+
+ <c:if
+ test="${forums:collectionSize(myForumsAll.watchedTopics) gt 0}">
+ <c:forEach items="#{myForumsAll.watchedTopics}" var="topicrow"
+ varStatus="status">
+ <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>
+ <h:form>
+ <td>
+ <h3>
+ <h:commandLink action="viewTopic"
+ value="${topicrow.subject}">
+ <f:param name="t" value="${topicrow.id}" />
+ </h:commandLink>
+ </h3> <!-- mini post navigator for this topic --> <c:if
+ test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
 ( 
<h:commandLink action="viewTopic" value="${1}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="0"/>
- </h:commandLink>
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page" value="0" />
+ </h:commandLink>
 
<h:commandLink action="viewTopic" value="${2}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="1"/>
- </h:commandLink>
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page" value="1" />
+ </h:commandLink>
+ <c:if
+ test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
 
<h:commandLink action="viewTopic" value="{3}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="2"/>
- </h:commandLink>
- </c:if>
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page" value="2" />
+ </h:commandLink>
+ </c:if>
+ <c:if
+ test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
 … 
- <h:commandLink action="viewTopic" value="${resource.Last_page}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}"/>
- </h:commandLink>
- </c:if>
+ <h:commandLink action="viewTopic"
+ value="${resource.Last_page}">
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page"
+ value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}" />
+ </h:commandLink>
+ </c:if>
 )
- </c:if>
- <br />
- ${resource.By} 
- <c:choose>
-
- <c:when test="#{myForumsAll.anonymous}">
+ </c:if> <br /> ${resource.By}  <c:choose>
+
+ <c:when test="#{myForumsAll.anonymous}">
${topicrow.poster.user.userName}
</c:when>
-
- <c:otherwise>
- <h:commandLink action="viewProfile" value="${topicrow.poster.user.userName}">
- <f:param name="uid" value="${topicrow.poster.user.id}"/>
- </h:commandLink>
- </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)}">
+
+ <c:otherwise>
+ <h:commandLink action="viewProfile"
+ value="${topicrow.poster.user.userName}">
+ <f:param name="uid" value="${topicrow.poster.user.id}" />
+ </h:commandLink>
+ </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>
+
+ <c:otherwise>
#{myForumsAll.topicsLastPosts[topicrow.id].message.subject}
</c:otherwise>
-
- </c:choose>
- </a>
- <br />
- ${resource.By}
- <c:choose>
-
- <c:when test="#{myForumsAll.anonymous}">
+
+ </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:commandLink action="viewProfile" value="${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}">
- <f:param name="uid" value="#{myForumsAll.topicsLastPosts[topicrow.id].poster.user.id}"/>
- </h:commandLink>
- </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="${myForumsAll.topicWatches[topicrow.id].mode eq 0}">
+
+ <c:otherwise>
+ <h:commandLink action="viewProfile"
+ value="${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}">
+ <f:param name="uid"
+ value="#{myForumsAll.topicsLastPosts[topicrow.id].poster.user.id}" />
+ </h:commandLink>
+ </c:otherwise>
+
+ </c:choose> <br />
+ #{myForumsAll.topicsLastPosts[topicrow.id].createDate}</td>
+ </h:form>
+ <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="${myForumsAll.topicWatches[topicrow.id].mode eq 0}">
${resource.EMAIL_LINKED_NOTIFICATION}
</c:when>
-
- <c:when test="${myForumsAll.topicWatches[topicrow.id].mode eq 1}">
+
+ <c:when
+ test="${myForumsAll.topicWatches[topicrow.id].mode eq 1}">
${resource.EMAIL_EMBEDED_NOTIFICATION}
</c:when>
-
- <c:otherwise>
+
+ <c:otherwise>
${resource.EMAIL_NO_NOTIFICATION}
</c:otherwise>
-
- </c:choose>
+
+ </c:choose>
 (
<h:commandLink action="#{topicWatch.dummyAction}">
- <h:outputText value="${resource.Edit}"/>
- </h:commandLink>
+ <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:commandLink action="viewTopic" value="${topicrow.subject}">
- <f:param name="t" value="${topicrow.id}"/>
- </h:commandLink>
- </h3>
- <!-- mini post navigator for this topic -->
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
+ </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:commandLink action="viewTopic"
+ value="${topicrow.subject}">
+ <f:param name="t" value="${topicrow.id}" />
+ </h:commandLink>
+ </h3> <!-- mini post navigator for this topic --> <c:if
+ test="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
 ( 
<h:commandLink action="viewTopic" value="${1}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="0"/>
- </h:commandLink>
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page" value="0" />
+ </h:commandLink>
 
<h:commandLink action="viewTopic" value="${2}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="1"/>
- </h:commandLink>
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page" value="1" />
+ </h:commandLink>
+ <c:if
+ test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
 
<h:commandLink action="viewTopic" value="${3}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="2"/>
- </h:commandLink>
- </c:if>
- <c:if test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page" value="2" />
+ </h:commandLink>
+ </c:if>
+ <c:if
+ test="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
 … 
- <h:commandLink action="viewTopic" value="${resource.Last_page}">
- <f:param name="t" value="#{topicrow.id}"/>
- <f:param name="page" value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}"/>
- </h:commandLink>
- </c:if>
+ <h:commandLink action="viewTopic"
+ value="${resource.Last_page}">
+ <f:param name="t" value="#{topicrow.id}" />
+ <f:param name="page"
+ value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}" />
+ </h:commandLink>
+ </c:if>
 )
- </c:if>
- <br />
- ${resource.By} 
- <c:choose>
-
- <c:when test="#{myForumsAll.anonymous}">
+ </c:if> <br /> ${resource.By}  <c:choose>
+
+ <c:when test="#{myForumsAll.anonymous}">
${topicrow.poster.user.userName}
</c:when>
-
- <c:otherwise>
- <h:commandLink action="viewProfile" value="${topicrow.poster.user.userName}">
- <f:param name="uid" value="${topicrow.poster.user.id}"/>
- </h:commandLink>
- </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>
- <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>
-<div class="forumlegend">
- <hr class="forumdashedHR" />
- <ul>
- <li>
- <img src="${forums:themeURL('resourceForumNewURL')}" alt="${resource.New_posts}" width="11" height="14" />
- ${resource.New_posts}
- </li>
- <li>
- <img src="${forums:themeURL('resourceForumURL')}" alt="${resource.No_new_posts}" width="11" height="14" />
- ${resource.No_new_posts}
- </li>
- <li>
- <img src="${forums:themeURL('resourceForumLockedURL')}" alt="${resource.Forum_is_locked}" width="11" height="14" />
- ${resource.Forum_is_locked}
- </li>
- </ul>
-</div>
+ <c:otherwise>
+ <h:commandLink action="viewProfile"
+ value="${topicrow.poster.user.userName}">
+ <f:param name="uid" value="${topicrow.poster.user.id}" />
+ </h:commandLink>
+ </c:otherwise>
-</c:if>
+ </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">
-</ui:define>
-</ui:composition>
+ <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>
+ <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>
+
+ <div class="forumlegend">
+ <hr class="forumdashedHR" />
+ <ul>
+ <li><img src="${forums:themeURL('resourceForumNewURL')}"
+ alt="${resource.New_posts}" width="11" height="14" />
+ ${resource.New_posts}</li>
+ <li><img src="${forums:themeURL('resourceForumURL')}"
+ alt="${resource.No_new_posts}" width="11" height="14" />
+ ${resource.No_new_posts}</li>
+ <li><img src="${forums:themeURL('resourceForumLockedURL')}"
+ alt="${resource.Forum_is_locked}" width="11" height="14" />
+ ${resource.Forum_is_locked}</li>
+ </ul>
+ </div>
+
+ </c:if>
+
+ </ui:define>
+ </ui:composition>
</div>
\ No newline at end of file
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -625,7 +625,9 @@
</td>
<td>
<h:inputText id="option_${idx.index+1}" name="option_${idx.index+1}"
- value="${optionRow}" style="width: 300px;" maxlength="255"/>
+ value="${optionRow}" style="width: 300px;" maxlength="255">
+ <f:converter converterId="pollOptionConverter" />
+ </h:inputText>
 
<h:commandButton id="UpdateOption_${idx.index+1}" action="#{editPost.updateOption}" value="${resource.Update}"
styleClass="buttonMed" onclick="selectOption(${idx.index+1});"/>
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -621,7 +621,9 @@
</td>
<td>
<h:inputText id="option_${idx.index+1}" name="option_${idx.index+1}"
- value="${optionRow}" style="width: 300px;" maxlength="255"/>
+ value="${optionRow}" style="width: 300px;" maxlength="255">
+ <f:converter converterId="pollOptionConverter" />
+ </h:inputText>
 
<h:commandButton id="UpdateOption_${idx.index+1}" action="#{newTopic.updateOption}" value="${resource.Update}"
styleClass="buttonMed" onclick="selectOption(${idx.index+1});"/>
Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml 2013-06-19 17:36:34 UTC (rev 38360)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml 2013-06-19 17:38:04 UTC (rev 38361)
@@ -23,65 +23,60 @@
******************************************************************************/
-->
-<td 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"
- colspan="2">
+<td 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"
+ colspan="2">
+ <h:form>
+ <table cellspacing="0" cellpadding="0" border="0"
+ class="forumPollTable">
-<table cellspacing="0" cellpadding="0" border="0" class="forumPollTable">
+ <!-- title -->
+ <tr>
+ <td class="questionCell" colspan="6">#{poll.title}</td>
+ </tr>
- <!-- title -->
- <tr>
- <td class="questionCell" colspan="6">#{poll.title}</td>
- </tr>
-
- <!-- option results -->
- <c:forEach items="#{poll.options}" var="optionrow" varStatus="status">
- <tr>
- <td>#{optionrow.question}</td>
- <td>
- <table cellspacing="0" cellpadding="0" border="0" class="forumPollTableGraph">
- <tr>
- <td>
- <img src="#{forums:themeURL('resourcePollVotingLBar')}"
- width="4"
- height="12" />
- </td>
- <td>
- <img src="#{forums:themeURL('resourcePollVotingBar')}"
- width="#{(forums:votePercent(poll,optionrow))*205}"
- height="12" />
- </td>
- <td>
- <img src="#{forums:themeURL('resourcePollVotingRBar')}" width="4" height="12" />
- </td>
- </tr>
- </table>
- </td>
- <td>${forums:percentStr(forums:votePercent(poll,optionrow))}</td>
- <td>[ #{optionrow.votes} ]</td>
- </tr>
- </c:forEach>
-
- <!-- total result -->
- <tr>
- <td class="totalCell" colspan="6">Total Votes : #{poll.votesSum}</td>
- </tr>
-
- <!-- switch back to the voting screen -->
- <forums:isAllowed fragment="acl://votePoll" contextData="#{poll}">
- <tr>
- <td class="linkCell" colspan="6">
- <h:commandLink action="viewTopic" value="${resource.View_ballot}">
- <f:param name="t" value="${t}"/>
- </h:commandLink>
- </td>
- </tr>
- </forums:isAllowed>
-
-</table>
+ <!-- option results -->
+ <c:forEach items="#{poll.options}" var="optionrow" varStatus="status">
+ <tr>
+ <td>#{optionrow.question}</td>
+ <td>
+ <table cellspacing="0" cellpadding="0" border="0"
+ class="forumPollTableGraph">
+ <tr>
+ <td><img src="#{forums:themeURL('resourcePollVotingLBar')}"
+ width="4" height="12" /></td>
+ <td><img src="#{forums:themeURL('resourcePollVotingBar')}"
+ width="#{(forums:votePercent(poll,optionrow))*205}" height="12" />
+ </td>
+ <td><img src="#{forums:themeURL('resourcePollVotingRBar')}"
+ width="4" height="12" /></td>
+ </tr>
+ </table>
+ </td>
+ <td>${forums:percentStr(forums:votePercent(poll,optionrow))}</td>
+ <td>[ #{optionrow.votes} ]</td>
+ </tr>
+ </c:forEach>
-</td>
+ <!-- total result -->
+ <tr>
+ <td class="totalCell" colspan="6">Total Votes :
+ #{poll.votesSum}</td>
+ </tr>
+
+ <!-- switch back to the voting screen -->
+ <forums:isAllowed fragment="acl://votePoll" contextData="#{poll}">
+ <tr>
+ <td class="linkCell" colspan="6"><h:commandLink
+ action="viewTopic" value="${resource.View_ballot}">
+ <f:param name="t" value="${t}" />
+ </h:commandLink></td>
+ </tr>
+ </forums:isAllowed>
+
+ </table>
+ </h:form></td>
More information about the jboss-svn-commits
mailing list