[jboss-svn-commits] JBL Code SVN: r18836 - in labs/jbossforums/branches/forums101P22/forums/src: main/org/jboss/portlet/forums/ui/action and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Mar 11 12:35:28 EDT 2008
Author: unibrew
Date: 2008-03-11 12:35:28 -0400 (Tue, 11 Mar 2008)
New Revision: 18836
Added:
labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/views/moderator/delete_topics.xhtml
Modified:
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties
labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
Log:
[JBFORUMS-215] Moderator's delete topics view rewritten.
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2008-03-11 16:34:41 UTC (rev 18835)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2008-03-11 16:35:28 UTC (rev 18836)
@@ -142,6 +142,9 @@
TEMP_VIEW_ID_TO_NAME.put("v","/views/moderator/delete_topic.jsf");
TEMP_VIEW_NAME_TO_ID.put("/views/moderator/delete_topic.jsf","v");
+ TEMP_VIEW_ID_TO_NAME.put("vs","/views/moderator/delete_topics.jsf");
+ TEMP_VIEW_NAME_TO_ID.put("/views/moderator/delete_topics.jsf","vs");
+
TEMP_VIEW_ID_TO_NAME.put("q","/views/moderator/modcp_move.jsf");
TEMP_VIEW_NAME_TO_ID.put("/views/moderator/modcp_move.jsf","q");
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2008-03-11 16:34:41 UTC (rev 18835)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2008-03-11 16:35:28 UTC (rev 18836)
@@ -26,20 +26,16 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Locale;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
-import java.util.ResourceBundle;
-
import javax.faces.application.FacesMessage;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
-import org.hibernate.Session;
-
import org.jboss.portal.core.modules.ModuleException;
import org.jboss.portlet.forums.ForumsModule;
-import org.jboss.portlet.forums.impl.ForumsModuleImpl;
import org.jboss.portlet.forums.model.Forum;
import org.jboss.portlet.forums.model.Post;
import org.jboss.portlet.forums.model.Topic;
@@ -367,10 +363,11 @@
*
* @return
*/
- private boolean isAnyCheckboxSelected()
+ public boolean isAnyCheckboxSelected()
{
// Looking for selected topicId's in checkboxes Map
- if (checkboxes!=null && checkboxes.size()!=0) {
+ if (checkboxes!=null && checkboxes.size()!=0)
+ {
Iterator it = checkboxes.keySet().iterator();
while (it.hasNext())
{
@@ -384,7 +381,8 @@
// Looking for topicId sent in parameter
String topicId = ForumUtil.getParameter(Constants.p_topicId);
- if (topicId!=null && topicId.trim().length()>0){
+ if (topicId!=null && topicId.trim().length()>0)
+ {
checkboxes = new HashMap(1);
checkboxes.put(new Integer(topicId),Boolean.TRUE);
return true;
@@ -392,6 +390,28 @@
return false;
}
+ public List getAllSelectedTopics()
+ {
+ List list = new LinkedList();
+ Iterator it = checkboxes.keySet().iterator();
+ while (it.hasNext())
+ {
+ Integer topicId = (Integer)it.next();
+ if ( ((Boolean)checkboxes.get(topicId)).booleanValue() )
+ {
+ try
+ {
+ list.add(getForumsModule().findTopicById(topicId));
+ }
+ catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ }
+ }
+ return list;
+ }
+
// ---------- Initialization -----------------------------------------------
/**
Modified: labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2008-03-11 16:34:41 UTC (rev 18835)
+++ labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2008-03-11 16:35:28 UTC (rev 18836)
@@ -323,6 +323,7 @@
Lock=Lock
Unlock=Unlock
Confirm_move_topic=Are you sure you want to move the selected topic/s?
+Confirm_delete_topic=Are you sure you want to remove the selected topic/s?
Move_to_forum=Move to forum
Leave_shadow_topic=Leave shadow topic in old forum.
@@ -332,6 +333,7 @@
L_SPLIT_FORUM=Forum for new topic
L_SPLIT_POSTS=Split selected posts
L_SPLIT_AFTER=Split from selected post
+None_selected=You have not selected any topics to perform this operation on.
ERR_NO_DEST_FORUM=You must select destination forum to perform move operations.
ERR_INTERNAL=Internal data error - please try again.
SUCC_TOPIC_MOVED=Move operation succeded!
Modified: labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties 2008-03-11 16:34:41 UTC (rev 18835)
+++ labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF_it.properties 2008-03-11 16:35:28 UTC (rev 18836)
@@ -323,6 +323,7 @@
Lock=Blocca
Unlock=Sblocca
Confirm_move_topic=Sei sicuro di voler spostare i topics selezionati?
+Confirm_delete_topic=Sei sicuro di voler rimuovere i topics selezionati?
Move_to_forum=Sposta al forum
Leave_shadow_topic=Lascia un'ombra del topic nel vecchio forum.
@@ -332,6 +333,7 @@
L_SPLIT_FORUM=Forum per il nuovo topic
L_SPLIT_POSTS=Suddividi i posts selezionati
L_SPLIT_AFTER=Suddividi dal post selezionato
+None_selected=Non hai selezionato alcun topic per eseguire l'operazione.
ERR_NO_DEST_FORUM=Devi selezionare la destinazione del forum per effettuare lo spostamento.
ERR_INTERNAL=Errore interno - per favore riprova.
SUCC_TOPIC_MOVED=Spostamento eseguito con successo!
Modified: labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2008-03-11 16:34:41 UTC (rev 18835)
+++ labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2008-03-11 16:35:28 UTC (rev 18836)
@@ -367,7 +367,7 @@
<from-view-id>/views/moderator/modcp_body.xhtml</from-view-id>
<navigation-case>
<from-outcome>confirmDelete</from-outcome>
- <to-view-id>/views/moderator/delete_topic.xhtml</to-view-id>
+ <to-view-id>/views/moderator/delete_topics.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>confirmMove</from-outcome>
@@ -381,6 +381,13 @@
<to-view-id>/views/moderator/modcp_body.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/views/moderator/delete_topics.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/views/moderator/modcp_body.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
<!-- managedBean for deletePost usecase -->
<managed-bean>
Copied: labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/views/moderator/delete_topics.xhtml (from rev 18834, labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/moderator/delete_topics.xhtml)
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/views/moderator/delete_topics.xhtml (rev 0)
+++ labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/views/moderator/delete_topics.xhtml 2008-03-11 16:35:28 UTC (rev 18836)
@@ -0,0 +1,134 @@
+<!--
+/*
+* 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:t="http://myfaces.apache.org/tomahawk"
+ xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
+ class="forumscontainer"
+>
+
+<ui:composition template="/views/common/common.xhtml">
+<ui:define name="mainContent">
+<forums:isAllowedChoose>
+<forums:isAllowedWhen fragment="acl://moderateForum" contextData="#{moderator.forum}">
+<c:choose>
+
+ <c:when test="#{moderator.anyCheckboxSelected && moderator.forum!=null && moderator.forum.id!=-1}">
+ <div class="dialog">
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr>
+ <td class="icon">
+ <img src="#{forums:themeURL('resourceIconDialogWarningURL')}" border="0" />
+ </td>
+ <td class="title" width="100%">
+ ${resource.Topic_delete_confirm}
+ </td>
+ </tr>
+ <tr>
+ <td class="icon"></td>
+ <td>
+ ${resource.Confirm_delete_topic}
+ <br /><br />
+ <c:forEach items="#{moderator.allSelectedTopics}" var="topicrow">
+ #{topicrow.subject}<br />
+ </c:forEach>
+ <br />
+ </td>
+ </tr>
+ <tr>
+ <td class="buttons" colspan="2">
+ <h:form>
+ <input type="hidden" name="f" value="#{moderator.forum.id}"/>
+ <h:commandButton type="submit"
+ value="${resource.Yes}"
+ styleClass="buttonMed"
+ action="#{moderator.deleteTopic}">
+ <f:param name="f" value="#{moderator.forum.id}"/>
+ </h:commandButton>
+ <h:commandButton type="button"
+ value="${resource.No}"
+ styleClass="buttonMed"
+ onclick="javascript:history.back();">
+ <f:param name="f" value="#{moderator.forum.id}"/>
+ </h:commandButton>
+ </h:form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </c:when>
+
+ <c:otherwise>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+ <tr>
+ <td>
+ <table width="100%" cellspacing="0" cellpadding="1" border="0">
+ <tr>
+ <td> </td>
+ </tr>
+ <tr>
+ <td align="center">
+ ${resource.Not_Moderator}
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </c:otherwise>
+
+</c:choose>
+</forums:isAllowedWhen>
+<forums:isAllowedOtherwise>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+ <tr>
+ <td>
+ <table width="100%" cellspacing="0" cellpadding="1" border="0">
+ <tr>
+ <td> </td>
+ </tr>
+ <tr>
+ <td align="center">
+ ${resource.Not_Moderator}
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</forums:isAllowedOtherwise>
+</forums:isAllowedChoose>
+</ui:define>
+</ui:composition>
+</div>
More information about the jboss-svn-commits
mailing list