You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "David H. DeWolf" <dd...@apache.org> on 2006/12/14 14:12:48 UTC
Re: svn commit: r486914 - in /portals/pluto/trunk: pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/
pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/
pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/
Good feedback, thanks. I'll take a look at the NullPointer and see if I
can duplicate. Can you add a jira issue for it?
Thanks,
David
CDoremus@hannaford.com wrote:
> Hi David,
> I checked out the Pluto Page Administrator and it works very well. I
> have a couple of comments:
> 1. Since its operation is not intiutive, can you add a help mode page to
> this portlet explaining how to use it?
> 2. I added an 'Upload and deploy new portlet war' link to the bottom of
> the Page Administrator page that redirects to the Tomcat manager (URL is
> configurable via a properties file so it can be changed when Pluto is
> deployed on another app server.). But when I tried to deploy a war via
> the manager app (the war included a proper context.xml in META-INF), and
> added it to a page using the Page Administrator, a NPE was thrown
> because of a null WindowConfig object. It did work when I stopped the
> server and added a portlet-app record to pluto-portal-driver-config.xml
> for the portlet I just deployed. I think it would be useful to have this
> link and I can commit it, but we need to make sure this is explained in
> the help file (BTW, for tomcat, you need to be in the manager role to be
> able to properly jump to the manager page). Here is what needs to be
> added to the bottom of view.jsp in
> <pluto.home>/webapps/pluto/WEB-INF/fragments/admin/page/
>
> <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
> <fmt:bundle basename="AdminPortlet">
> <fmt:message key="appserver.deployer.url" var="deployerurl"/>
> </fmt:bundle>
> <div><a href='<c:out value="${deployerurl}"/>' target="_blank">Upload
> and deploy a new portlet war</a></div>
> In addition, a AdminPortlet.properties file has to be deployed in the
> WEB-INF/classes directory with a record:
> #URL to the war deployer for this app server.
> appserver.deployer.url=/manager/html/
> Also, the tomcat-users.xml file in the conf directory needs to have
> tomcat included in the manager role like this:
> <user username="tomcat" password="tomcat" roles="tomcat,pluto,manager"/>
> Finally, there needs to be an explanation that a portlet-app record
> needs to be added to the config file in the help file for this portlet.
>
> Do you (and anyone else) also think this is useful or do you have any
> other suggestions along this line?
> /Craig
>
>
> -----ddewolf@apache.org wrote: -----
>
> To: pluto-scm@portals.apache.org
> From: ddewolf@apache.org
> Date: 12/13/2006 08:03PM
> Subject: svn commit: r486914 - in /portals/pluto/trunk:
> pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/
> pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/
> pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/
>
> Author: ddewolf
> Date: Wed Dec 13 17:03:38 2006
> New Revision: 486914
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=486914
> <http://svn.apache.org/viewvc?view=rev&rev=486914>
> Log:
> Finalizing remove portlet functionality in admin portlet
>
> Modified:
>
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/PageAdminPortlet.java
>
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java
>
> portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/view.jsp
>
> Modified:
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/PageAdminPortlet.java
> URL:
> http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/PageAdminPortlet.java?view=diff&rev=486914&r1=486913&r2=486914
> <http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/PageAdminPortlet.java?view=diff&rev=486914&r1=486913&r2=486914>
> ==============================================================================
> ---
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/PageAdminPortlet.java
> (original)
> +++
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/portlets/PageAdminPortlet.java
> Wed Dec 13 17:03:38 2006
> @@ -17,20 +17,20 @@
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> -import org.apache.pluto.driver.config.DriverConfiguration;
> import org.apache.pluto.driver.AttributeKeys;
> +import org.apache.pluto.driver.config.DriverConfiguration;
> import org.apache.pluto.driver.services.portal.PageConfig;
> import org.apache.pluto.driver.services.portal.PortletWindowConfig;
>
> import javax.portlet.ActionRequest;
> import javax.portlet.ActionResponse;
> +import javax.portlet.PortletException;
> import javax.portlet.RenderRequest;
> import javax.portlet.RenderResponse;
> -import javax.portlet.PortletException;
> +import java.io.IOException;
> +import java.util.ArrayList;
> import java.util.Collection;
> import java.util.Iterator;
> -import java.util.ArrayList;
> -import java.io.IOException;
>
>
> public class PageAdminPortlet extends GenericPlutoPortlet {
> @@ -43,19 +43,44 @@
>
>
> public void processAction(ActionRequest request, ActionResponse
> response) {
> + String command = request.getParameter("command");
> + if("add".equalsIgnoreCase(command)) {
> + doAddPortlet(request);
> + }
> + else if ("remove".equalsIgnoreCase(command)) {
> + doRemovePortlet(request);
> + }
> + }
> +
> + public void doAddPortlet(ActionRequest request) {
> String page = request.getParameter("page");
> String applicationId = request.getParameter("applications");
> String portletId = request.getParameter("availablePortlets");
>
> - LOG.info("Request:
> Add[applicationId="+applicationId+":portletId="+portletId+"] to page
> '"+page+"'");
> + LOG.info("Request: Add [applicationId=" + applicationId +
> ":portletId=" + portletId + "] to page '" + page + "'");
> +
> + PageConfig config = getPageConfig(page);
> + config.addPortlet(applicationId, portletId);
> +
> + }
> +
> +
> + public void doRemovePortlet(ActionRequest request) {
> + String page = request.getParameter("page");
> + String portletId = request.getParameter("placedPortlets");
>
> - DriverConfiguration driverConfig =
> (DriverConfiguration)getPortletContext()
> + LOG.info("Request: Remove [portletId=" + portletId + "]
> from page '" + page + "'");
> +
> + PageConfig config = getPageConfig(page);
> + config.removePortlet(portletId);
> + }
> +
> + private PageConfig getPageConfig(String page) {
> + DriverConfiguration driverConfig = (DriverConfiguration)
> getPortletContext()
> .getAttribute(AttributeKeys.DRIVER_CONFIG);
>
> PageConfig config = driverConfig.getPageConfig(page);
> - config.addPortlet(applicationId, portletId);
> -
> - response.setRenderParameter("portlets", portletId);
> + return config;
> }
>
> public void doView(RenderRequest request, RenderResponse
> response) throws PortletException, IOException {
> @@ -81,11 +106,11 @@
>
> ArrayList list = new ArrayList();
> Iterator it = configuration.getPages().iterator();
> - while(it.hasNext()) {
> - PageConfig config = (PageConfig)it.next();
> + while (it.hasNext()) {
> + PageConfig config = (PageConfig) it.next();
> ArrayList portlets = new ArrayList();
> Iterator pids = config.getPortletIds().iterator();
> - while(pids.hasNext()) {
> + while (pids.hasNext()) {
> String pid = pids.next().toString();
> String name = PortletWindowConfig.parsePortletName(pid);
> portlets.add(new Placement(pid, name));
>
> Modified:
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java
> URL:
> http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java?view=diff&rev=486914&r1=486913&r2=486914
> <http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java?view=diff&rev=486914&r1=486913&r2=486914>
> ==============================================================================
> ---
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java
> (original)
> +++
> portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java
> Wed Dec 13 17:03:38 2006
> @@ -63,6 +63,10 @@
> PortletWindowConfig.createPortletId(contextPath,
> portletName));
> }
>
> + public void removePortlet(String portletId) {
> + portletIds.remove(portletId);
> + }
> +
> void setOrderNumber(int number) {
> this.orderNumber = number;
> }
>
> Modified:
> portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/view.jsp
> URL:
> http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/view.jsp?view=diff&rev=486914&r1=486913&r2=486914
> <http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/view.jsp?view=diff&rev=486914&r1=486913&r2=486914>
> ==============================================================================
> ---
> portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/view.jsp
> (original)
> +++
> portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/fragments/admin/page/view.jsp
> Wed Dec 13 17:03:38 2006
> @@ -45,10 +45,17 @@
> placePortletsSelect.options[i] = null;
> }
>
> + var disabled = select.value == 'Select. . .'
> +
> document.forms['adminForm'].elements['command'][0].disabled = disabled;
> +
> + if(disabled) {
> + return;
> + }
>
> for(var i=0;i<placedPortlets[select.value].length;i++) {
> placePortletsSelect[i] = new
> Option(placedPortlets[select.value][i][1],
> placedPortlets[select.value][i][0]);
> }
> +
> }
> </script>
>
> @@ -57,7 +64,7 @@
>
>
> <select name="page" onChange="doSwitchPage(this)">
> - <option>Select. . .</option>
> + <option value="Select. . .">Select. . .</option>
> <c:forEach items="${driverConfig.pages}" var="page">
> <option value="<c:out value="${page.name}"/>"><c:out
> value="${page.name}"/></option>
> </c:forEach>
> @@ -66,6 +73,10 @@
> <select name="placedPortlets" size="5">
>
> </select>
> +
> + <button name="command" disabled="true" value="remove">
> + Remove
> + </button>
> </p>
> </div>
>
> @@ -103,7 +114,7 @@
> }
>
> function doSwitchButton(select) {
> -
> document.forms['adminForm'].elements['submitButton'].disabled =
> (select.value == 'Select. . .' || select.disabled);
> +
> document.forms['adminForm'].elements['command'][1].disabled =
> (select.value == 'Select. . .' || select.disabled);
> }
> </script>
>
> @@ -118,7 +129,7 @@
>
> </select>
>
> - <button name="submitButton" disabled="true">
> + <button name="command" disabled="true" value="add">
> Add Portlet
> </button>
> </p>
>
>