[gatein-commits] gatein SVN: r7995 - in portal/trunk: portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Nov 7 03:48:21 EST 2011


Author: phuong_vu
Date: 2011-11-07 03:48:21 -0500 (Mon, 07 Nov 2011)
New Revision: 7995

Modified:
   portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
   portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
   portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
   portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
   portal/trunk/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
   portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js
   portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
Log:
GTNPORTAL-1927 Menu items for navigation nodes which don't lead to any page shouldn't be clickable

Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java	2011-11-07 08:48:21 UTC (rev 7995)
@@ -460,31 +460,31 @@
       }
    }
 
-   static public class EditPageNodeActionListener extends EventListener<UIRightClickPopupMenu>
+   static public class EditPageNodeActionListener extends BaseActionListener<UIRightClickPopupMenu>
    {
       public void execute(Event<UIRightClickPopupMenu> event) throws Exception
       {
-         // get nodeID
+         UIPortalApplication uiApp = Util.getUIPortalApplication();
+         UIRightClickPopupMenu popupMenu = event.getSource();
+         UINavigationNodeSelector uiNodeSelector = popupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+
          String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
-
-         // get UINavigationNodeSelector
-         UIRightClickPopupMenu uiPopupMenu = event.getSource();
-         UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
-
-         // get Selected Node
-         TreeNode selectedPageNode = uiNodeSelector.findNode(nodeID);
-
-         UIPortalApplication uiApp = Util.getUIPortalApplication();
-         if (selectedPageNode == null || selectedPageNode.getPageRef() == null)
+         TreeNode node = uiNodeSelector.findNode(nodeID);
+         try
          {
-            uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
+            node = rebaseNode(node, uiNodeSelector);
+            if (node == null) return;
+         }
+         catch (NavigationServiceException ex)
+         {
+            handleError(ex.getError(), uiNodeSelector);
             return;
-         }
+         }         
 
          UserPortalConfigService userService = uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);
 
          // get selected page
-         String pageId = selectedPageNode.getPageRef();
+         String pageId = node.getPageRef();
          Page selectPage = (pageId != null) ? userService.getPage(pageId) : null;
          if (selectPage != null)
          {
@@ -518,7 +518,7 @@
             UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();
 
             if (selectPage.getTitle() == null)
-               selectPage.setTitle(selectedPageNode.getLabel());
+               selectPage.setTitle(node.getLabel());
 
             // convert Page to UIPage
             PortalDataMapper.toUIPage(uiPage, selectPage);

Modified: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl	2011-11-07 08:48:21 UTC (rev 7995)
@@ -70,7 +70,7 @@
 						if(node.pageRef != null) {
 								print """<a class="ItemIcon $icon" href="$href" $title>$label</a>""";
 						} else {
-								print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
+								print """<a class="ItemIcon $icon" onclick='eXo.portal.UIPortalNavigation.cancelHideMenuContainer(event)' $title>$label</a>""";
 						}
 		if(hasChild) {
 			print """

Modified: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl	2011-11-07 08:48:21 UTC (rev 7995)
@@ -71,7 +71,7 @@
 						if(node.pageRef != null) {
 								print """<a class="ItemIcon $icon" href="$actionLink" $title>$label</a>""";
 						} else {
-								print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
+								print """<a class="ItemIcon $icon" onclick='eXo.portal.UIPortalNavigation.cancelHideMenuContainer(event)' $title>$label</a>""";
 						}
 		if(hasChild) {
 			print """

Modified: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl	2011-11-07 08:48:21 UTC (rev 7995)
@@ -108,7 +108,7 @@
 						if(node.pageRef != null) {
 								print """<a class="ItemIcon $icon" href="$href" $title>$label</a>""";
 						} else {
-								print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
+								print """<a class="ItemIcon $icon" onclick='eXo.portal.UIPortalNavigation.cancelHideMenuContainer(event)' $title>$label</a>""";
 						}
 		print """
 

Modified: portal/trunk/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
===================================================================
--- portal/trunk/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl	2011-11-07 08:48:21 UTC (rev 7995)
@@ -58,16 +58,21 @@
 			label = label.substring(0,37) + "...";
 		}
 					
-		def actionLink = "#";
+		print """
+		<li class="MenuItem $tabStyleNavigation $arrowIcon" title="$title" $getNodeURL>
+		""";
 		if(node.getPageRef() != null) {
 		    nodeURL.setNode(node);
 			nodeURL.setAjax(uicomponent.isUseAjax());
-			actionLink = nodeURL.toString();
-		} 
-		print """
-			<li class="MenuItem $tabStyleNavigation $arrowIcon" title="$title" $getNodeURL>
-				<a  class="ItemIcon $icon" href="$actionLink">$label</a>
-		""";
+			def actionLink = nodeURL.toString();
+			print """
+					<a  class="ItemIcon $icon" href="$actionLink">$label</a>
+			""";
+		} else {
+		   print """
+				<a  class="ItemIcon $icon" onclick='eXo.portal.UIPortalNavigation.cancelHideMenuContainer(event)'>$label</a>
+			""";
+		}
 		
 		if (node.getChildren().size() > 0) {
 			renderChildrenContainer(node, nodeURL);

Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js	2011-11-07 08:48:21 UTC (rev 7995)
@@ -291,7 +291,13 @@
   }
 };
 
-UIPortalNavigation.prototype.cancelHideMenuContainer = function() {
+UIPortalNavigation.prototype.cancelHideMenuContainer = function(evt) {
+  if (evt && evt.stopPropagation) {
+	  evt.stopPropagation();
+  } else if (window.event) {
+	  window.event.cancelBubble = true;
+  }
+	
   if (this.hideMenuTimeoutId) {
     window.clearTimeout(this.hideMenuTimeoutId) ;
   }

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	2011-11-07 08:02:35 UTC (rev 7994)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties	2011-11-07 08:48:21 UTC (rev 7995)
@@ -478,7 +478,7 @@
   #############################################################################
   
 UIPageNodeSelector.UIDropDown.title=Select Navigations
-UIPageNodeSelector.msg.notAvailable=The page of this node is not available.
+UIPageNodeSelector.msg.notAvailable=This node doesn't point to any page or the page has been deleted
 UIPageNodeSelector.msg.Invalid-editPermission=You have not the rights to edit this page
 UIPageNodeSelector.msg.deleteNav=You can not delete this page navigation.
 UIPageNodeSelector.msg.NoPageNavigation=You must create a navigation before you can use this function.



More information about the gatein-commits mailing list