[jboss-svn-commits] JBoss Portal SVN: r5343 - in trunk: core/src/bin/portal-core-war/layouts/generic core/src/bin/portal-core-war/themes/renaissance core/src/main/org/jboss/portal/core/portlet/catalog core/src/resources/portal-core-sar/conf/data core/src/resources/portal-core-war/WEB-INF theme/src/main/org/jboss/portal/theme/impl/render/div theme/src/main/org/jboss/portal/theme/render/region

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 6 16:29:22 EDT 2006


Author: roy.russo at jboss.com
Date: 2006-10-06 16:29:17 -0400 (Fri, 06 Oct 2006)
New Revision: 5343

Added:
   trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java
Removed:
   trunk/theme/src/main/org/jboss/portal/theme/render/region/UtilityNavigation.java
Modified:
   trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp
   trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
   trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
   trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
   trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
   trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java
Log:
JBPORTAL-1070 - Convert Dashboard navigation to portlet

Modified: trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp
===================================================================
--- trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp	2006-10-06 20:29:17 UTC (rev 5343)
@@ -25,7 +25,7 @@
                <td align="center" valign="top" id="header">
 
                   <!-- Utility controls -->
-                  <p:region regionName='UtilityNavigation' regionID='UtilityNavigation'/>
+                  <p:region regionName='dashboardnav' regionID='dashboardnav'/>
 
                   <!-- navigation tabs and such -->
                   <p:region regionName='navigation' regionID='navigation'/>

Modified: trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css	2006-10-06 20:29:17 UTC (rev 5343)
@@ -12,11 +12,11 @@
    font-size: 12px;
 }
 
-   /*****************
-   * Portal Header  *
-   ******************/
+/*****************
+* Portal Header  *
+******************/
 
-   /* spacer to keep header at certain width regardless of display size
+/* spacer to keep header at certain width regardless of display size
 done to avoid overlapping of tab navigation in header */
 #spacer {
    width: 770px;
@@ -57,9 +57,9 @@
 
 }
 
-   /************************
-   * Portal Layout Regions *
-   *************************/
+/************************
+* Portal Layout Regions *
+*************************/
 
 /* wrapper for entire portal. starts/ends after/before body tag */
 #portal-container {
@@ -202,9 +202,9 @@
    z-index: -1;
 }
 
-   /* used to clear float in regionA,B,C divs so that
+/* used to clear float in regionA,B,C divs so that
 footer spans bottom of page */
-   /* used to clear float in regionA,B,C divs so that
+/* used to clear float in regionA,B,C divs so that
 footer spans bottom of page */
 hr.cleaner {
    clear: both;
@@ -215,9 +215,9 @@
    visibility: hidden;
 }
 
-   /***************************
-   *  Primary Navigation (Tabbed Nav)  *
-   *****************************/
+/***************************
+*  Primary Navigation (Tabbed Nav)  *
+*****************************/
 
 UL#tabsHeader {
    margin: 0;
@@ -366,23 +366,23 @@
 
 /* fixes IE6 win hack */
 
-   /***************************
-   *  Utility Navigation  *
-   *****************************/
+/***************************
+*  Utility Navigation  *
+*****************************/
 
-#UtilityNavigation {
+#dashboardnav {
    float: right;
    font-size: 10px;
    padding: 6px 12px 0px 0px;
-   color: #000000;
+   color: #FFFFFF;
    z-index: 20;
 }
 
-#UtilityNavigation a {
+#dashboardnav a {
    color: #FFFFFF;
 }
 
-#UtilityNavigation .addcontent {
+#dashboardnav .addcontent {
    background-image: url( images/ico_addcontent.gif );
    background-repeat: no-repeat;
    background-position: left;
@@ -391,9 +391,9 @@
    padding-left: 16px;
 }
 
-   /****************************
-   * Portlet Container Windows *
-   *****************************/
+/****************************
+* Portlet Container Windows *
+*****************************/
 
 .portlet-container {
 /*	margin: 10px;*/
@@ -420,9 +420,9 @@
    padding-bottom: 6px;
 }
 
-   /* ------ NOT CURRENTLY IN USE FOR NEW 2.6 FUNCTIONALITY -------
-   .portlet-titlebar-decoration {}
-   */
+/* ------ NOT CURRENTLY IN USE FOR NEW 2.6 FUNCTIONALITY -------
+.portlet-titlebar-decoration {}
+*/
 
 .portlet-titlebar-left {
    background-image: url( images/portlet-top-left.gif );
@@ -544,9 +544,9 @@
    */
 }
 
-   /***********************
-   * Portlet Window Modes *
-   ************************/
+/***********************
+* Portlet Window Modes *
+************************/
 .portlet-mode-maximized {
    background-image: url( images/ico_16_maximize.gif );
    background-repeat: no-repeat;
@@ -646,9 +646,9 @@
    cursor: pointer;
 }
 
-   /**********************
-   * Copyright Selectors *
-   ***********************/
+/**********************
+* Copyright Selectors *
+***********************/
 .portal-copyright {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
@@ -669,9 +669,9 @@
    content: "Theme by JBoss.org Design";
 }
 
-   /*************
-   *  Elements  *
-   **************/
+/*************
+*  Elements  *
+**************/
 a {
    color: #5078aa;
    text-decoration: none;
@@ -714,11 +714,11 @@
 LEGEND {
 }
 
-   /********
-   * FONTS *
-   *********/
+/********
+* FONTS *
+*********/
 
-   /* Font attributes for the normal  fragment font.
+/* Font attributes for the normal  fragment font.
 Used for the display of non-accentuated information */
 .portlet-font {
    color: #000000;
@@ -733,9 +733,9 @@
    font-size: 12px;
 }
 
-   /********
-   * FORMS *
-   *********/
+/********
+* FORMS *
+*********/
 .portlet-form-label {
    color: #336699;
    text-decoration: none;
@@ -768,7 +768,7 @@
 
 }
 
-   /* Text that appears beside a "standard" icon (e.g Ok, or Cancel)
+/* Text that appears beside a "standard" icon (e.g Ok, or Cancel)
 not sure if we need this one?.. */
 .portlet-dlg-icon-label {
 
@@ -789,9 +789,9 @@
    color: #000; /*margin-top: 10px;*/
 }
 
-   /********
-   * LINKS *
-   *********/
+/********
+* LINKS *
+*********/
 
 .portal-links:link {
    font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
@@ -825,9 +825,9 @@
    text-decoration: none;
 }
 
-   /***********
-   * MESSAGES *
-   ************/
+/***********
+* MESSAGES *
+************/
 
 /* Status of the current operation. */
 .portlet-msg-status {
@@ -869,9 +869,9 @@
    color: #359630;
 }
 
-   /***********
-   * SECTIONS *
-   ************/
+/***********
+* SECTIONS *
+************/
 
 /* Table or section header */
 .portlet-section-header {
@@ -904,16 +904,16 @@
    font-size: 11px;
 }
 
-   /* Text that belongs to the table but does not fall in one of the other categories
+/* Text that belongs to the table but does not fall in one of the other categories
 (e.g. explanatory or help text that is associated with the section. */
 .portlet-section-text {
    font-size: 12px;
    font-style: italic;
 }
 
-   /*******************
-   * Table Selectors  *
-   ********************/
+/*******************
+* Table Selectors  *
+********************/
 /* Table header */
 .portlet-table-header {
    font-weight: bold;
@@ -961,9 +961,9 @@
    font-style: italic;
 }
 
-   /********
-   * MENUS *
-   *********/
+/********
+* MENUS *
+*********/
 
 /*General menu settings such as background color, margins, etc. */
 .portlet-menu {
@@ -1049,9 +1049,9 @@
 .portlet-tab-area {
 }
 
-   /*****************
-   * AJAX Selectors *
-   *****************/
+/*****************
+* AJAX Selectors *
+*****************/
 
 .handle {
    cursor: move;

Added: trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java	2006-10-06 20:29:17 UTC (rev 5343)
@@ -0,0 +1,107 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.portal.core.portlet.catalog;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.core.api.Navigation;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ */
+
+public class DashboardNavPortlet extends JBossPortlet
+{
+   public void init() throws PortletException
+   {
+   }
+
+   /**
+    * Renders dashboard-related links
+    *
+    * @param renderRequest
+    * @param renderResponse
+    * @throws IOException
+    * @throws PortletException
+    */
+   public void doView(JBossRenderRequest renderRequest, JBossRenderResponse renderResponse) throws IOException, PortletException
+   {
+      renderResponse.setContentType("text/html");
+      StringBuffer sb = new StringBuffer();
+      PrintWriter writer = renderResponse.getWriter();
+      if(renderRequest.getUser() == null)
+      {
+         PortalNode currentNode = Navigation.getCurrentNode();
+         PortalNodeURL loginURL = renderResponse.createRenderURL(currentNode);
+         loginURL.setAuthenticated(Boolean.TRUE);
+         sb.append("<a href=\"").append(loginURL).append("\">Login</a>");
+      }
+      else
+      {
+         // TODO: add checks for shared/private pages
+         PortletURL logoutURL = renderResponse.createActionURL();
+         logoutURL.setParameter("op", "userLogout");
+
+         //sb.append("<a href=\"#\" class=\"addcontent\">Add Content</a>");
+         sb.append("Logged in as: ").append(renderRequest.getUser().getUserName());
+         sb.append("<br/><br/>");
+         sb.append("<a href=\"#\">Add Content</a>");
+         sb.append("&nbsp;&nbsp;|&nbsp;&nbsp;");
+         sb.append("<a href=\"#\">Edit Page</a>");
+         sb.append("&nbsp;&nbsp;|&nbsp;&nbsp;");
+         sb.append("<a href=\"#\">Add Page</a>");
+         sb.append("&nbsp;&nbsp;|&nbsp;&nbsp;");
+         sb.append("<a href=\"").append(logoutURL).append("\">Logout</a>");
+
+      }
+      writer.write(sb.toString());
+   }
+
+   /**
+    * @param req
+    * @param resp
+    * @throws IOException
+    */
+   public void userLogout(JBossActionRequest req, JBossActionResponse resp) throws IOException
+   {
+      String locationURL = req.getParameter("locationURL");
+      if(locationURL != null)
+      {
+         resp.signOut(locationURL);
+      }
+      else
+      {
+         resp.signOut();
+      }
+   }
+}

Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml	2006-10-06 20:29:17 UTC (rev 5343)
@@ -79,6 +79,26 @@
                </properties>
             </window>
             <window>
+               <window-name>DashboardNavPortletWindow</window-name>
+               <instance-ref>DashboardNavPortletInstance</instance-ref>
+               <region>dashboardnav</region>
+               <height>0</height>
+               <properties>
+                  <property>
+                     <name>theme.windowRendererId</name>
+                     <value>emptyRenderer</value>
+                  </property>
+                  <property>
+                     <name>theme.decorationRendererId</name>
+                     <value>emptyRenderer</value>
+                  </property>
+                  <property>
+                     <name>theme.portletRendererId</name>
+                     <value>emptyRenderer</value>
+                  </property>
+               </properties>
+            </window>
+            <window>
                <window-name>JSPPortletWindow</window-name>
                <instance-ref>JSPPortletInstance</instance-ref>
                <region>left</region>

Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml	2006-10-06 20:29:17 UTC (rev 5343)
@@ -8,6 +8,12 @@
    </deployment>
    <deployment>
       <instance>
+         <instance-id>DashboardNavPortletInstance</instance-id>
+         <portlet-ref>DashboardNavPortlet</portlet-ref>
+      </instance>
+   </deployment>
+   <deployment>
+      <instance>
          <instance-id>UserPortletInstance</instance-id>
          <portlet-ref>UserPortlet</portlet-ref>
       </instance>

Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml	2006-10-06 20:29:17 UTC (rev 5343)
@@ -177,6 +177,24 @@
          </preference>
       </portlet-preferences>
    </portlet>
+   <portlet>
+      <description>Portlet providing dashboard navigation</description>
+      <portlet-name>DashboardNavPortlet</portlet-name>
+      <display-name>Dashboard Navigation Portlet</display-name>
+      <portlet-class>org.jboss.portal.core.portlet.catalog.DashboardNavPortlet</portlet-class>
+      <supports>
+         <mime-type>text/html</mime-type>
+         <portlet-mode>VIEW</portlet-mode>
+      </supports>
+      <supported-locale>en</supported-locale>
+      <supported-locale>fr</supported-locale>
+      <supported-locale>es</supported-locale>
+      <resource-bundle>Resource</resource-bundle>
+      <portlet-info>
+         <title></title>
+      </portlet-info>
+   </portlet>
+
    <user-attribute>
       <name>user.name.nickName</name>
    </user-attribute>

Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java	2006-10-06 20:29:17 UTC (rev 5343)
@@ -79,7 +79,7 @@
          }
          catch(Exception e)
          {
-            log.info("No region class found for: " + "org.jboss.portal.theme.render.region." + region.getId());
+            log.debug("No region class found for: " + "org.jboss.portal.theme.render.region." + region.getId());
          }
       }
       else // process window fragments

Deleted: trunk/theme/src/main/org/jboss/portal/theme/render/region/UtilityNavigation.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/region/UtilityNavigation.java	2006-10-06 17:31:22 UTC (rev 5342)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/region/UtilityNavigation.java	2006-10-06 20:29:17 UTC (rev 5343)
@@ -1,57 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, 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.portal.theme.render.region;
-
-import org.jboss.portal.theme.render.RenderContext;
-
-/**
- * This is a static div region, that is not bound to a window.
- *
- * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
- */
-
-public class UtilityNavigation
-{
-   /**
-    * Returns output for rendering in region tag.
-    *
-    * @param renderContext
-    * @return output for rendering
-    */
-   public String render(RenderContext renderContext)
-   {
-      if(renderContext.getRequest().getUser() != null)
-      {
-         return "<a href=\"#\" class=\"addcontent\">Add Content</a>" +
-                "&nbsp;&nbsp;|&nbsp;&nbsp;" +
-                "<a href=\"#\">Edit Page</a>" +
-                "&nbsp;&nbsp;|&nbsp;&nbsp;" +
-                "<a href=\"#\" class=\"addcontent\">Add Page</a>";
-      }
-      else
-      {
-         //URLFactory urlFactory = new URLFactory();
-         return "<a href=\"/portal/login.jsp\" class=\"addcontent\">Login</a>";
-      }
-   }
-}




More information about the jboss-svn-commits mailing list