liferay自带的 导航portlet 颜色更改

这个portlet名字是:navigation.原本以为,控制其显示的代码是在/webapp/root/portlet/html/navigation下的jsp页面中。然而找到jsp文件中,并没有发现相关的代码。请教了别人后,得知,在:/webapps/ROOT/html/taglib/ui/navigation/page.jsp中:

<%@ include file="/html/taglib/ui/navigation/init.jsp" %>
<%@ page language="java"  contentType="text/html;charset=gb2312"%>
<c:if test="<%= layout != null %>">

 <%
 Layout rootLayout = null;
 boolean hidden = false;

 List selBranch = new ArrayList();

 selBranch.add(layout);
 selBranch.addAll(layout.getAncestors());
%>
 <table width="228" border="0" cellspacing="0" cellpadding="0" style="margin-left:7px; margin-top:3px; margin-bottom:7px;">
  <tr>
  <%
  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;
  }
 }
 
    String layoutURL = PortalUtil.getLayoutURL(rootLayout, themeDisplay);
    String target = PortalUtil.getLayoutTarget(rootLayout);
    String layoutName = rootLayout.getName(themeDisplay.getLocale());
    %>

    <td height="28" width="228" background="<%= themeDisplay.getPathThemeImage() + "/fsjj/header_navigation.gif"%>" style="padding-left:30px"><span class="STYLE1"><h4>
     <a href="<%= layoutURL %>" <%= target %>><%= layoutName %></a>
    </h4></span></td>
    
   </tr>
 
  <tr>
    <td height="150" width="228" valign="top" bgcolor="#FFFFFF"  background="<%= themeDisplay.getPathThemeImage() + "/fsjj/bg_nagivgation.gif "%>" style="border:1px; border-left-style:solid; border-left-color: #FF6600; border-right-style:solid; border-right-color: #FF6600; border-bottom-style:solid; border-bottom-color: #FF0066;padding-left:20px; padding-top:10px; line-height:200%; letter-spacing:2">
 
    
  <div class="nav-menu nav-menu-style-1" style="line-height:200%; letter-spacing:2px">

  <%
  if (!hidden) {
   StringMaker sm = new StringMaker();

   _buildNavigation(rootLayout, layout, selBranch, themeDisplay, 1, includedLayouts, sm);

   out.print(sm.toString());
  }
  %>

 </div>
 </td>
  </tr>
</table>
</c:if>

<%!
private void _buildNavigation(Layout rootLayout, Layout selLayout, List selBranch, ThemeDisplay themeDisplay, int layoutLevel, String includedLayouts, StringMaker sm) throws Exception {
 List layoutChildren = null;

 if (rootLayout != null) {
  layoutChildren = rootLayout.getChildren();
 }
 else {
  layoutChildren = LayoutLocalServiceUtil.getLayouts(selLayout.getGroupId(), selLayout.isPrivateLayout(), LayoutImpl.DEFAULT_PARENT_LAYOUT_ID);
 }

 if (layoutChildren.size() > 0) {
  sm.append("<ul class=/"layouts/">");

  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;
    }

    StringMaker className = new StringMaker();

    if (open) {
     className.append("open ");
    }

    if (selLayout.getLayoutId() == layoutChild.getLayoutId()) {
     className.append("selected ");
    }

    sm.append("<li ");

    if (Validator.isNotNull(className)) {
     sm.append("class=/"");
     sm.append(className);
     sm.append("/" ");
    }

    sm.append(">");
    sm.append("<a ");

    if (Validator.isNotNull(className)) {
     sm.append("class=/"");
     sm.append(className);
     sm.append("/" ");
    }

    sm.append("href=/"");
    sm.append(layoutURL);
    sm.append("/" ");
    sm.append(target);
    sm.append("> ");
    sm.append(layoutChild.getName(themeDisplay.getLocale()));
    sm.append("</a>");

    if (open) {
     _buildNavigation(layoutChild, selLayout, selBranch, themeDisplay, layoutLevel + 1, includedLayouts, sm);
    }

    sm.append("</li>");
   }
  }

  sm.append("</ul>");
 }
}
%>

 

 

//header_navigation.gif 是navigation标题头 ,FF6600是红线 改成0066FF就变成蓝线了。 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值