Re: LHS navigation menu. How to pass the contents of the portlet to child pages?
Benjamin Papez <[email protected]> Tue, 22 Jul 2008 09:25:39 +0200
| Newsgroups | gmane.comp.cms.jahia.template |
|---|---|
| Message-ID | <[email protected]> |
Hi Bojana,
with <content:containerList
name='<%="boxContainer" + id%>'
id="boxContainerList"> in the box.jsp, you are
always only getting the container list of the current page and not the
box container list of the parent page(s). If I understand you right,
you would like the boxes in the left column to be "passed through" in
the sense that if a box has been added on a parent page, all child
pages should also display it in the left column. Should it be possible
to add additional boxes just on the child page(s) and should they again
be passed through to their children ? Depending on this you would
either have to get the boxContainer from a specific parent page or you
would need to iterate over the parent pages and get all box containers
of the left column from all the parent pages.
Instead of the <content:containerList> you would have to use
<content:absoluteContainerList> where you either set the pageId
of the page, where the container list is located, or alternatively
(more comfortable but slower) you could use the pageLevel attribute,
where you can iterate through the pages in the current page-path by
just using level offsets (1 is homepage, 2 is first level,...).
As the box.jsp is not only used in the left column, but also in other
columns you have to implement this iteration or obtain the boxes from
other pages only for the box with e.g. the id "left_menu_home"
(taken from your first post).
So your code should look something like this:
<%
List pageList = new ArrayList();
if ("left_menu_home".equals(id)) {
for (Enumeration pageEnum =
jData.page().getContentPagePath(jData.params().getOperationMode(),
jData.params().getUser()); pageEnum.hasMoreElements;) {
pageList.add((ContentPage)pageEnum.nextElement);
}
}else {
pageList.add(jParams.getContentPage());
}
for (Iterator it = pageList.iterator(); it.hasNext();) {
%>
<content:absoluteContainerList
name='<%="boxContainer" + id%>'
id="boxContainerList" pageId='<%=String.valueOf(((ContentPage)it.next()).getID())%>'>
...
</content:absoluteContainerList>
<%
}
%>
I hope it helps.
Regards,
Benjamin
On 22.07.2008 02:25 Bojana Lalic wrote:
Can
someone please help me with my query below?
J
Regards
Bojana
From: Bojana Lalic
Sent: Monday, 21 July 2008 4:12 PM
To: '[email protected] '
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%> <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.
----------
_______________________________________________
template_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/template_list
_______________________________________________
template_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/template_list