[gatein-commits] gatein SVN: r1931 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Mar 2 16:45:41 EST 2010


Author: julien_viet
Date: 2010-03-02 16:45:41 -0500 (Tue, 02 Mar 2010)
New Revision: 1931

Modified:
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
Log:
Use the page title in the <title> tag of the browser instead of the navigation label

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java	2010-03-02 17:32:51 UTC (rev 1930)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java	2010-03-02 21:45:41 UTC (rev 1931)
@@ -26,6 +26,10 @@
 import org.exoplatform.commons.utils.TableCharEncoder;
 import org.exoplatform.commons.utils.TextEncoder;
 import org.exoplatform.commons.utils.WriterPrinter;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.webui.portal.UIPortal;
 import org.exoplatform.portal.webui.util.Util;
 import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -184,14 +188,35 @@
    public String getTitle() throws Exception
    {
       String title = (String)request_.getAttribute(REQUEST_TITLE);
-      if (title != null)
+
+      //
+      if (title == null)
       {
-         return title;
+         UIPortal uiportal = Util.getUIPortal();
+
+         //
+         PageNode node = uiportal.getSelectedNode();
+         if (node != null)
+         {
+            ExoContainer container = getApplication().getApplicationServiceContainer();
+            container.getComponentInstanceOfType(UserPortalConfigService.class);
+            UserPortalConfigService configService = (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
+            Page page = configService.getPage(node.getPageReference(), getRemoteUser());
+
+            //
+            if (page != null)
+            {
+               title = page.getTitle();
+            }
+            else
+            {
+               title = node.getResolvedLabel();
+            }
+         }
       }
-      UIPortal uiportal = Util.getUIPortal();
-      String resolvedLabel =
-         (uiportal.getSelectedNode() == null) ? null : uiportal.getSelectedNode().getResolvedLabel();
-      return resolvedLabel;
+
+      //
+      return title;
    }
 
    public Orientation getOrientation()



More information about the gatein-commits mailing list