[gatein-commits] gatein SVN: r1141 - in portal/trunk: component/dashboard/src/main/resources/groovy/dashboard/webui/component and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Dec 24 05:09:43 EST 2009


Author: liem_nguyen
Date: 2009-12-24 05:09:43 -0500 (Thu, 24 Dec 2009)
New Revision: 1141

Modified:
   portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
   portal/trunk/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl
   portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
   portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
   portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
Log:
GTNPORTAL-416 Fix for Page Management, Dashboard, Group Navigation 

Modified: portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
--- portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java	2009-12-24 10:09:43 UTC (rev 1141)
@@ -30,8 +30,6 @@
 import org.exoplatform.portal.webui.application.UIPortlet;
 import org.exoplatform.portal.webui.container.UIContainer;
 import org.exoplatform.portal.webui.util.PortalDataMapper;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
 import org.exoplatform.web.application.ApplicationMessage;
 import org.exoplatform.web.application.RequestContext;
 import org.exoplatform.webui.application.WebuiRequestContext;

Modified: portal/trunk/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl
===================================================================
--- portal/trunk/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl	2009-12-24 10:09:43 UTC (rev 1141)
@@ -13,7 +13,7 @@
 <div id="$uicomponent.id" class="UIDashboard">
 	<div class="DashboardContainer <%=maxiGadget == null ? "" : "Maximized"%>">
 	<%
-		if(maxiGadget == null) {
+		if(maxiGadget == null || !maxiGadget.isRendered()) {
 			uicomponent.renderChildren(); 
 	%>
 			<div class="ClearLeft"><span></span></div>

Modified: portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
--- portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java	2009-12-24 10:09:43 UTC (rev 1141)
@@ -155,38 +155,53 @@
       try
       {
          List<PageNode> nodes = pageNavigation.getNodes();
-         PageNode parentNode = null;
-         List<PageNode> selectedPath = uiPortal.getSelectedPaths();
-         if (selectedPath != null && selectedPath.size() > 1)
-         {
-            parentNode = selectedPath.get(selectedPath.size() - 2);
-            nodes = parentNode.getChildren();
-         }
-         if (parentNode == null && nodes.size() < 2)
-         {
-            return null; // At the moment, we prevent user from deleting all the dashboard
-         }
          PageNode tobeRemoved = nodes.get(nodeIndex);
          PageNode selectedNode = uiPortal.getSelectedNode();
-
-         nodes.remove(nodeIndex);
-
-         String pageRef = tobeRemoved.getPageReference();
-         if (pageRef != null && pageRef.length() > 0)
+         
+         // Refresh Node List to prevent session conflict
+         nodes.clear();
+         PageNavigation updateNav = configService.getPageNavigation(pageNavigation.getOwnerType(), pageNavigation.getOwnerId());
+         int count = 0;
+         for (PageNode pageNode : updateNav.getNodes())
          {
-            configService.remove(configService.getPage(pageRef));
+            nodes.add(pageNode);
+            if (pageNode.getUri().equals(tobeRemoved.getUri())) {
+               nodeIndex = count;
+               tobeRemoved = pageNode;
+            }
+            if (pageNode.getUri().equals(selectedNode.getUri())) {
+               selectedNode = pageNode;
+            }
+            count ++;
          }
-
+         
          if (tobeRemoved.getUri().equals(selectedNode.getUri()))
          {
             selectedNode = nodes.get(Math.max(0, nodeIndex - 1));
+            
+         } else if (!nodes.contains(selectedNode)) {
+            selectedNode = nodes.get(0);
+         }
+         
+         if (nodes.size() >= 2)
+         {            
+            nodes.remove(tobeRemoved);
+            String pageRef = tobeRemoved.getPageReference();
+            if (pageRef != null && pageRef.length() > 0)
+            {
+               Page page = configService.getPage(pageRef);
+               if (page != null)
+                  configService.remove(page);
+            }
+            
             uiPortal.setSelectedNode(selectedNode);
             configService.update(pageNavigation);
-            return selectedNode;
+         } else {
+            getAncestorOfType(UIApplication.class).addMessage(
+               new ApplicationMessage("UITabPaneDashboard.msg.cannotDeleteLastTab", null));
          }
-
-         configService.update(pageNavigation);
-         return null; //Return null as there is no need to switch to new node
+         
+         return selectedNode;
       }
       catch (Exception ex)
       {
@@ -364,17 +379,7 @@
       public void execute(Event<UITabPaneDashboard> event) throws Exception
       {
          UITabPaneDashboard source = event.getSource();
-         WebuiRequestContext context = event.getRequestContext();
-         List<PageNode> path = Util.getUIPortal().getSelectedPaths();
-         boolean isRoot = true;
-         if (path != null && path.size() > 1)
-            isRoot = false;
-         if (isRoot && source.getCurrentNumberOfTabs() == 1)
-         {
-            source.getAncestorOfType(UIApplication.class).addMessage(
-               new ApplicationMessage("UITabPaneDashboard.msg.cannotDeleteLastTab", null));
-            return;
-         }
+         WebuiRequestContext context = event.getRequestContext();         
          int removedNodeIndex = Integer.parseInt(context.getRequestParameter(UIComponent.OBJECTID));
          PageNode selectedNode = source.removePageNode(removedNodeIndex);
 

Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java	2009-12-24 10:09:43 UTC (rev 1141)
@@ -44,12 +44,11 @@
 import org.exoplatform.webui.core.UIContainer;
 import org.exoplatform.webui.core.UIPopupWindow;
 import org.exoplatform.webui.core.UIRepeater;
-import org.exoplatform.webui.core.UIRightClickPopupMenu;
 import org.exoplatform.webui.core.UIVirtualList;
 import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
 import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.Event.Phase;
 import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.event.Event.Phase;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -189,7 +188,7 @@
 
          if (!userACL.hasEditPermission(navigation))
          {
-            uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.notUrl", null));
+            uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.Invalid-editPermission", null));
             return;
          }
 
@@ -197,7 +196,7 @@
          DataStorage service = uicomp.getApplicationComponent(DataStorage.class);
          if (service.getPageNavigation(navigation.getOwnerType(), navigation.getOwnerId()) == null)
          {
-            uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.notUrl", null));
+            uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist", null));
             return;
          }
 
@@ -273,7 +272,7 @@
 
          if (!userACL.hasEditPermission(navigation))
          {
-            uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.notUrl", null));
+            uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.Invalid-editPermission", null));
             return;
          }
 
@@ -281,7 +280,7 @@
          DataStorage service = uicomp.getApplicationComponent(DataStorage.class);
          if (service.getPageNavigation(navigation.getOwnerType(), navigation.getOwnerId()) == null)
          {
-            uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.notUrl", null));
+            uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist", null));
             return;
          }
 

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties	2009-12-24 10:09:43 UTC (rev 1141)
@@ -1359,7 +1359,10 @@
   ############################################################################
 	
 UIGroupNavigationManagement.Action.Add=Add Navigation
-UIGroupNavigationManagement.Delete.Confirm=Are you sure to delete this navigation? 
+UIGroupNavigationManagement.Delete.Confirm=Are you sure to delete this navigation?
+UIGroupNavigationManagement.msg.Invalid-deletePermission=User doesn't have permission to delete this navigation
+UIGroupNavigationManagement.msg.navigation-not-exist=The navigation is not existed or may be deleted 
+UIGroupNavigationManagement.msg.Invalid-editPermission=User doesn't have permission to edit this navigation
 
   ############################################################################
   #		           org.exoplatform.navigation.webui.component.UIGroupNavigationManagement         #

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java	2009-12-24 10:09:43 UTC (rev 1141)
@@ -212,18 +212,26 @@
          return null;
       }
    }
-
+   
    @Override
-   public void processRender(WebuiRequestContext context) throws Exception
+   public boolean isRendered()
    {
-      if (getApplication() == null)
+      DataStorage service = getApplicationComponent(DataStorage.class);      
+      try
       {
-         this.setRendered(false);
-         return;
+         service.load(state, ApplicationType.GADGET);
+         if (getApplication() == null)
+         {
+            throw new Exception("ApplicationNotExisted");
+         }
       }
-      super.processRender(context);
+      catch (Exception e)
+      {         
+         return false;
+      }
+      return super.isRendered();
    }
-
+   
    /**
     * Gets GadgetApplication by GadgedRegistryService
     * 

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java	2009-12-24 03:31:15 UTC (rev 1140)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java	2009-12-24 10:09:43 UTC (rev 1141)
@@ -23,7 +23,6 @@
 import org.exoplatform.portal.config.UserPortalConfig;
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.config.model.PortalProperties;
 import org.exoplatform.portal.pom.data.ModelChange;



More information about the gatein-commits mailing list