From: <jbo...@li...> - 2006-04-17 23:56:27
|
Author: unibrew Date: 2006-04-17 19:56:20 -0400 (Mon, 17 Apr 2006) New Revision: 3750 Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml 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/forums/viewforum_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml Log: [JBFORUMS-37] Adding Jumpbox feature to TopicView and ForumsView. Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java 2006-04-17 23:17:35 UTC (rev 3749) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java 2006-04-17 23:56:20 UTC (rev 3750) @@ -0,0 +1,59 @@ +/* +* 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.view; + +import java.util.List; + +import org.jboss.portlet.forums.ui.BaseController; +import org.jboss.portlet.forums.ui.Constants; +import org.jboss.portlet.forums.ui.ForumUtil; +import org.jboss.portlet.forums.ui.JSFUtil; + +/** + * @author <a href="mailto:rys...@jb...">Ryszard Kozmik</a> + */ +public class ViewJumpbox extends BaseController +{ + + /** + * @author Ryszard Kozmik + */ + public ViewJumpbox () { + super(); + } + + public List getCategories() + { + try + { + return getForumsModule().findCategories(); + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + return null ; + } + + +} 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-04-17 23:17:35 UTC (rev 3749) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-04-17 23:56:20 UTC (rev 3750) @@ -160,4 +160,9 @@ <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewTopic</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> + <managed-bean> + <managed-bean-name>jumpbox</managed-bean-name> + <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewJumpbox</managed-bean-class> + <managed-bean-scope>request</managed-bean-scope> + </managed-bean> </faces-config> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml 2006-04-17 23:17:35 UTC (rev 3749) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml 2006-04-17 23:56:20 UTC (rev 3750) @@ -319,6 +319,7 @@ </td> <td align="right"> <span class="gensmall"> + <ui:include src="/views/jumpbox.xhtml"/> <!-- TODO: hookup real data here...need to extract out the hardcoded html code from the original portlet --> <!-- S_AUTH_LIST --> </span> Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml 2006-04-17 23:17:35 UTC (rev 3749) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml 2006-04-17 23:56:20 UTC (rev 3750) @@ -0,0 +1,64 @@ +<!-- +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +--> + +<div xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:c="http://java.sun.com/jstl/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:forums="http://www.jboss.com/products/jbossportal/forums" class="bb"> + + <form method="post" name="jumpbox" + action="#{forums:outputLink(shared.links['forum'],true)}" + onSubmit="if(document.jumpbox.f.value == -1){return false;}"> + <table cellspacing="0" cellpadding="0" border="0" align="right"> + <tr> + <td nowrap="nowrap" valign="top" align="right"> + <span class="gensmall" align="right"> + ${resource.Jump_to}:&nbsp; + <select name="f" + onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }" > + <option value="-1">${resource.Select_forum}</option> + <c:forEach items="${jumpbox.categories}" + var="category"> + <option value="-1"></option> + <option value="-1">${category.title}</option> + <option value="-1">----------------</option> + <c:forEach items="${category.forums}" + var="forum"> + <option value="${forum.id}"> + ${forum.name} + </option> + </c:forEach> + </c:forEach> + </select> + &nbsp; + <input type="submit" value="${resource.Go}" + class="liteoption"/> + </span> + </td> + </tr> + </table> + </form> +</div> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-04-17 23:17:35 UTC (rev 3749) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-04-17 23:56:20 UTC (rev 3750) @@ -535,55 +535,57 @@ <br/> </td> --> - <script language='JavaScript' type='text/javascript'> - <!-- - function checkForm() - { - formErrors = false; - if (document.post.message.value.length < 2) - { - formErrors = 'Vous devez entrer un message avant de poster.'; - } - if (formErrors) - { - alert(formErrors); - return false; - } - else - { - return true; - } - } - --> - </script> + <script language='JavaScript' type='text/javascript'> + <!-- + function checkForm() + { + formErrors = false; + if (document.post.message.value.length < 2) + { + formErrors = 'Vous devez entrer un message avant de poster.'; + } + if (formErrors) + { + alert(formErrors); + return false; + } + else + { + return true; + } + } + --> + </script> <!-- TODO: SECURITY CHECK NEEDED--> + <!-- TODO: THIS INSTANT REPLY BOX IS WAITING FOR POSTINGVIEW UPDATE TO SUPPORT REPLYING <td> - <!--form action='${n:out("U_REPLY_SUBMIT")}' method="post" name="post" - onsubmit="return checkForm(this)"> + <h:form name="post" onsubmit="return checkForm(this)" > <span class="genmed"> - <b>${n:i18n("Instant_reply")}</b> + <b>${resource.Instant_reply}</b> <br/> <br/> - <textarea class="post" name="message" rows="10" cols="50" - wrap="virtual"></textarea> + <h:inputTextarea class="post" name="message" rows="10" cols="50" wrap="virtual"> + </h:inputTextarea> <br/> - ${n:out("S_INSTANT_REPLY_HIDDEN_FORM_FIELDS")} <br/> + <input type="hidden" name="f" value="#{newTopic.forumId}"/> + <input type="hidden" name="t" value="#{newTopic.topicId}"/> <input type="submit" name="preview" class="liteoption" value='${n:i18n("Preview")}'/> &nbsp; <input type="submit" name="post" class="mainoption" value='${n:i18n("Submit")}'/> </span> - </form--> - </td> - <!--td align="right" valign="top" nowrap="nowrap"> - ${n:out("JUMPBOX")} - <span class="gensmall">${n:out("S_AUTH_LIST")}</span> - </td--> + </form> + </td>--> + <!-- TODO: IN THIS PLACE THE JUMPBOXVIEW SHOULD BE INCLUDED--> + <td align="right" valign="top" nowrap="nowrap"> + <ui:include src="/views/jumpbox.xhtml"/> + <!--<span class="gensmall">${n:out("S_AUTH_LIST")}</span>--> + </td> </tr> - <!-- TODO: SECURITY CHECK NEEDED AND REIMPLEMENTATION OF HARDCODED HTML IN PORTLET + <!-- TODO: SECURITY CHECK NEEDED, REIMPLEMENTATION OF HARDCODED HTML IN PORTLET WHICH NEEDS MODERATOR VIEWS <tr> <td> ${n:out("S_TOPIC_ADMIN")} |