Author: unibrew Date: 2006-06-28 20:58:59 -0400 (Wed, 28 Jun 2006) New Revision: 4859 Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml Log: [JBFORUMS-54] Rewriting JSP to XHTML and adding managed bean for SplitTopic moderator action. Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2006-06-29 00:07:38 UTC (rev 4858) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2006-06-29 00:58:59 UTC (rev 4859) @@ -0,0 +1,42 @@ +/* +* 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. +*/ + +package org.jboss.portlet.forums.ui.action; + +import org.jboss.portlet.forums.ui.BaseController; + +/** + * @author <a href="mailto:rys...@jb...">Ryszard Kozmik</a> + */ +public class SplitTopic extends BaseController { + + private String newTopicTitle; + + + public void setNewTopicTitle(String newTopicTitle) { + this.newTopicTitle = newTopicTitle; + } + + public String getNewTopicTitle() { + return newTopicTitle; + } +} Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-06-29 00:07:38 UTC (rev 4858) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-06-29 00:58:59 UTC (rev 4859) @@ -292,12 +292,17 @@ <managed-bean-name>moderator</managed-bean-name> <managed-bean-class>org.jboss.portlet.forums.ui.action.ModeratorAction</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> - <managed-property> - <property-name>userPreferences</property-name> - <property-class>org.jboss.portlet.forums.ui.action.PreferenceController</property-class> - <value>#{prefController}</value> - </managed-property> - </managed-bean> + <managed-property> + <property-name>userPreferences</property-name> + <property-class>org.jboss.portlet.forums.ui.action.PreferenceController</property-class> + <value>#{prefController}</value> + </managed-property> + </managed-bean> + <managed-bean> + <managed-bean-name>splitTopic</managed-bean-name> + <managed-bean-class>org.jboss.portlet.forums.ui.action.SplitTopic</managed-bean-class> + <managed-bean-scope>request</managed-bean-scope> + </managed-bean> <navigation-rule> <from-view-id>/views/moderator/modcp_body.xhtml</from-view-id> <navigation-case> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml 2006-06-29 00:07:38 UTC (rev 4858) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml 2006-06-29 00:58:59 UTC (rev 4859) @@ -29,85 +29,146 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:forums="http://www.jboss.com/products/jbossportal/forums" class="bb"> - <ui:composition template="/views/common/common.xhtml"> - <ui:define name="mainContent"> -<c:if test="#{moderator.initialized && moderator.forum!=null && moderator.forum.id!=-1}"> - <forums:isAllowed fragment="acl://moderateForum" contextData="#{moderator.forum}"> - <h:messages layout="table" infoStyle="color:green" warnStyle="color:red"/> +<ui:composition template="/views/common/common.xhtml"> +<ui:define name="mainContent"> +<c:if test="#{splitTopic.initialized && splitTopic.topic!=null && splitTopic.topic.id!=-1}"> +<forums:isAllowed fragment="acl://moderateForum" contextData="#{splitTopic.forum}"> +<h:messages layout="table" infoStyle="color:green" warnStyle="color:red"/> -<form method="post" action="${n:out("S_SPLIT_ACTION")}"> +<h:form> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <tr> - <td align="left" class="nav"><a href="${n:out("U_INDEX")}" class="nav">${n:i18n("L_INDEX")}</a><span - class="nav"> - -> <a href="${n:out("U_VIEW_FORUM")}" class="nav">${n:out("FORUM_NAME")}</a></span></td> + <td align="left" class="nav"> + <span class="nav"> + ->&nbsp; + <h:outputLink value="#{forums:outputLink(shared.links['forum'],true)}" + styleClass="nav"> + <f:param name="f" value="#{splitTopic.forum.id}"/> + <h:outputText value="#{splitTopic.forum.name}"/> + </h:outputLink> + </span> + </td> </tr> </table> <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> <tr> - <th height="25" class="thHead" colspan="3" nowrap="nowrap">${n:i18n("L_SPLIT_TOPIC")}</th> + <th height="25" class="thHead" colspan="3" nowrap="nowrap"> + ${resource.L_SPLIT_TOPIC} + </th> </tr> <tr> - <td class="row2" colspan="3" align="center"><span class="gensmall">${n:i18n("L_SPLIT_TOPIC_EXPLAIN")}</span> + <td class="row2" colspan="3" align="center"> + <span class="gensmall">${resource.L_SPLIT_TOPIC_EXPLAIN}</span> </td> </tr> <tr> - <td class="row1" nowrap="nowrap"><span class="gen">${n:i18n("L_SPLIT_SUBJECT")}</span></td> - <td class="row2" colspan="2"><input class="post" type="text" size="35" style="width: 350px" maxlength="60" - name="subject"/></td> + <td class="row1" nowrap="nowrap"> + <span class="gen">${resource.L_SPLIT_SUBJECT}</span> + </td> + <td class="row2" colspan="2"> + <h:inputText class="post" size="35" style="width: 350px" maxlength="60" + name="subject" value="#{splitTopic.newTopicTitle}"/> + </td> </tr> <tr> - <td class="row1" nowrap="nowrap"><span class="gen">${n:i18n("L_SPLIT_FORUM")}</span></td> - <td class="row2" colspan="2">${n:out("S_FORUM_SELECT")}</td> + <td class="row1" nowrap="nowrap"> + <span class="gen">${resource.L_SPLIT_FORUM}</span> + </td> + <td class="row2" colspan="2"> + <select name="forum_to_id"> + <option value="-1">${resource.Select_forum}</option> + <c:forEach items="${jumpbox.categories}" + var="category"> + <forums:isAllowed fragment="acl://readCategory" + contextData="#{category}"> + <option value="-1"></option> + <option value="-1">${category.title}</option> + <option value="-1">----------------</option> + <c:forEach items="${category.forums}" + var="forum"> + <forums:isAllowed fragment="acl://newTopic" + contextData="#{forum}"> + <option value="${forum.id}"> + ${forum.name} + </option> + </forums:isAllowed> + </c:forEach> + </forums:isAllowed> + </c:forEach> + </select> + </td> </tr> <tr> <td class="catHead" colspan="3" height="28"> - <table width="60%" cellspacing="0" cellpadding="0" border="0" align="center"> + <table width="60%" cellspacing="0" cellpadding="0" + border="0" align="center"> <tr> <td width="50%" align="center"> - <input class="liteoption" type="submit" name="split_type_all" value="${n:i18n("L_SPLIT_POSTS")}"/> + <h:commandButton action="{splitTopic.splitPosts}" + type="submit" + class="liteoption" + name="split_type_all" + value="{resource.L_SPLIT_POSTS}"/> </td> <td width="50%" align="center"> - <input class="liteoption" type="submit" name="split_type_beyond" - value="${n:i18n("L_SPLIT_AFTER")}"/> + <h:commandButton action="{splitTopic.splitAfter}" + type="submit" + class="liteoption" + name="split_type_beyond" + value="{resource.L_SPLIT_AFTER}"/> </td> </tr> </table> </td> </tr> <tr> - <th class="thLeft" nowrap="nowrap">${n:i18n("L_AUTHOR")}</th> - <th nowrap="nowrap">${n:i18n("L_MESSAGE")}</th> - <th class="thRight" nowrap="nowrap">${n:i18n("L_SELECT")}</th> + <th class="thLeft" nowrap="nowrap">${resource.L_AUTHOR}</th> + <th nowrap="nowrap">${resoure.L_MESSAGE}</th> + <th class="thRight" nowrap="nowrap">${resource.L_SELECT}</th> </tr> - <n:iterate ctx="postrow"> + <c:forEach items="#{splitTopic.topic.posts}" var="postrow" varStatus="status" > <tr> - <td align="left" valign="top" class="${n:out("postrow.ROW_CLASS")}"><span class="name"><a - name="${n:out("postrow.U_POST_ID")}"></a>${n:out("postrow.POSTER_NAME")}</span></td> + <td align="left" valign="top" class="${n:out("postrow.ROW_CLASS")}"> + <span class="name"> + <a name="${n:out("postrow.U_POST_ID")}"></a> + ${n:out("postrow.POSTER_NAME")} + </span> + </td> <td width="100%" valign="top" class="${n:out("postrow.ROW_CLASS")}"> <table width="100%" cellspacing="0" cellpadding="3" border="0"> <tr> - <td valign="middle"><img src="${n:out("postrow.IMG_MINIPOST")}" alt="${n:i18n("L_POST")}"><span - class="postdetails">${n:i18n("L_POSTED")}: - ${n:out("postrow.POST_DATE")} ${n:i18n("L_POST_SUBJECT")}: ${n:out("postrow.POST_SUBJECT")}</span> + <td valign="middle"> + <img src="${n:out("postrow.IMG_MINIPOST")}" alt="${resource.L_POST}"> + <span class="postdetails"> + ${resource.L_POSTED}: + ${n:out("postrow.POST_DATE")} + + ${resource.L_POST_SUBJECT}: + ${n:out("postrow.POST_SUBJECT")} + </span> </td> </tr> <tr> <td valign="top"> <hr size="1"/> - <span class="postbody">${n:out("postrow.MESSAGE")}</span></td> + <span class="postbody"> + ${n:out("postrow.MESSAGE")} + </span> + </td> </tr> </table> </td> - <td width="5%" align="center" - class="${n:out("postrow.ROW_CLASS")}"><%--${n:out("postrow.S_SPLIT_CHECKBOX")}--%> - <input type="checkbox" name="post_id_list[${n:out("postrow.POST_ROW_INDEX")}]" + <td width="5%" align="center" class="${n:out("postrow.ROW_CLASS")}"> + <%--${n:out("postrow.S_SPLIT_CHECKBOX")}--%> + <input type="checkbox" + name="post_id_list[${n:out("postrow.POST_ROW_INDEX")}]" value="${n:out("postrow.POST_ID")}"/> </td> </tr> <tr> - <td colspan="3" height="1" class="row3"><img src="${n:out("postrow.IMG_SPACER")}" width="1" height="1" - alt="."></td> + <td colspan="3" height="1" class="row3"> + <img src="${n:out("postrow.IMG_SPACER")}" width="1" height="1" alt="."> + </td> </tr> </n:iterate> <tr> @@ -115,12 +176,14 @@ <table width="60%" cellspacing="0" cellpadding="0" border="0" align="center"> <tr> <td width="50%" align="center"> - <input class="liteoption" type="submit" name="split_type_all" value="${n:i18n("L_SPLIT_POSTS")}"/> + <input class="liteoption" type="submit" name="split_type_all" + value="${resource.L_SPLIT_POSTS}"/> </td> <td width="50%" align="center"> <input class="liteoption" type="submit" name="split_type_beyond" - value="${n:i18n("L_SPLIT_AFTER")}"/> - ${n:out("S_HIDDEN_FIELDS")} </td> + value="${resource.L_SPLIT_AFTER}"/> + ${n:out("S_HIDDEN_FIELDS")} + </td> </tr> </table> </td> @@ -128,10 +191,14 @@ </table> <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2"> <tr> - <td align="right" valign="top"><span class="gensmall">${n:out("S_TIMEZONE")}</span></td> + <td align="right" valign="top"> + <span class="gensmall"> + ${n:out("S_TIMEZONE")} + </span> + </td> </tr> </table> -</form> +</h:form> </forums:isAllowed> </c:if> |