WebSphere Portal中多层Placebar主题的开发(一)

示例效果如图:

代码:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="com.ibm.wps.portlets.admin.shared.*"%>
<%@ page import="com.ibm.portal.content.ContentNode" %>
<%@ page import="com.ibm.portal.content.ContentNodeType" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>

<%
 int i = 0;
 int cNum = 10;     //每行的栏目数为cNum
 Calendar currDate = Calendar.getInstance();
 int nYear = currDate.get(Calendar.YEAR);
 int nMonth = currDate.get(Calendar.MONTH);
 int nDate = currDate.get(Calendar.DATE);
 int nDay = currDate.get(Calendar.DAY_OF_WEEK);
 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
%>

<wps:if navigationAvailable="yes" screen="Home,LoggedIn,LoggedOut">
 <!-- one row, one cell table to span the page-->
 <table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tr>
     
   <td id="tdDate" class="wpsPlaceBar1" height=30 align=center valign=middle width=200 style="font-variant:small-caps" nowrap>
   <!-- 显示系统时间 --> 
    &nbsp;&nbsp;<wps:text key="today" bundle="nls.theme"/>&nbsp;<%=nYear%>&nbsp;年&nbsp;<wps:text key="year" bundle="nls.theme"/><%=nMonth+1 %>&nbsp;月&nbsp;<wps:text key="month" bundle="nls.theme"/><%=nDate %>&nbsp;日<wps:text key="date" bundle="nls.theme"/>  
   </td>
   
   <td width=22 class="wpsPlaceBar2" >   
     </td>
   
 <wps:navigation startLevel="2" stopLevel="2">
  <wps:navigationLoop>
<%
 if ( (i % cNum == 0) && (i != 0) ) { 
%>
  </tr>
  <tr>
   <td class="wpsUnSelectedPlace" height=30></td>
   <td class="wpsUnSelectedPlace"></td>        
<% 
 }
 i++;  
%>           
   <wps:if nodeInSelectionPath="no">     
   <td class="wpsUnSelectedPlace" nowrap width=70>
    <a class="wpsUnSelectedPlaceLink" href='<wps:navigationUrl type="link" />' >
     &nbsp;<%= com.ibm.wps.model.LocaleHelper.getTitle((com.ibm.portal.Localized)wpsNavNode, pageContext.getRequest()) %>&nbsp;
    </a>
   </td>   
   </wps:if> 
   <wps:if nodeInSelectionPath="yes">
   <td class="wpsSelectedPlace" nowrap width=70>
    <a class="wpsSelectedPlaceLink" href='<wps:navigationUrl type="link" />' >
     &nbsp;<%= com.ibm.wps.model.LocaleHelper.getTitle((com.ibm.portal.Localized)wpsNavNode, pageContext.getRequest())%>&nbsp;
    </a>    
   </td>
   </wps:if>

   <td width=1><img src='<wps:urlFindInTheme file="njtc_images/placebar_sp.gif"/>'/></td>  
     
  </wps:navigationLoop>
 </wps:navigation>

   <td class="wpsUnSelectedPlace" nowrap colspan=100></td>
  </tr>
 </table>
</wps:if>

注释:
cNum
变量控制每行显示的栏目数。

标签<wps:navigation startLevel="2" stopLevel="2">指定有几层栏目。
<wps:navigationLoop>是一个循环,依次读取所有placebar上要显示的栏目,
<wps:if nodeInSelectionPath="no">判断是否是选中栏目,no表示未选中,yes选中,据此赋予对应的样式。 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值