[jboss-svn-commits] JBL Code SVN: r17890 - in labs/jbossforums/branches/forums101P24/forums/src: main/org/jboss/portlet/forums/ui/action and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jan 16 07:12:06 EST 2008


Author: unibrew
Date: 2008-01-16 07:12:06 -0500 (Wed, 16 Jan 2008)
New Revision: 17890

Added:
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/ValueRequiredMessageModifierListener.java
Modified:
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/Constants.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_de.properties
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_fr.properties
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/admin/index.xhtml
Log:
[JBFORUMS-259] Actions in admin panel are now working properly.

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/Constants.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/Constants.java	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/Constants.java	2008-01-16 12:12:06 UTC (rev 17890)
@@ -39,6 +39,8 @@
     public static final String FEEDBACK = "feedback";
     public static final String EDIT_CATEGORY = "editCategory";
     public static final String EDIT_FORUM = "editForum";
+    public static final String ADD_CATEGORY = "addCategory";
+    public static final String ADD_FORUM = "addForum";
     public static final String EDIT_WATCH = "editWatch";
     public static final String DELETE_CATEGORY = "deleteCategory";
     public static final String DELETE_FORUM = "deleteForum";

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java	2008-01-16 12:12:06 UTC (rev 17890)
@@ -467,6 +467,8 @@
         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)
         {
@@ -532,6 +534,14 @@
         {
             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);

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java	2008-01-16 12:12:06 UTC (rev 17890)
@@ -67,6 +67,8 @@
      */
     private boolean editCategoryMode;
     private boolean editForumMode;
+    private boolean addCategoryMode;
+    private boolean addForumMode;
     
     //-----ui data-------------------------------------------------------------------------------------------------------------------------
     /**
@@ -159,6 +161,22 @@
     {
         return editForumMode;
     }
+    
+    /**
+     * 
+     */
+    public boolean isAddCategoryMode()
+    {
+        return addCategoryMode;
+    }
+    
+    /**
+     * 
+     */
+    public boolean isAddForumMode()
+    {
+        return addForumMode;
+    }
     //cleanup related----------------------------------------------------------------------------------------------------------------------
     /**
      * 
@@ -172,6 +190,8 @@
         this.selectedForum = -1;
         this.editCategoryMode = false;
         this.editForumMode = false;
+        this.addCategoryMode = false;
+        this.addForumMode = false;
     }
     //-------------------------------------------------------------------------------------------------------------------------------------
     /**
@@ -240,6 +260,19 @@
             {
                 this.editForumMode = Boolean.valueOf(editForStr).booleanValue();
             }
+            
+            // Checking for addModes flags
+            String addCatStr = ForumUtil.getParameter(Constants.ADD_CATEGORY);
+            if (addCatStr != null && addCatStr.trim().length()>0)
+            {
+                this.addCategoryMode = Boolean.valueOf(addCatStr).booleanValue();
+            }
+            
+            String addForStr = ForumUtil.getParameter(Constants.ADD_FORUM);
+            if (addForStr != null && addForStr.trim().length()>0)
+            {
+                this.addForumMode = Boolean.valueOf(addForStr).booleanValue();
+            }
         }
         catch(Exception e)
         {
@@ -261,7 +294,7 @@
             BaseController.getForumsModule().createCategory(this.categoryName);
             String start = JSFUtil.getBundleMessage("ResourceJSF","Category_created_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Category_created_1");
-            JSFUtil.setMessage(Constants.FEEDBACK,start+"\""+this.categoryName+"\""+end);
+            JSFUtil.setMessage(Constants.FEEDBACK,start+" \""+this.categoryName+"\" "+end);
             success = true;
         }
         catch(Exception e)
@@ -356,7 +389,7 @@
            
             String start = JSFUtil.getBundleMessage("ResourceJSF","Category_deleted_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Category_deleted_1");
-            JSFUtil.setMessage(Constants.FEEDBACK,start+"\""+this.categoryName+"\""+end);
+            JSFUtil.setMessage(Constants.FEEDBACK,start+" \""+this.categoryName+"\" "+end);
            
             navState = Constants.DELETE_CATEGORY;
             getForumsModule().getHibernate().getSessionFactory().getCurrentSession().flush();
@@ -387,21 +420,13 @@
         boolean success = false;
         try
         {
-            //get the categoryId where this forum should be added
-            int categoryId = -1;
-            String cour = ForumUtil.getParameter(Constants.p_categoryId);
-            if(cour!=null && cour.trim().length()>0)
-            {
-                categoryId = Integer.parseInt(cour);
-            }
-            
             //add this new forum to the category
-            Category category = BaseController.getForumsModule().findCategoryById(new Integer(categoryId));
+            Category category = BaseController.getForumsModule().findCategoryById(new Integer(this.selectedCategory));
             BaseController.getForumsModule().createForum(category,this.forumName,this.forumDescription);
             
             String start = JSFUtil.getBundleMessage("ResourceJSF","Forum_created_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Forum_created_1");
-            JSFUtil.setMessage(Constants.FEEDBACK,start+"\""+this.forumName+"\""+end);
+            JSFUtil.setMessage(Constants.FEEDBACK,start+" \""+this.forumName+"\" "+end);
             
             success = true;
         }
@@ -447,7 +472,7 @@
                 
             String start = JSFUtil.getBundleMessage("ResourceJSF","Forum_updated_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Forum_updated_1");
-            JSFUtil.setMessage(Constants.FEEDBACK,start+"\""+this.forumName+"\""+end);
+            JSFUtil.setMessage(Constants.FEEDBACK,start+" \""+this.forumName+"\" "+end);
                 
             navState = Constants.EDIT_FORUM;
             success = true;
@@ -510,7 +535,7 @@
 	        
             String start = JSFUtil.getBundleMessage("ResourceJSF","Forum_deleted_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Forum_deleted_1");
-            JSFUtil.setMessage(Constants.FEEDBACK,start+"\""+this.forumName+"\""+end);	        	                   
+            JSFUtil.setMessage(Constants.FEEDBACK,start+" \""+this.forumName+"\" "+end);	        	                   
             
             navState = Constants.DELETE_FORUM;
             success = true;

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java	2008-01-16 12:12:06 UTC (rev 17890)
@@ -1,3 +1,24 @@
+/*
+* 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.event;
 
 import java.util.Date;

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/ValueRequiredMessageModifierListener.java (from rev 17889, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/event/ValueRequiredMessageModifierListener.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/ValueRequiredMessageModifierListener.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/event/ValueRequiredMessageModifierListener.java	2008-01-16 12:12:06 UTC (rev 17890)
@@ -0,0 +1,79 @@
+/*
+* 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.event;
+
+import java.util.Iterator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+/**
+ * This class which implements JSF PhaseListener interface
+ * will modify the view of validation messages which are generated
+ * from required="true" validators.
+ * 
+ * @author <a href="ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ *
+ */
+public class ValueRequiredMessageModifierListener implements PhaseListener {
+    
+    public static final String FIELD_NAME_COMP = "fieldName";
+    
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1L;
+
+    public PhaseId getPhaseId() {
+        return PhaseId.RENDER_RESPONSE;
+    }
+
+    public void beforePhase(PhaseEvent event) {
+        FacesContext context = event.getFacesContext();
+        UIViewRoot root = context.getViewRoot();
+        Iterator it = context.getClientIdsWithMessages();
+        while (it.hasNext())
+        {
+            String clientId = (String)it.next();
+            UIComponent comp = root.findComponent(clientId);
+            {
+                Iterator i = context.getMessages(clientId);
+                while (i.hasNext())
+                {
+                    FacesMessage fm = (FacesMessage) i.next();
+                    if (fm.getDetail().indexOf(":")!=-1)
+                    {
+                        fm.setDetail(fm.getDetail().substring(fm.getDetail().indexOf(":")+1));
+                    }
+                }
+            }
+        }
+    }
+
+    public void afterPhase(PhaseEvent e) {
+    }
+}
\ No newline at end of file

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties	2008-01-16 12:12:06 UTC (rev 17890)
@@ -384,6 +384,7 @@
 Category_deleted_0=The Category
 Category_deleted_1=was successfully deleted.
 Edit=Edit
+Create=Create
 Delete=Delete
 Move_up=Move up
 Move_down=Move down

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_de.properties
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_de.properties	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_de.properties	2008-01-16 12:12:06 UTC (rev 17890)
@@ -384,6 +384,7 @@
 Category_deleted_0=Die Kategorie
 Category_deleted_1=wurde erfolgreich gel\u00F6scht.
 Edit=Bearbeiten
+Create=
 Delete=L\u00F6schen
 Move_up=Nach oben
 Move_down=Nach unten
@@ -467,4 +468,4 @@
 
 Category_delete=Kategorie l\u00F6schen
 
-topiclockederr=Dieses Thema ist gesperrt, du kannst keine Beitr\u00e4ge bearbeiten oder beantworten
\ No newline at end of file
+topiclockederr=Dieses Thema ist gesperrt, du kannst keine Beitr\u00e4ge bearbeiten oder beantworten

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_fr.properties
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_fr.properties	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_fr.properties	2008-01-16 12:12:06 UTC (rev 17890)
@@ -384,6 +384,7 @@
 Category_deleted_0=La catégoie
 Category_deleted_1=a été supprimée.
 Edit=Modifier
+Create=
 Delete=Supprimer
 Move_up=Monter
 Move_down=Descendre

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties	2008-01-16 12:12:06 UTC (rev 17890)
@@ -384,6 +384,7 @@
 Category_deleted_0=La Categoria
 Category_deleted_1=\u00e8 stata cancellata con successo.
 Edit=Modifica
+Create=
 Delete=Cancella
 Move_up=Sposta su
 Move_down=Sposta giu

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml	2008-01-16 12:12:06 UTC (rev 17890)
@@ -29,15 +29,19 @@
     </application> 
     
     <!-- phase listeners -->
-    <!-- 
-    	remove this in portal-environment. This is needed only for managing a transaction in standalone mode.
-    	in portal mode, the portal takes care of this
-    -->
-    <!--lifecycle>    	
-    	<phase-listener>org.jboss.portlet.forums.ui.event.BeginTransactionListener</phase-listener>    	
-    	<phase-listener>org.jboss.portlet.forums.ui.event.EndTransactionListener</phase-listener>    	
-    </lifecycle-->
+    <lifecycle>
         
+        <phase-listener>org.jboss.portlet.forums.ui.event.ValueRequiredMessageModifierListener</phase-listener>
+    
+        <!-- 
+        remove this in portal-environment. This is needed only for managing a transaction in standalone mode.
+        in portal mode, the portal takes care of this
+        -->
+    	<!--phase-listener>org.jboss.portlet.forums.ui.event.BeginTransactionListener</phase-listener>    	
+    	<phase-listener>org.jboss.portlet.forums.ui.event.EndTransactionListener</phase-listener-->
+            	
+    </lifecycle>
+    
     <!-- Custom validators definitions -->
     <validator>
         <validator-id>pollValidator</validator-id>

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/admin/index.xhtml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/admin/index.xhtml	2008-01-16 12:08:31 UTC (rev 17889)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/admin/index.xhtml	2008-01-16 12:12:06 UTC (rev 17890)
@@ -43,10 +43,11 @@
     <!-- Add new category button -->
     <forums:isAllowed fragment="acl://addCategory">
     <h:form>
+    <input type="hidden" name="addCategory" value="true" />
     <div class="actionbuttons">
         <ul>
             <li>
-                <h:commandLink action="#{adminController.addCategory}">
+                <h:commandLink action="#{adminController.dummyAction}">
                     <img src="${forums:themeURL('resourceAdminNewCategoryURL')}"
                          alt="${resource.Create_category}" name="newCategory"
                          border="0" />
@@ -73,20 +74,24 @@
         
         <c:choose>
         
-            <c:when test="${ ( (adminController.editCategoryMode or forums:message('form:Category') ne null) 
+            <c:when test="${ ( (adminController.editCategoryMode and forums:message('feedback') eq null) 
                                and (adminController.selectedCategory eq category.id)                         )
                              or 
-                             ( (forums:nullIfEmptyString(category.title) eq null)                            )}" >
+                             ( (forums:nullIfEmptyString(category.title) eq null)                            )
+                           }" >
                 <tr class="editRow">
                     <td>
                         <h:form id="form_${category.id}">
                             <input type="hidden" name="c" value="#{category.id}"/>
+                            <input type="hidden" name="editCategory" value="true" />
                             <label for="categoryname" class="categorylabel">${resource.Category_name}:</label>
                             <h:inputText id="Category" required="true"
                                          value="#{adminController.categoryName}" />
-                            <h:message for="Category" styleClass="inlinefailure"/>
-                            <h:commandButton id="editinline" value="${resource.Update}" styleClass="buttonMed"
-                                             action="#{adminController.editCategory}"/>
+                            <h:message for="Category" styleClass="inlinefailure" />
+                            <h:commandButton id="editinline"
+                                             value="${resource.Update}"
+                                             styleClass="buttonMed"
+                                             action="#{adminController.editCategory }"/>
                         </h:form>
                     </td>
                     <td class="forumlistlast">
@@ -103,8 +108,9 @@
                         <forums:isAllowed fragment="acl://addForum">
                         <h:form>
                             <input type="hidden" name="c" value="#{category.id}"/>
+                            <input type="hidden" name="addForum" value="true" />
                             <div class="forumfloatright actionbuttons">
-                                <h:commandLink action="#{adminController.addForum}">
+                                <h:commandLink action="#{adminController.dummyAction}">
                                     <img src="${forums:themeURL('resourceAdminNewForumURL')}"
                                          alt="${resource.Create_forum}" border="0" />
                                 </h:commandLink>
@@ -213,12 +219,14 @@
         
         <c:choose>
         
-            <c:when test="${( (adminController.editForumMode or forums:message('forumForm:Forum') ne null)
+            <c:when test="${( (adminController.editForumMode and forums:message('feedback') eq null)
                                and adminController.selectedForum eq forum.id                              )
                             or ( forums:nullIfEmptyString(forum.name) eq null                         )}" >
                 <tr class="editRow">
                     <td class="Indent">
                         <h:form id="forumForm_${forum.id}">
+                            <input type="hidden" name="c" value="#{category.id}"/>
+                            <input type="hidden" name="editForum" value="true" />
                             <input type="hidden" name="f" value="#{forum.id}"/>
                             <label for="forumname">${resource.Forum_name}:</label>
                             <h:inputText id="Forum" required="true"
@@ -360,17 +368,81 @@
         </forums:isAllowed>
         </c:forEach>
         
+        <!-- Add forum form -->
+        <c:if test="${ adminController.addForumMode
+                       and (adminController.selectedCategory eq category.id)
+                       and forums:message('feedback') eq null }">
+        
+        <tr class="editRow">
+            <td class="Indent">
+                <h:form id="addForumForm">
+                    <input type="hidden" name="c" value="#{category.id}"/>
+                    <input type="hidden" name="addForum" value="true" />
+                    <label for="forumname">${resource.Forum_name}:</label>
+                    <h:inputText id="Forum" required="true"
+                                 style="margin-left: 100px; display:block; margin-bottom: 10px;"
+                                 value="#{adminController.forumName}" />
+                    <h:message for="Forum" styleClass="inlinefailure"/>
+                    <label for="forumdescription">${resource.Forum_desc}:</label>
+                    <h:inputTextarea rows="5"
+                                     style="margin-left: 100px; display:block; margin-bottom: 10px;"
+                                     value="#{adminController.forumDescription}"/>
+                    <label for="forumcategory">${resource.Forum_category}:</label>
+                    <h:selectOneMenu value="#{adminController.selectedCategory}"
+                                     style="margin-left: 100px; display:block; margin-bottom: 10px;">
+                        <c:forEach items="#{adminPanel.categories}" var="cat">
+                            <f:selectItem itemValue="#{cat.id}" itemLabel="#{cat.title}" />
+                        </c:forEach>
+                    </h:selectOneMenu>
+                    <h:commandButton id="adminbutton" value="${resource.Create}" styleClass="buttonMed"
+                                     style="margin-left: 100px; display:block; margin-bottom: 10px;"
+                                     action="#{adminController.addForum}"/>
+                </h:form>
+            </td>
+            <td class="forumlistlast">
+                &#160;
+            </td>
+        </tr>
+        
+        </c:if>
+        
     </forums:isAllowed>
     </c:forEach>
+    
+    <!-- Add category form -->
+    <c:if test="${adminController.addCategoryMode and forums:message('feedback') eq null}" >
+    <h:form id="addCategoryForm">
+    
+        <tr class="editRow">
+            <td>
+                <input type="hidden" name="addCategory" value="true" />
+                <label for="categoryname" class="categorylabel">${resource.Category_name}:</label>
+                <h:inputText id="Category" required="true"
+                             value="#{adminController.categoryName}" />
+                <h:message for="Category" styleClass="inlinefailure"/>
+                <h:commandButton id="editinline"
+                                 value="${resource.Create}"
+                                 styleClass="buttonMed"
+                                action="#{adminController.addCategory}"/>
+            </td>
+            <td class="forumlistlast">
+                &#160;
+            </td>
+        </tr>
+        
+    </h:form>
+    </c:if>
+    
     </table>
     
     <!-- Add new category button -->
     <forums:isAllowed fragment="acl://addCategory">
     <h:form>
     <div class="actionbuttons">
+    <input type="hidden" name="addCategory" value="true" />
         <ul>
             <li>
-                <h:commandLink action="#{adminController.addCategory}">
+                <h:commandLink action="#{adminController.dummyAction}">
                     <img src="${forums:themeURL('resourceAdminNewCategoryURL')}"
                          alt="${resource.Create_category}" name="newCategory"
                          border="0" />




More information about the jboss-svn-commits mailing list