<%-- 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 contentType="text/html" %> <%@ page import="java.util.Collection" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.Set" %> <%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="org.apache.commons.lang.StringEscapeUtils"%> <%@ page import="org.apache.jetspeed.JetspeedActions" %> <%@ page import="org.apache.jetspeed.ui.Jetui" %> <%@ page import="org.apache.jetspeed.ui.Toolbar" %> <%@ page import="org.apache.jetspeed.request.RequestContext" %> <%@ page import="org.apache.jetspeed.om.page.ContentFragment" %> <%@ page import="org.apache.jetspeed.om.page.ContentPage" %> <%@ page import="org.apache.jetspeed.portlets.layout.ColumnLayout" %> <%@ page import="org.apache.jetspeed.PortalReservedParameters" %> <%@ page import="org.apache.jetspeed.administration.PortalConfiguration" %> <%@ page import="org.apache.jetspeed.administration.PortalConfigurationConstants" %> <%@ page import="org.apache.jetspeed.decoration.Decoration" %> <% Jetui jetui = (Jetui)request.getAttribute("jetui"); PortalConfiguration pc = jetui.getPortalConfiguration(); RequestContext rc = (RequestContext)request.getAttribute(RequestContext.REQUEST_PORTALENV); String userNameFamily = null; String userNameGiven = null; if (request.getUserPrincipal() != null) { userNameFamily = jetui.getUserAttribute(rc,"user.name.family",request.getUserPrincipal().getName()); userNameGiven = jetui.getUserAttribute(rc,"user.name.given",""); } ContentPage portalPage = rc.getPage(); ContentFragment maximized = (ContentFragment)request.getAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE); ColumnLayout columnLayout = (ColumnLayout)request.getAttribute("columnLayout"); ContentFragment jstbLeft = jetui.getContentFragment("jstbLeft", rc); ContentFragment jstbRight = jetui.getContentFragment("jstbRight", rc); String breadcrumbs = jetui.renderPortletWindow("jsBreadcrumbMenu", "j2-admin::BreadcrumbMenu", rc); String encoding = "text/html"; if (response.getCharacterEncoding() != null) { encoding += "; charset=" + response.getCharacterEncoding(); } String baseUrl = jetui.getBaseURL(rc); String pageDec = jetui.getTheme(rc).getPageLayoutDecoration().getName(); boolean inheritDec = "inherit".equals(pageDec); String portalContextPath = request.getContextPath(); String portalServletPath = request.getServletPath(); String portalPagePath = rc.getPortalURL().getPath(); if (portalPagePath == null || "".equals(portalPagePath)) { portalPagePath = "/"; } // Toolbars Toolbar ltb = jetui.getToolbar(rc, Toolbar.Orientation.LEFT); Toolbar rtb = jetui.getToolbar(rc, Toolbar.Orientation.RIGHT); String leftDisplayState = "display: block"; String leftToggleClass = "jstbToggle1"; String rightDisplayState = "display: block"; String rightToggleClass = "jstbToggle2"; if (ltb != null) { if (ltb.isClosed()) { leftDisplayState = "display: none"; leftToggleClass = "jstbToggle2"; } } if (rtb != null) { if (rtb.isClosed()) { rightDisplayState = "display: none"; rightToggleClass = "jstbToggle1"; } } String inheritDecorationName = null; if (inheritDec) { inheritDecorationName = request.getParameter("_inheritdeco"); if (!StringUtils.isEmpty(inheritDecorationName)) { pageDec = inheritDecorationName; } } Set styleSheets = jetui.getStyleSheets(rc, inheritDecorationName); %> <%=StringEscapeUtils.escapeXml(jetui.getTitle(rc))%> <%=jetui.includeHeaderResources(rc)%> <% for (String style : styleSheets) { %> <% } %>
<% if (!inheritDec) { %>

Jetspeed 2

<%if (request.getUserPrincipal() != null) {%> <%=userNameGiven%> <%=userNameFamily%> | Log out <% } %>
<% } %>
<% if (ltb != null) { %>
<% for (ContentFragment tool : ltb.getTools()) { String decorator = tool.getDecorator(); if (decorator == null) decorator = pageDec; String navContent; if (maximized != null) navContent = jetui.renderPortletWindow(tool.getId(), tool.getName(), rc); else navContent = jetui.getRenderedContent(tool, rc); String title = ""; boolean showTitle = tool.getDecoration().getTitleOption() == Decoration.TitleOption.SHOW; if (showTitle && tool.getPortletContent() != null) title = tool.getPortletContent().getTitle(); %>
<%=title%>
<% } %>
<% } // endif ltb %>
<% if (!inheritDec) { %>
 <%=breadcrumbs%>
<% } %>
<% if (maximized != null) { String content = jetui.getRenderedContent(maximized, rc); request.setAttribute("content", content); String decorator = maximized.getDecorator(); if (decorator == null) decorator = pageDec; request.setAttribute("decorator", decorator); request.setAttribute("fragment", maximized); request.setAttribute("coordinate", columnLayout.getCoordinate(maximized)); // request.setAttribute("detached", new Boolean(true)); %>
<% } else { int index = 0; for (Collection collections : columnLayout.getColumns()) { String columnFloat = columnLayout.getColumnFloat(index); String columnWidth = columnLayout.getColumnWidth(index); // class="portal-layout-column portal-layout-column-${layoutType}-${columnIndex}" %>
<% int subindex = 0; for (ContentFragment fragment : collections) { String state = fragment.getState(); if (state == null || !state.equals(JetspeedActions.DETACH)) { //String content = jetui.renderPortletWindow(fragment.getId(), fragment.getName(), rc); String content = jetui.getRenderedContent((ContentFragment)fragment, rc); request.setAttribute("content", content); String decorator = fragment.getDecorator(); if (decorator == null) { decorator = pageDec; } request.setAttribute("decorator", inheritDecorationName == null ? decorator : inheritDecorationName); request.setAttribute("fragment", fragment); request.setAttribute("coordinate", columnLayout.getCoordinate(fragment)); %> <% subindex++; } } index++; %>
<% } } %>
<% if (rtb != null) { %>
<% for (ContentFragment tool : rtb.getTools()) { String decorator = tool.getDecorator(); if (decorator == null) decorator = pageDec; String tbContent; if (maximized != null) tbContent = jetui.renderPortletWindow(tool.getId(), tool.getName(), rc); else tbContent = jetui.getRenderedContent(tool, rc); String title = ""; boolean showTitle = tool.getDecoration().getTitleOption() == Decoration.TitleOption.SHOW; if (showTitle && tool.getPortletContent() != null) title = tool.getPortletContent().getTitle(); %>
<%=title%>
<%=tbContent%>
<% } %>
<% } // endif rtb %>
<% for (ContentFragment fragment : columnLayout.getDetachedPortlets()) { String x = fragment.getProperty(ContentFragment.X_PROPERTY_NAME); String y = fragment.getProperty(ContentFragment.Y_PROPERTY_NAME); String h = fragment.getProperty(ContentFragment.HEIGHT_PROPERTY_NAME); String w = fragment.getProperty(ContentFragment.WIDTH_PROPERTY_NAME); int row = fragment.getLayoutRow(); int col = fragment.getLayoutColumn(); String xpos = fragment.getProperty(ContentFragment.XPOS_PROPERTY_NAME); if (xpos == null) xpos = "top"; String ypos = fragment.getProperty(ContentFragment.YPOS_PROPERTY_NAME); if (ypos == null) ypos = "left"; String content = jetui.getRenderedContent((ContentFragment)fragment, rc); Decoration.ActionsOption option = fragment.getDecoration().getActionsOption(); if (option == Decoration.ActionsOption.HIDE) // TODO: HOVER, DROP DOWN not yet implemented { %>
<%=content%>
<% } else { request.setAttribute("content", content); String decorator = fragment.getDecorator(); if (decorator == null) decorator = pageDec; request.setAttribute("decorator", decorator); request.setAttribute("fragment", fragment); request.setAttribute("detached", new Boolean(true)); %> <% } } %>