portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r834767 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main: java/org/apache/jetspeed/portlets/spaces/ webapp/WEB-INF/ webapp/WEB-INF/view/spaces/
Date Wed, 11 Nov 2009 04:53:02 GMT
Author: taylor
Date: Wed Nov 11 04:53:02 2009
New Revision: 834767

URL: http://svn.apache.org/viewvc?rev=834767&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-1080

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
  (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp
  (with props)
Removed:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesNavigator.java
Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/JetspeedNavigator.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java?rev=834767&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
Wed Nov 11 04:53:02 2009
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.spaces;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.jetspeed.CommonPortletServices;
+import org.apache.jetspeed.administration.PortalAdministration;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.document.Node;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.spaces.Spaces;
+import org.apache.portals.bridges.common.GenericServletPortlet;
+
+/**
+ * Jetspeed Breadcrumb Menu
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class BreadcrumbMenu extends GenericServletPortlet
+{
+    private Spaces spacesService;
+    private PortalAdministration admin;
+    protected PageManager pageManager;    
+
+    public void init(PortletConfig config) throws PortletException
+    {
+        super.init(config);
+        PortletContext context = getPortletContext();
+        spacesService = (Spaces) context.getAttribute(CommonPortletServices.CPS_SPACES_SERVICE);
+        if (spacesService == null)
+                throw new PortletException(
+                        "Could not get instance of portal spaces service component");
+        admin = (PortalAdministration) getPortletContext().getAttribute(
+                CommonPortletServices.CPS_PORTAL_ADMINISTRATION);
+        if (null == admin) { throw new PortletException(
+                "Failed to find the Portal Administration on portlet initialization"); }
+        pageManager = (PageManager)context.getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
+        if (null == pageManager)
+        {
+            throw new PortletException("Failed to find the Page Manager on portlet initialization");
+        }                       
+    }
+
+    public void doView(RenderRequest request, RenderResponse response)
+            throws PortletException, IOException
+    {    
+        RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
+        Stack<BreadcrumbMenuItem> stack = new Stack<BreadcrumbMenuItem>();
+        Node node = rc.getPage().getParent();
+        while (node != null)
+        {
+            stack.push(new BreadcrumbMenuItem(node.getTitle(), admin.getPortalURL(request,
response, node.getPath())));
+            node = node.getParent();
+        } 
+        List<BreadcrumbMenuItem> breadcrumbs = new LinkedList<BreadcrumbMenuItem>();
+        while (!stack.empty())
+        {
+            breadcrumbs.add(stack.pop());
+        }
+        breadcrumbs.add(new BreadcrumbMenuItem(rc.getPage().getTitle(), admin.getPortalURL(request,
response, rc.getPage().getPath())));
+        request.setAttribute("breadcrumbs", breadcrumbs);
+        try
+        {
+            super.doView(request, response);
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }
+
+    public class BreadcrumbMenuItem implements Serializable
+    {
+        private static final long serialVersionUID = 1L;
+        private String title;
+        private String path;
+        
+        public BreadcrumbMenuItem(String title, String path)
+        {
+            this.title = title;
+            this.path = path;
+        }
+        
+        public String getTitle()
+        {
+            return title;
+        }
+        
+        public String getPath()
+        {
+            return path;
+        }
+    }
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/JetspeedNavigator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/JetspeedNavigator.java?rev=834767&r1=834766&r2=834767&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/JetspeedNavigator.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/JetspeedNavigator.java
Wed Nov 11 04:53:02 2009
@@ -31,11 +31,8 @@
 
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.administration.PortalAdministration;
-import org.apache.jetspeed.om.folder.Folder;
-import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
-import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.spaces.Space;
 import org.apache.jetspeed.spaces.Spaces;
 import org.apache.portals.bridges.common.GenericServletPortlet;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml?rev=834767&r1=834766&r2=834767&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml Wed
Nov 11 04:53:02 2009
@@ -2247,10 +2247,6 @@
       <name>ViewPage</name>
       <value>/WEB-INF/view/spaces/page-navigator.jsp</value>
     </init-param>
-    <init-param>
-      <name>portlet-icon</name>
-      <value>lock.png</value>
-    </init-param>                        
     <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
@@ -2264,6 +2260,28 @@
       <keywords>admin,spaces,space,navigator,pages,nav</keywords>           
            
     </portlet-info>
   </portlet>
+
+   <portlet id="BreadcrumbMenu">
+    <description>Jetspeed Breadcrumb Menu widget</description>
+    <portlet-name>BreadcrumbMenu</portlet-name>
+    <display-name>Breadcrumb Menu</display-name>
+    <portlet-class>org.apache.jetspeed.portlets.spaces.BreadcrumbMenu</portlet-class>
+    <init-param>
+      <name>ViewPage</name>
+      <value>/WEB-INF/view/spaces/breadcrumbs.jsp</value>
+    </init-param>
+    <expiration-cache>0</expiration-cache>
+    <supports>
+      <mime-type>text/html</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <portlet-info>
+      <title>Breadcrumb Menu</title>
+      <short-title>Breadcrumb</short-title>
+      <keywords>admin,breadcrumb,menu,nav</keywords>                        
+    </portlet-info>
+  </portlet>
       
   <custom-portlet-mode>
     <description>a Custom Edit_defaults Mode</description>            

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp?rev=834767&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp
Wed Nov 11 04:53:02 2009
@@ -0,0 +1,38 @@
+<%--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+--%>
+<%@page import="java.util.List"%>
+<%@page import="org.apache.jetspeed.page.document.Node"%>
+<%@page import="org.apache.jetspeed.portlets.spaces.BreadcrumbMenu.BreadcrumbMenuItem"
%>
+<%@ page contentType="text/html" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+<%
+List<BreadcrumbMenuItem> menus = (List<BreadcrumbMenuItem>)renderRequest.getAttribute("breadcrumbs");
+int count = 0;
+
+String separator = "";
+for (BreadcrumbMenuItem item : menus)
+{
+	if (count == 1)
+	    separator = "> ";
+%>     
+<%=separator%><a href="<%=item.getPath()%>"><%=item.getTitle() %></a>
+<%
+	count++;
+}
+%>

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/breadcrumbs.jsp
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message