Discussion:
LHS navigation menu. How to pass the contents of the portlet to child pages?
Bojana Lalic
2008-07-21 06:42:12 UTC
Permalink
Hi all

I've got a left hand navigation on my site which consists of the open content area (can be any portlet) and navigation links. The links work fine and are "passed" through to the pages navigated to from the menu. However, if I for example add a free text portlet with some text in it, it does not get passed through to the pages navigated to from the menu. (Even though the links do).

I've included the contents of my box.jsp file below... I've debugged and it gets to the <content:container id="boxContainer"> and it then stops. Does anyone have any tips as to how to get this to work, and make sure that my portlet contents is passed through?

Thanks

Bojana


<div id="left_nav">
<jsp:include page="include/box.jsp" flush="true">
<jsp:param name="id" value="left_menu_home"/>
<jsp:param name="displayDetailshome" value="true"/>

</jsp:include>
<%!
public void getPageSubTree( JahiaData jData,
int rootPageID,
int currentPageID,
String theURL,
int currentLevel,
PageContext pageContext,
org.apache.log4j.Logger logger
)
throws JahiaException
{
JspWriter out = pageContext.getOut();
JahiaContainerList linksContainerList = jData.containers().getAbsoluteContainerList( "linkContainer", currentPageID );

boolean editMode = jData.gui().isEditMode();
boolean hasSubs = false;

currentLevel++;
try {
if (linksContainerList != null) {
Enumeration linksContainerEnum = linksContainerList.getContainers();
if (linksContainerEnum.hasMoreElements()) {
out.print("<ul>");
hasSubs = true;
}
while (linksContainerEnum.hasMoreElements()) {
JahiaContainer linksContainer = (JahiaContainer) linksContainerEnum.nextElement();
ContainerBean linksContainerBean = new ContainerBean(linksContainer,jData.params());
PageBean linkBean = (PageBean) linksContainerBean.getField("link").getObject() ;
if (linkBean != null) {
int truncSize = editMode ? 30 - (currentLevel * 3) : 40 - (currentLevel * 3);
String pageTitle = linkBean.getTitle();
logger.debug("pageTitle is " + pageTitle + " for pid " + linkBean.getId());
boolean displayLine = false;
if (pageTitle != null) {
if (pageTitle.length() == 0) {
if (editMode) {
pageTitle = "<span style='color:#ff0000;'>" + getResourceBundle("noTitle","No title",jData) + "</span>";
displayLine = true;
}
} else {
displayLine = true;
}
} else {
if (editMode) {
pageTitle = "<span style='color:#ff0000;'>" + getResourceBundle("noTitle","No title",jData) + "</span>";
displayLine = true;
}
}
if (displayLine) {
// displays page info
String state = "";
if ( jData.gui().isPageInPath(linkBean.getId()) ) {
state = "on";
}
if ( linkBean.getId() == rootPageID ) {
state = "current";
}
out.println("<li>");
//out.println("<td class=\"left"+state+"\"");

//boolean isCurrent = false;
if (! jData.gui().isPageInPath(linkBean.getId()) && ! "current".equals(state)){
//out.println(" onmouseover=\"leftOn(this)\" onmouseout=\"leftOff(this)\"");
//isCurrent = true;
}
//out.println(">");

out.println("<a class=\"leftlevel" + currentLevel + " side" + state);
out.println("\" href=\"" + linkBean.getUrl() + "\">"+pageTitle+"</a>");

// displays action buttons on container
jData.gui().html().drawBeginActionMenu(linksContainerBean, null, null, false, "", "jahiatemplates.Corporate_portal_templates", null, out);
out.println("</li>\n");

// displays sub links
if (linkBean.isInCurrentPagePath()) {
getPageSubTree(jData , rootPageID, linkBean.getId(), theURL,currentLevel, pageContext,logger);
}
}
} else {
if (editMode) {
out.println("<li>");
out.println("<a href='#' class='leftlevel" + currentLevel +
"' style='color:#ff0000;'>" + getResourceBundle("noPage","No page",jData) + "</a>");
jData.gui().html().drawBeginActionMenu(linksContainerBean, null, null, false, "", "jahiatemplates.Corporate_portal_templates", null, out);
out.println("</li>");
}
}
} // while (linksContainerEnum.hasMoreElements

// displays action buttons on containerlist
ContentPage currentPage = ContentPage.getPage(currentPageID);

ContainerListBean linksContainerListBean = new ContainerListBean(linksContainerList,jData.params());
logger.info("linksContainerListBean.isActionURIsEmpty() for page " + currentPageID + " -> " + linksContainerListBean.isActionURIsEmpty());
if (! linksContainerListBean.isActionURIsEmpty() ) {
out.println("<li>");
//out.println("<span class=\"leftlevel" + currentLevel +"\">");
jData.gui().html().drawBeginActionMenu(linksContainerListBean , null, theURL + "/images/add.gif", false, "", "jahiatemplates.Corporate_portal_templates", "addPage", out);
out.println("</li>\n");
}
if (hasSubs) {
out.print("</ul>");
}
}

} catch (IOException ioe) {
logger.debug("IO exception while trying to print left menu for object ", ioe);
}
}

// return the pid of the parent page at the wanted level
public int getPageIDAtLevel(JahiaData jData, int startLevel, int maxLevel)
throws JahiaException
{
int initLevel = startLevel;
int currentLevel = jData.gui().getLevel();
if ( (currentLevel - maxLevel) > initLevel ){
startLevel = currentLevel - maxLevel;
}
Enumeration myPath = jData.page().getContentPagePath(jData.params().getOperationMode(), jData.params().getUser());
int i = 0;
while (myPath.hasMoreElements()) {
ContentPage myPage = (ContentPage) myPath.nextElement();
i++;
if (i == (startLevel)) {
return myPage.getID();
}
}
return -1;
} // end getLevelID
%>

<%
/*String maxLevelStr = (String) pageContext.findAttribute("leftMenuMaxDepth");
int maxLevel = 1;
try {
maxLevel = Integer.parseInt(maxLevelStr);
} catch (NumberFormatException nfe) {
//System.out.println("left_menu.jsp -> NumberException : " + nfe.toString());
}
*/
int maxLevel = 2;
%>

<content:declareField name="isHomeMenu" title="Is child of Home Page" type="Boolean" value="false" />
<jahia:ifNotEditMode><!--</jahia:ifNotEditMode>
<p>Child of Home Page: <content:booleanField name="isHomeMenu" id="isHomeMenu" valueId="isHomeMenuVal" display="true" /></p>
<jahia:ifNotEditMode>--></jahia:ifNotEditMode>

<%
int startLevel = jData.gui().getContentHomePage().getID() == jData.page().getID() ? 1 : 2;
//out.print(startLevel);
%>

<logic:notEmpty name="isHomeMenuVal">
<logic:equal name="isHomeMenuVal" value="true">
<%
startLevel = 1;
//out.print("got here");
%>
</logic:equal>
</logic:notEmpty>
<jahiaHtml:actionMenu name="isHomeMenu" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false"/>

<%
//out.print(getPageIDAtLevel(jData, 1 ,maxLevel));
//for (Enumeration e = jData.gui().getContentHomePage().getChilds(jData.params()) ; e.hasMoreElements() ;) {
// out.print(e.nextElement()+"<hr>");
//}
//out.print(jData.gui().getContentHomePage().getChilds(jData.params()));
//out.print(jData.gui().getLevelID(3)+"<hr>");
//int startLevel = 1;
//out.print(startLevel);
int linkCount = 0;
if (!thePrint) {
%>
<content:declareContainerList name="linkContainer"
title="linkContainer"
titleKey="Link Container"
bundleKey="<%=resBundleID%>"
<content:declareContainer>
<content:declareField name="link"
title="Link"
titleKey="link"
bundleKey="<%=resBundleID%>"
type="Page"
/>
</content:declareContainer>
</content:declareContainerList>

<content:absoluteContainerList name="linkContainer" id="linkContainerList" pageLevel="<%=String.valueOf(startLevel)%>">
<jahiaHtml:actionMenu name="linkContainerList" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
<content:container id="linkContainer">
<content:pageField valueId="link" name="link"/>


<logic:empty name="link">
<logic:equal name="currentRequest" property="editMode" value="true">
<%
linkCount++;
if (linkCount == 1) {
%><ul><%
}
%>
<li>
<a href="#" class="leftlevel1" style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="noPage"
defaultValue="No page"/></a>
<jahiaHtml:actionMenu name="linkContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
</jahiaHtml:actionMenu>
</li>
</logic:equal>
</logic:empty>


<logic:notEmpty name="link">

<logic:equal name="link" property="currentPage" value="true">
<bean:define id="state" value="current"/>
</logic:equal>
<logic:notEqual name="link" property="currentPage" value="true">
<logic:equal name="link" property="inCurrentPagePath" value="true">
<bean:define id="state" value="on"/>
</logic:equal>
<logic:notEqual name="link" property="inCurrentPagePath" value="true">
<bean:define id="state" value=""/>
</logic:notEqual>
</logic:notEqual>

<logic:notEmpty name="link" property="title">
<%
linkCount++;
if (linkCount == 1) {
%><ul><%
}
%>
<li
<logic:equal name="link" property="currentPage" value="false">

</logic:equal>
<jahia:ifNotEditMode>

</jahia:ifNotEditMode>
<a href="<bean:write name='link' property='url'/>" class="leftlevel1 <logic:equal name="state" value="current">sidecurrent</logic:equal> <logic:equal name="state" value="on">sidecurrentpath</logic:equal>"><bean:write name="link"
property="title" filter="false"/></a>
<jahiaHtml:actionMenu name="linkContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
</jahiaHtml:actionMenu>
<%
if ( jData.gui().getLevel() > startLevel + maxLevel + 1){
%>
<logic:equal name="link" property="inCurrentPagePath" value="true">
<br/><a href="<%=jData.params().composePageUrl(getPageIDAtLevel(jData,startLevel + 1 ,maxLevel))%>"><img src="<jahia:contextURL/>/images/up.gif" alt="[..]" border="0" width="16" height="16"></a>
</logic:equal>
<%
}
%>
<logic:equal name="link" property="inCurrentPagePath" value="true">
<%getPageSubTree(jData, jData.page().getID(), getPageIDAtLevel(jData,startLevel + 1 ,maxLevel), theURL,1, pageContext,logger);%>
</logic:equal>
</li>
</logic:notEmpty>
<logic:empty name="link" property="title">
<logic:equal name="currentRequest" property="editMode" value="true">
<%
linkCount++;
if (linkCount == 1) {
%><ul><%
}
%>
<li>
<a href="<bean:write name='link' property='url'/>" class="leftlevel1" style="color:#ff0000;"><span style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="noTitle"
defaultValue="No tage"/></span></a>
<jahiaHtml:actionMenu name="linkContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
</jahiaHtml:actionMenu>
</li>
<logic:equal name="link" property="inCurrentPagePath" value="true">
<%getPageSubTree(jData, jData.page().getID(), getPageIDAtLevel(jData,startLevel + 1 ,maxLevel), theURL,1, pageContext,logger);%>
</logic:equal>
</logic:equal>
</logic:empty>

</logic:notEmpty>
</content:container>
<%
if (linkCount > 0) {
%>
</ul>
<%
}
hasLeft = linkCount;
%>


<content:addContainerURL id="addContainerURL" display="false"/>
<logic:present name="addContainerURL">
<br/><a
href="<bean:write name='addContainerURL'/>"><%=addBoxButton%>&#160;<jahia:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="addPage"/></a>
</logic:present>

</jahiaHtml:actionMenu>
</content:absoluteContainerList>


</div>

<%
}
if (jData.gui().isEditMode()) {
hasLeft++;
%><img src="<jahia:contextURL/>/images/pix.gif" alt="" width="147" height="12"/><%
}
%>





<div>
<a name="Top_of_Page"></a>

________________________________
Mind Over Matter - How Technology Matters
Find out how modern lifestyles and technologies are influencing the human mind at education.au's seminar on Tuesday 26 August, Sydney.
Find out more: www.educationau.edu.au


IMPORTANT: This e-mail, including any attachments, may contain private or confidential information. If you think you may not be the intended recipient, or if you have received this e-mail in error, please contact the sender immediately and delete all copies of this e-mail. If you are not the intended recipient, you must not reproduce any part of this e-mail or disclose its contents to any other party. This email represents the views of the individual sender, which do not necessarily reflect those of education.au limited except where the sender expressly states otherwise. It is your responsibility to scan this email and any files transmitted with it for viruses or any other defects. education.au limited will not be liable for any loss, damage or consequence caused directly or indirectly by this email.
Bojana Lalic
2008-07-21 06:45:55 UTC
Permalink
This is the contents of my box.jsp file. Sorry about my previous email :)

<%@ page language="java" %>
<%@ include file="declarations.jsp"%>
<%@ include file="box_declarations.jsp"%>
<%
int loopcount=0;
String dualColumn = "";
if (request.getParameter("dualColumn")!=null) {
dualColumn = request.getParameter("dualColumn");
}
//String priorityTitle = (request.getParameter("title")==null)?"":request.getParameter("title");
//System.out.println(priorityTitle);

//Output Priority title if it exists
//if (request.getParameter("title")!=null) {
//out.print("<h3>"+request.getParameter("title")+"</h3>");
//}
%>
<content:containerList name='<%="boxContainer" + id%>' id="boxContainerList"> <jahiaHtml:actionMenu name="boxContainerList" namePostFix="Portlet" resourceBundle="jahiatemplates.Corporate_portal_templates"> <logic:greaterThan name="boxContainerList" property="size" value="0">
<%
if (loopcount==0 && request.getParameter("title")!=null && jData.gui().isNormalMode()) {
out.print("<h3>"+request.getParameter("title")+"</h3>");
}
%>
</logic:greaterThan> <content:container id="boxContainer">
<%
ContainerBean boxContainerBean = (ContainerBean) pageContext.findAttribute("boxContainer");
JahiaContainer theContainer = boxContainerBean.getJahiaContainer();
if (theContainer.getField("boxType" + id) != null) {
%>
<content:updateContainerURL id="updateContainerURL" display="false"/> <content:deleteContainerURL id="deleteContainerURL" display="false"/> <bean:define id="boxTypeValue" name="boxContainer" property='<%="field(boxType" + id + ").value"%>'/> <content:textField name='<%="boxTitle" + id%>' diffActive="true" display="false" valueId="boxTitle" defaultValue=""/> <bean:define id="displayBox" value="true"/> <logic:empty name="boxTitle"> <jahia:ifNotEditMode> <bean:define id="displayBox" value="true"/> </jahia:ifNotEditMode> <jahia:ifEditMode> <bean:define id="displayBox" value="true"/> </jahia:ifEditMode> </logic:empty> <logic:equal name="displayBox" value="true">
<!-- dual column code -->
<%
if (dualColumn.equals("true")) {
loopcount = loopcount+1;
if (loopcount % 2 != 0) {
%>
<%
;} else {
%>

<%
;}
}
%>
<!-- dual column code end -->

<logic:present name="boxContainer" property='<%="field(boxHeadingLevel" + id + ")"%>'>
<bean:define id="headingSize" name="boxContainer" property='<%="field(boxHeadingLevel" + id + ")" %>'/>
</logic:present>

<jahia:ifEditMode></jahia:ifEditMode>
<jahia:ifEditMode>
<logic:empty name="boxTitle">
<h3 class="box_notitle">No Title</h3>
</logic:empty>
</jahia:ifEditMode>
<logic:notEmpty name="boxTitle">

<logic:present name="headingSize">
<logic:equal name="headingSize" property="value" value="Heading 1"><h1></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2"><h2></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2 - Home"><h2 class="intro_heading"></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 3"><h3></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 4"><h4></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 5"><h5></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 6"><h6></logic:equal>
</logic:present>

<bean:write name="boxTitle" filter="false"/>
<logic:present name="headingSize">
<logic:equal name="headingSize" property="value" value="Heading 1"></h1></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2"></h2></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2 - Home"></h2></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 3"></h3></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 4"></h4></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 5"></h5></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 6"></h6></logic:equal>
</logic:present>

</logic:notEmpty>






<jahia:ifEditMode>


</jahia:ifEditMode>
<span class="align"><jahiaHtml:actionMenu name="boxContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false"> </jahiaHtml:actionMenu></span> <bean:define id="freeText" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"freeText","")%>'/> <bean:define id="files" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"files","")%>'/> <bean:define id="links" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"links","")%>'/> <bean:define id="forms" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"forms","")%>'/> <bean:define id="events" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"events","")%>'/> <bean:define id="sendToColleague" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"sendToColleague","")%>'/> <bean:define id="news" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"news","")%>'/> <bean:define id="generic" value='<%=ResourceBundleMarker.drawMarker(resBundleID, "generic","")%>'/><c:choose> <c:when test="${boxTypeValue == files}">
<%@ include file="box_files.jsp"%>
</c:when> <c:when test="${boxTypeValue == links}">
<%@ include file="box_links.jsp"%>
</c:when> <c:when test="${boxTypeValue == forms}">
<%@ include file="box_forms.jsp"%>
</c:when><c:when test="${boxTypeValue == news}">
<%@ include file="box_rss.jsp"%>
</c:when> <c:when test="${boxTypeValue == generic}">
<%@ include file="box_generic_feed.jsp"%>
</c:when> <c:otherwise>
<%@ include file="box_text.jsp"%>
</c:otherwise> </c:choose> </logic:equal>
<%
}

%>
<logic:present name="boxContainer" property='<%="field(boxTopOfPage" + id + ")"%>'> <bean:define id="top_of_page" name="boxContainer" property='<%="field(boxTopOfPage" + id + ")" %>'/> </logic:present> <logic:present name="top_of_page"><logic:equal name="top_of_page" property="value" value="true">
<div class="topOfPage"><a href="#Top_of_Page">Top of Page</a></div>
</logic:equal></logic:present>
<!-- dual column code -->
<%
if (dualColumn.equals("true")) {
if (loopcount % 2 == 0)
{%>
<% ;}
else
{%>

<% ;}
}
%>
<!-- dual column code end -->
</content:container> <logic:greaterThan name="boxContainerList" property="size" value="0">
</logic:greaterThan> <content:addContainerURL id="addContainerURL" display="false"/> <logic:present name="addContainerURL"> <br/>
<a
href="<bean:write name='addContainerURL'/>"><%=addBoxButton%>&#160;<jahia:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates"
resourceName="addPortlet"/></a> </logic:present> </jahiaHtml:actionMenu> </content:containerList>
<%
if (jData.gui().isEditMode()) {
%>
<img src="<jahia:contextURL/>/images/pix.gif" alt="" width="147" height="12"/>
<%
}
%>


Regards

Bojana

From: Bojana Lalic
Sent: Monday, 21 July 2008 4:12 PM
To: '***@jahia.org'
Subject: LHS navigation menu. How to pass the contents of the portlet to child pages?
Importance: High

Hi all

I've got a left hand navigation on my site which consists of the open content area (can be any portlet) and navigation links. The links work fine and are "passed" through to the pages navigated to from the menu. However, if I for example add a free text portlet with some text in it, it does not get passed through to the pages navigated to from the menu. (Even though the links do).

I've included the contents of my box.jsp file below... I've debugged and it gets to the <content:container id="boxContainer"> and it then stops. Does anyone have any tips as to how to get this to work, and make sure that my portlet contents is passed through?

Thanks

Bojana


<div id="left_nav">
<jsp:include page="include/box.jsp" flush="true">
<jsp:param name="id" value="left_menu_home"/>
<jsp:param name="displayDetailshome" value="true"/>

</jsp:include>
<%!
public void getPageSubTree( JahiaData jData,
int rootPageID,
int currentPageID,
String theURL,
int currentLevel,
PageContext pageContext,
org.apache.log4j.Logger logger
)
throws JahiaException
{
JspWriter out = pageContext.getOut();
JahiaContainerList linksContainerList = jData.containers().getAbsoluteContainerList( "linkContainer", currentPageID );

boolean editMode = jData.gui().isEditMode();
boolean hasSubs = false;

currentLevel++;
try {
if (linksContainerList != null) {
Enumeration linksContainerEnum = linksContainerList.getContainers();
if (linksContainerEnum.hasMoreElements()) {
out.print("<ul>");
hasSubs = true;
}
while (linksContainerEnum.hasMoreElements()) {
JahiaContainer linksContainer = (JahiaContainer) linksContainerEnum.nextElement();
ContainerBean linksContainerBean = new ContainerBean(linksContainer,jData.params());
PageBean linkBean = (PageBean) linksContainerBean.getField("link").getObject() ;
if (linkBean != null) {
int truncSize = editMode ? 30 - (currentLevel * 3) : 40 - (currentLevel * 3);
String pageTitle = linkBean.getTitle();
logger.debug("pageTitle is " + pageTitle + " for pid " + linkBean.getId());
boolean displayLine = false;
if (pageTitle != null) {
if (pageTitle.length() == 0) {
if (editMode) {
pageTitle = "<span style='color:#ff0000;'>" + getResourceBundle("noTitle","No title",jData) + "</span>";
displayLine = true;
}
} else {
displayLine = true;
}
} else {
if (editMode) {
pageTitle = "<span style='color:#ff0000;'>" + getResourceBundle("noTitle","No title",jData) + "</span>";
displayLine = true;
}
}
if (displayLine) {
// displays page info
String state = "";
if ( jData.gui().isPageInPath(linkBean.getId()) ) {
state = "on";
}
if ( linkBean.getId() == rootPageID ) {
state = "current";
}
out.println("<li>");
//out.println("<td class=\"left"+state+"\"");

//boolean isCurrent = false;
if (! jData.gui().isPageInPath(linkBean.getId()) && ! "current".equals(state)){
//out.println(" onmouseover=\"leftOn(this)\" onmouseout=\"leftOff(this)\"");
//isCurrent = true;
}
//out.println(">");

out.println("<a class=\"leftlevel" + currentLevel + " side" + state);
out.println("\" href=\"" + linkBean.getUrl() + "\">"+pageTitle+"</a>");

// displays action buttons on container
jData.gui().html().drawBeginActionMenu(linksContainerBean, null, null, false, "", "jahiatemplates.Corporate_portal_templates", null, out);
out.println("</li>\n");

// displays sub links
if (linkBean.isInCurrentPagePath()) {
getPageSubTree(jData , rootPageID, linkBean.getId(), theURL,currentLevel, pageContext,logger);
}
}
} else {
if (editMode) {
out.println("<li>");
out.println("<a href='#' class='leftlevel" + currentLevel +
"' style='color:#ff0000;'>" + getResourceBundle("noPage","No page",jData) + "</a>");
jData.gui().html().drawBeginActionMenu(linksContainerBean, null, null, false, "", "jahiatemplates.Corporate_portal_templates", null, out);
out.println("</li>");
}
}
} // while (linksContainerEnum.hasMoreElements

// displays action buttons on containerlist
ContentPage currentPage = ContentPage.getPage(currentPageID);

ContainerListBean linksContainerListBean = new ContainerListBean(linksContainerList,jData.params());
logger.info("linksContainerListBean.isActionURIsEmpty() for page " + currentPageID + " -> " + linksContainerListBean.isActionURIsEmpty());
if (! linksContainerListBean.isActionURIsEmpty() ) {
out.println("<li>");
//out.println("<span class=\"leftlevel" + currentLevel +"\">");
jData.gui().html().drawBeginActionMenu(linksContainerListBean , null, theURL + "/images/add.gif", false, "", "jahiatemplates.Corporate_portal_templates", "addPage", out);
out.println("</li>\n");
}
if (hasSubs) {
out.print("</ul>");
}
}

} catch (IOException ioe) {
logger.debug("IO exception while trying to print left menu for object ", ioe);
}
}

// return the pid of the parent page at the wanted level
public int getPageIDAtLevel(JahiaData jData, int startLevel, int maxLevel)
throws JahiaException
{
int initLevel = startLevel;
int currentLevel = jData.gui().getLevel();
if ( (currentLevel - maxLevel) > initLevel ){
startLevel = currentLevel - maxLevel;
}
Enumeration myPath = jData.page().getContentPagePath(jData.params().getOperationMode(), jData.params().getUser());
int i = 0;
while (myPath.hasMoreElements()) {
ContentPage myPage = (ContentPage) myPath.nextElement();
i++;
if (i == (startLevel)) {
return myPage.getID();
}
}
return -1;
} // end getLevelID
%>

<%
/*String maxLevelStr = (String) pageContext.findAttribute("leftMenuMaxDepth");
int maxLevel = 1;
try {
maxLevel = Integer.parseInt(maxLevelStr);
} catch (NumberFormatException nfe) {
//System.out.println("left_menu.jsp -> NumberException : " + nfe.toString());
}
*/
int maxLevel = 2;
%>

<content:declareField name="isHomeMenu" title="Is child of Home Page" type="Boolean" value="false" />
<jahia:ifNotEditMode><!--</jahia:ifNotEditMode>
<p>Child of Home Page: <content:booleanField name="isHomeMenu" id="isHomeMenu" valueId="isHomeMenuVal" display="true" /></p>
<jahia:ifNotEditMode>--></jahia:ifNotEditMode>

<%
int startLevel = jData.gui().getContentHomePage().getID() == jData.page().getID() ? 1 : 2;
//out.print(startLevel);
%>

<logic:notEmpty name="isHomeMenuVal">
<logic:equal name="isHomeMenuVal" value="true">
<%
startLevel = 1;
//out.print("got here");
%>
</logic:equal>
</logic:notEmpty>
<jahiaHtml:actionMenu name="isHomeMenu" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false"/>

<%
//out.print(getPageIDAtLevel(jData, 1 ,maxLevel));
//for (Enumeration e = jData.gui().getContentHomePage().getChilds(jData.params()) ; e.hasMoreElements() ;) {
// out.print(e.nextElement()+"<hr>");
//}
//out.print(jData.gui().getContentHomePage().getChilds(jData.params()));
//out.print(jData.gui().getLevelID(3)+"<hr>");
//int startLevel = 1;
//out.print(startLevel);
int linkCount = 0;
if (!thePrint) {
%>
<content:declareContainerList name="linkContainer"
title="linkContainer"
titleKey="Link Container"
bundleKey="<%=resBundleID%>"
<content:declareContainer>
<content:declareField name="link"
title="Link"
titleKey="link"
bundleKey="<%=resBundleID%>"
type="Page"
/>
</content:declareContainer>
</content:declareContainerList>

<content:absoluteContainerList name="linkContainer" id="linkContainerList" pageLevel="<%=String.valueOf(startLevel)%>">
<jahiaHtml:actionMenu name="linkContainerList" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
<content:container id="linkContainer">
<content:pageField valueId="link" name="link"/>


<logic:empty name="link">
<logic:equal name="currentRequest" property="editMode" value="true">
<%
linkCount++;
if (linkCount == 1) {
%><ul><%
}
%>
<li>
<a href="#" class="leftlevel1" style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="noPage"
defaultValue="No page"/></a>
<jahiaHtml:actionMenu name="linkContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
</jahiaHtml:actionMenu>
</li>
</logic:equal>
</logic:empty>


<logic:notEmpty name="link">

<logic:equal name="link" property="currentPage" value="true">
<bean:define id="state" value="current"/>
</logic:equal>
<logic:notEqual name="link" property="currentPage" value="true">
<logic:equal name="link" property="inCurrentPagePath" value="true">
<bean:define id="state" value="on"/>
</logic:equal>
<logic:notEqual name="link" property="inCurrentPagePath" value="true">
<bean:define id="state" value=""/>
</logic:notEqual>
</logic:notEqual>

<logic:notEmpty name="link" property="title">
<%
linkCount++;
if (linkCount == 1) {
%><ul><%
}
%>
<li
<logic:equal name="link" property="currentPage" value="false">

</logic:equal>
<jahia:ifNotEditMode>

</jahia:ifNotEditMode>
<a href="<bean:write name='link' property='url'/>" class="leftlevel1 <logic:equal name="state" value="current">sidecurrent</logic:equal> <logic:equal name="state" value="on">sidecurrentpath</logic:equal>"><bean:write name="link"
property="title" filter="false"/></a>
<jahiaHtml:actionMenu name="linkContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
</jahiaHtml:actionMenu>
<%
if ( jData.gui().getLevel() > startLevel + maxLevel + 1){
%>
<logic:equal name="link" property="inCurrentPagePath" value="true">
<br/><a href="<%=jData.params().composePageUrl(getPageIDAtLevel(jData,startLevel + 1 ,maxLevel))%>"><img src="<jahia:contextURL/>/images/up.gif" alt="[..]" border="0" width="16" height="16"></a>
</logic:equal>
<%
}
%>
<logic:equal name="link" property="inCurrentPagePath" value="true">
<%getPageSubTree(jData, jData.page().getID(), getPageIDAtLevel(jData,startLevel + 1 ,maxLevel), theURL,1, pageContext,logger);%>
</logic:equal>
</li>
</logic:notEmpty>
<logic:empty name="link" property="title">
<logic:equal name="currentRequest" property="editMode" value="true">
<%
linkCount++;
if (linkCount == 1) {
%><ul><%
}
%>
<li>
<a href="<bean:write name='link' property='url'/>" class="leftlevel1" style="color:#ff0000;"><span style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="noTitle"
defaultValue="No tage"/></span></a>
<jahiaHtml:actionMenu name="linkContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false">
</jahiaHtml:actionMenu>
</li>
<logic:equal name="link" property="inCurrentPagePath" value="true">
<%getPageSubTree(jData, jData.page().getID(), getPageIDAtLevel(jData,startLevel + 1 ,maxLevel), theURL,1, pageContext,logger);%>
</logic:equal>
</logic:equal>
</logic:empty>

</logic:notEmpty>
</content:container>
<%
if (linkCount > 0) {
%>
</ul>
<%
}
hasLeft = linkCount;
%>


<content:addContainerURL id="addContainerURL" display="false"/>
<logic:present name="addContainerURL">
<br/><a
href="<bean:write name='addContainerURL'/>"><%=addBoxButton%>&#160;<jahia:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="addPage"/></a>
</logic:present>

</jahiaHtml:actionMenu>
</content:absoluteContainerList>


</div>

<%
}
if (jData.gui().isEditMode()) {
hasLeft++;
%><img src="<jahia:contextURL/>/images/pix.gif" alt="" width="147" height="12"/><%
}
%>





<div>
<a name="Top_of_Page"></a>

________________________________
Mind Over Matter - How Technology Matters
Find out how modern lifestyles and technologies are influencing the human mind at education.au's seminar on Tuesday 26 August, Sydney.
Find out more: www.educationau.edu.au


IMPORTANT: This e-mail, including any attachments, may contain private or confidential information. If you think you may not be the intended recipient, or if you have received this e-mail in error, please contact the sender immediately and delete all copies of this e-mail. If you are not the intended recipient, you must not reproduce any part of this e-mail or disclose its contents to any other party. This email represents the views of the individual sender, which do not necessarily reflect those of education.au limited except where the sender expressly states otherwise. It is your responsibility to scan this email and any files transmitted with it for viruses or any other defects. education.au limited will not be liable for any loss, damage or consequence caused directly or indirectly by this email.
Bojana Lalic
2008-07-22 00:25:10 UTC
Permalink
Can someone please help me with my query below? :)

Regards

Bojana

From: Bojana Lalic
Sent: Monday, 21 July 2008 4:12 PM
To: '***@jahia.org'
Subject: LHS navigation menu. How to pass the contents of the portlet to child pages?
Importance: High

Hi all

I've got a left hand navigation on my site which consists of the open content area (can be any portlet) and navigation links. The links work fine and are "passed" through to the pages navigated to from the menu. However, if I for example add a free text portlet with some text in it, it does not get passed through to the pages navigated to from the menu. (Even though the links do).

I've included the contents of my box.jsp file below... I've debugged and it gets to the <content:container id="boxContainer"> and it then stops. Does anyone have any tips as to how to get this to work, and make sure that my portlet contents is passed through?

Thanks

Bojana


<%@ page language="java" %>
<%@ include file="declarations.jsp"%>
<%@ include file="box_declarations.jsp"%>
<%
int loopcount=0;
String dualColumn = "";
if (request.getParameter("dualColumn")!=null) {
dualColumn = request.getParameter("dualColumn");
}
//String priorityTitle = (request.getParameter("title")==null)?"":request.getParameter("title");
//System.out.println(priorityTitle);

//Output Priority title if it exists
//if (request.getParameter("title")!=null) {
//out.print("<h3>"+request.getParameter("title")+"</h3>");
//}
%>
<content:containerList name='<%="boxContainer" + id%>' id="boxContainerList"> <jahiaHtml:actionMenu name="boxContainerList" namePostFix="Portlet" resourceBundle="jahiatemplates.Corporate_portal_templates"> <logic:greaterThan name="boxContainerList" property="size" value="0">
<%
if (loopcount==0 && request.getParameter("title")!=null && jData.gui().isNormalMode()) {
out.print("<h3>"+request.getParameter("title")+"</h3>");
}
%>
</logic:greaterThan> <content:container id="boxContainer">
<%
ContainerBean boxContainerBean = (ContainerBean) pageContext.findAttribute("boxContainer");
JahiaContainer theContainer = boxContainerBean.getJahiaContainer();
if (theContainer.getField("boxType" + id) != null) {
%>
<content:updateContainerURL id="updateContainerURL" display="false"/> <content:deleteContainerURL id="deleteContainerURL" display="false"/> <bean:define id="boxTypeValue" name="boxContainer" property='<%="field(boxType" + id + ").value"%>'/> <content:textField name='<%="boxTitle" + id%>' diffActive="true" display="false" valueId="boxTitle" defaultValue=""/> <bean:define id="displayBox" value="true"/> <logic:empty name="boxTitle"> <jahia:ifNotEditMode> <bean:define id="displayBox" value="true"/> </jahia:ifNotEditMode> <jahia:ifEditMode> <bean:define id="displayBox" value="true"/> </jahia:ifEditMode> </logic:empty> <logic:equal name="displayBox" value="true">
<!-- dual column code -->
<%
if (dualColumn.equals("true")) {
loopcount = loopcount+1;
if (loopcount % 2 != 0) {
%>
<%
;} else {
%>

<%
;}
}
%>
<!-- dual column code end -->

<logic:present name="boxContainer" property='<%="field(boxHeadingLevel" + id + ")"%>'>
<bean:define id="headingSize" name="boxContainer" property='<%="field(boxHeadingLevel" + id + ")" %>'/>
</logic:present>

<jahia:ifEditMode></jahia:ifEditMode>
<jahia:ifEditMode>
<logic:empty name="boxTitle">
<h3 class="box_notitle">No Title</h3>
</logic:empty>
</jahia:ifEditMode>
<logic:notEmpty name="boxTitle">

<logic:present name="headingSize">
<logic:equal name="headingSize" property="value" value="Heading 1"><h1></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2"><h2></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2 - Home"><h2 class="intro_heading"></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 3"><h3></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 4"><h4></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 5"><h5></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 6"><h6></logic:equal>
</logic:present>

<bean:write name="boxTitle" filter="false"/>
<logic:present name="headingSize">
<logic:equal name="headingSize" property="value" value="Heading 1"></h1></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2"></h2></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 2 - Home"></h2></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 3"></h3></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 4"></h4></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 5"></h5></logic:equal>
<logic:equal name="headingSize" property="value" value="Heading 6"></h6></logic:equal>
</logic:present>

</logic:notEmpty>






<jahia:ifEditMode>


</jahia:ifEditMode>
<span class="align"><jahiaHtml:actionMenu name="boxContainer" namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates" useFieldSet="false"> </jahiaHtml:actionMenu></span> <bean:define id="freeText" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"freeText","")%>'/> <bean:define id="files" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"files","")%>'/> <bean:define id="links" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"links","")%>'/> <bean:define id="forms" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"forms","")%>'/> <bean:define id="events" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"events","")%>'/> <bean:define id="sendToColleague" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"sendToColleague","")%>'/> <bean:define id="news" value='<%=ResourceBundleMarker.drawMarker(resBundleID,"news","")%>'/> <bean:define id="generic" value='<%=ResourceBundleMarker.drawMarker(resBundleID, "generic","")%>'/><c:choose> <c:when test="${boxTypeValue == files}">
<%@ include file="box_files.jsp"%>
</c:when> <c:when test="${boxTypeValue == links}">
<%@ include file="box_links.jsp"%>
</c:when> <c:when test="${boxTypeValue == forms}">
<%@ include file="box_forms.jsp"%>
</c:when><c:when test="${boxTypeValue == news}">
<%@ include file="box_rss.jsp"%>
</c:when> <c:when test="${boxTypeValue == generic}">
<%@ include file="box_generic_feed.jsp"%>
</c:when> <c:otherwise>
<%@ include file="box_text.jsp"%>
</c:otherwise> </c:choose> </logic:equal>
<%
}

%>
<logic:present name="boxContainer" property='<%="field(boxTopOfPage" + id + ")"%>'> <bean:define id="top_of_page" name="boxContainer" property='<%="field(boxTopOfPage" + id + ")" %>'/> </logic:present> <logic:present name="top_of_page"><logic:equal name="top_of_page" property="value" value="true">
<div class="topOfPage"><a href="#Top_of_Page">Top of Page</a></div>
</logic:equal></logic:present>
<!-- dual column code -->
<%
if (dualColumn.equals("true")) {
if (loopcount % 2 == 0)
{%>
<% ;}
else
{%>

<% ;}
}
%>
<!-- dual column code end -->
</content:container> <logic:greaterThan name="boxContainerList" property="size" value="0">
</logic:greaterThan> <content:addContainerURL id="addContainerURL" display="false"/> <logic:present name="addContainerURL"> <br/>
<a
href="<bean:write name='addContainerURL'/>"><%=addBoxButton%>&#160;<jahia:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates"
resourceName="addPortlet"/></a> </logic:present> </jahiaHtml:actionMenu> </content:containerList>
<%
if (jData.gui().isEditMode()) {
%>
<img src="<jahia:contextURL/>/images/pix.gif" alt="" width="147" height="12"/>
<%
}
%>


________________________________
Mind Over Matter - How Technology Matters
Find out how modern lifestyles and technologies are influencing the human mind at education.au's seminar on Tuesday 26 August, Sydney.
Find out more: www.educationau.edu.au


IMPORTANT: This e-mail, including any attachments, may contain private or confidential information. If you think you may not be the intended recipient, or if you have received this e-mail in error, please contact the sender immediately and delete all copies of this e-mail. If you are not the intended recipient, you must not reproduce any part of this e-mail or disclose its contents to any other party. This email represents the views of the individual sender, which do not necessarily reflect those of education.au limited except where the sender expressly states otherwise. It is your responsibility to scan this email and any files transmitted with it for viruses or any other defects. education.au limited will not be liable for any loss, damage or consequence caused directly or indirectly by this email.
Benjamin Papez
2008-07-22 07:25:39 UTC
Permalink
_______________________________________________
template_list mailing list
***@jahia.org
http://lists.jahia.org/cgi-bin/mailman/listinfo/template_list

Loading...