if (linksContainerList!=null) {
ContainerListBean linksContainerListBean = new ContainerListBean(linksContainerList,jData.params());
if (linksContainerListBean != null) {
if (! linksContainerListBean.isActionURIsEmpty() ) {
jData.gui().html().drawBeginActionMenu(linksContainerListBean , null, theURL + "/images/add.gif", false, "", "jahiatemplates.Corporate_portal_templates", null, out);
}
}
}
|
Hi Ghislain thanks for your support but I didnt get it yet. When you say add an action menu with API in the include/main_menu.inc like my left_menu.inc I sent to you an attachment file with my main_menu.inc. Tried but no success. Thanks a lot. >
>
Thiago Reis -----Original Message----- Yes you can ! Just add an action menu with API in the include/main_menu.inc file like in include/left_menu.inc like this (extract from getPageSubTree method) : JahiaContainerList linksContainerList = jData.containers().getAbsoluteContainerList( "linkContainer", currentPageID ); Regards, Ghislain >
Hi, Im new on Jahia template development, and Im facing some problems with the drop-down menus. I read that they are created automatically when you create a menu on a given page, for example, when you add left-nav menu items, the drop-down menu will be populated. But my layout design doesnt support a left nav menus so I need my drop-down menus include without the let-nav menus. I tried to look up at the site map and I was allowed just to delete and update. Would be nice if I could create drop-down menus in the sitemap or anyway without left-nav. Thanks a lot, Att, Thiago Reis |
<content:declareContainerList name="topMenu"
title="Top Menu"
titleKey="topMenu"
bundleKey="<%=resBundleID%>"
>
<content:declareContainer>
<content:declareField name="topLink"
title="Top Link"
titleKey="topLink"
bundleKey="<%=resBundleID%>"
type="Page"
/>
<content:declareField name="colorSet"
title="Color set"
titleKey="colorSet"
bundleKey="<%=resBundleID%>"
type="SharedSmallText"
value='<%="<jahia_multivalue[blue:green:orange:red]>" +
defaultColorSet%>'
/>
</content:declareContainer>
</content:declareContainerList>
<%
boolean enablePopup = true;
if ("false".equals(pageContext.findAttribute("displayDropMenu"))) {
enablePopup = false;
}
enablePopup = enablePopup && (! isNS4(request));
int menuCount = 0;
StringBuffer callJs = new StringBuffer("<script language=\"javascript\"
type=\"text/JavaScript\"><!--\n");
StringBuffer div = new StringBuffer();
%>
<table width="<bean:write name="pageWidth" filter="false"/>" border="0"
cellspacing="0" cellpadding="0" class="maintable">
<tr>
<logic:present name="currentSite" property="homePage">
<td id="menu0"
class="topmenu<jahia:ifIsHomePage>on</jahia:ifIsHomePage><%=colorSet%>"
<jahia:ifIsNotHomePage>onmouseover="javascript:topOn<%=colorSet%>('menu0');"
onmouseout="javascript:topOff('menu0');"</jahia:ifIsNotHomePage>>
<a href="<bean:write name='currentSite' property='homePage.url'
ignore='true'/>"><bean:write name='currentSite' property='homePage.title'
filter='false' ignore='true'/></a>
<jahia:ifIsHomePage>
<jahia:ifPagePropertiesRights>
<jahia:pagePropertiesButton title="<img
src=\"images/update.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"Update
Home\">"/>
</jahia:ifPagePropertiesRights>
</jahia:ifIsHomePage>
<%
// here we add a cross reference, because the home page will be
displayed on all the pages that use this template.
// and we want to make sure that the pages' HTML cache is flushed
when the home page title changes.
if (jData.gui().getContentHomePage().getID() !=
jData.params().getPageID()) {
org.jahia.content.ContentPageXRefManager.getInstance().setPageID(jData.gui().getContentHomePage().getID(),
jData.params().getPageID());
}
%>
</td>
</logic:present>
<content:absoluteContainerList name="topMenu" id="topMenu" pageLevel="1">
<%
String homePageTitle =
TextHtml.text2html(jData.gui().getContentHomePage().getTitle(jData.params()));
if (homePageTitle==null){
homePageTitle ="";
}
%>
<content:container id="topMenuContainer">
<content:pageField valueId="topLink" name="topLink"/>
<content:sharedLangTextField valueId="myColorSet" name="colorSet"
defaultValue="<%=colorSet%>" display="false"/>
<logic:empty name="topLink">
<logic:equal name="currentRequest" property="editMode"
value="true">
<td id="menu<%=menuCount%>" class="topmenu<bean:write
name="myColorSet"/>">
<span style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates" resourceName="noPage"
defaultValue="No page"/></span>
<jahiaHtml:actionMenu name="topMenuContainer"
namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates"
useFieldSet="false">
</jahiaHtml:actionMenu>
</td>
</logic:equal>
</logic:empty>
<logic:notEmpty name="topLink">
<logic:notEqual name="topLink" property="inCurrentPagePath"
value="true">
<bean:define id="classpath" value="topmenu"/>
</logic:notEqual>
<logic:equal name="topLink" property="inCurrentPagePath"
value="true">
<bean:define id="classpath" value="topmenuon"/>
</logic:equal>
<%
PageBean topLinkBean = (PageBean)
pageContext.findAttribute("topLink");
JahiaPage topLink = topLinkBean.getJahiaPage();
String myColorSet = (String)
pageContext.findAttribute("myColorSet");
%>
<logic:notEmpty name="topLink" property="title">
<%
menuCount++;
String onmouseover = "";
String onmouseout = "";
if (enablePopup) {
onmouseover += "ypSlideOutMenu.showMenu('menu" +
menuCount + "');";
onmouseout += "ypSlideOutMenu.hideMenu('menu" +
menuCount + "');";
}
if ( ! jData.gui().isPageInPath(topLink.getID()) ){
onmouseover += "topOn" + myColorSet + "('menu" +
menuCount + "');";
onmouseout += "topOff('menu" + menuCount + "');";
}
boolean isRemoteLink =
(topLinkBean.getType() == PageInfoInterface.TYPE_URL) ||
(topLinkBean.getType() == PageInfoInterface.TYPE_LINK );
%>
<td id="menu<%=menuCount%>" class="<bean:write
name="classpath"/><bean:write name="myColorSet"/>">
<a href="<bean:write name='topLink' property='url'/>"<%
if (! "".equals(onmouseover)) {
%> onmouseover="<%=onmouseover%>"<%
}
if (! "".equals(onmouseout)) {
%> onmouseout="<%=onmouseout%>"<%
}
%>><%
if (isRemoteLink) {
%><img
src="<%=theURL%>/images/<%=topLinkBean.getType() == PageInfoInterface.TYPE_URL
? "remote" : "local"%>.gif" border="0" width="9" height="9"/><%
}
%><bean:write name="topLink" property="title"
filter="false"/>
<logic:empty name="topLink"
property="title"><span style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates"
resourceName="noTitle"
defaultValue="No
title"/></span></logic:empty>
</a>
<jahiaHtml:actionMenu name="topMenuContainer"
namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates"
useFieldSet="false">
</jahiaHtml:actionMenu>
<%
JahiaContainerList linksContainerList =
jData.containers().getAbsoluteContainerList( "linkContainer",
topLinkBean.getId() );
System.out.println("linksContainerList"+linksContainerList);
if (linksContainerList!=null) {
ContainerListBean linksContainerListBean =
new ContainerListBean(linksContainerList,jData.params());
System.out.println("ContainerListBean"+linksContainerListBean);
if (linksContainerListBean != null) {
if (!
linksContainerListBean.isActionURIsEmpty() ) {
jData.gui().html().drawBeginActionMenu(linksContainerListBean , null, theURL +
"/images/add.gif", false, "", "jahiatemplates.Corporate_portal_templates",
null, out);
}
}
}
%>
</td>
</logic:notEmpty>
<logic:empty name="topLink" property="title">
<logic:equal name="currentRequest" property="editMode"
value="true">
<%menuCount++;%>
<td id="menu<%=menuCount%>" class="topmenu<bean:write
name="myColorSet"/>">
<a href="<bean:write name='topLink'
property='url'/>" style="color:#ff0000;"><content:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates"
resourceName="noTitle"
defaultValue="No title"/></a>
<jahiaHtml:actionMenu name="topMenuContainer"
namePostFix="" resourceBundle="jahiatemplates.Corporate_portal_templates"
useFieldSet="false">
</jahiaHtml:actionMenu>
<%
JahiaContainerList linksContainerList =
jData.containers().getAbsoluteContainerList( "linkContainer",
topLinkBean.getId() );
System.out.println("linksContainerList"+linksContainerList);
if (linksContainerList!=null) {
ContainerListBean linksContainerListBean =
new ContainerListBean(linksContainerList,jData.params());
System.out.println("ContainerListBean"+linksContainerListBean);
if (linksContainerListBean != null) {
if (!
linksContainerListBean.isActionURIsEmpty() ) {
jData.gui().html().drawBeginActionMenu(linksContainerListBean , null, theURL +
"/images/add.gif", false, "", "jahiatemplates.Corporate_portal_templates",
null, out);
}
}
}
%>
</td>
</logic:equal>
</logic:empty>
<%
if (enablePopup && topLink != null){
div.append("<div
id=\"menu").append(menuCount).append("Container\">\n");
div.append("<table onmouseover=\"topOn" + myColorSet +
"('menu" + menuCount + "');\" ");
div.append("onmouseout=\"topOff('menu" + menuCount +
"');\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");
div.append("<tr valign=\"top\">\n");
div.append(" <td nowrap=\"nowrap\">\n");
div.append(" <div
id=\"menu").append(menuCount).append("Content\" class=\"menu" + myColorSet +
"\">\n");
div.append(" <div class=\"options" +
myColorSet + "\">\n");
int subMenuCount = 0;
int subMenuWidth = 0;
JahiaContainerList linkContainerList =
jData.containers().getAbsoluteContainerList( "linkContainer", topLink.getID() );
if (linkContainerList != null) {
Enumeration myContainerList =
linkContainerList.getContainers();
while (myContainerList.hasMoreElements()) {
JahiaContainer myContainer = (JahiaContainer)
myContainerList.nextElement();
JahiaPage myLink = (JahiaPage)
myContainer.getFieldObject( "link" );
if (myLink != null){
subMenuCount++;
boolean isRemoteLink =
(myLink.getPageType() ==
PageInfoInterface.TYPE_URL) ||
(myLink.getPageType() ==
PageInfoInterface.TYPE_LINK );
div.append(" <a
href=\"").append(myLink.getURL(jData.params())).append("\">");
if (isRemoteLink) {
String p = myLink.getPageType() ==
PageInfoInterface.TYPE_URL ? "remote" : "local";
div.append("<span class='"+p+"'>");
}
div.append(myLink.getTitle());
if (isRemoteLink) {
div.append("</span>");
}
div.append("</a>\n");
if (myLink.getTitle() != null) {
int w = myLink.getTitle().length() * 6
+ 30;
if (w > subMenuWidth) {
subMenuWidth = w;
}
}
}
}
}
div.append(" </div>\n");
div.append(" </div>\n");
div.append(" </td>\n");
div.append("</tr>\n");
div.append("</table>\n");
div.append("</div>\n");
callJs.append("new
ypSlideOutMenu(\"menu").append(menuCount);
callJs.append("\", \"down\", ");
callJs.append( "getX('menu" + menuCount + "')" ); //
left
callJs.append(", ");
callJs.append( "getY('menu" + menuCount + "')" ); // top
callJs.append(", " + subMenuWidth + ", "); // width
callJs.append(subMenuCount * 50); //heigh
callJs.append(");\n");
}
%>
</logic:notEmpty>
</content:container>
<logic:equal name="topMenu" property="actionURIsEmpty" value="false">
<td class="topmenubuttons">
<jahiaHtml:actionMenu name="topMenu" namePostFix=""
resourceBundle="jahiatemplates.Corporate_portal_templates"
useFieldSet="false" actionIcon='<%=theURL +
"/images/add.gif"%>'>
</jahiaHtml:actionMenu>
</td>
</logic:equal>
</content:absoluteContainerList>
<%
if (! jData.gui().isLogged()){
%><td width="100%" align="right"
class="topmenubuttons"><a
href="javascript:<%=jData.gui().html().drawLoginLauncher()%>"><jahia:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates"
resourceName="login" defaultValue="login"/></a><img
src="<%=theURL%>/images/pix.gif" alt="" width="1"
height="21"/> | <a
href="<%=jData.gui().html().drawNewUserRegistrationLauncher()%>"><jahia:resourceBundle
resourceBundle="jahiatemplates.Corporate_portal_templates"
resourceName="register" defaultValue="register"/> </td><%
} else {
%><td width="100%" class="topmenubg"><img
src="<%=theURL%>/images/pix.gif" alt="" width="1" height="21"/> </td><%
}
%>
</tr>
</table>
<%
callJs.append("\n-->\n</script>");
if (enablePopup){
%>
<%=callJs.toString()%>
<%=div.toString()%>
<%
}
%>
