Source Viewer : macro.vm
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
#*********************************
* Write drop down JavaScrip menu
*********************************#
#macro( writeMenu $rootMenu )
<table id="menuTable" border="0" width="100%" cellspacing="0" cellpadding="0" style="margin-top: 2px;">
<tr>
<td>
<div class="menustyle" id="$rootMenu.id">
<ul class="menubar">
#foreach ($topMenu in $rootMenu.children)
#if ($topMenu.children.empty)
<li class="topitem">$topMenu</li>
#else
<li class="topitem">$topMenu
<ul class="submenu"
#foreach ($subMenu in $topMenu.children)
><li>$subMenu</li
#end
></ul>
</li>
#end
#end
<li class="topitem"><a target="_blank" href="$context/source-viewer.htm?filename=WEB-INF/classes/$srcPath" title="Page Java source"><img border="0" class="link" alt="" src="$context/assets/images/lightbulb1.png"/> Page Java</a>
</li>
<li class="topitem"><a target="_blank" href="$context/source-viewer.htm?filename=$path" title="Page Content source"><img border="0" class="link" alt="" src="$context/assets/images/lightbulb2.png"/> Page HTML</a>
</li>
</ul>
</div>
</td>
</tr>
</table>
#end
#*********************
* Write generic form
*********************#
#macro( writeForm $form )
$form.startTag()
<table style="margin: 1em;">
#if ($form.error)
<tr>
<td colspan="2" style="color: red;" align="left"> $form.error </td>
</tr>
#end
## Render visible fields
#foreach ($field in $form.fieldList)
#if (!$field.hidden)
#if (!$field.valid)
<tr>
<td> </td>
<td style="color: red;" align="left"> $field.error </td>
</tr>
#end
<tr>
<td align="right">
#if ($field.required)
<span style="font-weight: 700;">$field.label</span>:
#else
$field.label:
#end
</td>
<td> $field </td>
</tr>
#end
#end
<tr><td> </td></tr>
## Render buttons
<tr>
<td> </td>
<td align="left">
#foreach ($button in $form.buttonList)
$button
#end
</td>
</tr>
</table>
$form.endTag()
#end
#*********************************************
* Write drop down border template header menu
*********************************************#
#macro( writeInfoBar )
|
<a class="menu" href="$context/source-viewer.htm?filename=WEB-INF/click.xml" title="Click application descriptor">click.xml</a>
|
<a class="menu" href="$context/source-viewer.htm?filename=WEB-INF/web.xml" title="Web application descriptor">web.xml</a>
|
<a class="menu" href="$context/javadoc/index.html" title="Examples HTML Javadoc API">Javadoc API</a>
#if ($title != 'Source Viewer')
|
<a class="menu" href="$context/source-viewer.htm?filename=WEB-INF/classes/org/apache/click/examples/page/BorderPage.java" title="BorderPage Java source">BorderPage</a>
|
<a class="menu" href="$context/source-viewer.htm?filename=border-template.htm" title="Page border HTML template">Border Template</a>
|
<a class="menu" href="$context/source-viewer.htm?filename=WEB-INF/classes/$srcPath" title="Page Java source">Page Java</a>
|
<a class="menu" href="$context/source-viewer.htm?filename=$path" title="Page Content source">Page HTML</a>
#end
#end