Author: unibrew Date: 2006-04-26 20:27:28 -0400 (Wed, 26 Apr 2006) New Revision: 3982 Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml Log: [JBFORUMS-38] Adding Moderator Control Panel View's files. Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-04-27 00:26:58 UTC (rev 3981) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-04-27 00:27:28 UTC (rev 3982) @@ -0,0 +1,152 @@ +/* +* 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 java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.jboss.portlet.forums.model.Forum; +import org.jboss.portlet.forums.model.Topic; +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 ModeratorAction +{ + + //business data being generated in this bean by executing ui actions + //this is data is created such that it can be consumed by the view components + //like facelets + private Forum forum = null; + + private Map checkboxes; + + //----------------bean configuration supplied by the forums-config.xml--------------------------------------------------------------------------------------------- + + + //----------------business data being generated for use by the view components like facelets--------------------------------------------------------------------------------------- + public Forum getForum() + { + return this.forum; + } + public String getPagination() + { + /** + * TODO: implement real code to get the pagination... + */ + //stub code + return "10"; + } + public String getPageNumber() + { + /** + * TODO: implement real code to get the pageNumber... + */ + //stub code + return "2"; + } + + public void setCheckboxes(Map checkboxes) + { + this.checkboxes = checkboxes; + } + + public Map getCheckboxes() + { + return checkboxes; + } + + //------------user preferences------------------------------------------------------------------------------------------------------------- + + //------------------------------------------------------------------------------------------------------------------------------------- + /** + * + * @author Ryszard Kozmik + */ + public ModeratorAction() + { + super(); + try + { + this.execute(); + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + } + + //ui actions supported by this bean---------------------------------------------------------------------------------------------------- + + + public String deleteTopic () + { + return ""; + } + + public String moveTopic () + { + return ""; + } + + public String lockTopic () + { + return ""; + } + + public String unlockTopic () + { + return ""; + } + + private void execute() throws Exception + { + int forumId = -1; + String f = ForumUtil.getParameter(Constants.p_forumId); + if(f!=null && f.trim().length()>0) + { + forumId = Integer.parseInt(f); + } + if(forumId!=-1) + { + // start with a stub implementation + this.forum = BaseController.getForumsModule().findForumById(new Integer(forumId)); + checkboxes = new HashMap(forum.getTopicCount()); + Iterator it = forum.getTopics().iterator(); + while (it.hasNext()) + { + Topic topic = (Topic)it.next(); + checkboxes.put(topic.getId(),Boolean.FALSE); + } + } + } + //------------------------------------------------------------------------------------------------------------------------------------- + + +} 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-27 00:26:58 UTC (rev 3981) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-04-27 00:27:28 UTC (rev 3982) @@ -131,28 +131,28 @@ </navigation-case> </navigation-rule> <navigation-rule> - <from-view-id>/views/topics/posting_body.xhtml</from-view-id> + <from-view-id>/views/topics/posting_body.xhtml.jsp</from-view-id> <!-- straight jsf calls --> <navigation-case> <from-outcome>addOption</from-outcome> - <to-view-id>/views/topics/posting_body.xhtml</to-view-id> + <to-view-id>/views/topics/posting_body.xhtml.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>updateOption</from-outcome> - <to-view-id>/views/topics/posting_body.xhtml</to-view-id> + <to-view-id>/views/topics/posting_body.xhtml.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>updateAttachment</from-outcome> - <to-view-id>/views/topics/posting_body.xhtml</to-view-id> + <to-view-id>/views/topics/posting_body.xhtml.jsp</to-view-id> </navigation-case> <!-- jsf state by method call on managed bean first --> <navigation-case> <from-outcome>cancel</from-outcome> - <to-view-id>/views/forums/viewforum_body.xhtml</to-view-id> + <to-view-id>/views/forums/viewforum_body.xhtml.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>success</from-outcome> - <to-view-id>/views/forums/viewforum_body.xhtml</to-view-id> + <to-view-id>/views/forums/viewforum_body.xhtml.jsp</to-view-id> </navigation-case> </navigation-rule> <managed-bean> @@ -170,4 +170,9 @@ <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewProfile</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> + <managed-bean> + <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-bean> </faces-config> \ No newline at end of file Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2006-04-27 00:26:58 UTC (rev 3981) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2006-04-27 00:27:28 UTC (rev 3982) @@ -0,0 +1,127 @@ +<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" +> +<ui:include src="/views/common/common.xhtml"/> + +<!-- TODO: +<n:errors/> +<n:success/> +--> +<!-- TODO: REWRITE S_POST_DAYS_ACTION +<form method="post" action="${n:out("S_POST_DAYS_ACTION")}">--> +<h:form> + <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> + <tr> + <td align="left"> + <span class="nav"> + <a href="" class="nav"></a> -> + <h:outputLink value="#{forums:outputLink(shared.links['forum'],true)}" styleClass="nav"> + <f:param name="f" value="#{moderator.forum.id}"/> + <h:outputText value="#{moderator.forum.name}"/> + </h:outputLink> + </span> + </td> + </tr> + </table> + + <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> + <tr> + <td class="catHead" colspan="5" align="center" height="28"> + <span class="cattitle">${resource.Mod_CP}</span> + </td> + </tr> + <tr> + <td class="spaceRow" colspan="5" align="center"> + <span class="gensmall">${resource.Mod_CP_explain}</span> + </td> + </tr> + <tr> + <th width="4%" class="thLeft" nowrap="nowrap">&nbsp;</th> + <th nowrap="nowrap">&nbsp;${resource.Topics}&nbsp;</th> + <th width="8%" nowrap="nowrap">&nbsp;${resource.Replies}&nbsp;</th> + <th width="17%" nowrap="nowrap">&nbsp;${resource.Last_Post}&nbsp;</th> + <th width="5%" class="thRight" nowrap="nowrap">&nbsp;${resource.Select}&nbsp;</th> + </tr> + <c:forEach items="#{moderator.forum.topics}" var="topicrow"> + <tr> + <td class="row1" align="center" valign="middle"> + <img src="#{forums:themeURL('resourceFolderURL')}" + width="19" + height="18" + alt="${resource.Topic_Moved}" + title="${resource.Topic_Moved}"/> + </td> + <td class="row1"> + &nbsp; + <!-- TODO: NEEDS SUPPORT OF EXECUTING THEME METHODS + <span class="topictitle">${n:out("topicrow.TOPIC_TYPE")} + --> + <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" styleClass="topictitle"> + <f:param name="t" value="${topicrow.id}"/> + <h:outputText value="${topicrow.subject}"/> + </h:outputLink> + + <!-- TODO: LOOK ABOVE </span> --> + </td> + <td class="row2" align="center" valign="middle"><span + class="postdetails">${topicrow.replies}</span></td> + <td class="row1" align="center" valign="middle"><span + class="postdetails">${topicrow.lastPostDate}</span></td> + <td class="row2" align="center" valign="middle"> + <h:selectBooleanCheckbox value="#{moderator.checkboxes[topicrow.id]}" /> + </td> + </tr> + </c:forEach> + <tr align="right"> + <td class="catBottom" colspan="5" height="29"> + + <!-- TODO: IT IS PROBABLY USELESS IN JSF IMPLEMENTATION SO IT WILL BE DELETED + ${n:out("S_HIDDEN_FIELDS")} + --> + + <h:commandButton action="#{moderator.deleteTopic}" class="liteoption" value="${resource.Delete}"> + <f:param name="f" value="#{forum.forum.id}"/> + </h:commandButton> + &nbsp; + <h:commandButton action="#{moderator.moveTopic}" class="liteoption" value="${resource.Move}"> + <f:param name="f" value="#{forum.forum.id}"/> + </h:commandButton> + &nbsp; + <h:commandButton action="#{moderator.lockTopic}" class="liteoption" value="${resource.Lock}"> + <f:param name="f" value="#{forum.forum.id}"/> + </h:commandButton> + &nbsp; + <h:commandButton action="#{moderator.unlockTopic}" class="liteoption" value="${resource.Unlock}"> + <f:param name="f" value="#{forum.forum.id}"/> + </h:commandButton> + </td> + </tr> + </table> + <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2"> + <tr> + <td align="left" valign="middle"> + <span class="nav"> + <b>#{forum.pagination}</b> + </span> + </td> + <td align="right" valign="top" nowrap="nowrap"> + <span class="gensmall"></span> + <br/> + <span class="nav">#{forum.pageNumber}</span> + </td> + </tr> +</table> +</h:form> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td align="right"> + <ui:include src="/views/jumpbox.xhtml"/> + </td> + </tr> +</table> +</div> |