Foros de discusión
multi level navigation portlet not for menu bar
jaidshaik shaik, modificado hace 12 años.
multi level navigation portlet not for menu bar
Regular Member Mensajes: 171 Fecha de incorporación: 8/10/10 Mensajes recientes
Hi friends,
I created navigation hook
my requirement is onmouseover show the child pages in navigation portlet.
after i deployed navigation hook child pages are not displaying.....its just displaying main menu item.
please check page.jsp {navigation hook}
any errors please let me know.
i am looking the output like this for navigation portlet link
Any help in this regard...
thanks
Jaid.shaik
I created navigation hook
my requirement is onmouseover show the child pages in navigation portlet.
after i deployed navigation hook child pages are not displaying.....its just displaying main menu item.
please check page.jsp {navigation hook}
any errors please let me know.
<script src="/html/js/jquery.js"></script>
<style>
#nav, #nav ul{
margin:0;
padding:0;
list-style-type:none;
list-style-position:outside;
position:relative;
line-height:1.5em;
}
#nav a:link, #nav a:active, #nav a:visited{
display:block;
padding:0px 5px;
border:1px solid #333;
color:#fff;
text-decoration:none;
background-color:#333;
}
#nav a:hover{
background-color:#fff;
color:#333;
}
#nav li{
float:left;
position:relative;
}
#nav ul {
position:absolute;
width:12em;
top:1.5em;
display:none;
}
#nav li ul a{
width:12em;
float:left;
}
#nav ul ul{
top:auto;
}
#nav li ul ul {
left:12em;
margin:0px 0 0 10px;
}
#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul{
display:none;
}
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul{
display:block;
}
</style>
<script>
function mainmenu(){
jQuery(" #nav ul ").css({display: "none"}); // Opera Fix
jQuery(" #nav li").hover(function(){
jQuery(this).find('contentnav').css({visibility: "visible",display: "none"}).show(400);
},function(){
jQuery(this).find('contentnav').css({visibility: "hidden"});
});
}
jQuery(document).ready(function(){
mainmenu();
});
</script>
<%@ include file="/html/taglib/ui/navigation/init.jsp" %>
<c:if test="<%= layout != null %>">
<%
Layout rootLayout = null;
boolean hidden = false;
List selBranch = new ArrayList();
selBranch.add(layout);
selBranch.addAll(layout.getAncestors());
if (rootLayoutType.equals("relative")) {
if ((rootLayoutLevel >= 0) && (rootLayoutLevel < selBranch.size())) {
rootLayout = (Layout) selBranch.get(rootLayoutLevel);
}
else {
rootLayout = null;
}
}
else if (rootLayoutType.equals("absolute")) {
int ancestorIndex = selBranch.size() - rootLayoutLevel;
if ((ancestorIndex >= 0) && (ancestorIndex < selBranch.size())) {
rootLayout = (Layout) selBranch.get(ancestorIndex);
}
else if (ancestorIndex == selBranch.size()) {
rootLayout = null;
}
else {
hidden = true;
}
}
%>
[b] <div id="nav">[/b]
<div class="nav-menu nav-menu-style-<%= bulletStyle %>">
<c:choose>
<c:when test="<%= (headerType.equals("root-layout") && (rootLayout != null)) %>">
<%
String layoutURL = PortalUtil.getLayoutURL(rootLayout, themeDisplay);
String target = PortalUtil.getLayoutTarget(rootLayout);
String layoutName = rootLayout.getName(themeDisplay.getLocale());
%>
<h2>
<a href="<%= layoutURL %>" <%="target" %>><%= layoutName %></a>
</h2>
</c:when>
<c:when test="<%= headerType.equals("portlet-title") %>">
<h2><%= themeDisplay.getPortletDisplay().getTitle() %></h2>
</c:when>
<c:when test="<%= headerType.equals("breadcrumb") %>">
<p id="heading"> <liferay-ui:breadcrumb /></p>
</c:when>
</c:choose>
[b] <div id="contentnav">[/b]
<%
if (!hidden) {
StringBuilder sb = new StringBuilder();
_buildNavigation(rootLayout, layout, selBranch, themeDisplay, 1, includedLayouts, nestedChildren, sb);
String content = sb.toString();
/*if (!nestedChildren) {
content = StringUtil.replace(content, "<ul class", "< a></ul><ul class"); content="StringUtil.replace(content," "< ul>", "</ul><ul class="\"layouts\"">");
}*/
%>
<%= content %>
<%
}
%>
</ul></div>
</div>
</div>
</c:if>
<%!
private void _buildNavigation(Layout rootLayout, Layout selLayout, List selBranch, ThemeDisplay themeDisplay, int layoutLevel, String includedLayouts, boolean nestedChildren, StringBuilder sb) throws Exception {
List layoutChildren = null;
if (rootLayout != null) {
layoutChildren = rootLayout.getChildren(themeDisplay.getPermissionChecker());
}
else {
layoutChildren = LayoutLocalServiceUtil.getLayouts(selLayout.getGroupId(), selLayout.isPrivateLayout(), LayoutConstants.DEFAULT_PARENT_LAYOUT_ID);
}
if (layoutChildren.size() > 0) {
StringBuilder tailSB = null;
if (!nestedChildren) {
tailSB = new StringBuilder();
}
sb.append("<ul class="\"layouts" level-"); sb.append(layoutlevel); sb.append("\">");
for (int i = 0; i < layoutChildren.size(); i++) {
Layout layoutChild = (Layout)layoutChildren.get(i);
if (!layoutChild.isHidden() && LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layoutChild, ActionKeys.VIEW)) {
String layoutURL = PortalUtil.getLayoutURL(layoutChild, themeDisplay);
String target = PortalUtil.getLayoutTarget(layoutChild);
boolean open = false;
if (includedLayouts.equals("auto") && selBranch.contains(layoutChild) && (layoutChild.getChildren().size() > 0)) {
open = true;
}
if (includedLayouts.equals("all")) {
open = true;
}
StringBuilder className = new StringBuilder();
if (open) {
className.append("open ");
}
if (selLayout.getLayoutId() == layoutChild.getLayoutId()) {
className.append("selected ");
}
sb.append("<li "); if (validator.isnotnull(classname)) { sb.append("class="\"");" sb.append(classname); sb.append("\" } sb.append(">");
sb.append("<a "); if (validator.isnotnull(classname)) { sb.append("class="\"");" sb.append(classname); sb.append("\" } sb.append("href="\"");" sb.append(layouturl); sb.append(target); sb.append("> ");
sb.append(layoutChild.getName(themeDisplay.getLocale()));
sb.append("</a>");
if (open) {
StringBuilder layoutChildSB = null;
if (nestedChildren) {
layoutChildSB = sb;
}
else {
layoutChildSB = tailSB;
}
_buildNavigation(layoutChild, selLayout, selBranch, themeDisplay, layoutLevel + 1, includedLayouts, nestedChildren, layoutChildSB);
}
sb.append("</li>");
}
}
sb.append("</ul>");
if (!nestedChildren) {
sb.append(tailSB);
}
}
}
%>
i am looking the output like this for navigation portlet link
Any help in this regard...
thanks
Jaid.shaik
jaidshaik shaik, modificado hace 12 años.
RE: multi level navigation portlet not for menu bar
Regular Member Mensajes: 171 Fecha de incorporación: 8/10/10 Mensajes recientes
Hi,
Any one please let me know about the navigation hook.
thanks
Jaid.Shaik
Any one please let me know about the navigation hook.
thanks
Jaid.Shaik