技术开发 频道

实战每晚构建之设计和实现

    3.5 显示界面模版

    显示界面模版在velocity模版文件buildinfo_list.vm中实现。这个文件引用了nightlyfrag.vm文件,另外定义宏headerCell的文在为GlobalMacros.vm。

    模版文件buildinfo_list.vm:

 

    <html>

    
<head>

    
<meta http-equiv="content-type" content="text/html; charset=gb2312">

    
<title>每晚构建</title>

    
<link href="css/default.css" type="text/css" rel="stylesheet">

    
</head>

    
<body bgcolor="#ffffff">

    
<center>

    
<table border="2" cellspacing="0" cellpadding="3" bordercolor="#000000">

    
<tr>

    
<td class="page-title" bordercolor="#000000" align="left" nowrap>

    
<font size="+2"><b> 每晚构建 </b> </font>

    
</td>

    
</tr>

    
</table>

    
<p/>

    
<table border="1" cellspacing="0" cellpadding="3">

    #parse(
"nightlyfrag.vm" )

    
</table>

    
</center>

    
</html>

    模版文件nightlyfrag.vm:

    #headerCell(
"header-center" "序号")

    #headerCell(
"header-left" "管理日志" )

    #headerCell(
"header-left" "构建日志" )

    #headerCell(
"header-left" "度量信息" )

    #headerCell(
"header-left" "测试记录" )

    #headerCell(
"header-left" "覆盖率" )

    #headerCell(
"header-left" "产品" )

    
<ul>

    #foreach( $key in $BuildList.keySet() )

    
<tr>

    
<td colspan="10" class="title">$key</td>

    
</tr>

    #set($body
=$BuildList.get($key))

    #foreach($entry in $body)

    #set($tagtime
=$BuildList.getTagTime($entry))

    
<tr>

    
<td class="row-center">$velocityCount </td>

    
<td class="row-left"><a href="${BuildList.LogTopDir}/${BuildList.logNamePrefix}${tagtime}.txt" >管理日志</a></td>

    
<td class="row-left"><a href="${BuildList.projectLogTopDir}/${entry}.txt" >构建日志</a></td>

    
<td class="row-left"><a href="${BuildList.statCVSTopDir}/${entry}" >度量信息</a></td>

    
<td class="row-left"><a href="${BuildList.testTopDir}/${entry}" >测试记录</a></td>

    
<td class="row-left"><a href="${BuildList.testCoverTopDir}/${entry}" >覆盖率</a></td>

    
<td class="row-left"><a href="/${entry}" >产品</a></td>

    
</tr>

    #end

    #end

    
</ul>

    宏定义文件GlobalMacros.vm:

    #macro (headerCell $classStyle $body)

    
<td class="$classStyle">

    
<b>

    $body

    
</b>

    
</td>

    #end
0
相关文章